From 2ff14448863ac1a1dd9533461708e29aae170c2d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:06:31 +0200 Subject: Adding debian version 1.65.0+dfsg1-2. Signed-off-by: Daniel Baumann --- .../issue-97463-broken-abi-leaked-uninit-data.rs | 39 ++ .../allocator/no_std-alloc-error-handler-custom.rs | 2 +- .../no_std-alloc-error-handler-default.rs | 2 +- src/test/ui/argument-suggestions/basic.stderr | 10 +- src/test/ui/argument-suggestions/complex.stderr | 4 +- .../ui/argument-suggestions/exotic-calls.stderr | 8 +- .../ui/argument-suggestions/extra_arguments.stderr | 28 +- .../argument-suggestions/invalid_arguments.stderr | 20 +- src/test/ui/argument-suggestions/issue-100478.rs | 52 ++ .../ui/argument-suggestions/issue-100478.stderr | 81 +++ src/test/ui/argument-suggestions/issue-101097.rs | 21 + .../ui/argument-suggestions/issue-101097.stderr | 160 ++++++ .../ui/argument-suggestions/issue-96638.stderr | 6 +- .../ui/argument-suggestions/issue-97197.stderr | 2 +- .../ui/argument-suggestions/issue-97484.stderr | 7 +- .../ui/argument-suggestions/issue-98894.stderr | 2 +- .../ui/argument-suggestions/issue-98897.stderr | 2 +- .../ui/argument-suggestions/issue-99482.stderr | 2 +- .../argument-suggestions/missing_arguments.stderr | 38 +- .../ui/argument-suggestions/mixed_cases.stderr | 12 +- .../argument-suggestions/permuted_arguments.stderr | 4 +- .../argument-suggestions/swapped_arguments.stderr | 10 +- src/test/ui/argument-suggestions/too-long.rs | 41 ++ src/test/ui/argument-suggestions/too-long.stderr | 24 + .../ui/argument-suggestions/two-mismatch-notes.rs | 11 + .../argument-suggestions/two-mismatch-notes.stderr | 29 ++ .../ui/array-slice-vec/suggest-array-length.fixed | 26 + .../ui/array-slice-vec/suggest-array-length.rs | 26 + .../ui/array-slice-vec/suggest-array-length.stderr | 108 ++++ src/test/ui/asm/aarch64/may_unwind.rs | 1 - src/test/ui/asm/aarch64/type-check-3.stderr | 40 +- .../ui/asm/bad-template.aarch64_mirunsafeck.stderr | 4 +- .../asm/bad-template.aarch64_thirunsafeck.stderr | 4 +- .../ui/asm/bad-template.x86_64_mirunsafeck.stderr | 4 +- .../ui/asm/bad-template.x86_64_thirunsafeck.stderr | 4 +- src/test/ui/asm/may_unwind.rs | 1 - src/test/ui/asm/naked-functions.stderr | 103 ++-- src/test/ui/asm/type-check-1.stderr | 4 +- src/test/ui/asm/unpretty-expanded.rs | 3 + src/test/ui/asm/unpretty-expanded.stdout | 9 + src/test/ui/asm/x86_64/may_unwind.rs | 2 +- src/test/ui/asm/x86_64/sym.rs | 1 - src/test/ui/asm/x86_64/type-check-3.stderr | 16 +- .../associated-consts/defaults-cyclic-fail.stderr | 4 +- .../ui/associated-consts/issue-102335-const.rs | 12 + .../ui/associated-consts/issue-102335-const.stderr | 9 + ...-24949-assoc-const-static-recursion-impl.stderr | 2 +- ...soc-const-static-recursion-trait-default.stderr | 2 +- ...24949-assoc-const-static-recursion-trait.stderr | 2 +- .../ui/associated-type-bounds/binder-on-bound.rs | 2 - .../associated-type-bounds/binder-on-bound.stderr | 2 +- src/test/ui/associated-type-bounds/elision.rs | 2 +- .../ui/associated-type-bounds/issue-102335-ty.rs | 12 + .../associated-type-bounds/issue-102335-ty.stderr | 9 + src/test/ui/associated-type-bounds/issue-79949.rs | 1 - ...sociated-type-projection-from-supertrait.stderr | 8 +- ...es-binding-to-type-defined-in-supertrait.stderr | 12 +- .../associated-types/associated-types-eq-3.stderr | 6 +- .../associated-types/associated-types-eq-hr.stderr | 8 +- .../associated-types-for-unimpl-trait.stderr | 4 +- .../associated-types-issue-20346.stderr | 6 +- ...ssociated-types-multiple-types-one-trait.stderr | 12 +- .../associated-types-no-suitable-bound.stderr | 4 +- ...ssociated-types-no-suitable-supertrait-2.stderr | 4 +- .../associated-types-no-suitable-supertrait.stderr | 8 +- .../associated-types-overridden-binding-2.rs | 2 +- .../associated-types-overridden-binding-2.stderr | 2 +- .../ui/associated-types/associated-types-path-2.rs | 2 + .../associated-types-path-2.stderr | 32 +- ...nrelated-trait-in-method-without-default.stderr | 4 +- .../associated-types/defaults-suitability.stderr | 6 +- .../higher-ranked-projection.badbase.stderr | 17 - .../higher-ranked-projection.badnll.stderr | 2 - .../hr-associated-type-bound-2.stderr | 4 +- .../ui/associated-types/impl-wf-cycle-1.stderr | 4 +- .../ui/associated-types/impl-wf-cycle-2.stderr | 2 +- src/test/ui/associated-types/issue-22560.stderr | 46 +- .../issue-27675-unchecked-bounds.stderr | 6 +- src/test/ui/associated-types/issue-44153.stderr | 2 +- src/test/ui/associated-types/issue-59324.rs | 2 +- src/test/ui/associated-types/issue-59324.stderr | 17 +- src/test/ui/associated-types/issue-62200.rs | 3 +- src/test/ui/associated-types/issue-62200.stderr | 3 +- src/test/ui/associated-types/issue-65774-1.stderr | 2 +- src/test/ui/associated-types/issue-87261.stderr | 84 ++-- .../ui/associated-types/substs-ppaux.normal.stderr | 8 +- .../associated-types/substs-ppaux.verbose.stderr | 8 +- .../async-await-let-else.drop-tracking.stderr | 110 +++++ .../async-await-let-else.no-drop-tracking.stderr | 94 ++++ src/test/ui/async-await/async-await-let-else.rs | 13 +- .../ui/async-await/async-await-let-else.stderr | 94 ---- .../async-block-control-flow-static-semantics.rs | 8 +- ...sync-block-control-flow-static-semantics.stderr | 8 +- src/test/ui/async-await/async-trait-fn.rs | 3 + src/test/ui/async-await/async-trait-fn.stderr | 75 ++- .../ui/async-await/edition-deny-async-fns-2015.rs | 3 +- .../async-await/edition-deny-async-fns-2015.stderr | 30 +- src/test/ui/async-await/generator-desc.stderr | 4 +- src/test/ui/async-await/issue-101715.rs | 17 + src/test/ui/async-await/issue-101715.stderr | 16 + .../issue-64130-4-async-move.drop-tracking.stderr | 26 + ...ssue-64130-4-async-move.no_drop_tracking.stderr | 26 + .../ui/async-await/issue-64130-4-async-move.rs | 10 +- .../ui/async-await/issue-64130-4-async-move.stderr | 26 - .../async-await/issue-67252-unnamed-future.stderr | 10 +- .../async-await/issue-68112.drop_tracking.stderr | 79 +++ .../issue-68112.no_drop_tracking.stderr | 79 +++ src/test/ui/async-await/issue-68112.rs | 11 +- src/test/ui/async-await/issue-68112.stderr | 74 --- src/test/ui/async-await/issue-70594.stderr | 12 +- .../issue-70935-complex-spans.drop_tracking.stderr | 10 +- ...sue-70935-complex-spans.no_drop_tracking.stderr | 25 + .../issue-70935-complex-spans.normal.stderr | 25 - .../ui/async-await/issue-70935-complex-spans.rs | 5 +- src/test/ui/async-await/issue-73137.rs | 3 + .../ui/async-await/issues/issue-62009-1.stderr | 14 +- ...-65436-raw-ptr-not-send.no_drop_tracking.stderr | 36 ++ .../issues/issue-65436-raw-ptr-not-send.rs | 6 +- .../issues/issue-65436-raw-ptr-not-send.stderr | 32 -- src/test/ui/async-await/issues/issue-95307.stderr | 14 +- ...artial-drop-partial-reinit.drop_tracking.stderr | 35 ++ ...ial-drop-partial-reinit.no_drop_tracking.stderr | 35 ++ .../ui/async-await/partial-drop-partial-reinit.rs | 11 +- .../async-await/partial-drop-partial-reinit.stderr | 35 -- src/test/ui/async-await/unnecessary-await.stderr | 2 +- src/test/ui/attempted-access-non-fatal.rs | 4 + src/test/ui/attempted-access-non-fatal.stderr | 46 +- .../ui/attributes/collapse-debuginfo-invalid.rs | 110 +++++ .../attributes/collapse-debuginfo-invalid.stderr | 222 +++++++++ src/test/ui/attributes/issue-100631.rs | 8 + src/test/ui/attributes/issue-100631.stderr | 12 + src/test/ui/attributes/issue-90873.stderr | 4 +- src/test/ui/attributes/register-attr-tool-fail.rs | 13 - .../ui/attributes/register-attr-tool-fail.stderr | 42 -- .../ui/attributes/register-attr-tool-import.rs | 17 - .../ui/attributes/register-attr-tool-import.stderr | 38 -- .../ui/attributes/register-attr-tool-prelude.rs | 14 - .../attributes/register-attr-tool-prelude.stderr | 15 - .../ui/attributes/register-attr-tool-unused.rs | 8 - .../ui/attributes/register-attr-tool-unused.stderr | 21 - src/test/ui/attributes/register-attr-tool.rs | 19 - .../unix_sigpipe/auxiliary/sigpipe-utils.rs | 31 ++ .../attributes/unix_sigpipe/unix_sigpipe-crate.rs | 4 + .../unix_sigpipe/unix_sigpipe-crate.stderr | 13 + .../unix_sigpipe/unix_sigpipe-duplicates.rs | 5 + .../unix_sigpipe/unix_sigpipe-duplicates.stderr | 14 + .../attributes/unix_sigpipe/unix_sigpipe-error.rs | 13 + .../unix_sigpipe/unix_sigpipe-inherit.rs | 14 + .../attributes/unix_sigpipe/unix_sigpipe-list.rs | 4 + .../unix_sigpipe/unix_sigpipe-list.stderr | 15 + .../unix_sigpipe/unix_sigpipe-non-main-fn.rs | 6 + .../unix_sigpipe/unix_sigpipe-non-main-fn.stderr | 8 + .../unix_sigpipe/unix_sigpipe-non-root-main.rs | 8 + .../unix_sigpipe/unix_sigpipe-non-root-main.stderr | 8 + .../unix_sigpipe/unix_sigpipe-not-used.rs | 9 + .../unix_sigpipe/unix_sigpipe-only-feature.rs | 13 + .../unix_sigpipe/unix_sigpipe-rustc_main.rs | 15 + .../unix_sigpipe/unix_sigpipe-sig_dfl.rs | 13 + .../attributes/unix_sigpipe/unix_sigpipe-start.rs | 6 + .../unix_sigpipe/unix_sigpipe-start.stderr | 8 + .../attributes/unix_sigpipe/unix_sigpipe-struct.rs | 6 + .../unix_sigpipe/unix_sigpipe-struct.stderr | 8 + .../attributes/unix_sigpipe/unix_sigpipe-wrong.rs | 4 + .../unix_sigpipe/unix_sigpipe-wrong.stderr | 8 + .../ui/attributes/unix_sigpipe/unix_sigpipe.rs | 4 + .../ui/attributes/unix_sigpipe/unix_sigpipe.stderr | 8 + src/test/ui/auto-ref-slice-plus-ref.stderr | 2 +- ...k-default-trait-impl-constituent-types-2.stderr | 4 +- .../typeck-default-trait-impl-precedence.stderr | 6 +- src/test/ui/backtrace-apple-no-dsymutil.rs | 2 - src/test/ui/binop/binary-op-on-double-ref.stderr | 2 +- src/test/ui/binop/issue-77910-1.stderr | 2 +- src/test/ui/binop/issue-77910-2.stderr | 5 + src/test/ui/block-result/issue-22645.stderr | 2 +- src/test/ui/block-result/issue-3563.stderr | 2 +- ...-or-patterns-slice-patterns-box-patterns.stderr | 30 +- .../ui/borrowck/borrowck-describe-lvalue.stderr | 12 +- .../borrowck-move-out-from-array-match.stderr | 6 +- ...wck-move-out-from-array-no-overlap-match.stderr | 6 +- .../borrowck-move-out-from-array-use-match.stderr | 10 +- ...move-out-from-array-use-no-overlap-match.stderr | 6 +- .../borrowck-move-out-from-array-use.stderr | 20 +- .../borrowck/borrowck-move-out-from-array.stderr | 16 +- ...orrowck-slice-pattern-element-loan-array.stderr | 8 +- ...orrowck-slice-pattern-element-loan-slice.stderr | 8 +- .../borrowck/borrowck-vec-pattern-move-tail.stderr | 2 +- .../borrowck/borrowck-vec-pattern-nesting.stderr | 2 +- ...-move-when-closure-is-already-marked-as-move.rs | 8 + ...e-when-closure-is-already-marked-as-move.stderr | 18 + src/test/ui/borrowck/index-mut-help.rs | 3 +- src/test/ui/borrowck/index-mut-help.stderr | 19 +- src/test/ui/borrowck/issue-101119.rs | 16 + src/test/ui/borrowck/issue-101119.stderr | 15 + ...2-nested-closure-outlives-borrowed-value.stderr | 4 + src/test/ui/borrowck/issue-64453.stderr | 1 + .../issue-95079-missing-move-in-nested-closure.rs | 14 + ...sue-95079-missing-move-in-nested-closure.stderr | 37 ++ .../borrowck/suggest-as-ref-on-mut-closure.stderr | 5 +- src/test/ui/borrowck/two-phase-nonrecv-autoref.rs | 4 +- .../two-phase-reservation-sharing-interference.rs | 2 +- src/test/ui/btreemap/btreemap-index-mut.rs | 6 + src/test/ui/btreemap/btreemap-index-mut.stderr | 19 + src/test/ui/c-variadic/issue-86053-1.stderr | 6 +- src/test/ui/c-variadic/variadic-ffi-1.stderr | 4 +- ...uture-compat-crate-attributes-using-cfg_attr.rs | 1 - ...e-compat-crate-attributes-using-cfg_attr.stderr | 15 +- src/test/ui/chalkify/type_wf.rs | 4 +- src/test/ui/chalkify/type_wf.stderr | 6 +- src/test/ui/check-cfg/allow-at-crate-level.rs | 8 + .../invalid-arguments.names_simple_ident.stderr | 2 +- .../invalid-arguments.values_simple_ident.stderr | 2 +- src/test/ui/check-cfg/invalid-cfg-value.stderr | 6 +- src/test/ui/check-cfg/mix.rs | 2 +- src/test/ui/check-cfg/mix.stderr | 10 +- src/test/ui/check-static-values-constraints.stderr | 1 + .../expect-fn-supply-fn.stderr | 12 +- ...o-infer-vars-supply-ty-with-bound-region.stderr | 2 +- .../ui/closure_context/issue-26046-fn-mut.stderr | 2 + .../ui/closure_context/issue-26046-fn-once.stderr | 2 + .../2229_closure_analysis/diagnostics/arrays.rs | 2 +- .../closure-origin-array-diagnostics.stderr | 10 +- .../closure-origin-tuple-diagnostics.stderr | 10 +- .../match/non-exhaustive-match.rs | 2 +- .../match/non-exhaustive-match.stderr | 8 +- .../closures/2229_closure_analysis/repr_packed.rs | 2 +- .../2229_closure_analysis/run_pass/by_value.rs | 4 +- ...structure-pattern-closure-within-closure.stderr | 16 +- .../run_pass/disjoint-capture-in-same-closure.rs | 2 +- .../run_pass/multilevel-path-1.rs | 4 +- .../run_pass/multilevel-path-2.rs | 2 +- .../run_pass/mut_ref_struct_mem.rs | 2 +- src/test/ui/closures/binder/disallow-const.rs | 6 + src/test/ui/closures/binder/disallow-const.stderr | 8 + src/test/ui/closures/binder/disallow-ty.rs | 6 + src/test/ui/closures/binder/disallow-ty.stderr | 8 + src/test/ui/closures/closure-move-sync.stderr | 22 +- src/test/ui/closures/closure-wrong-kind.stderr | 10 +- .../ui/closures/coerce-unsafe-to-closure.stderr | 2 +- src/test/ui/closures/issue-10398.rs | 4 +- src/test/ui/closures/issue-10398.stderr | 2 +- src/test/ui/closures/issue-52437.rs | 1 - src/test/ui/closures/issue-52437.stderr | 13 +- src/test/ui/closures/issue-6801.rs | 4 +- src/test/ui/closures/issue-84128.rs | 2 +- src/test/ui/closures/issue-84128.stderr | 5 - .../print/closure-print-generic-verbose-1.stderr | 2 +- src/test/ui/codegen/issue-101585-128bit-repeat.rs | 14 + src/test/ui/codegen/issue-99551.rs | 21 + .../coercion/coerce-reborrow-multi-arg-fail.stderr | 2 +- src/test/ui/coercion/coerce-to-bang.stderr | 10 +- src/test/ui/coercion/issue-101066.rs | 16 + .../coherence/auxiliary/trait-with-const-param.rs | 1 + .../coherence-negative-outlives-lifetimes.rs | 13 +- .../coherence-negative-outlives-lifetimes.stderr | 11 - ...erence-negative-outlives-lifetimes.stock.stderr | 11 + .../ui/coherence/const-generics-orphan-check-ok.rs | 28 ++ src/test/ui/coherence/issue-100191-2.rs | 12 + src/test/ui/coherence/issue-100191-2.stderr | 14 + src/test/ui/coherence/issue-100191.rs | 21 + src/test/ui/coherence/issue-100191.stderr | 12 + src/test/ui/command/command-current-dir.rs | 2 +- .../cfg-attr-syntax-validation.stderr | 4 +- src/test/ui/const-generics/argument_order.stderr | 4 +- .../const-param-before-other-params.rs | 2 +- .../const-param-before-other-params.stderr | 2 +- .../defaults/generic-expr-default-concrete.stderr | 4 +- .../generic-expr-default-mismatched-types.stderr | 4 +- .../const-generics/defaults/intermixed-lifetime.rs | 4 +- .../defaults/intermixed-lifetime.stderr | 4 +- .../param-order-err-pretty-prints-default.rs | 2 +- .../param-order-err-pretty-prints-default.stderr | 2 +- .../defaults/trait_objects_fail.stderr | 8 +- .../early/const-param-from-outer-fn.stderr | 2 +- .../abstract-const-as-cast-3.stderr | 96 ++-- .../generic_const_exprs/different-fn.stderr | 4 +- .../generic_const_exprs/issue-100217.rs | 42 ++ .../generic_const_exprs/issue-100360.rs | 13 + .../generic_const_exprs/issue-62504.full.stderr | 4 +- .../generic_const_exprs/issue-69654.stderr | 4 +- .../issue-72819-generic-in-const-eval.full.stderr | 22 +- .../generic_const_exprs/issue-73298.rs | 23 + .../generic_const_exprs/issue-82268.rs | 73 +++ .../generic_const_exprs/issue-83765.stderr | 8 +- .../generic_const_exprs/issue-83972.rs | 38 ++ .../generic_const_exprs/issue-84669.rs | 30 ++ .../generic_const_exprs/issue-85848.stderr | 12 +- .../generic_const_exprs/issue-86710.rs | 73 +++ .../generic_const_exprs/issue-89851.rs | 12 + .../generic_const_exprs/obligation-cause.rs | 24 + .../generic_const_exprs/obligation-cause.stderr | 20 + .../invalid-const-arg-for-type-param.stderr | 13 +- src/test/ui/const-generics/issue-103243.rs | 37 ++ src/test/ui/const-generics/issues/issue-100313.rs | 21 + .../ui/const-generics/issues/issue-100313.stderr | 15 + .../ui/const-generics/issues/issue-73260.stderr | 24 +- .../ui/const-generics/issues/issue-79674.stderr | 12 +- src/test/ui/const-generics/issues/issue-83466.rs | 2 +- .../ui/const-generics/issues/issue-83765.stderr | 4 +- .../ui/const-generics/issues/issue-87493.stderr | 8 +- .../invalid-patterns.32bit.stderr | 26 +- .../invalid-patterns.64bit.stderr | 26 +- .../min_const_generics/invalid-patterns.rs | 6 +- .../types-mismatch-const-args.full.stderr | 4 +- src/test/ui/consts/assert-type-intrinsics.rs | 4 +- src/test/ui/consts/assert-type-intrinsics.stderr | 8 +- src/test/ui/consts/const-block-const-bound.stderr | 4 +- .../const-blocks/fn-call-in-non-const.stderr | 2 +- .../ui/consts/const-blocks/migrate-fail.stderr | 4 +- src/test/ui/consts/const-blocks/nll-fail.stderr | 4 +- src/test/ui/consts/const-blocks/trait-error.stderr | 2 +- src/test/ui/consts/const-err4.32bit.stderr | 11 +- src/test/ui/consts/const-err4.64bit.stderr | 11 +- src/test/ui/consts/const-err4.rs | 3 +- ...st-pointer-values-in-various-types.64bit.stderr | 110 ++--- .../const-pointer-values-in-various-types.rs | 6 +- .../heap/alloc_intrinsic_uninit.32bit.stderr | 2 +- .../heap/alloc_intrinsic_uninit.64bit.stderr | 2 +- .../consts/const-eval/issue-91827-extern-types.rs | 1 - src/test/ui/consts/const-eval/ub-enum-overwrite.rs | 3 +- .../ui/consts/const-eval/ub-enum-overwrite.stderr | 13 +- src/test/ui/consts/const-eval/ub-enum.32bit.stderr | 25 +- src/test/ui/consts/const-eval/ub-enum.64bit.stderr | 25 +- src/test/ui/consts/const-eval/ub-enum.rs | 5 +- .../ui/consts/const-eval/ub-int-array.32bit.stderr | 39 +- .../ui/consts/const-eval/ub-int-array.64bit.stderr | 39 +- src/test/ui/consts/const-eval/ub-int-array.rs | 12 +- .../ui/consts/const-eval/ub-nonnull.32bit.stderr | 15 +- .../ui/consts/const-eval/ub-nonnull.64bit.stderr | 15 +- src/test/ui/consts/const-eval/ub-nonnull.rs | 3 +- .../ui/consts/const-eval/ub-ref-ptr.32bit.stderr | 28 +- .../ui/consts/const-eval/ub-ref-ptr.64bit.stderr | 28 +- src/test/ui/consts/const-eval/ub-ref-ptr.rs | 6 +- .../ui/consts/const-eval/ub-wide-ptr.32bit.stderr | 90 ++-- .../ui/consts/const-eval/ub-wide-ptr.64bit.stderr | 90 ++-- src/test/ui/consts/const-eval/ub-wide-ptr.rs | 12 +- .../ui/consts/const-eval/union-const-eval-field.rs | 3 +- .../const-eval/union-const-eval-field.stderr | 13 +- src/test/ui/consts/const-eval/union-ice.rs | 12 +- src/test/ui/consts/const-eval/union-ice.stderr | 39 +- .../ui/consts/const-eval/union-ub.32bit.stderr | 11 +- .../ui/consts/const-eval/union-ub.64bit.stderr | 11 +- src/test/ui/consts/const-eval/union-ub.rs | 3 +- .../ui/consts/const-float-bits-reject-conv.stderr | 40 -- .../ui/consts/const-points-to-static.32bit.stderr | 2 +- .../ui/consts/const-points-to-static.64bit.stderr | 2 +- .../ui/consts/const_in_pattern/incomplete-slice.rs | 15 + .../const_in_pattern/incomplete-slice.stderr | 26 + .../ui/consts/extra-const-ub/detect-extra-ub.rs | 45 ++ .../detect-extra-ub.with_flag.stderr | 117 +++++ src/test/ui/consts/extra-const-ub/issue-100771.rs | 20 + src/test/ui/consts/extra-const-ub/issue-101034.rs | 17 + src/test/ui/consts/issue-32829-2.stderr | 2 + src/test/ui/consts/issue-36163.stderr | 2 +- src/test/ui/consts/issue-miri-1910.rs | 1 + src/test/ui/consts/issue-miri-1910.stderr | 12 +- src/test/ui/consts/mir_check_nonconst.stderr | 1 + .../const_refers_to_static2.32bit.stderr | 4 +- .../const_refers_to_static2.64bit.stderr | 4 +- ...const_refers_to_static_cross_crate.32bit.stderr | 4 +- ...const_refers_to_static_cross_crate.64bit.stderr | 4 +- src/test/ui/consts/miri_unleashed/ptr_arith.rs | 5 +- src/test/ui/consts/miri_unleashed/ptr_arith.stderr | 2 +- src/test/ui/consts/miri_unleashed/slice_eq.rs | 12 +- src/test/ui/consts/offset.rs | 1 - src/test/ui/consts/offset_from.rs | 1 - src/test/ui/consts/offset_from_ub.rs | 2 +- src/test/ui/consts/ptr_comparisons.rs | 24 +- src/test/ui/consts/ptr_comparisons.stderr | 14 +- src/test/ui/consts/unnormalized-param-env.rs | 31 ++ .../cycle-trait/cycle-trait-default-type-trait.rs | 1 - .../cycle-trait-default-type-trait.stderr | 21 +- .../debuginfo-emit-llvm-ir-and-split-debuginfo.rs | 3 +- src/test/ui/deprecation/deprecation-sanity.stderr | 4 +- .../derives-span-PartialEq-enum-struct-variant.rs | 1 - ...rives-span-PartialEq-enum-struct-variant.stderr | 22 +- src/test/ui/derives/derives-span-PartialEq-enum.rs | 3 +- .../ui/derives/derives-span-PartialEq-enum.stderr | 22 +- .../ui/derives/derives-span-PartialEq-struct.rs | 1 - .../derives/derives-span-PartialEq-struct.stderr | 22 +- .../derives/derives-span-PartialEq-tuple-struct.rs | 1 - .../derives-span-PartialEq-tuple-struct.stderr | 22 +- src/test/ui/derives/deriving-copyclone.stderr | 12 +- .../deriving-no-inner-impl-error-message.rs | 1 - .../deriving-no-inner-impl-error-message.stderr | 24 +- src/test/ui/deriving/deriving-all-codegen.rs | 2 +- src/test/ui/deriving/deriving-all-codegen.stdout | 65 +-- src/test/ui/deriving/issue-103157.rs | 12 + src/test/ui/deriving/issue-103157.stderr | 30 ++ src/test/ui/deriving/issue-89188-gat-hrtb.rs | 2 - .../issue-21659-show-relevant-trait-impls-1.stderr | 6 +- .../issue-21659-show-relevant-trait-impls-2.stderr | 6 +- .../ui/did_you_mean/use_instead_of_import.fixed | 8 + src/test/ui/did_you_mean/use_instead_of_import.rs | 8 + .../ui/did_you_mean/use_instead_of_import.stderr | 16 +- src/test/ui/drop/drop-foreign-fundamental.rs | 23 + src/test/ui/drop/drop-foreign-fundamental.stderr | 9 + src/test/ui/drop/drop_order.rs | 145 ++++++ src/test/ui/dropck/drop-on-non-struct.rs | 7 +- src/test/ui/dropck/drop-on-non-struct.stderr | 4 +- src/test/ui/dst/dst-bad-coercions.stderr | 8 +- src/test/ui/dst/dst-rvalue.rs | 6 +- src/test/ui/dst/dst-rvalue.stderr | 28 +- .../ui/dyn-keyword/dyn-2018-edition-lint.stderr | 35 +- .../ui/dyn-keyword/dyn-2021-edition-error.stderr | 10 +- src/test/ui/dyn-keyword/dyn-angle-brackets.stderr | 5 +- src/test/ui/dyn-star/const.rs | 14 + src/test/ui/dyn-star/drop.rs | 23 + src/test/ui/dyn-star/drop.run.stdout | 1 + src/test/ui/dyn-star/error.rs | 13 + src/test/ui/dyn-star/error.stderr | 9 + src/test/ui/dyn-star/feature-gate-dyn_star.rs | 9 + src/test/ui/dyn-star/feature-gate-dyn_star.stderr | 12 + src/test/ui/dyn-star/make-dyn-star.rs | 13 + src/test/ui/dyn-star/method.rs | 26 + src/test/ui/dyn-star/syntax.rs | 11 + src/test/ui/dynamically-sized-types/dst-struct.rs | 3 +- src/test/ui/dynamically-sized-types/dst-trait.rs | 1 - src/test/ui/empty/empty-never-array.rs | 2 +- src/test/ui/empty/empty-never-array.stderr | 6 +- src/test/ui/enum/enum-discrim-autosizing.rs | 4 +- src/test/ui/enum/enum-discrim-autosizing.stderr | 4 +- src/test/ui/env-funky-keys.rs | 1 + src/test/ui/error-codes/E0004.stderr | 6 +- src/test/ui/error-codes/E0005.stderr | 2 +- src/test/ui/error-codes/E0057.stderr | 4 +- src/test/ui/error-codes/E0060.stderr | 2 +- src/test/ui/error-codes/E0061.stderr | 4 +- src/test/ui/error-codes/E0081.rs | 37 +- src/test/ui/error-codes/E0081.stderr | 52 +- src/test/ui/error-codes/E0107.stderr | 2 +- src/test/ui/error-codes/E0117.rs | 2 +- src/test/ui/error-codes/E0117.stderr | 4 +- src/test/ui/error-codes/E0120.stderr | 4 +- src/test/ui/error-codes/E0271.stderr | 6 +- src/test/ui/error-codes/E0275.stderr | 4 +- src/test/ui/error-codes/E0277-2.stderr | 4 +- src/test/ui/error-codes/E0401.stderr | 8 +- src/test/ui/error-codes/E0565-2.stderr | 4 +- src/test/ui/explore-issue-38412.stderr | 6 +- src/test/ui/expr/if/if-branch-types.stderr | 5 + src/test/ui/expr/if/if-else-type-mismatch.stderr | 10 + src/test/ui/extern/extern-types-unsized.stderr | 12 +- src/test/ui/extern/extern-wrong-value-type.stderr | 2 +- .../feature-gate-collapse_debuginfo.rs | 7 + .../feature-gate-collapse_debuginfo.stderr | 12 + .../feature-gate-exhaustive-patterns.stderr | 2 +- .../feature-gate-generic_arg_infer.normal.stderr | 30 +- .../feature-gate-generic_associated_types.rs | 31 -- .../feature-gate-generic_associated_types.stderr | 78 --- ...ature-gate-generic_associated_types_extended.rs | 2 - ...e-gate-generic_associated_types_extended.stderr | 2 +- .../feature-gate-label_break_value.rs | 5 - .../feature-gate-label_break_value.stderr | 12 - src/test/ui/feature-gates/feature-gate-let_else.rs | 5 - .../ui/feature-gates/feature-gate-let_else.stderr | 14 - ...re-gate-non_exhaustive_omitted_patterns_lint.rs | 2 +- ...ate-non_exhaustive_omitted_patterns_lint.stderr | 6 +- .../feature-gate-object_safe_for_dispatch.stderr | 8 +- .../ui/feature-gates/feature-gate-raw-dylib-2.rs | 6 +- .../feature-gates/feature-gate-raw-dylib-2.stderr | 15 +- .../feature-gate-raw-dylib-import-name-type.rs | 8 + .../feature-gate-raw-dylib-import-name-type.stderr | 21 + .../ui/feature-gates/feature-gate-raw-dylib.rs | 3 +- .../ui/feature-gates/feature-gate-raw-dylib.stderr | 4 +- .../ui/feature-gates/feature-gate-register_attr.rs | 3 - .../feature-gate-register_attr.stderr | 12 - ...ure-gate-return_position_impl_trait_in_trait.rs | 5 + ...gate-return_position_impl_trait_in_trait.stderr | 12 + .../ui/feature-gates/feature-gate-unix_sigpipe.rs | 4 + .../feature-gates/feature-gate-unix_sigpipe.stderr | 12 + .../feature-gates/soft-syntax-gates-with-errors.rs | 30 ++ .../soft-syntax-gates-with-errors.stderr | 21 + .../soft-syntax-gates-without-errors.rs | 26 + .../soft-syntax-gates-without-errors.stderr | 24 + src/test/ui/fmt/ifmt-bad-arg.rs | 2 + src/test/ui/fmt/ifmt-bad-arg.stderr | 13 +- src/test/ui/fmt/ifmt-unimpl.stderr | 2 +- src/test/ui/fmt/send-sync.stderr | 14 +- src/test/ui/fn/fn-compare-mismatch.stderr | 10 +- src/test/ui/fn/fn-item-type.stderr | 10 +- src/test/ui/fn/fn-trait-formatting.stderr | 8 + .../fn/implied-bounds-unnorm-associated-type-2.rs | 3 +- .../implied-bounds-unnorm-associated-type-2.stderr | 17 + .../fn/implied-bounds-unnorm-associated-type-3.rs | 5 +- .../implied-bounds-unnorm-associated-type-3.stderr | 14 - .../fn/implied-bounds-unnorm-associated-type-4.rs | 24 + .../implied-bounds-unnorm-associated-type-4.stderr | 14 + .../fn/implied-bounds-unnorm-associated-type-5.rs | 23 + .../implied-bounds-unnorm-associated-type-5.stderr | 19 + .../ui/fn/implied-bounds-unnorm-associated-type.rs | 6 +- .../implied-bounds-unnorm-associated-type.stderr | 20 +- .../ui/for-loop-while/break-while-condition.stderr | 8 + src/test/ui/for-loop-while/label_break_value.rs | 1 - .../ui/for-loop-while/label_break_value_invalid.rs | 1 - .../label_break_value_invalid.stderr | 6 +- src/test/ui/for/for-c-in-str.rs | 2 +- src/test/ui/for/for-c-in-str.stderr | 2 +- src/test/ui/for/for-loop-bogosity.stderr | 2 +- src/test/ui/functions-closures/fn-help-with-err.rs | 28 +- .../ui/functions-closures/fn-help-with-err.stderr | 38 +- src/test/ui/generator/clone-impl-async.rs | 71 +++ src/test/ui/generator/clone-impl-async.stderr | 171 +++++++ src/test/ui/generator/clone-impl-static.rs | 17 + src/test/ui/generator/clone-impl-static.stderr | 31 ++ src/test/ui/generator/clone-impl.rs | 73 +++ src/test/ui/generator/clone-impl.stderr | 142 ++++++ .../drop-tracking-parent-expression.stderr | 12 +- src/test/ui/generator/drop-yield-twice.stderr | 12 +- .../generator-yielding-or-returning-itself.stderr | 26 +- src/test/ui/generator/issue-68112.rs | 3 +- src/test/ui/generator/issue-68112.stderr | 12 +- src/test/ui/generator/not-send-sync.stderr | 28 +- src/test/ui/generator/partial-drop.stderr | 39 +- .../print/generator-print-verbose-1.stderr | 12 +- .../print/generator-print-verbose-2.stderr | 28 +- .../type-mismatch-signature-deduction.stderr | 6 + .../yield-outside-generator-issue-78653.stderr | 2 +- .../anonymize-bound-vars.rs | 1 - .../generic-associated-types/auxiliary/foo_defn.rs | 2 - .../bugs/hrtb-implied-1.rs | 35 ++ .../bugs/hrtb-implied-1.stderr | 20 + .../bugs/hrtb-implied-2.rs | 40 ++ .../bugs/hrtb-implied-2.stderr | 22 + .../bugs/hrtb-implied-3.rs | 23 + .../bugs/hrtb-implied-3.stderr | 22 + .../generic-associated-types/bugs/issue-80626.rs | 2 - .../bugs/issue-80626.stderr | 4 +- .../generic-associated-types/bugs/issue-86218.rs | 1 - .../bugs/issue-86218.stderr | 6 +- .../generic-associated-types/bugs/issue-87735.rs | 2 - .../bugs/issue-87735.stderr | 2 +- .../generic-associated-types/bugs/issue-87748.rs | 23 - .../bugs/issue-87748.stderr | 20 - .../generic-associated-types/bugs/issue-87755.rs | 2 - .../bugs/issue-87755.stderr | 2 +- .../generic-associated-types/bugs/issue-87803.rs | 2 - .../bugs/issue-87803.stderr | 2 +- .../generic-associated-types/bugs/issue-88382.rs | 2 - .../bugs/issue-88382.stderr | 4 +- .../generic-associated-types/bugs/issue-88460.rs | 2 - .../bugs/issue-88460.stderr | 8 +- .../generic-associated-types/bugs/issue-88526.rs | 2 - .../bugs/issue-88526.stderr | 2 +- .../generic-associated-types/bugs/issue-89008.rs | 1 - .../bugs/issue-89008.stderr | 4 +- .../generic-associated-types/bugs/issue-91762.rs | 29 ++ .../bugs/issue-91762.stderr | 14 + .../collections-project-default.rs | 1 - .../collections-project-default.stderr | 2 +- .../ui/generic-associated-types/collections.rs | 1 - .../collectivity-regression.rs | 2 - .../collectivity-regression.stderr | 2 +- .../const-generics-gat-in-trait-return-type-1.rs | 1 - .../const-generics-gat-in-trait-return-type-2.rs | 1 - .../const-generics-gat-in-trait-return-type-3.rs | 1 - .../const_params_have_right_type.rs | 2 - .../const_params_have_right_type.stderr | 2 +- .../constraint-assoc-type-suggestion.rs | 2 - .../constraint-assoc-type-suggestion.stderr | 2 +- .../construct_with_other_type.rs | 2 - .../cross-crate-bounds.stderr | 2 +- .../elided-in-expr-position.rs | 1 - .../elided-in-expr-position.stderr | 8 +- .../ui/generic-associated-types/empty_generics.rs | 2 - .../generic-associated-types/empty_generics.stderr | 2 +- .../extended/lending_iterator.base.stderr | 2 +- .../extended/lending_iterator.rs | 1 - .../extended/lending_iterator_2.base.stderr | 2 +- .../extended/lending_iterator_2.rs | 1 - .../gat-dont-ice-on-absent-feature-2.rs | 16 - .../gat-dont-ice-on-absent-feature-2.stderr | 21 - .../gat-dont-ice-on-absent-feature.rs | 16 - .../gat-dont-ice-on-absent-feature.stderr | 19 - .../gat-in-trait-path-undeclared-lifetime.rs | 2 - .../gat-in-trait-path-undeclared-lifetime.stderr | 4 +- .../gat-in-trait-path.base.stderr | 4 +- .../generic-associated-types/gat-in-trait-path.rs | 1 - .../gat-incomplete-warning.rs | 5 - .../gat-trait-path-generic-type-arg.rs | 2 - .../gat-trait-path-generic-type-arg.stderr | 6 +- .../gat-trait-path-missing-lifetime.rs | 2 - .../gat-trait-path-missing-lifetime.stderr | 8 +- .../gat-trait-path-parenthesised-args.rs | 2 - .../gat-trait-path-parenthesised-args.stderr | 18 +- .../generic-associated-type-bounds.rs | 2 - .../generic-associated-types-where.rs | 2 - .../generic-associated-types-where.stderr | 4 +- ...generic_associated_type_undeclared_lifetimes.rs | 2 - ...ric_associated_type_undeclared_lifetimes.stderr | 4 +- .../ui/generic-associated-types/impl_bounds.rs | 1 - .../ui/generic-associated-types/impl_bounds.stderr | 26 +- .../ui/generic-associated-types/impl_bounds_ok.rs | 1 - .../ui/generic-associated-types/issue-101020.rs | 35 ++ .../generic-associated-types/issue-101020.stderr | 25 + .../ui/generic-associated-types/issue-102333.rs | 15 + .../generic-associated-types/issue-102335-gat.rs | 12 + .../issue-102335-gat.stderr | 9 + .../issue-47206-where-clause.rs | 2 - .../issue-47206-where-clause.stderr | 2 +- .../issue-58694-parameter-out-of-range.rs | 2 - .../issue-62326-parameter-out-of-range.rs | 2 - .../ui/generic-associated-types/issue-67424.rs | 2 +- .../ui/generic-associated-types/issue-67424.stderr | 12 - .../issue-67510-pass.base.stderr | 4 +- .../generic-associated-types/issue-67510-pass.rs | 1 - .../ui/generic-associated-types/issue-67510.rs | 2 - .../ui/generic-associated-types/issue-67510.stderr | 8 +- .../issue-68641-check-gat-bounds.rs | 2 - .../issue-68641-check-gat-bounds.stderr | 4 +- .../issue-68642-broken-llvm-ir.rs | 2 - .../issue-68642-broken-llvm-ir.stderr | 4 +- .../issue-68643-broken-mir.rs | 2 - .../issue-68643-broken-mir.stderr | 4 +- .../issue-68644-codegen-selection.rs | 2 - .../issue-68644-codegen-selection.stderr | 4 +- .../issue-68645-codegen-fulfillment.rs | 2 - .../issue-68645-codegen-fulfillment.stderr | 4 +- .../ui/generic-associated-types/issue-68648-1.rs | 3 - .../ui/generic-associated-types/issue-68648-2.rs | 2 - .../generic-associated-types/issue-68648-2.stderr | 4 +- .../generic-associated-types/issue-68649-pass.rs | 2 - .../ui/generic-associated-types/issue-68653.rs | 2 - .../issue-68656-unsized-values.rs | 2 - .../issue-68656-unsized-values.stderr | 4 +- .../ui/generic-associated-types/issue-70303.rs | 2 - .../ui/generic-associated-types/issue-70304.rs | 2 - .../ui/generic-associated-types/issue-70304.stderr | 6 +- .../ui/generic-associated-types/issue-71176.rs | 2 - .../ui/generic-associated-types/issue-71176.stderr | 4 +- .../ui/generic-associated-types/issue-74684-1.rs | 2 - .../generic-associated-types/issue-74684-1.stderr | 2 +- .../ui/generic-associated-types/issue-74684-2.rs | 2 - .../generic-associated-types/issue-74684-2.stderr | 10 +- .../ui/generic-associated-types/issue-74816.rs | 1 - .../ui/generic-associated-types/issue-74816.stderr | 8 +- .../ui/generic-associated-types/issue-74824.rs | 1 - .../ui/generic-associated-types/issue-74824.stderr | 10 +- .../ui/generic-associated-types/issue-76407.rs | 2 - .../issue-76535.base.stderr | 14 +- .../issue-76535.extended.stderr | 4 +- .../ui/generic-associated-types/issue-76535.rs | 1 - .../ui/generic-associated-types/issue-76826.rs | 2 - .../issue-78113-lifetime-mismatch-dyn-trait-box.rs | 4 +- ...ue-78113-lifetime-mismatch-dyn-trait-box.stderr | 26 +- .../issue-78671.base.stderr | 8 +- .../issue-78671.extended.stderr | 4 +- .../ui/generic-associated-types/issue-78671.rs | 1 - .../issue-79422.base.stderr | 14 +- .../issue-79422.extended.stderr | 8 +- .../ui/generic-associated-types/issue-79422.rs | 1 - .../ui/generic-associated-types/issue-79636-1.rs | 2 - .../generic-associated-types/issue-79636-1.stderr | 4 +- .../ui/generic-associated-types/issue-79636-2.rs | 2 - .../generic-associated-types/issue-79636-2.stderr | 4 +- .../issue-80433-reduced.rs | 2 - .../ui/generic-associated-types/issue-80433.rs | 2 - .../ui/generic-associated-types/issue-80433.stderr | 4 +- .../ui/generic-associated-types/issue-81487.rs | 2 - .../issue-81712-cyclic-traits.rs | 2 - .../issue-81712-cyclic-traits.stderr | 4 +- .../ui/generic-associated-types/issue-81862.rs | 2 - .../ui/generic-associated-types/issue-81862.stderr | 4 +- .../ui/generic-associated-types/issue-84931.rs | 1 - .../ui/generic-associated-types/issue-84931.stderr | 2 +- .../ui/generic-associated-types/issue-85921.rs | 2 - .../ui/generic-associated-types/issue-86483.rs | 2 - .../ui/generic-associated-types/issue-86787.rs | 1 - .../ui/generic-associated-types/issue-86787.stderr | 2 +- .../ui/generic-associated-types/issue-87258_a.rs | 1 - .../generic-associated-types/issue-87258_a.stderr | 2 +- .../ui/generic-associated-types/issue-87258_b.rs | 1 - .../generic-associated-types/issue-87258_b.stderr | 2 +- .../ui/generic-associated-types/issue-87429-2.rs | 2 - .../issue-87429-associated-type-default.rs | 1 - .../issue-87429-associated-type-default.stderr | 4 +- .../issue-87429-specialization.rs | 1 - .../issue-87429-specialization.stderr | 4 +- .../ui/generic-associated-types/issue-87429.rs | 2 - .../ui/generic-associated-types/issue-87748.rs | 21 + .../ui/generic-associated-types/issue-87750.rs | 2 - .../ui/generic-associated-types/issue-87750.stderr | 2 +- .../ui/generic-associated-types/issue-88287.rs | 1 - .../ui/generic-associated-types/issue-88287.stderr | 4 +- .../ui/generic-associated-types/issue-88360.rs | 2 - .../ui/generic-associated-types/issue-88360.stderr | 2 +- .../ui/generic-associated-types/issue-88405.rs | 2 - .../ui/generic-associated-types/issue-88459.rs | 2 - .../ui/generic-associated-types/issue-88595.rs | 1 - .../ui/generic-associated-types/issue-88595.stderr | 4 +- .../ui/generic-associated-types/issue-89352.rs | 2 - .../ui/generic-associated-types/issue-90014.rs | 1 - .../ui/generic-associated-types/issue-90014.stderr | 4 +- .../ui/generic-associated-types/issue-90729.rs | 2 - .../issue-91139.migrate.stderr | 13 +- .../ui/generic-associated-types/issue-91139.rs | 2 - .../ui/generic-associated-types/issue-91139.stderr | 18 +- .../ui/generic-associated-types/issue-91762.rs | 30 -- .../ui/generic-associated-types/issue-91762.stderr | 14 - .../ui/generic-associated-types/issue-91883.rs | 2 - .../ui/generic-associated-types/issue-91883.stderr | 6 +- .../ui/generic-associated-types/issue-92033.rs | 2 - .../ui/generic-associated-types/issue-92033.stderr | 4 +- .../issue-92096.migrate.stderr | 4 +- .../ui/generic-associated-types/issue-92096.rs | 2 - .../ui/generic-associated-types/issue-92096.stderr | 2 +- .../ui/generic-associated-types/issue-92280.rs | 1 - .../ui/generic-associated-types/issue-92954.rs | 2 - .../ui/generic-associated-types/issue-93141.rs | 2 - .../ui/generic-associated-types/issue-93262.rs | 2 - .../ui/generic-associated-types/issue-93340.rs | 2 - .../ui/generic-associated-types/issue-93341.rs | 1 - .../ui/generic-associated-types/issue-93342.rs | 2 - .../ui/generic-associated-types/issue-93874.rs | 2 - .../ui/generic-associated-types/issue-95305.rs | 1 - .../ui/generic-associated-types/issue-95305.stderr | 2 +- src/test/ui/generic-associated-types/iterable.rs | 2 - .../method-unsatified-assoc-type-predicate.rs | 2 - .../method-unsatified-assoc-type-predicate.stderr | 4 +- .../generic-associated-types/missing-bounds.fixed | 2 +- .../generic-associated-types/missing-bounds.stderr | 4 +- .../missing-where-clause-on-trait.rs | 2 - .../missing-where-clause-on-trait.stderr | 2 +- .../missing_lifetime_args.rs | 2 - .../missing_lifetime_args.stderr | 12 +- .../missing_lifetime_const.rs | 2 - .../missing_lifetime_const.stderr | 4 +- .../parameter_number_and_kind.rs | 1 - .../parameter_number_and_kind.stderr | 12 +- .../parameter_number_and_kind_impl.rs | 1 - .../parameter_number_and_kind_impl.stderr | 12 +- .../parse/in-trait-impl.rs | 2 - .../ui/generic-associated-types/parse/in-trait.rs | 2 - .../parse/trait-path-expected-token.rs | 2 - .../parse/trait-path-expected-token.stderr | 2 +- .../parse/trait-path-expressions.rs | 2 - .../parse/trait-path-expressions.stderr | 4 +- .../parse/trait-path-missing-gen_arg.rs | 2 - .../parse/trait-path-missing-gen_arg.stderr | 10 +- .../parse/trait-path-segments.rs | 2 - .../parse/trait-path-segments.stderr | 6 +- .../trait-path-type-error-once-implemented.rs | 2 - .../trait-path-type-error-once-implemented.stderr | 8 +- .../parse/trait-path-types.rs | 2 - .../parse/trait-path-types.stderr | 6 +- .../ui/generic-associated-types/pointer_family.rs | 2 - .../projection-bound-cycle-generic.rs | 2 - .../projection-bound-cycle-generic.stderr | 4 +- .../projection-bound-cycle.rs | 1 - .../projection-bound-cycle.stderr | 4 +- .../projection-type-lifetime-mismatch.rs | 2 - .../projection-type-lifetime-mismatch.stderr | 6 +- .../generic-associated-types/self-outlives-lint.rs | 15 +- .../self-outlives-lint.stderr | 43 +- src/test/ui/generic-associated-types/shadowing.rs | 2 - .../ui/generic-associated-types/shadowing.stderr | 8 +- .../generic-associated-types/streaming_iterator.rs | 2 - .../trait-objects.base.stderr | 4 +- .../trait-objects.extended.stderr | 4 +- .../ui/generic-associated-types/trait-objects.rs | 1 - .../type-param-defaults.rs | 34 ++ .../type-param-defaults.stderr | 20 + .../unsatified-item-lifetime-bound.rs | 2 - .../unsatified-item-lifetime-bound.stderr | 14 +- .../unsatisfied-outlives-bound.rs | 2 - .../unsatisfied-outlives-bound.stderr | 8 +- .../variance_constraints.rs | 1 - src/test/ui/generics/issue-59508-1.rs | 2 +- src/test/ui/generics/issue-59508-1.stderr | 2 +- src/test/ui/generics/issue-59508.fixed | 2 +- src/test/ui/generics/issue-59508.rs | 2 +- src/test/ui/generics/issue-59508.stderr | 2 +- .../issue-80512-param-reordering-with-defaults.rs | 2 +- ...sue-80512-param-reordering-with-defaults.stderr | 2 +- src/test/ui/generics/issue-98432.stderr | 6 +- .../ui/generics/lifetime-before-type-params.rs | 8 +- .../ui/generics/lifetime-before-type-params.stderr | 8 +- src/test/ui/hashmap/hashmap-index-mut.rs | 6 + src/test/ui/hashmap/hashmap-index-mut.stderr | 19 + src/test/ui/higher-rank-trait-bounds/complex.rs | 28 ++ .../due-to-where-clause.rs | 13 + .../due-to-where-clause.stderr | 11 + .../hrtb-cache-issue-54302.rs | 24 + .../hrtb-cache-issue-54302.stderr | 11 + .../hrtb-conflate-regions.rs | 31 ++ .../hrtb-conflate-regions.stderr | 20 + .../hrtb-debruijn-in-receiver.rs | 18 + .../hrtb-debruijn-in-receiver.stderr | 14 + .../hrtb-exists-forall-fn.rs | 18 + .../hrtb-exists-forall-fn.stderr | 12 + .../hrtb-exists-forall-trait-contravariant.rs | 36 ++ .../hrtb-exists-forall-trait-contravariant.stderr | 11 + .../hrtb-exists-forall-trait-covariant.rs | 37 ++ .../hrtb-exists-forall-trait-invariant.rs | 29 ++ .../hrtb-exists-forall-trait-invariant.stderr | 11 + .../hrtb-higher-ranker-supertraits-transitive.rs | 50 ++ ...rtb-higher-ranker-supertraits-transitive.stderr | 23 + .../hrtb-higher-ranker-supertraits.rs | 48 ++ .../hrtb-higher-ranker-supertraits.stderr | 43 ++ .../hrtb-identity-fn-borrows.rs | 26 + .../hrtb-identity-fn-borrows.stderr | 14 + .../hrtb-just-for-static.rs | 35 ++ .../hrtb-just-for-static.stderr | 34 ++ .../hrtb-perfect-forwarding.polonius.stderr | 71 +++ .../hrtb-perfect-forwarding.rs | 56 +++ .../hrtb-perfect-forwarding.stderr | 79 +++ .../ui/higher-rank-trait-bounds/issue-30786.rs | 134 +++++ .../ui/higher-rank-trait-bounds/issue-30786.stderr | 45 ++ .../ui/higher-rank-trait-bounds/issue-46989.rs | 40 ++ .../ui/higher-rank-trait-bounds/issue-46989.stderr | 11 + .../ui/higher-rank-trait-bounds/issue-57639.rs | 29 ++ .../ui/higher-rank-trait-bounds/issue-58451.rs | 13 + .../ui/higher-rank-trait-bounds/issue-58451.stderr | 19 + .../issue-62203-hrtb-ice.rs | 54 ++ .../issue-62203-hrtb-ice.stderr | 63 +++ .../ui/higher-rank-trait-bounds/issue-88446.rs | 35 ++ .../ui/higher-rank-trait-bounds/issue-90177.rs | 32 ++ .../ui/higher-rank-trait-bounds/issue-95034.rs | 98 ++++ .../ui/higher-rank-trait-bounds/issue-95034.stderr | 1 + .../ui/higher-rank-trait-bounds/issue-95230.rs | 7 + .../normalize-under-binder/issue-62529-3.stderr | 6 +- .../normalize-under-binder/issue-85455.rs | 1 - .../normalize-under-binder/issue-85455.stderr | 13 +- .../normalize-under-binder/issue-89118.stderr | 6 +- .../normalize-under-binder/issue-90612.rs | 2 - .../normalize-under-binder/issue-90638.rs | 2 - src/test/ui/hrtb/complex.rs | 28 -- src/test/ui/hrtb/due-to-where-clause.rs | 13 - src/test/ui/hrtb/due-to-where-clause.stderr | 11 - src/test/ui/hrtb/hrtb-cache-issue-54302.rs | 24 - src/test/ui/hrtb/hrtb-cache-issue-54302.stderr | 11 - src/test/ui/hrtb/hrtb-conflate-regions.rs | 31 -- src/test/ui/hrtb/hrtb-conflate-regions.stderr | 20 - src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs | 18 - src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr | 14 - src/test/ui/hrtb/hrtb-exists-forall-fn.rs | 18 - src/test/ui/hrtb/hrtb-exists-forall-fn.stderr | 12 - .../hrtb/hrtb-exists-forall-trait-contravariant.rs | 36 -- .../hrtb-exists-forall-trait-contravariant.stderr | 11 - .../ui/hrtb/hrtb-exists-forall-trait-covariant.rs | 37 -- .../ui/hrtb/hrtb-exists-forall-trait-invariant.rs | 29 -- .../hrtb/hrtb-exists-forall-trait-invariant.stderr | 11 - .../hrtb-higher-ranker-supertraits-transitive.rs | 50 -- ...rtb-higher-ranker-supertraits-transitive.stderr | 23 - src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs | 48 -- .../ui/hrtb/hrtb-higher-ranker-supertraits.stderr | 43 -- src/test/ui/hrtb/hrtb-identity-fn-borrows.rs | 26 - src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr | 14 - src/test/ui/hrtb/hrtb-just-for-static.rs | 35 -- src/test/ui/hrtb/hrtb-just-for-static.stderr | 28 -- .../hrtb/hrtb-perfect-forwarding.polonius.stderr | 71 --- src/test/ui/hrtb/hrtb-perfect-forwarding.rs | 56 --- src/test/ui/hrtb/hrtb-perfect-forwarding.stderr | 73 --- src/test/ui/hrtb/issue-30786.rs | 134 ----- src/test/ui/hrtb/issue-30786.stderr | 53 -- src/test/ui/hrtb/issue-46989.rs | 40 -- src/test/ui/hrtb/issue-46989.stderr | 11 - src/test/ui/hrtb/issue-57639.rs | 29 -- src/test/ui/hrtb/issue-58451.rs | 13 - src/test/ui/hrtb/issue-58451.stderr | 19 - src/test/ui/hrtb/issue-62203-hrtb-ice.rs | 50 -- src/test/ui/hrtb/issue-62203-hrtb-ice.stderr | 53 -- src/test/ui/hrtb/issue-88446.rs | 35 -- src/test/ui/hrtb/issue-90177.rs | 32 -- src/test/ui/hrtb/issue-95034.rs | 98 ---- src/test/ui/hrtb/issue-95034.stderr | 1 - src/test/ui/hrtb/issue-95230.rs | 7 - src/test/ui/impl-trait/auto-trait-leak.stderr | 10 + src/test/ui/impl-trait/equality.stderr | 7 +- ...th-implicit-hrtb-without-dyn.edition2021.stderr | 5 +- src/test/ui/impl-trait/impl-generic-mismatch.rs | 9 + .../ui/impl-trait/impl-generic-mismatch.stderr | 18 +- .../ui/impl-trait/in-trait/deep-match-works.rs | 16 + src/test/ui/impl-trait/in-trait/deep-match.rs | 15 + src/test/ui/impl-trait/in-trait/deep-match.stderr | 15 + src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs | 13 + .../ui/impl-trait/in-trait/doesnt-satisfy.stderr | 17 + src/test/ui/impl-trait/in-trait/encode.rs | 9 + src/test/ui/impl-trait/in-trait/nested-rpitit.rs | 32 ++ src/test/ui/impl-trait/in-trait/object-safety.rs | 22 + .../ui/impl-trait/in-trait/object-safety.stderr | 50 ++ .../in-trait/opaque-in-impl-is-opaque.rs | 19 + .../in-trait/opaque-in-impl-is-opaque.stderr | 17 + src/test/ui/impl-trait/in-trait/opaque-in-impl.rs | 48 ++ src/test/ui/impl-trait/in-trait/reveal.rs | 18 + src/test/ui/impl-trait/in-trait/success.rs | 40 ++ src/test/ui/impl-trait/in-trait/wf-bounds.rs | 16 + src/test/ui/impl-trait/in-trait/wf-bounds.stderr | 33 ++ src/test/ui/impl-trait/issue-100075-2.rs | 8 + src/test/ui/impl-trait/issue-100075-2.stderr | 24 + src/test/ui/impl-trait/issue-100075.rs | 21 + src/test/ui/impl-trait/issue-100075.stderr | 12 + src/test/ui/impl-trait/issue-103599.rs | 10 + src/test/ui/impl-trait/issue-103599.stderr | 14 + src/test/ui/impl-trait/issue-99914.rs | 13 + src/test/ui/impl-trait/issue-99914.stderr | 21 + src/test/ui/impl-trait/issues/issue-78722.rs | 2 +- src/test/ui/impl-trait/issues/issue-78722.stderr | 2 +- .../ui/impl-trait/nested-return-type2-tait2.stderr | 2 +- .../ui/impl-trait/nested-return-type2-tait3.stderr | 2 +- .../nested-rpit-with-anonymous-lifetimes.rs | 23 + src/test/ui/impl-trait/nested_impl_trait.stderr | 4 +- ...nsafe-trait-in-return-position-dyn-trait.stderr | 4 +- ...safe-trait-in-return-position-impl-trait.stderr | 4 +- ...t-to-type-err-cause-on-impl-trait-return.stderr | 96 +++- ...projection-mismatch-in-impl-where-clause.stderr | 2 +- .../impl-trait/suggest-calling-rpit-closure.stderr | 2 +- src/test/ui/impl-trait/where-allowed.stderr | 6 + .../assoc-ty-wf-used-to-get-assoc-ty.rs | 27 + .../assoc-ty-wf-used-to-get-assoc-ty.stderr | 15 + .../impl-header-unnormalized-types.rs | 28 ++ .../impl-header-unnormalized-types.stderr | 20 + src/test/ui/implied-bounds/issue-100690.rs | 45 ++ src/test/ui/implied-bounds/issue-100690.stderr | 22 + src/test/ui/implied-bounds/issue-101951.rs | 50 ++ src/test/ui/index-help.stderr | 2 +- src/test/ui/indexing-requires-a-uint.stderr | 2 +- src/test/ui/inference/issue-71732.stderr | 6 +- src/test/ui/inference/issue-86162-1.stderr | 2 +- src/test/ui/inference/issue-86162-2.stderr | 2 +- .../expr-struct-type-relative-gat.rs | 2 - .../expr-struct-type-relative-gat.stderr | 2 +- src/test/ui/integral-indexing.stderr | 16 +- .../interior-mutability/interior-mutability.stderr | 8 +- .../intrinsics/const-eval-select-backtrace-std.rs | 6 + .../const-eval-select-backtrace-std.run.stderr | 2 + .../ui/intrinsics/const-eval-select-backtrace.rs | 18 + .../const-eval-select-backtrace.run.stderr | 2 + src/test/ui/intrinsics/const-eval-select-bad.rs | 14 +- .../ui/intrinsics/const-eval-select-bad.stderr | 85 ++-- src/test/ui/issue-94866.stderr | 6 +- src/test/ui/issues/auxiliary/issue-2380.rs | 4 +- ...50-normalization-ice-exposed-by-mir-inlining.rs | 39 -- src/test/ui/issues/issue-100605.rs | 9 + src/test/ui/issues/issue-100605.stderr | 46 ++ src/test/ui/issues/issue-10682.rs | 4 +- src/test/ui/issues/issue-10767.rs | 4 +- src/test/ui/issues/issue-10802.rs | 9 +- src/test/ui/issues/issue-11192.rs | 8 +- src/test/ui/issues/issue-11192.stderr | 2 +- src/test/ui/issues/issue-11374.stderr | 2 +- src/test/ui/issues/issue-11515.rs | 6 +- src/test/ui/issues/issue-11515.stderr | 6 +- src/test/ui/issues/issue-11552.rs | 6 +- src/test/ui/issues/issue-11844.rs | 4 +- src/test/ui/issues/issue-11844.stderr | 2 +- src/test/ui/issues/issue-12127.rs | 4 +- src/test/ui/issues/issue-13323.rs | 3 +- src/test/ui/issues/issue-14399.rs | 4 +- src/test/ui/issues/issue-14915.rs | 4 +- src/test/ui/issues/issue-14915.stderr | 2 +- src/test/ui/issues/issue-15524.rs | 16 - src/test/ui/issues/issue-15524.stderr | 40 -- src/test/ui/issues/issue-15571.rs | 7 +- src/test/ui/issues/issue-15763.rs | 9 +- src/test/ui/issues/issue-16538.mir.stderr | 1 + src/test/ui/issues/issue-16538.thir.stderr | 1 + src/test/ui/issues/issue-16739.rs | 7 +- src/test/ui/issues/issue-16774.rs | 3 +- src/test/ui/issues/issue-16939.stderr | 2 +- src/test/ui/issues/issue-17252.stderr | 2 +- src/test/ui/issues/issue-17322.rs | 4 +- src/test/ui/issues/issue-18611.stderr | 8 +- src/test/ui/issues/issue-18819.stderr | 12 +- src/test/ui/issues/issue-20162.stderr | 6 +- src/test/ui/issues/issue-20413.stderr | 16 +- src/test/ui/issues/issue-20605.stderr | 4 +- src/test/ui/issues/issue-20831-debruijn.stderr | 24 +- src/test/ui/issues/issue-21033.rs | 5 +- src/test/ui/issues/issue-21763.stderr | 6 +- src/test/ui/issues/issue-21950.stderr | 18 +- src/test/ui/issues/issue-22872.stderr | 2 +- src/test/ui/issues/issue-2288.rs | 4 +- src/test/ui/issues/issue-23024.rs | 3 +- src/test/ui/issues/issue-23024.stderr | 6 +- src/test/ui/issues/issue-23122-2.stderr | 7 +- src/test/ui/issues/issue-23302-3.stderr | 4 +- src/test/ui/issues/issue-23491.rs | 3 +- .../ui/issues/issue-23611-enum-swap-in-drop.rs | 2 +- src/test/ui/issues/issue-25901.stderr | 1 + src/test/ui/issues/issue-26217.stderr | 6 + src/test/ui/issues/issue-2708.rs | 4 +- src/test/ui/issues/issue-2734.rs | 8 +- src/test/ui/issues/issue-2735.rs | 8 +- src/test/ui/issues/issue-28344.stderr | 4 +- src/test/ui/issues/issue-2935.rs | 3 +- src/test/ui/issues/issue-3026.rs | 4 +- src/test/ui/issues/issue-31173.rs | 11 +- src/test/ui/issues/issue-31173.stderr | 42 +- src/test/ui/issues/issue-3121.rs | 3 +- src/test/ui/issues/issue-3214.stderr | 5 +- src/test/ui/issues/issue-32709.stderr | 2 +- src/test/ui/issues/issue-3290.rs | 3 +- src/test/ui/issues/issue-33941.rs | 6 +- src/test/ui/issues/issue-33941.stderr | 18 +- src/test/ui/issues/issue-34334.stderr | 6 +- src/test/ui/issues/issue-34349.stderr | 10 +- src/test/ui/issues/issue-3447.rs | 3 +- src/test/ui/issues/issue-35241.stderr | 4 +- src/test/ui/issues/issue-35570.rs | 3 +- src/test/ui/issues/issue-35570.stderr | 12 +- src/test/ui/issues/issue-3794.rs | 3 +- src/test/ui/issues/issue-3878.rs | 3 +- src/test/ui/issues/issue-38821.stderr | 2 +- src/test/ui/issues/issue-39970.stderr | 2 +- src/test/ui/issues/issue-40510-3.stderr | 4 + src/test/ui/issues/issue-40827.stderr | 4 +- src/test/ui/issues/issue-41139.stderr | 4 +- src/test/ui/issues/issue-41726.stderr | 4 + src/test/ui/issues/issue-41974.stderr | 4 +- src/test/ui/issues/issue-43988.stderr | 4 + src/test/ui/issues/issue-47511.stderr | 3 +- src/test/ui/issues/issue-4759.rs | 4 +- src/test/ui/issues/issue-4935.stderr | 2 +- src/test/ui/issues/issue-4972.rs | 1 - src/test/ui/issues/issue-4972.stderr | 2 +- src/test/ui/issues/issue-49824.stderr | 4 + src/test/ui/issues/issue-5100.rs | 2 +- src/test/ui/issues/issue-5192.rs | 4 +- src/test/ui/issues/issue-5439.rs | 4 +- src/test/ui/issues/issue-5439.stderr | 6 +- src/test/ui/issues/issue-5666.rs | 5 +- src/test/ui/issues/issue-5718.rs | 4 +- src/test/ui/issues/issue-57362-1.stderr | 4 +- src/test/ui/issues/issue-5884.rs | 4 +- src/test/ui/issues/issue-59488.rs | 1 + src/test/ui/issues/issue-59488.stderr | 41 +- src/test/ui/issues/issue-5997-enum.stderr | 8 +- src/test/ui/issues/issue-5997-struct.stderr | 8 +- src/test/ui/issues/issue-60218.stderr | 4 +- src/test/ui/issues/issue-62480.rs | 2 - src/test/ui/issues/issue-62480.stderr | 4 +- src/test/ui/issues/issue-6318.rs | 4 +- src/test/ui/issues/issue-6557.rs | 1 - src/test/ui/issues/issue-66706.rs | 3 - src/test/ui/issues/issue-66706.stderr | 35 +- .../issue-66923-show-error-for-correct-call.stderr | 12 +- .../issue-67039-unsound-pin-partialeq.stderr | 2 +- .../issue-69396-const-no-type-in-macro.stderr | 14 +- src/test/ui/issues/issue-69455.stderr | 2 +- src/test/ui/issues/issue-7013.rs | 4 +- src/test/ui/issues/issue-7013.stderr | 8 +- ...ssue-70724-add_type_neq_err_label-unwrap.stderr | 9 +- src/test/ui/issues/issue-7364.rs | 4 +- src/test/ui/issues/issue-7364.stderr | 6 +- ...ssue-7673-cast-generically-implemented-trait.rs | 4 +- src/test/ui/issues/issue-86756.stderr | 5 +- src/test/ui/issues/issue-9129.rs | 4 +- src/test/ui/issues/issue-9382.rs | 5 +- src/test/ui/issues/issue-99875.rs | 16 + src/test/ui/issues/issue-99875.stderr | 33 ++ src/test/ui/iterators/collect-into-array.rs | 1 + src/test/ui/iterators/collect-into-array.stderr | 6 +- src/test/ui/iterators/collect-into-slice.rs | 5 + src/test/ui/iterators/collect-into-slice.stderr | 23 +- src/test/ui/iterators/integral.stderr | 24 +- src/test/ui/iterators/issue-28098.rs | 4 + src/test/ui/iterators/issue-28098.stderr | 50 +- .../ui/iterators/issue-58952-filter-type-length.rs | 2 +- src/test/ui/iterators/ranges.stderr | 4 +- src/test/ui/iterators/string.stderr | 4 +- src/test/ui/json-and-color.rs | 3 - src/test/ui/json-and-color.stderr | 2 - src/test/ui/json-and-error-format.rs | 3 - src/test/ui/json-and-error-format.stderr | 2 - src/test/ui/json-bom-plus-crlf-multifile-aux.rs | 27 - src/test/ui/json-bom-plus-crlf-multifile.rs | 11 - src/test/ui/json-bom-plus-crlf-multifile.stderr | 114 ----- src/test/ui/json-bom-plus-crlf.rs | 26 - src/test/ui/json-bom-plus-crlf.stderr | 114 ----- src/test/ui/json-invalid.rs | 3 - src/test/ui/json-invalid.stderr | 2 - src/test/ui/json-multiple.polonius.stderr | 1 - src/test/ui/json-multiple.rs | 5 - src/test/ui/json-multiple.stderr | 1 - src/test/ui/json-options.polonius.stderr | 1 - src/test/ui/json-options.rs | 5 - src/test/ui/json-options.stderr | 1 - src/test/ui/json-short.rs | 1 - src/test/ui/json-short.stderr | 19 - src/test/ui/json/json-and-color.rs | 3 + src/test/ui/json/json-and-color.stderr | 2 + src/test/ui/json/json-and-error-format.rs | 3 + src/test/ui/json/json-and-error-format.stderr | 2 + .../ui/json/json-bom-plus-crlf-multifile-aux.rs | 27 + src/test/ui/json/json-bom-plus-crlf-multifile.rs | 11 + .../ui/json/json-bom-plus-crlf-multifile.stderr | 114 +++++ src/test/ui/json/json-bom-plus-crlf.rs | 26 + src/test/ui/json/json-bom-plus-crlf.stderr | 114 +++++ src/test/ui/json/json-invalid.rs | 3 + src/test/ui/json/json-invalid.stderr | 2 + src/test/ui/json/json-multiple.polonius.stderr | 1 + src/test/ui/json/json-multiple.rs | 5 + src/test/ui/json/json-multiple.stderr | 1 + src/test/ui/json/json-options.polonius.stderr | 1 + src/test/ui/json/json-options.rs | 5 + src/test/ui/json/json-options.stderr | 1 + src/test/ui/json/json-short.rs | 1 + src/test/ui/json/json-short.stderr | 19 + src/test/ui/kindck/kindck-impl-type-params-2.rs | 2 +- .../ui/kindck/kindck-impl-type-params-2.stderr | 4 +- src/test/ui/kindck/kindck-impl-type-params.stderr | 12 +- .../kindck/kindck-inherited-copy-bound.curr.stderr | 6 +- ...ited-copy-bound.object_safe_for_dispatch.stderr | 6 +- src/test/ui/kindck/kindck-nonsendable-1.stderr | 10 +- src/test/ui/kindck/kindck-send-object.stderr | 12 +- src/test/ui/kindck/kindck-send-object1.stderr | 12 +- src/test/ui/kindck/kindck-send-object2.stderr | 12 +- src/test/ui/kindck/kindck-send-owned.stderr | 6 +- src/test/ui/label/label_break_value_continue.rs | 1 - .../ui/label/label_break_value_continue.stderr | 6 +- .../ui/label/label_break_value_desugared_break.rs | 9 +- .../ui/label/label_break_value_illegal_uses.fixed | 1 - .../ui/label/label_break_value_illegal_uses.rs | 1 - .../ui/label/label_break_value_illegal_uses.stderr | 8 +- .../ui/label/label_break_value_unlabeled_break.rs | 1 - .../label/label_break_value_unlabeled_break.stderr | 4 +- ...96158-scalarpair-payload-might-be-uninit.stderr | 4 +- .../ui/layout/zero-sized-array-enum-niche.stderr | 2 +- .../ui/lazy-type-alias-impl-trait/branches.stderr | 6 +- .../lazy-type-alias-impl-trait/recursion4.stderr | 12 +- src/test/ui/let-else/const-fn.rs | 19 + src/test/ui/let-else/issue-100103.rs | 15 + src/test/ui/let-else/issue-102317.rs | 20 + src/test/ui/let-else/issue-94176.rs | 10 + src/test/ui/let-else/issue-94176.stderr | 19 + src/test/ui/let-else/issue-99975.rs | 20 + src/test/ui/let-else/let-else-allow-in-expr.rs | 2 - src/test/ui/let-else/let-else-allow-in-expr.stderr | 6 +- src/test/ui/let-else/let-else-allow-unused.rs | 2 +- .../let-else-binding-explicit-mut-annotated.rs | 2 +- .../let-else-binding-explicit-mut-borrow.rs | 4 +- .../let-else/let-else-binding-explicit-mut-pass.rs | 2 +- .../ui/let-else/let-else-binding-explicit-mut.rs | 2 +- src/test/ui/let-else/let-else-binding-immutable.rs | 2 +- src/test/ui/let-else/let-else-bindings.rs | 2 +- .../ui/let-else/let-else-bool-binop-init.fixed | 2 +- src/test/ui/let-else/let-else-bool-binop-init.rs | 2 +- .../ui/let-else/let-else-brace-before-else.fixed | 2 +- src/test/ui/let-else/let-else-brace-before-else.rs | 2 +- src/test/ui/let-else/let-else-check.rs | 2 - src/test/ui/let-else/let-else-check.stderr | 6 +- .../let-else/let-else-deref-coercion-annotated.rs | 2 +- src/test/ui/let-else/let-else-deref-coercion.rs | 2 +- src/test/ui/let-else/let-else-destructuring.rs | 1 - src/test/ui/let-else/let-else-destructuring.stderr | 4 +- src/test/ui/let-else/let-else-drop-order.rs | 270 ++++++++++ .../ui/let-else/let-else-drop-order.run.stdout | 51 ++ src/test/ui/let-else/let-else-if.rs | 2 - src/test/ui/let-else/let-else-if.stderr | 2 +- src/test/ui/let-else/let-else-irrefutable.rs | 2 +- src/test/ui/let-else/let-else-missing-semicolon.rs | 2 - .../ui/let-else/let-else-missing-semicolon.stderr | 4 +- src/test/ui/let-else/let-else-no-double-error.rs | 2 +- src/test/ui/let-else/let-else-non-copy.rs | 2 +- src/test/ui/let-else/let-else-non-diverging.rs | 2 - src/test/ui/let-else/let-else-non-diverging.stderr | 6 +- src/test/ui/let-else/let-else-ref-bindings-pass.rs | 2 +- src/test/ui/let-else/let-else-ref-bindings.rs | 2 +- src/test/ui/let-else/let-else-run-pass.rs | 2 +- src/test/ui/let-else/let-else-scope.rs | 2 - src/test/ui/let-else/let-else-scope.stderr | 2 +- src/test/ui/let-else/let-else-slicing-error.rs | 2 +- .../let-else/let-else-source-expr-nomove-pass.rs | 2 +- src/test/ui/let-else/let-else-temp-borrowck.rs | 2 +- .../ui/let-else/let-else-temporary-lifetime.rs | 13 +- src/test/ui/let-else/let-else-then-diverge.rs | 19 + src/test/ui/let-else/let-else-then-diverge.stderr | 14 + src/test/ui/let-else/let-else.rs | 8 + src/test/ui/lexical-scopes.stderr | 2 + src/test/ui/lifetimes/fullwidth-ampersand.rs | 7 + src/test/ui/lifetimes/fullwidth-ampersand.stderr | 26 + src/test/ui/lifetimes/issue-26638.stderr | 2 +- ...ision-return-type-requires-explicit-lifetime.rs | 6 + ...n-return-type-requires-explicit-lifetime.stderr | 14 +- src/test/ui/lifetimes/missing-lifetime-in-alias.rs | 2 - .../ui/lifetimes/missing-lifetime-in-alias.stderr | 10 +- ...gest-introducing-and-adding-missing-lifetime.rs | 9 + ...-introducing-and-adding-missing-lifetime.stderr | 23 + src/test/ui/limits/issue-17913.rs | 6 +- .../linkage-attr/link-attr-validation-early.stderr | 4 +- .../linkage-attr/link-attr-validation-late.stderr | 4 +- .../allowed-group-warn-by-default-lint.stderr | 15 +- src/test/ui/lint/force-warn/cap-lints-allow.stderr | 15 +- ...t-group-allowed-cli-warn-by-default-lint.stderr | 15 +- .../lint-group-allowed-lint-group.stderr | 15 +- .../lint-group-allowed-warn-by-default-lint.stderr | 15 +- src/test/ui/lint/issue-101284.rs | 15 + ...sue-70819-dont-override-forbid-in-same-scope.rs | 2 +- .../ui/lint/let_underscore/let_underscore_drop.rs | 14 + .../lint/let_underscore/let_underscore_drop.stderr | 22 + .../ui/lint/let_underscore/let_underscore_lock.rs | 7 + .../lint/let_underscore/let_underscore_lock.stderr | 20 + src/test/ui/lint/lint-attr-everywhere-early.rs | 176 +++++++ src/test/ui/lint/lint-attr-everywhere-early.stderr | 486 ++++++++++++++++++ src/test/ui/lint/lint-attr-everywhere-late.rs | 197 ++++++++ src/test/ui/lint/lint-attr-everywhere-late.stderr | 428 ++++++++++++++++ .../ui/lint/must_not_suspend/ref-drop-tracking.rs | 30 ++ .../lint/must_not_suspend/ref-drop-tracking.stderr | 27 + .../lint/must_not_suspend/ref.drop_tracking.stderr | 27 + .../must_not_suspend/ref.no_drop_tracking.stderr | 27 + src/test/ui/lint/must_not_suspend/ref.rs | 12 +- src/test/ui/lint/must_not_suspend/ref.stderr | 27 - src/test/ui/lint/uninitialized-zeroed.rs | 15 +- src/test/ui/lint/uninitialized-zeroed.stderr | 60 ++- .../unused/issue-54180-unused-ref-field.stderr | 12 +- .../ui/lint/unused/lint-unused-variables.stderr | 28 +- .../ui/lint/unused/unused_attributes-must_use.rs | 6 + .../lint/unused/unused_attributes-must_use.stderr | 14 +- src/test/ui/lint/unused_labels.rs | 1 - src/test/ui/lint/unused_labels.stderr | 20 +- .../ui/lint/unused_parens_multibyte_recovery.rs | 11 + .../lint/unused_parens_multibyte_recovery.stderr | 43 ++ src/test/ui/liveness/liveness-consts.stderr | 12 +- src/test/ui/lowering/issue-96847.rs | 14 + .../lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr | 2 - .../lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr | 2 - src/test/ui/macros/auxiliary/issue-100199.rs | 18 + src/test/ui/macros/issue-100199.rs | 16 + src/test/ui/macros/issue-100199.stderr | 15 + src/test/ui/macros/stringify.rs | 11 +- src/test/ui/malformed/malformed-regressions.stderr | 4 +- src/test/ui/match/issue-42679.rs | 7 +- src/test/ui/match/match_non_exhaustive.rs | 2 +- src/test/ui/match/match_non_exhaustive.stderr | 8 +- src/test/ui/methods/method-call-err-msg.stderr | 16 +- .../method-on-ambiguous-numeric-type.stderr | 8 +- .../ui/mir/issue-100476-recursion-check-blewup.rs | 42 -- src/test/ui/mir/issue-101844.rs | 73 +++ src/test/ui/mir/issue-102389.rs | 8 + src/test/ui/mir/issue-102389.stderr | 9 + src/test/ui/mir/issue-99852.rs | 24 + src/test/ui/mir/issue-99866.rs | 25 + .../ice-issue-100550-unnormalized-projection.rs | 30 ++ .../ui/mir/mir_codegen_calls_diverging_drops.rs | 1 + src/test/ui/mismatched_types/E0409.stderr | 4 + src/test/ui/mismatched_types/E0631.rs | 2 +- src/test/ui/mismatched_types/E0631.stderr | 8 +- src/test/ui/mismatched_types/closure-arg-count.rs | 2 +- .../ui/mismatched_types/closure-arg-count.stderr | 8 +- ...st-boxed-trait-objects-instead-of-impl-trait.rs | 23 + ...oxed-trait-objects-instead-of-impl-trait.stderr | 26 + .../mismatched_types/dont-point-return-on-E0308.rs | 18 + .../dont-point-return-on-E0308.stderr | 19 + src/test/ui/mismatched_types/issue-19109.stderr | 2 +- src/test/ui/mismatched_types/issue-84976.stderr | 5 + .../method-help-unsatisfied-bound.stderr | 6 +- src/test/ui/mismatched_types/normalize-fn-sig.rs | 16 + .../ui/mismatched_types/normalize-fn-sig.stderr | 19 + .../mismatched_types/overloaded-calls-bad.stderr | 4 +- ...dding-or-removing-ref-for-binding-pattern.fixed | 21 + ...t-adding-or-removing-ref-for-binding-pattern.rs | 21 + ...ding-or-removing-ref-for-binding-pattern.stderr | 49 ++ ...boxed-trait-objects-instead-of-impl-trait.fixed | 28 ++ ...st-boxed-trait-objects-instead-of-impl-trait.rs | 28 ++ ...oxed-trait-objects-instead-of-impl-trait.stderr | 47 ++ src/test/ui/modules/auxiliary/dummy_lib.rs | 2 + src/test/ui/modules/special_module_name.rs | 8 + src/test/ui/modules/special_module_name.stderr | 37 ++ src/test/ui/modules/special_module_name_ignore.rs | 9 + src/test/ui/moves/move-out-of-array-ref.stderr | 4 +- src/test/ui/moves/move-out-of-slice-2.stderr | 8 +- src/test/ui/mutexguard-sync.stderr | 2 +- src/test/ui/namespace/namespace-mix.stderr | 8 +- src/test/ui/nested-ty-params.stderr | 12 +- .../defaulted-never-note.fallback.stderr | 6 +- src/test/ui/never_type/defaulted-never-note.rs | 1 + .../diverging-fallback-no-leak.fallback.stderr | 6 +- .../fallback-closure-wrap.fallback.stderr | 2 +- src/test/ui/never_type/fallback-closure-wrap.rs | 4 +- .../feature-gate-never_type_fallback.stderr | 8 +- ...er-value-fallback-issue-66757.nofallback.stderr | 6 +- .../escape-argument-callee.stderr | 10 +- .../closure-requirements/escape-argument.stderr | 10 +- .../escape-upvar-nested.stderr | 10 +- .../closure-requirements/escape-upvar-ref.stderr | 10 +- .../propagate-approximated-fail-no-postdom.stderr | 10 +- .../propagate-approximated-ref.stderr | 10 +- ...shorter-to-static-comparing-against-free.stderr | 20 +- ...-approximated-shorter-to-static-no-bound.stderr | 12 +- ...proximated-shorter-to-static-wrong-bound.stderr | 12 +- .../propagate-approximated-val.stderr | 10 +- .../propagate-despite-same-free-region.stderr | 10 +- ...ate-fail-to-approximate-longer-no-bounds.stderr | 10 +- ...-fail-to-approximate-longer-wrong-bounds.stderr | 10 +- .../propagate-from-trait-match.stderr | 6 +- .../return-wrong-bound-region.stderr | 7 +- .../ui/nll/issue-21232-partial-init-and-use.rs | 2 +- src/test/ui/nll/issue-51244.stderr | 2 +- .../ui/nll/local-outlives-static-via-hrtb.stderr | 12 + src/test/ui/nll/normalization-bounds-error.stderr | 8 +- src/test/ui/nll/polonius/assignment-kills-loans.rs | 2 +- .../relate_tys/impl-fn-ignore-binder-via-bottom.rs | 1 + .../impl-fn-ignore-binder-via-bottom.stderr | 11 +- .../projection-no-regions-closure.stderr | 22 +- .../projection-one-region-closure.stderr | 22 +- ...rojection-one-region-trait-bound-closure.stderr | 27 +- ...on-one-region-trait-bound-static-closure.stderr | 26 +- ...rojection-two-region-trait-bound-closure.stderr | 43 +- ...ty-param-closure-approximate-lower-bound.stderr | 14 +- ...-param-closure-outlives-from-return-type.stderr | 6 +- ...param-closure-outlives-from-where-clause.stderr | 27 +- src/test/ui/nll/type-test-universe.stderr | 6 + .../nll/user-annotations/adt-nullary-enums.stderr | 5 +- .../user-annotations/adt-tuple-struct-calls.stderr | 10 +- src/test/ui/nll/user-annotations/fns.stderr | 6 +- .../ui/nll/user-annotations/method-call.stderr | 5 +- .../ui/nll/user-annotations/method-ufcs-3.stderr | 5 +- src/test/ui/no-send-res-ports.stderr | 17 +- src/test/ui/not-clone-closure.stderr | 6 +- src/test/ui/not-enough-arguments.stderr | 4 +- src/test/ui/not-panic/not-panic-safe-2.stderr | 12 +- src/test/ui/not-panic/not-panic-safe-3.stderr | 12 +- src/test/ui/not-panic/not-panic-safe-4.stderr | 12 +- src/test/ui/not-panic/not-panic-safe-5.stderr | 6 +- src/test/ui/not-panic/not-panic-safe-6.stderr | 12 +- .../ui/object-lifetime/object-lifetime-default.rs | 44 +- .../object-lifetime/object-lifetime-default.stderr | 60 ++- src/test/ui/object-safety/issue-19538.stderr | 2 +- .../object-safety-associated-consts.curr.stderr | 4 +- ...sociated-consts.object_safe_for_dispatch.stderr | 2 +- .../ui/object-safety/object-safety-bounds.stderr | 4 +- .../object-safety-generics.curr.stderr | 8 +- ...safety-generics.object_safe_for_dispatch.stderr | 4 +- .../object-safety-mentions-Self.curr.stderr | 8 +- ...y-mentions-Self.object_safe_for_dispatch.stderr | 4 +- .../object-safety-no-static.curr.stderr | 4 +- ...afety-no-static.object_safe_for_dispatch.stderr | 2 +- .../object-safety-sized-2.curr.stderr | 4 +- ...-safety-sized-2.object_safe_for_dispatch.stderr | 2 +- .../object-safety/object-safety-sized.curr.stderr | 4 +- ...ct-safety-sized.object_safe_for_dispatch.stderr | 2 +- src/test/ui/on-unimplemented/enclosing-scope.rs | 27 - .../ui/on-unimplemented/enclosing-scope.stderr | 86 ---- src/test/ui/on-unimplemented/multiple-impls.rs | 3 + src/test/ui/on-unimplemented/multiple-impls.stderr | 51 +- src/test/ui/on-unimplemented/on-impl.rs | 1 + src/test/ui/on-unimplemented/on-impl.stderr | 15 +- src/test/ui/on-unimplemented/parent-label.rs | 27 + src/test/ui/on-unimplemented/parent-label.stderr | 69 +++ src/test/ui/on-unimplemented/slice-index.stderr | 4 +- src/test/ui/or-patterns/inner-or-pat.or3.stderr | 11 + src/test/ui/or-patterns/inner-or-pat.or4.stderr | 11 + src/test/ui/or-patterns/inner-or-pat.rs | 73 +++ .../ui/or-patterns/or-patterns-syntactic-pass.rs | 16 +- .../or-patterns/or-patterns-syntactic-pass.stderr | 13 + src/test/ui/parser/bad-interpolated-block.rs | 2 - src/test/ui/parser/bad-interpolated-block.stderr | 6 +- ...nstraints-before-generic-args-syntactic-pass.rs | 4 + ...aints-before-generic-args-syntactic-pass.stderr | 24 + .../do-not-suggest-semicolon-before-array.rs | 8 + .../do-not-suggest-semicolon-before-array.stderr | 10 + ...een-macro-without-exclamation-mark-and-array.rs | 3 + ...macro-without-exclamation-mark-and-array.stderr | 8 + src/test/ui/parser/fn-defined-using-def.rs | 10 + src/test/ui/parser/fn-defined-using-def.stderr | 10 + src/test/ui/parser/fn-defined-using-fun.rs | 10 + src/test/ui/parser/fn-defined-using-fun.stderr | 10 + src/test/ui/parser/fn-defined-using-func.rs | 10 + src/test/ui/parser/fn-defined-using-func.stderr | 10 + src/test/ui/parser/fn-defined-using-function.rs | 10 + .../ui/parser/fn-defined-using-function.stderr | 10 + src/test/ui/parser/fn-header-semantic-fail.rs | 2 - src/test/ui/parser/fn-header-semantic-fail.stderr | 184 +++---- .../parser/impl-item-type-no-body-semantic-fail.rs | 2 - .../impl-item-type-no-body-semantic-fail.stderr | 20 +- src/test/ui/parser/increment-notfixed.stderr | 30 +- src/test/ui/parser/issue-100197-mut-let.fixed | 6 + src/test/ui/parser/issue-100197-mut-let.rs | 6 + src/test/ui/parser/issue-100197-mut-let.stderr | 8 + src/test/ui/parser/issue-101477-enum.fixed | 10 + src/test/ui/parser/issue-101477-enum.rs | 10 + src/test/ui/parser/issue-101477-enum.stderr | 14 + src/test/ui/parser/issue-101477-let.fixed | 6 + src/test/ui/parser/issue-101477-let.rs | 6 + src/test/ui/parser/issue-101477-let.stderr | 8 + .../issue-99910-const-let-mutually-exclusive.fixed | 8 + .../issue-99910-const-let-mutually-exclusive.rs | 8 + ...issue-99910-const-let-mutually-exclusive.stderr | 14 + src/test/ui/parser/issues/issue-14303-enum.rs | 6 - src/test/ui/parser/issues/issue-14303-enum.stderr | 8 - src/test/ui/parser/issues/issue-14303-fn-def.rs | 4 - .../ui/parser/issues/issue-14303-fn-def.stderr | 8 - src/test/ui/parser/issues/issue-14303-impl.rs | 6 - src/test/ui/parser/issues/issue-14303-impl.stderr | 8 - src/test/ui/parser/issues/issue-14303-path.rs | 13 - src/test/ui/parser/issues/issue-14303-path.stderr | 9 - src/test/ui/parser/issues/issue-14303-struct.rs | 6 - .../ui/parser/issues/issue-14303-struct.stderr | 8 - src/test/ui/parser/issues/issue-14303-trait.rs | 4 - src/test/ui/parser/issues/issue-14303-trait.stderr | 8 - src/test/ui/parser/issues/issue-14303.rs | 33 ++ src/test/ui/parser/issues/issue-14303.stderr | 39 ++ ...7377-invalid-syntax-in-enum-discriminant.stderr | 4 +- src/test/ui/parser/issues/issue-89574.stderr | 4 +- .../item-free-const-no-body-semantic-fail.stderr | 4 +- .../item-free-static-no-body-semantic-fail.stderr | 8 +- src/test/ui/parser/kw-in-trait-bounds.rs | 47 ++ src/test/ui/parser/kw-in-trait-bounds.stderr | 171 +++++++ src/test/ui/parser/labeled-no-colon-expr.rs | 2 - src/test/ui/parser/labeled-no-colon-expr.stderr | 16 +- src/test/ui/parser/public-instead-of-pub-1.fixed | 11 + src/test/ui/parser/public-instead-of-pub-1.rs | 11 + src/test/ui/parser/public-instead-of-pub-1.stderr | 13 + src/test/ui/parser/public-instead-of-pub-2.rs | 7 + src/test/ui/parser/public-instead-of-pub-2.stderr | 8 + src/test/ui/parser/public-instead-of-pub-3.fixed | 9 + src/test/ui/parser/public-instead-of-pub-3.rs | 9 + src/test/ui/parser/public-instead-of-pub-3.stderr | 13 + src/test/ui/parser/recover-field-semi.rs | 16 + src/test/ui/parser/recover-field-semi.stderr | 29 ++ .../ui/parser/recover-labeled-non-block-expr.fixed | 1 - .../ui/parser/recover-labeled-non-block-expr.rs | 1 - .../parser/recover-labeled-non-block-expr.stderr | 12 +- .../parser/recover-missing-semi-before-item.fixed | 61 +++ .../ui/parser/recover-missing-semi-before-item.rs | 61 +++ .../parser/recover-missing-semi-before-item.stderr | 83 ++++ .../ui/parser/removed-syntax-field-semicolon.rs | 2 +- .../parser/removed-syntax-field-semicolon.stderr | 4 +- src/test/ui/parser/removed-syntax-static-fn.stderr | 4 +- src/test/ui/parser/struct-filed-with-attr.fixed | 18 + src/test/ui/parser/struct-filed-with-attr.rs | 18 + src/test/ui/parser/struct-filed-with-attr.stderr | 8 + src/test/ui/parser/struct-literal-in-for.stderr | 2 +- src/test/ui/parser/suggest-assoc-const.fixed | 10 + src/test/ui/parser/suggest-assoc-const.rs | 10 + src/test/ui/parser/suggest-assoc-const.stderr | 8 + src/test/ui/parser/suggest-const-for-global-var.rs | 6 + .../ui/parser/suggest-const-for-global-var.stderr | 8 + ...removing-semicolon-after-impl-trait-items.fixed | 7 + ...st-removing-semicolon-after-impl-trait-items.rs | 7 + ...emoving-semicolon-after-impl-trait-items.stderr | 15 + .../ui/parser/suggest-semicolon-before-array.fixed | 11 + .../ui/parser/suggest-semicolon-before-array.rs | 11 + .../parser/suggest-semicolon-before-array.stderr | 13 + src/test/ui/parser/trait-object-delimiters.rs | 2 +- src/test/ui/parser/trait-object-delimiters.stderr | 4 +- .../ui/parser/trait-object-trait-parens.stderr | 15 +- src/test/ui/parser/type-alias-where-fixable.fixed | 2 - src/test/ui/parser/type-alias-where-fixable.rs | 2 - src/test/ui/parser/type-alias-where-fixable.stderr | 6 +- src/test/ui/parser/type-alias-where.rs | 2 - src/test/ui/parser/type-alias-where.stderr | 4 +- src/test/ui/parser/unnecessary-let.rs | 11 + src/test/ui/parser/unnecessary-let.stderr | 20 + ...ther-can-live-while-the-other-survives-1.stderr | 10 +- .../bind-by-move-no-subbindings-fun-param.stderr | 5 +- .../borrowck-move-and-move.stderr | 37 +- .../borrowck-pat-at-and-box.stderr | 30 +- .../borrowck-pat-by-move-and-ref-inverse.stderr | 40 +- .../borrowck-pat-by-move-and-ref.stderr | 52 +- .../borrowck-pat-ref-mut-and-ref.stderr | 45 +- .../borrowck-pat-ref-mut-twice.stderr | 35 +- .../bindings-after-at/copy-and-move-mixed.stderr | 5 +- ...ult-binding-modes-both-sides-independent.stderr | 2 +- .../nested-binding-modes-mut.stderr | 2 +- .../borrowck-move-ref-pattern.stderr | 6 +- .../move-ref-patterns-closure-captures.stderr | 30 +- .../ui/pattern/rest-pat-semantic-disallowed.rs | 2 +- src/test/ui/pattern/rest-pat-syntactic.rs | 5 +- src/test/ui/pattern/rest-pat-syntactic.stderr | 24 + ...priate-missing-pattern-excluding-comments.fixed | 10 + ...propriate-missing-pattern-excluding-comments.rs | 9 + ...riate-missing-pattern-excluding-comments.stderr | 24 + .../usefulness/doc-hidden-non-exhaustive.rs | 8 +- .../usefulness/doc-hidden-non-exhaustive.stderr | 24 +- .../empty-match.exhaustive_patterns.stderr | 28 +- .../pattern/usefulness/empty-match.normal.stderr | 28 +- src/test/ui/pattern/usefulness/empty-match.rs | 12 +- src/test/ui/pattern/usefulness/issue-15129.rs | 2 +- src/test/ui/pattern/usefulness/issue-15129.stderr | 6 +- src/test/ui/pattern/usefulness/issue-31561.rs | 2 +- src/test/ui/pattern/usefulness/issue-31561.stderr | 6 +- src/test/ui/pattern/usefulness/issue-35609.stderr | 32 +- src/test/ui/pattern/usefulness/issue-39362.stderr | 4 +- src/test/ui/pattern/usefulness/issue-40221.stderr | 6 +- src/test/ui/pattern/usefulness/issue-50900.rs | 2 +- src/test/ui/pattern/usefulness/issue-50900.stderr | 6 +- src/test/ui/pattern/usefulness/issue-56379.rs | 2 +- src/test/ui/pattern/usefulness/issue-56379.stderr | 6 +- src/test/ui/pattern/usefulness/issue-72377.rs | 2 +- src/test/ui/pattern/usefulness/issue-72377.stderr | 4 +- .../ui/pattern/usefulness/match-arm-statics-2.rs | 4 +- .../pattern/usefulness/match-arm-statics-2.stderr | 12 +- .../usefulness/non-exhaustive-defined-here.rs | 32 +- .../usefulness/non-exhaustive-defined-here.stderr | 42 +- .../usefulness/non-exhaustive-match-nested.rs | 2 +- .../usefulness/non-exhaustive-match-nested.stderr | 6 +- .../ui/pattern/usefulness/non-exhaustive-match.rs | 6 +- .../pattern/usefulness/non-exhaustive-match.stderr | 20 +- .../usefulness/non-exhaustive-pattern-witness.rs | 10 +- .../non-exhaustive-pattern-witness.stderr | 28 +- .../ui/pattern/usefulness/stable-gated-patterns.rs | 2 +- .../usefulness/stable-gated-patterns.stderr | 6 +- .../struct-like-enum-nonexhaustive.stderr | 6 +- .../ui/pattern/usefulness/top-level-alternation.rs | 2 - .../usefulness/top-level-alternation.stderr | 24 +- .../pattern/usefulness/unstable-gated-patterns.rs | 2 +- .../usefulness/unstable-gated-patterns.stderr | 6 +- src/test/ui/phantom-auto-trait.stderr | 4 +- src/test/ui/privacy/access_levels.rs | 49 ++ src/test/ui/privacy/access_levels.stderr | 125 +++++ src/test/ui/proc-macro/auxiliary/expand-expr.rs | 23 +- src/test/ui/proc-macro/auxiliary/re-export.rs | 19 + src/test/ui/proc-macro/crt-static.rs | 2 +- .../ui/proc-macro/dollar-crate-issue-101211.rs | 29 ++ src/test/ui/proc-macro/expand-to-unstable-2.rs | 17 - src/test/ui/proc-macro/expand-to-unstable-2.stderr | 10 - src/test/ui/proc-macro/inner-attrs.rs | 1 + src/test/ui/proc-macro/inner-attrs.stderr | 8 +- src/test/ui/proc-macro/inner-attrs.stdout | 356 ++++++------- src/test/ui/proc-macro/invalid-punct-ident-1.rs | 1 + .../ui/proc-macro/invalid-punct-ident-1.stderr | 2 +- src/test/ui/proc-macro/invalid-punct-ident-2.rs | 1 + .../ui/proc-macro/invalid-punct-ident-2.stderr | 2 +- src/test/ui/proc-macro/invalid-punct-ident-3.rs | 1 + .../ui/proc-macro/invalid-punct-ident-3.stderr | 2 +- src/test/ui/proc-macro/invalid-punct-ident-4.rs | 1 + .../ui/proc-macro/invalid-punct-ident-4.stderr | 6 +- src/test/ui/proc-macro/issue-36935.rs | 1 + src/test/ui/proc-macro/issue-36935.stderr | 4 +- src/test/ui/proc-macro/issue-41211.rs | 16 - src/test/ui/proc-macro/issue-41211.stderr | 22 - .../issue-76270-panic-in-libproc-macro.rs | 1 + .../issue-76270-panic-in-libproc-macro.stderr | 2 +- src/test/ui/proc-macro/issue-79148.rs | 10 + src/test/ui/proc-macro/issue-79148.stderr | 16 + src/test/ui/proc-macro/load-panic-backtrace.rs | 1 + src/test/ui/proc-macro/load-panic-backtrace.stderr | 2 +- src/test/ui/proc-macro/load-panic.rs | 1 + src/test/ui/proc-macro/load-panic.stderr | 2 +- src/test/ui/proc-macro/signature.stderr | 7 +- src/test/ui/process/core-run-destroy.rs | 1 + src/test/ui/process/process-envs.rs | 1 + src/test/ui/process/process-remove-from-env.rs | 1 + src/test/ui/process/process-sigpipe.rs | 1 + src/test/ui/ptr_ops/issue-80309-safe.rs | 1 - src/test/ui/ptr_ops/issue-80309.rs | 1 - src/test/ui/range/range-1.stderr | 6 +- src/test/ui/recursion/issue-83150.stderr | 6 +- src/test/ui/recursion/issue-95134.rs | 28 ++ src/test/ui/recursion/issue-95134.stderr | 7 + .../recursive-types-are-not-uninhabited.stderr | 2 +- .../do-not-suggest-adding-bound-to-opaque-type.rs | 12 + ...-not-suggest-adding-bound-to-opaque-type.stderr | 14 + ...sue-56537-closure-uses-region-from-container.rs | 2 +- src/test/ui/regions/outlives-with-missing.rs | 16 + src/test/ui/regions/outlives-with-missing.stderr | 12 + .../regions-implied-bounds-projection-gap-hr-1.rs | 3 +- ...gions-implied-bounds-projection-gap-hr-1.stderr | 17 +- src/test/ui/reify-intrinsic.stderr | 3 + src/test/ui/repr/invalid_repr_list_help.rs | 17 + src/test/ui/repr/invalid_repr_list_help.stderr | 35 ++ src/test/ui/resolve/bad-type-env-capture.stderr | 6 +- src/test/ui/resolve/issue-100365.rs | 50 ++ src/test/ui/resolve/issue-100365.stderr | 54 ++ src/test/ui/resolve/issue-22692.rs | 59 ++- src/test/ui/resolve/issue-22692.stderr | 85 +++- src/test/ui/resolve/issue-3021-c.stderr | 16 +- .../issue-70736-async-fn-no-body-def-collector.rs | 1 - ...sue-70736-async-fn-no-body-def-collector.stderr | 43 +- src/test/ui/resolve/issue-73427.rs | 6 + src/test/ui/resolve/issue-73427.stderr | 44 +- ...int-at-type-parameter-shadowing-another-type.rs | 21 + ...at-type-parameter-shadowing-another-type.stderr | 12 + src/test/ui/resolve/privacy-enum-ctor.stderr | 22 +- .../resolve-inconsistent-binding-mode.stderr | 8 + src/test/ui/resolve/resolve-inconsistent-names.rs | 1 + .../ui/resolve/resolve-inconsistent-names.stderr | 9 +- .../ui/resolve/resolve-primitive-fallback.stderr | 2 +- .../resolve-type-param-in-item-in-trait.stderr | 18 +- .../resolve/suggest-path-for-tuple-struct.stderr | 8 +- .../suggest-path-instead-of-mod-dot-item.rs | 52 ++ .../suggest-path-instead-of-mod-dot-item.stderr | 82 ++- .../termination-trait-test-wrong-type.stderr | 2 +- .../ui/rfc-2008-non-exhaustive/enum-as-cast.rs | 8 +- .../ui/rfc-2008-non-exhaustive/enum-as-cast.stderr | 11 + .../enum_same_crate_empty_match.rs | 4 +- .../enum_same_crate_empty_match.stderr | 12 +- .../omitted-patterns.stderr | 16 +- .../stable-omitted-patterns.stderr | 2 +- .../uninhabited/match.stderr | 6 +- .../uninhabited/match_same_crate.stderr | 6 +- .../match_with_exhaustive_patterns.stderr | 6 +- .../disallowed-positions.stderr | 48 +- ...t-let-else-does-not-interact-with-let-chains.rs | 2 +- .../ui/rfc-2565-param-attrs/param-attrs-cfg.stderr | 42 +- .../import-name-type-invalid-format.rs | 9 + .../import-name-type-invalid-format.stderr | 8 + .../import-name-type-multiple.rs | 10 + .../import-name-type-multiple.stderr | 8 + .../import-name-type-unknown-value.rs | 9 + .../import-name-type-unknown-value.stderr | 8 + .../import-name-type-unsupported-link-kind.rs | 17 + .../import-name-type-unsupported-link-kind.stderr | 14 + .../import-name-type-x86-only.rs | 7 + .../import-name-type-x86-only.stderr | 8 + .../ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs | 7 +- .../link-ordinal-and-name.stderr | 19 +- .../link-ordinal-invalid-format.rs | 6 +- .../link-ordinal-invalid-format.stderr | 15 +- .../link-ordinal-missing-argument.rs | 6 +- .../link-ordinal-missing-argument.stderr | 15 +- .../ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs | 6 +- .../link-ordinal-multiple.stderr | 21 +- .../link-ordinal-not-foreign-fn.rs | 24 + .../link-ordinal-not-foreign-fn.stderr | 20 + .../rfc-2627-raw-dylib/link-ordinal-too-large.rs | 6 +- .../link-ordinal-too-large.stderr | 15 +- .../link-ordinal-too-many-arguments.rs | 6 +- .../link-ordinal-too-many-arguments.stderr | 15 +- .../link-ordinal-unsupported-link-kind.rs | 17 + .../link-ordinal-unsupported-link-kind.stderr | 14 + .../ui/rfc-2627-raw-dylib/multiple-declarations.rs | 1 - .../multiple-declarations.stderr | 13 +- .../rfc-2627-raw-dylib/raw-dylib-windows-only.rs | 3 +- .../raw-dylib-windows-only.stderr | 13 +- src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs | 2 - .../ui/rfc-2627-raw-dylib/unsupported-abi.stderr | 2 +- .../const-default-method-bodies.stderr | 10 +- .../const-drop-fail.precise.stderr | 8 +- .../const-drop-fail.stock.stderr | 8 +- .../cross-crate.gatednc.stderr | 10 +- .../cross-crate.stocknc.stderr | 10 +- ...fault-method-body-is-const-same-trait-ck.stderr | 10 +- .../ui/rfc-2632-const-trait-impl/issue-100222.rs | 29 ++ .../trait-where-clause.stderr | 12 +- .../ui/rfc-2632-const-trait-impl/without-tilde.rs | 2 +- .../rfc-2632-const-trait-impl/without-tilde.stderr | 6 +- .../rfc-2396-target_feature-11/fn-traits.stderr | 12 +- .../rust-2021/reserved-prefixes-migration.stderr | 25 +- src/test/ui/rust-2021/reserved-prefixes.stderr | 45 +- src/test/ui/sanitize/memory-eager.rs | 38 ++ src/test/ui/sanitize/memory.rs | 14 +- ...rbitrary-self-types-not-object-safe.curr.stderr | 2 +- ...not-object-safe.object_safe_for_dispatch.stderr | 2 +- src/test/ui/simd/intrinsic/ptr-cast.rs | 33 ++ ...ust-2021-incompatible-closure-captures-93117.rs | 5 +- ...2021-incompatible-closure-captures-93117.stderr | 46 +- src/test/ui/span/issue-34264.stderr | 6 +- src/test/ui/span/issue-35987.stderr | 4 +- src/test/ui/span/issue-36530.rs | 12 - src/test/ui/span/issue-36530.stderr | 12 - src/test/ui/span/lint-unused-unsafe-thir.rs | 4 +- src/test/ui/span/lint-unused-unsafe-thir.stderr | 18 +- src/test/ui/span/lint-unused-unsafe.mir.stderr | 548 +++------------------ src/test/ui/span/lint-unused-unsafe.rs | 74 +-- src/test/ui/span/missing-unit-argument.stderr | 16 +- .../default-generic-associated-type-bound.rs | 3 +- .../default-generic-associated-type-bound.stderr | 6 +- src/test/ui/specialization/issue-33017.rs | 2 +- src/test/ui/specialization/issue-38091-2.stderr | 2 +- src/test/ui/specialization/issue-39448.stderr | 4 +- src/test/ui/specialization/issue-45814.stderr | 4 +- .../min_specialization/issue-79224.stderr | 22 +- .../auxiliary/ctor-stability.rs | 8 + .../stability-attribute/auxiliary/default_body.rs | 29 ++ src/test/ui/stability-attribute/ctor-stability.rs | 8 + .../default-body-stability-err.rs | 19 + .../default-body-stability-err.stderr | 38 ++ .../default-body-stability-ok-enables.rs | 18 + .../default-body-stability-ok-impls.rs | 21 + .../static/static-vec-repeat-not-constant.stderr | 1 + src/test/ui/stats/hir-stats.rs | 42 ++ src/test/ui/stats/hir-stats.stderr | 178 +++++++ src/test/ui/std-backtrace.rs | 2 - src/test/ui/str/str-idx.stderr | 4 +- src/test/ui/str/str-mut-idx.stderr | 4 +- src/test/ui/structs-enums/align-struct.rs | 5 +- src/test/ui/structs-enums/type-sizes.rs | 79 +++ src/test/ui/structs/struct-record-suggestion.fixed | 24 +- src/test/ui/structs/struct-record-suggestion.rs | 24 +- .../ui/structs/struct-record-suggestion.stderr | 23 +- .../args-instead-of-tuple-errors.stderr | 24 +- .../ui/suggestions/args-instead-of-tuple.stderr | 2 +- src/test/ui/suggestions/as-ref-2.fixed | 13 - src/test/ui/suggestions/as-ref-2.rs | 2 - src/test/ui/suggestions/as-ref-2.stderr | 10 +- src/test/ui/suggestions/as-ref.rs | 7 + src/test/ui/suggestions/as-ref.stderr | 62 ++- .../ui/suggestions/assoc-const-as-field.stderr | 4 +- ...-as-arg-where-it-should-have-been-called.stderr | 4 +- src/test/ui/suggestions/bool_typo_err_suggest.rs | 12 + .../ui/suggestions/bool_typo_err_suggest.stderr | 25 + src/test/ui/suggestions/call-boxed.rs | 7 + src/test/ui/suggestions/call-boxed.stderr | 20 + src/test/ui/suggestions/call-on-missing.rs | 39 ++ src/test/ui/suggestions/call-on-missing.stderr | 75 +++ src/test/ui/suggestions/const-no-type.rs | 14 +- src/test/ui/suggestions/const-no-type.stderr | 28 +- src/test/ui/suggestions/copied-and-cloned.fixed | 23 + src/test/ui/suggestions/copied-and-cloned.rs | 23 + src/test/ui/suggestions/copied-and-cloned.stderr | 83 ++++ src/test/ui/suggestions/deref-path-method.rs | 6 + src/test/ui/suggestions/deref-path-method.stderr | 14 + src/test/ui/suggestions/derive-clone-for-eq.stderr | 2 +- .../suggestions/derive-macro-missing-bounds.stderr | 16 +- .../dont-suggest-pin-array-dot-set.stderr | 2 +- .../ui/suggestions/dont-try-removing-the-field.rs | 17 + .../suggestions/dont-try-removing-the-field.stderr | 10 + .../expected-boxed-future-isnt-pinned.stderr | 14 +- .../field-access-considering-privacy.rs | 35 ++ .../field-access-considering-privacy.stderr | 14 + ...-as-arg-where-it-should-have-been-called.stderr | 4 +- .../fn-or-tuple-struct-without-args.stderr | 60 +-- ...m-ref-trait-object-literal-bound-regions.stderr | 6 +- .../imm-ref-trait-object-literal.stderr | 2 +- src/test/ui/suggestions/into-str.stderr | 2 +- src/test/ui/suggestions/issue-101421.rs | 12 + src/test/ui/suggestions/issue-101421.stderr | 17 + src/test/ui/suggestions/issue-101465.rs | 25 + src/test/ui/suggestions/issue-101465.stderr | 25 + src/test/ui/suggestions/issue-101984.rs | 27 + src/test/ui/suggestions/issue-101984.stderr | 14 + src/test/ui/suggestions/issue-61963.stderr | 35 +- src/test/ui/suggestions/issue-62843.stderr | 4 +- .../ui/suggestions/issue-71394-no-from-impl.stderr | 8 +- src/test/ui/suggestions/issue-84973-2.stderr | 2 +- .../ui/suggestions/issue-84973-blacklist.stderr | 6 +- .../ui/suggestions/issue-84973-negative.stderr | 2 +- src/test/ui/suggestions/issue-84973.stderr | 2 +- src/test/ui/suggestions/issue-85347.rs | 3 +- src/test/ui/suggestions/issue-85347.stderr | 15 +- src/test/ui/suggestions/issue-89064.rs | 35 ++ src/test/ui/suggestions/issue-89064.stderr | 82 +++ src/test/ui/suggestions/issue-96223.stderr | 4 +- src/test/ui/suggestions/issue-96555.stderr | 6 +- src/test/ui/suggestions/issue-97677.fixed | 2 +- src/test/ui/suggestions/issue-97677.stderr | 4 +- .../missing-lifetimes-in-signature-2.stderr | 4 +- .../missing-lifetimes-in-signature.stderr | 18 +- src/test/ui/suggestions/many-type-ascription.rs | 4 + .../ui/suggestions/many-type-ascription.stderr | 12 + .../move-generic-to-trait-in-method-with-params.rs | 18 + ...e-generic-to-trait-in-method-with-params.stderr | 24 + src/test/ui/suggestions/option-content-move.fixed | 39 -- src/test/ui/suggestions/option-content-move.rs | 2 - src/test/ui/suggestions/option-content-move.stderr | 14 +- src/test/ui/suggestions/restrict-type-not-param.rs | 12 + .../ui/suggestions/restrict-type-not-param.stderr | 26 + src/test/ui/suggestions/return-closures.rs | 13 + src/test/ui/suggestions/return-closures.stderr | 27 + src/test/ui/suggestions/return-cycle-2.rs | 14 + src/test/ui/suggestions/return-cycle-2.stderr | 12 + src/test/ui/suggestions/return-cycle.rs | 14 + src/test/ui/suggestions/return-cycle.stderr | 12 + src/test/ui/suggestions/slice-issue-87994.stderr | 16 +- .../sugg_with_positional_args_and_debug_fmt.rs | 10 + .../sugg_with_positional_args_and_debug_fmt.stderr | 21 + ...gest-adding-reference-to-trait-assoc-item.fixed | 15 + ...suggest-adding-reference-to-trait-assoc-item.rs | 15 + ...est-adding-reference-to-trait-assoc-item.stderr | 25 + .../suggest-blanket-impl-local-trait.rs | 2 +- .../suggest-blanket-impl-local-trait.stderr | 35 +- .../suggest-borrow-to-dyn-object.stderr | 4 +- .../suggestions/suggest-dereferencing-index.stderr | 2 +- .../suggest-imm-mut-trait-implementations.stderr | 6 +- src/test/ui/suggestions/suggest-methods.stderr | 8 +- .../ui/suggestions/suggest-move-lifetimes.stderr | 8 +- src/test/ui/suggestions/suggest-move-types.stderr | 4 +- src/test/ui/suggestions/suggest-ref-macro.stderr | 10 +- .../ui/suggestions/suggest-remove-refs-1.stderr | 2 +- .../ui/suggestions/suggest-remove-refs-2.stderr | 2 +- .../ui/suggestions/suggest-remove-refs-3.stderr | 2 +- ...-swapping-self-ty-and-trait-edition-2021.stderr | 5 +- .../suggest-swapping-self-ty-and-trait.stderr | 5 +- .../ui/suggestions/too-many-field-suggestions.rs | 29 ++ .../suggestions/too-many-field-suggestions.stderr | 44 ++ src/test/ui/suggestions/try-removing-the-field.rs | 17 + .../ui/suggestions/try-removing-the-field.stderr | 12 + .../suggestions/type-ascription-and-other-error.rs | 6 + .../type-ascription-and-other-error.stderr | 8 + src/test/ui/suggestions/unnamable-types.stderr | 20 +- .../use-type-argument-instead-of-assoc-type.stderr | 2 +- src/test/ui/tag-variant-disr-dup.rs | 12 - src/test/ui/tag-variant-disr-dup.stderr | 14 - src/test/ui/thir-tree.stdout | 22 +- src/test/ui/traits/alias/cross-crate.stderr | 4 +- src/test/ui/traits/alias/generic-default-in-dyn.rs | 10 + .../ui/traits/alias/generic-default-in-dyn.stderr | 39 ++ src/test/ui/traits/alias/self-in-const-generics.rs | 12 + .../ui/traits/alias/self-in-const-generics.stderr | 11 + src/test/ui/traits/alias/self-in-generics.rs | 15 + src/test/ui/traits/alias/self-in-generics.stderr | 11 + src/test/ui/traits/assoc-type-in-superbad.rs | 8 +- src/test/ui/traits/assoc-type-in-superbad.stderr | 6 +- .../check-trait-object-bounds-1.stderr | 4 +- .../check-trait-object-bounds-2.stderr | 4 +- .../check-trait-object-bounds-4.stderr | 4 +- .../check-trait-object-bounds-5.stderr | 6 +- .../check-trait-object-bounds-6.stderr | 6 +- src/test/ui/traits/bad-method-typaram-kind.stderr | 4 +- .../traits/bound/assoc-fn-bound-root-obligation.rs | 3 +- .../bound/assoc-fn-bound-root-obligation.stderr | 8 +- src/test/ui/traits/bound/not-on-bare-trait.stderr | 5 +- .../ui/traits/bound/on-structs-and-enums-locals.rs | 2 +- .../bound/on-structs-and-enums-locals.stderr | 6 +- .../ui/traits/bound/on-structs-and-enums-xc1.rs | 2 +- .../traits/bound/on-structs-and-enums-xc1.stderr | 6 +- src/test/ui/traits/cycle-cache-err-60010.stderr | 4 +- src/test/ui/traits/inductive-overflow/lifetime.rs | 2 +- .../ui/traits/inductive-overflow/lifetime.stderr | 4 +- .../traits/inductive-overflow/simultaneous.stderr | 2 +- .../supertrait-auto-trait.stderr | 2 +- .../ui/traits/inductive-overflow/supertrait.stderr | 2 +- .../inheritance/repeated-supertrait-ambig.stderr | 30 +- src/test/ui/traits/issue-18400.stderr | 4 +- src/test/ui/traits/issue-20692.stderr | 2 +- src/test/ui/traits/issue-38604.stderr | 2 +- src/test/ui/traits/issue-71036.rs | 2 +- src/test/ui/traits/issue-71036.stderr | 2 +- src/test/ui/traits/issue-71136.stderr | 2 +- src/test/ui/traits/issue-77982.stderr | 8 +- src/test/ui/traits/issue-82830.stderr | 2 +- src/test/ui/traits/issue-91594.stderr | 6 +- .../traits/issue-91949-hangs-on-recursion.stderr | 4 +- src/test/ui/traits/issue-97576.stderr | 8 +- src/test/ui/traits/multidispatch-bad.stderr | 2 +- .../traits/multidispatch-convert-ambig-dest.stderr | 10 +- .../explicitly-unimplemented-error-message.rs | 2 +- .../negated-auto-traits-error.stderr | 8 +- ...uggest-non-existing-fully-qualified-path.stderr | 2 +- .../object/enforce-supertrait-projection.stderr | 4 +- src/test/ui/traits/object/safety.stderr | 2 +- .../traits/pointee-tail-is-generic-errors.stderr | 8 +- .../ui/traits/resolution-in-overloaded-op.stderr | 4 +- .../traits/suggest-deferences/issue-39029.stderr | 12 +- .../traits/suggest-deferences/issue-62530.stderr | 10 +- .../ui/traits/suggest-deferences/multiple-0.stderr | 10 +- .../suggest-deferences/root-obligation.stderr | 4 +- src/test/ui/traits/suggest-where-clause.stderr | 4 +- src/test/ui/traits/test-2.stderr | 2 +- .../traits/trait-upcasting/subtrait-method.stderr | 10 +- .../ui/traits/unspecified-self-in-trait-ref.rs | 30 ++ .../ui/traits/unspecified-self-in-trait-ref.stderr | 105 ++++ .../abstraction/abstracted_assume.rs | 27 +- .../abstraction/const_generic_fn.rs | 6 +- .../arrays/should_have_correct_length.rs | 4 +- .../arrays/should_inherit_alignment.rs | 9 +- .../arrays/should_require_well_defined_layout.rs | 9 +- .../should_require_well_defined_layout.stderr | 120 +++-- .../primitive_reprs_should_have_correct_length.rs | 11 +- ...imitive_reprs_should_have_correct_length.stderr | 420 ++++++++++------ .../repr/should_require_well_defined_layout.rs | 11 +- .../repr/should_require_well_defined_layout.stderr | 126 +++-- .../enums/should_order_correctly.rs | 9 +- .../transmutability/enums/should_pad_variants.rs | 9 +- .../enums/should_pad_variants.stderr | 20 +- .../enums/should_respect_endianness.rs | 9 +- .../enums/should_respect_endianness.stderr | 20 +- .../malformed-program-gracefulness/unknown_dst.rs | 2 +- .../malformed-program-gracefulness/unknown_src.rs | 2 +- .../unknown_src_field.rs | 2 +- .../wrong-type-assume.rs | 29 +- .../wrong-type-assume.stderr | 37 +- src/test/ui/transmutability/primitives/bool.rs | 6 +- src/test/ui/transmutability/primitives/bool.stderr | 6 +- src/test/ui/transmutability/primitives/numbers.rs | 2 +- .../ui/transmutability/primitives/numbers.stderr | 342 ++++++------- src/test/ui/transmutability/primitives/unit.rs | 9 +- src/test/ui/transmutability/primitives/unit.stderr | 20 +- src/test/ui/transmutability/references.rs | 11 +- src/test/ui/transmutability/references.stderr | 23 +- .../structs/repr/should_handle_align.rs | 11 +- .../structs/repr/should_handle_packed.rs | 11 +- .../repr/should_require_well_defined_layout.rs | 11 +- .../repr/should_require_well_defined_layout.stderr | 252 ++++++---- .../structs/should_order_fields_correctly.rs | 9 +- src/test/ui/transmutability/unions/boolish.rs | 4 +- .../unions/repr/should_handle_align.rs | 11 +- .../unions/repr/should_handle_packed.rs | 11 +- .../repr/should_require_well_defined_layout.rs | 11 +- .../repr/should_require_well_defined_layout.stderr | 42 +- .../transmutability/unions/should_pad_variants.rs | 9 +- .../unions/should_pad_variants.stderr | 20 +- ...d_permit_intersecting_if_validity_is_assumed.rs | 5 +- .../unions/should_reject_contraction.rs | 4 +- .../unions/should_reject_contraction.stderr | 6 +- .../unions/should_reject_disjoint.rs | 5 +- .../unions/should_reject_disjoint.stderr | 16 +- .../unions/should_reject_intersecting.rs | 6 +- .../unions/should_reject_intersecting.stderr | 12 +- .../should_accept_if_dst_has_private_field.rs | 6 +- .../should_accept_if_dst_has_private_variant.rs | 6 +- ...d_accept_if_dst_has_tricky_unreachable_field.rs | 6 +- .../should_accept_if_dst_has_unreachable_field.rs | 6 +- .../should_accept_if_dst_has_unreachable_ty.rs | 6 +- .../should_accept_if_src_has_private_field.rs | 3 +- .../should_accept_if_src_has_private_variant.rs | 3 +- .../should_accept_if_src_has_unreachable_field.rs | 3 +- ...ould_accept_if_src_has_unreachable_field.stderr | 2 +- .../should_accept_if_src_has_unreachable_ty.rs | 3 +- .../should_accept_if_src_has_unreachable_ty.stderr | 4 +- .../should_reject_if_dst_has_private_field.rs | 3 +- .../should_reject_if_dst_has_private_field.stderr | 8 +- .../should_reject_if_dst_has_private_variant.rs | 3 +- ...should_reject_if_dst_has_private_variant.stderr | 8 +- ...d_reject_if_dst_has_tricky_unreachable_field.rs | 3 +- .../should_reject_if_dst_has_unreachable_field.rs | 3 +- ...ould_reject_if_dst_has_unreachable_field.stderr | 8 +- .../should_reject_if_dst_has_unreachable_ty.rs | 3 +- .../should_reject_if_dst_has_unreachable_ty.stderr | 12 +- src/test/ui/try-block/try-block-bad-type.stderr | 2 +- src/test/ui/try-trait/bad-interconversion.stderr | 75 ++- src/test/ui/try-trait/option-to-result.stderr | 24 +- .../ui/try-trait/try-on-option-diagnostics.stderr | 47 +- src/test/ui/try-trait/try-on-option.stderr | 24 +- src/test/ui/try-trait/try-operator-on-main.stderr | 30 +- .../ui/tuple/add-tuple-within-arguments.stderr | 4 +- src/test/ui/tuple/builtin-fail.rs | 19 + src/test/ui/tuple/builtin-fail.stderr | 55 +++ src/test/ui/tuple/builtin.rs | 20 + src/test/ui/tuple/wrong_argument_ice-3.stderr | 11 +- src/test/ui/tuple/wrong_argument_ice-4.stderr | 2 +- ...iant-priority-higher-than-other-inherent.stderr | 2 +- src/test/ui/type-alias-impl-trait/closure_args.rs | 16 + src/test/ui/type-alias-impl-trait/closure_args2.rs | 23 + .../ui/type-alias-impl-trait/constrain_inputs.rs | 24 +- .../type-alias-impl-trait/constrain_inputs.stderr | 58 +++ .../constrain_inputs_unsound.rs | 31 ++ .../constrain_inputs_unsound.stderr | 9 + .../generic_duplicate_param_use5.stderr | 8 +- .../generic_duplicate_param_use6.stderr | 6 +- .../generic_duplicate_param_use8.stderr | 4 +- .../generic_duplicate_param_use9.stderr | 8 +- src/test/ui/type-alias-impl-trait/issue-57961.rs | 2 +- .../ui/type-alias-impl-trait/issue-57961.stderr | 2 +- .../ui/type-alias-impl-trait/issue-60371.stderr | 2 +- .../ui/type-alias-impl-trait/issue-74280.stderr | 2 +- src/test/ui/type-alias-impl-trait/issue-90400-1.rs | 1 - .../ui/type-alias-impl-trait/issue-90400-1.stderr | 4 +- src/test/ui/type-alias-impl-trait/issue-90400-2.rs | 1 - .../ui/type-alias-impl-trait/issue-90400-2.stderr | 6 +- src/test/ui/type-alias-impl-trait/issue-98604.rs | 6 +- .../ui/type-alias-impl-trait/issue-98604.stderr | 6 +- src/test/ui/type-alias-impl-trait/issue-98608.rs | 6 +- .../ui/type-alias-impl-trait/issue-98608.stderr | 6 +- .../multiple-def-uses-in-one-fn.stderr | 2 +- .../not_a_defining_use.stderr | 4 +- .../underconstrained_generic.stderr | 2 +- src/test/ui/type/issue-100584.rs | 15 + src/test/ui/type/issue-100584.stderr | 44 ++ src/test/ui/type/type-alias-bounds.rs | 2 +- src/test/ui/type/type-arg-out-of-scope.stderr | 12 +- .../type-ascription-instead-of-initializer.stderr | 2 +- src/test/ui/type/type-check-defaults.stderr | 8 +- ...-check-fn-with-more-than-65535-arguments.stderr | 16 +- .../type/type-params-in-different-spaces-2.stderr | 12 +- src/test/ui/type_length_limit.stderr | 4 +- src/test/ui/typeck/assign-non-lval-derefmut.stderr | 4 +- src/test/ui/typeck/assign-non-lval-mut-ref.stderr | 4 +- src/test/ui/typeck/assign-non-lval-needs-deref.rs | 19 + .../ui/typeck/assign-non-lval-needs-deref.stderr | 16 + ...est-placeholder-to-const-static-without-type.rs | 8 + ...placeholder-to-const-static-without-type.stderr | 20 + src/test/ui/typeck/issue-100164.fixed | 9 + src/test/ui/typeck/issue-100164.rs | 9 + src/test/ui/typeck/issue-100164.stderr | 14 + src/test/ui/typeck/issue-100246.rs | 30 ++ src/test/ui/typeck/issue-100246.stderr | 13 + src/test/ui/typeck/issue-100285.rs | 22 + src/test/ui/typeck/issue-100285.stderr | 34 ++ src/test/ui/typeck/issue-29124.stderr | 8 +- src/test/ui/typeck/issue-79040.stderr | 4 +- .../ui/typeck/issue-87181/empty-tuple-method.rs | 2 +- .../typeck/issue-87181/empty-tuple-method.stderr | 6 +- src/test/ui/typeck/issue-87181/enum-variant.rs | 2 +- src/test/ui/typeck/issue-87181/enum-variant.stderr | 6 +- src/test/ui/typeck/issue-87181/tuple-field.stderr | 10 +- src/test/ui/typeck/issue-87181/tuple-method.stderr | 9 +- src/test/ui/typeck/issue-90101.stderr | 2 +- src/test/ui/typeck/issue-91210-ptr-method.stderr | 9 +- src/test/ui/typeck/issue-91633.rs | 8 + src/test/ui/typeck/issue-96738.stderr | 18 +- src/test/ui/typeck/issue-98982.rs | 9 + src/test/ui/typeck/issue-98982.stderr | 24 + .../ui/typeck/point-at-type-param-in-path-expr.rs | 6 + .../typeck/point-at-type-param-in-path-expr.stderr | 17 + src/test/ui/typeck/remove-extra-argument.stderr | 2 +- src/test/ui/typeck/struct-enum-wrong-args.stderr | 16 +- ...ng-missing-zero-to-floating-point-number.stderr | 14 +- .../typeck-default-trait-impl-negation-sync.stderr | 8 +- .../ui/typeck/typeck_type_placeholder_item.stderr | 4 +- src/test/ui/typeof/issue-100183.rs | 6 + src/test/ui/typeof/issue-100183.stderr | 14 + src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs | 1 + src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr | 30 +- .../ui/unboxed-closures/non-tupled-arg-mismatch.rs | 8 + .../non-tupled-arg-mismatch.stderr | 17 + ...sures-infer-fn-once-move-from-projection.stderr | 12 +- ...unboxed-closures-static-call-wrong-trait.stderr | 4 +- .../unboxed-closures-type-mismatch.stderr | 6 +- .../unboxed-closures-unsafe-extern-fn.stderr | 6 +- .../unboxed-closures-wrong-abi.stderr | 6 +- ...nboxed-closures-wrong-arg-type-extern-fn.stderr | 6 +- src/test/ui/uninhabited/uninhabited-irrefutable.rs | 2 +- .../ui/uninhabited/uninhabited-irrefutable.stderr | 6 +- .../uninhabited-matches-feature-gated.stderr | 2 +- src/test/ui/union/union-generic.mirunsafeck.stderr | 4 +- .../ui/union/union-generic.thirunsafeck.stderr | 4 +- src/test/ui/unpretty/avoid-crash.rs | 4 + src/test/ui/unpretty/avoid-crash.stderr | 4 + src/test/ui/unpretty/bad-literal.rs | 8 + src/test/ui/unpretty/bad-literal.stderr | 10 + src/test/ui/unpretty/bad-literal.stdout | 11 + src/test/ui/unpretty/pretty-let-else.rs | 10 + src/test/ui/unpretty/pretty-let-else.stdout | 18 + .../rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr | 38 +- .../ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs | 2 - .../rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr | 24 +- src/test/ui/unsized-locals/unsized-exprs.stderr | 4 +- src/test/ui/unsized/issue-71659.stderr | 6 +- src/test/ui/unsized/issue-75707.stderr | 4 +- src/test/ui/unsized/issue-75899-but-gats.rs | 21 + src/test/ui/unsized/issue-75899.rs | 18 + src/test/ui/unsized/unsized-fn-param.stderr | 16 +- src/test/ui/unsized/unsized-struct.stderr | 4 +- src/test/ui/unsized/unsized3.stderr | 10 +- src/test/ui/unspecified-self-in-trait-ref.rs | 30 -- src/test/ui/unspecified-self-in-trait-ref.stderr | 105 ---- .../variance-use-contravariant-struct-1.rs | 2 +- .../variance-use-contravariant-struct-2.rs | 2 +- .../ui/variance/variance-use-invariant-struct-1.rs | 2 +- src/test/ui/wait-forked-but-failed-child.rs | 1 + src/test/ui/wf/hir-wf-check-erase-regions.stderr | 4 +- src/test/ui/wf/wf-const-type.stderr | 2 +- .../ui/wf/wf-convert-unsafe-trait-obj-box.stderr | 6 +- src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr | 6 +- src/test/ui/wf/wf-foreign-fn-decl-ret.stderr | 4 +- src/test/ui/wf/wf-static-type.stderr | 2 +- src/test/ui/wf/wf-trait-fn-ret.stderr | 4 +- src/test/ui/wf/wf-unsafe-trait-obj-match.stderr | 4 +- .../where-clause-method-substituion.stderr | 4 +- .../where-clauses-method-unsatisfied.stderr | 6 +- 2033 files changed, 21346 insertions(+), 9859 deletions(-) create mode 100644 src/test/ui/abi/issues/issue-97463-broken-abi-leaked-uninit-data.rs create mode 100644 src/test/ui/argument-suggestions/issue-100478.rs create mode 100644 src/test/ui/argument-suggestions/issue-100478.stderr create mode 100644 src/test/ui/argument-suggestions/issue-101097.rs create mode 100644 src/test/ui/argument-suggestions/issue-101097.stderr create mode 100644 src/test/ui/argument-suggestions/too-long.rs create mode 100644 src/test/ui/argument-suggestions/too-long.stderr create mode 100644 src/test/ui/argument-suggestions/two-mismatch-notes.rs create mode 100644 src/test/ui/argument-suggestions/two-mismatch-notes.stderr create mode 100644 src/test/ui/array-slice-vec/suggest-array-length.fixed create mode 100644 src/test/ui/array-slice-vec/suggest-array-length.rs create mode 100644 src/test/ui/array-slice-vec/suggest-array-length.stderr create mode 100644 src/test/ui/asm/unpretty-expanded.rs create mode 100644 src/test/ui/asm/unpretty-expanded.stdout create mode 100644 src/test/ui/associated-consts/issue-102335-const.rs create mode 100644 src/test/ui/associated-consts/issue-102335-const.stderr create mode 100644 src/test/ui/associated-type-bounds/issue-102335-ty.rs create mode 100644 src/test/ui/associated-type-bounds/issue-102335-ty.stderr delete mode 100644 src/test/ui/associated-types/higher-ranked-projection.badbase.stderr delete mode 100644 src/test/ui/associated-types/higher-ranked-projection.badnll.stderr create mode 100644 src/test/ui/async-await/async-await-let-else.drop-tracking.stderr create mode 100644 src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr delete mode 100644 src/test/ui/async-await/async-await-let-else.stderr create mode 100644 src/test/ui/async-await/issue-101715.rs create mode 100644 src/test/ui/async-await/issue-101715.stderr create mode 100644 src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr create mode 100644 src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issue-64130-4-async-move.stderr create mode 100644 src/test/ui/async-await/issue-68112.drop_tracking.stderr create mode 100644 src/test/ui/async-await/issue-68112.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issue-68112.stderr create mode 100644 src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issue-70935-complex-spans.normal.stderr create mode 100644 src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr create mode 100644 src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr create mode 100644 src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr delete mode 100644 src/test/ui/async-await/partial-drop-partial-reinit.stderr create mode 100644 src/test/ui/attributes/collapse-debuginfo-invalid.rs create mode 100644 src/test/ui/attributes/collapse-debuginfo-invalid.stderr create mode 100644 src/test/ui/attributes/issue-100631.rs create mode 100644 src/test/ui/attributes/issue-100631.stderr delete mode 100644 src/test/ui/attributes/register-attr-tool-fail.rs delete mode 100644 src/test/ui/attributes/register-attr-tool-fail.stderr delete mode 100644 src/test/ui/attributes/register-attr-tool-import.rs delete mode 100644 src/test/ui/attributes/register-attr-tool-import.stderr delete mode 100644 src/test/ui/attributes/register-attr-tool-prelude.rs delete mode 100644 src/test/ui/attributes/register-attr-tool-prelude.stderr delete mode 100644 src/test/ui/attributes/register-attr-tool-unused.rs delete mode 100644 src/test/ui/attributes/register-attr-tool-unused.stderr delete mode 100644 src/test/ui/attributes/register-attr-tool.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/auxiliary/sigpipe-utils.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-crate.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-error.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.stderr create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.stderr create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-rustc_main.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-sig_dfl.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-start.stderr create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-struct.stderr create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.stderr create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe.rs create mode 100644 src/test/ui/attributes/unix_sigpipe/unix_sigpipe.stderr create mode 100644 src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs create mode 100644 src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr create mode 100644 src/test/ui/borrowck/issue-101119.rs create mode 100644 src/test/ui/borrowck/issue-101119.stderr create mode 100644 src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs create mode 100644 src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr create mode 100644 src/test/ui/btreemap/btreemap-index-mut.rs create mode 100644 src/test/ui/btreemap/btreemap-index-mut.stderr create mode 100644 src/test/ui/check-cfg/allow-at-crate-level.rs create mode 100644 src/test/ui/closures/binder/disallow-const.rs create mode 100644 src/test/ui/closures/binder/disallow-const.stderr create mode 100644 src/test/ui/closures/binder/disallow-ty.rs create mode 100644 src/test/ui/closures/binder/disallow-ty.stderr create mode 100644 src/test/ui/codegen/issue-101585-128bit-repeat.rs create mode 100644 src/test/ui/codegen/issue-99551.rs create mode 100644 src/test/ui/coercion/issue-101066.rs create mode 100644 src/test/ui/coherence/auxiliary/trait-with-const-param.rs delete mode 100644 src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr create mode 100644 src/test/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr create mode 100644 src/test/ui/coherence/const-generics-orphan-check-ok.rs create mode 100644 src/test/ui/coherence/issue-100191-2.rs create mode 100644 src/test/ui/coherence/issue-100191-2.stderr create mode 100644 src/test/ui/coherence/issue-100191.rs create mode 100644 src/test/ui/coherence/issue-100191.stderr create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-100217.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-100360.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-73298.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-82268.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-83972.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-84669.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-86710.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-89851.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/obligation-cause.rs create mode 100644 src/test/ui/const-generics/generic_const_exprs/obligation-cause.stderr create mode 100644 src/test/ui/const-generics/issue-103243.rs create mode 100644 src/test/ui/const-generics/issues/issue-100313.rs create mode 100644 src/test/ui/const-generics/issues/issue-100313.stderr create mode 100644 src/test/ui/consts/const_in_pattern/incomplete-slice.rs create mode 100644 src/test/ui/consts/const_in_pattern/incomplete-slice.stderr create mode 100644 src/test/ui/consts/extra-const-ub/detect-extra-ub.rs create mode 100644 src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr create mode 100644 src/test/ui/consts/extra-const-ub/issue-100771.rs create mode 100644 src/test/ui/consts/extra-const-ub/issue-101034.rs create mode 100644 src/test/ui/consts/unnormalized-param-env.rs create mode 100644 src/test/ui/deriving/issue-103157.rs create mode 100644 src/test/ui/deriving/issue-103157.stderr create mode 100644 src/test/ui/drop/drop-foreign-fundamental.rs create mode 100644 src/test/ui/drop/drop-foreign-fundamental.stderr create mode 100644 src/test/ui/drop/drop_order.rs create mode 100644 src/test/ui/dyn-star/const.rs create mode 100644 src/test/ui/dyn-star/drop.rs create mode 100644 src/test/ui/dyn-star/drop.run.stdout create mode 100644 src/test/ui/dyn-star/error.rs create mode 100644 src/test/ui/dyn-star/error.stderr create mode 100644 src/test/ui/dyn-star/feature-gate-dyn_star.rs create mode 100644 src/test/ui/dyn-star/feature-gate-dyn_star.stderr create mode 100644 src/test/ui/dyn-star/make-dyn-star.rs create mode 100644 src/test/ui/dyn-star/method.rs create mode 100644 src/test/ui/dyn-star/syntax.rs create mode 100644 src/test/ui/feature-gates/feature-gate-collapse_debuginfo.rs create mode 100644 src/test/ui/feature-gates/feature-gate-collapse_debuginfo.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-generic_associated_types.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-label_break_value.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-label_break_value.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-let_else.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-let_else.stderr create mode 100644 src/test/ui/feature-gates/feature-gate-raw-dylib-import-name-type.rs create mode 100644 src/test/ui/feature-gates/feature-gate-raw-dylib-import-name-type.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-register_attr.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-register_attr.stderr create mode 100644 src/test/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs create mode 100644 src/test/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr create mode 100644 src/test/ui/feature-gates/feature-gate-unix_sigpipe.rs create mode 100644 src/test/ui/feature-gates/feature-gate-unix_sigpipe.stderr create mode 100644 src/test/ui/feature-gates/soft-syntax-gates-with-errors.rs create mode 100644 src/test/ui/feature-gates/soft-syntax-gates-with-errors.stderr create mode 100644 src/test/ui/feature-gates/soft-syntax-gates-without-errors.rs create mode 100644 src/test/ui/feature-gates/soft-syntax-gates-without-errors.stderr create mode 100644 src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr delete mode 100644 src/test/ui/fn/implied-bounds-unnorm-associated-type-3.stderr create mode 100644 src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs create mode 100644 src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr create mode 100644 src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs create mode 100644 src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr create mode 100644 src/test/ui/generator/clone-impl-async.rs create mode 100644 src/test/ui/generator/clone-impl-async.stderr create mode 100644 src/test/ui/generator/clone-impl-static.rs create mode 100644 src/test/ui/generator/clone-impl-static.stderr create mode 100644 src/test/ui/generator/clone-impl.rs create mode 100644 src/test/ui/generator/clone-impl.stderr create mode 100644 src/test/ui/generic-associated-types/bugs/hrtb-implied-1.rs create mode 100644 src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr create mode 100644 src/test/ui/generic-associated-types/bugs/hrtb-implied-2.rs create mode 100644 src/test/ui/generic-associated-types/bugs/hrtb-implied-2.stderr create mode 100644 src/test/ui/generic-associated-types/bugs/hrtb-implied-3.rs create mode 100644 src/test/ui/generic-associated-types/bugs/hrtb-implied-3.stderr delete mode 100644 src/test/ui/generic-associated-types/bugs/issue-87748.rs delete mode 100644 src/test/ui/generic-associated-types/bugs/issue-87748.stderr create mode 100644 src/test/ui/generic-associated-types/bugs/issue-91762.rs create mode 100644 src/test/ui/generic-associated-types/bugs/issue-91762.stderr delete mode 100644 src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.rs delete mode 100644 src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.stderr delete mode 100644 src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.rs delete mode 100644 src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.stderr delete mode 100644 src/test/ui/generic-associated-types/gat-incomplete-warning.rs create mode 100644 src/test/ui/generic-associated-types/issue-101020.rs create mode 100644 src/test/ui/generic-associated-types/issue-101020.stderr create mode 100644 src/test/ui/generic-associated-types/issue-102333.rs create mode 100644 src/test/ui/generic-associated-types/issue-102335-gat.rs create mode 100644 src/test/ui/generic-associated-types/issue-102335-gat.stderr delete mode 100644 src/test/ui/generic-associated-types/issue-67424.stderr create mode 100644 src/test/ui/generic-associated-types/issue-87748.rs delete mode 100644 src/test/ui/generic-associated-types/issue-91762.rs delete mode 100644 src/test/ui/generic-associated-types/issue-91762.stderr create mode 100644 src/test/ui/generic-associated-types/type-param-defaults.rs create mode 100644 src/test/ui/generic-associated-types/type-param-defaults.stderr create mode 100644 src/test/ui/hashmap/hashmap-index-mut.rs create mode 100644 src/test/ui/hashmap/hashmap-index-mut.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/complex.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/due-to-where-clause.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/due-to-where-clause.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-covariant.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.polonius.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-30786.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-30786.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-46989.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-46989.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-57639.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-58451.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-58451.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-88446.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-90177.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-95034.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-95034.stderr create mode 100644 src/test/ui/higher-rank-trait-bounds/issue-95230.rs delete mode 100644 src/test/ui/hrtb/complex.rs delete mode 100644 src/test/ui/hrtb/due-to-where-clause.rs delete mode 100644 src/test/ui/hrtb/due-to-where-clause.stderr delete mode 100644 src/test/ui/hrtb/hrtb-cache-issue-54302.rs delete mode 100644 src/test/ui/hrtb/hrtb-cache-issue-54302.stderr delete mode 100644 src/test/ui/hrtb/hrtb-conflate-regions.rs delete mode 100644 src/test/ui/hrtb/hrtb-conflate-regions.stderr delete mode 100644 src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs delete mode 100644 src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr delete mode 100644 src/test/ui/hrtb/hrtb-exists-forall-fn.rs delete mode 100644 src/test/ui/hrtb/hrtb-exists-forall-fn.stderr delete mode 100644 src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs delete mode 100644 src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr delete mode 100644 src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs delete mode 100644 src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs delete mode 100644 src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr delete mode 100644 src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs delete mode 100644 src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr delete mode 100644 src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs delete mode 100644 src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr delete mode 100644 src/test/ui/hrtb/hrtb-identity-fn-borrows.rs delete mode 100644 src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr delete mode 100644 src/test/ui/hrtb/hrtb-just-for-static.rs delete mode 100644 src/test/ui/hrtb/hrtb-just-for-static.stderr delete mode 100644 src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr delete mode 100644 src/test/ui/hrtb/hrtb-perfect-forwarding.rs delete mode 100644 src/test/ui/hrtb/hrtb-perfect-forwarding.stderr delete mode 100644 src/test/ui/hrtb/issue-30786.rs delete mode 100644 src/test/ui/hrtb/issue-30786.stderr delete mode 100644 src/test/ui/hrtb/issue-46989.rs delete mode 100644 src/test/ui/hrtb/issue-46989.stderr delete mode 100644 src/test/ui/hrtb/issue-57639.rs delete mode 100644 src/test/ui/hrtb/issue-58451.rs delete mode 100644 src/test/ui/hrtb/issue-58451.stderr delete mode 100644 src/test/ui/hrtb/issue-62203-hrtb-ice.rs delete mode 100644 src/test/ui/hrtb/issue-62203-hrtb-ice.stderr delete mode 100644 src/test/ui/hrtb/issue-88446.rs delete mode 100644 src/test/ui/hrtb/issue-90177.rs delete mode 100644 src/test/ui/hrtb/issue-95034.rs delete mode 100644 src/test/ui/hrtb/issue-95034.stderr delete mode 100644 src/test/ui/hrtb/issue-95230.rs create mode 100644 src/test/ui/impl-trait/in-trait/deep-match-works.rs create mode 100644 src/test/ui/impl-trait/in-trait/deep-match.rs create mode 100644 src/test/ui/impl-trait/in-trait/deep-match.stderr create mode 100644 src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs create mode 100644 src/test/ui/impl-trait/in-trait/doesnt-satisfy.stderr create mode 100644 src/test/ui/impl-trait/in-trait/encode.rs create mode 100644 src/test/ui/impl-trait/in-trait/nested-rpitit.rs create mode 100644 src/test/ui/impl-trait/in-trait/object-safety.rs create mode 100644 src/test/ui/impl-trait/in-trait/object-safety.stderr create mode 100644 src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs create mode 100644 src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr create mode 100644 src/test/ui/impl-trait/in-trait/opaque-in-impl.rs create mode 100644 src/test/ui/impl-trait/in-trait/reveal.rs create mode 100644 src/test/ui/impl-trait/in-trait/success.rs create mode 100644 src/test/ui/impl-trait/in-trait/wf-bounds.rs create mode 100644 src/test/ui/impl-trait/in-trait/wf-bounds.stderr create mode 100644 src/test/ui/impl-trait/issue-100075-2.rs create mode 100644 src/test/ui/impl-trait/issue-100075-2.stderr create mode 100644 src/test/ui/impl-trait/issue-100075.rs create mode 100644 src/test/ui/impl-trait/issue-100075.stderr create mode 100644 src/test/ui/impl-trait/issue-103599.rs create mode 100644 src/test/ui/impl-trait/issue-103599.stderr create mode 100644 src/test/ui/impl-trait/issue-99914.rs create mode 100644 src/test/ui/impl-trait/issue-99914.stderr create mode 100644 src/test/ui/impl-trait/nested-rpit-with-anonymous-lifetimes.rs create mode 100644 src/test/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.rs create mode 100644 src/test/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.stderr create mode 100644 src/test/ui/implied-bounds/impl-header-unnormalized-types.rs create mode 100644 src/test/ui/implied-bounds/impl-header-unnormalized-types.stderr create mode 100644 src/test/ui/implied-bounds/issue-100690.rs create mode 100644 src/test/ui/implied-bounds/issue-100690.stderr create mode 100644 src/test/ui/implied-bounds/issue-101951.rs create mode 100644 src/test/ui/intrinsics/const-eval-select-backtrace-std.rs create mode 100644 src/test/ui/intrinsics/const-eval-select-backtrace-std.run.stderr create mode 100644 src/test/ui/intrinsics/const-eval-select-backtrace.rs create mode 100644 src/test/ui/intrinsics/const-eval-select-backtrace.run.stderr delete mode 100644 src/test/ui/issues/issue-100550-normalization-ice-exposed-by-mir-inlining.rs create mode 100644 src/test/ui/issues/issue-100605.rs create mode 100644 src/test/ui/issues/issue-100605.stderr delete mode 100644 src/test/ui/issues/issue-15524.rs delete mode 100644 src/test/ui/issues/issue-15524.stderr create mode 100644 src/test/ui/issues/issue-99875.rs create mode 100644 src/test/ui/issues/issue-99875.stderr delete mode 100644 src/test/ui/json-and-color.rs delete mode 100644 src/test/ui/json-and-color.stderr delete mode 100644 src/test/ui/json-and-error-format.rs delete mode 100644 src/test/ui/json-and-error-format.stderr delete mode 100644 src/test/ui/json-bom-plus-crlf-multifile-aux.rs delete mode 100644 src/test/ui/json-bom-plus-crlf-multifile.rs delete mode 100644 src/test/ui/json-bom-plus-crlf-multifile.stderr delete mode 100644 src/test/ui/json-bom-plus-crlf.rs delete mode 100644 src/test/ui/json-bom-plus-crlf.stderr delete mode 100644 src/test/ui/json-invalid.rs delete mode 100644 src/test/ui/json-invalid.stderr delete mode 100644 src/test/ui/json-multiple.polonius.stderr delete mode 100644 src/test/ui/json-multiple.rs delete mode 100644 src/test/ui/json-multiple.stderr delete mode 100644 src/test/ui/json-options.polonius.stderr delete mode 100644 src/test/ui/json-options.rs delete mode 100644 src/test/ui/json-options.stderr delete mode 100644 src/test/ui/json-short.rs delete mode 100644 src/test/ui/json-short.stderr create mode 100644 src/test/ui/json/json-and-color.rs create mode 100644 src/test/ui/json/json-and-color.stderr create mode 100644 src/test/ui/json/json-and-error-format.rs create mode 100644 src/test/ui/json/json-and-error-format.stderr create mode 100644 src/test/ui/json/json-bom-plus-crlf-multifile-aux.rs create mode 100644 src/test/ui/json/json-bom-plus-crlf-multifile.rs create mode 100644 src/test/ui/json/json-bom-plus-crlf-multifile.stderr create mode 100644 src/test/ui/json/json-bom-plus-crlf.rs create mode 100644 src/test/ui/json/json-bom-plus-crlf.stderr create mode 100644 src/test/ui/json/json-invalid.rs create mode 100644 src/test/ui/json/json-invalid.stderr create mode 100644 src/test/ui/json/json-multiple.polonius.stderr create mode 100644 src/test/ui/json/json-multiple.rs create mode 100644 src/test/ui/json/json-multiple.stderr create mode 100644 src/test/ui/json/json-options.polonius.stderr create mode 100644 src/test/ui/json/json-options.rs create mode 100644 src/test/ui/json/json-options.stderr create mode 100644 src/test/ui/json/json-short.rs create mode 100644 src/test/ui/json/json-short.stderr create mode 100644 src/test/ui/let-else/const-fn.rs create mode 100644 src/test/ui/let-else/issue-100103.rs create mode 100644 src/test/ui/let-else/issue-102317.rs create mode 100644 src/test/ui/let-else/issue-94176.rs create mode 100644 src/test/ui/let-else/issue-94176.stderr create mode 100644 src/test/ui/let-else/issue-99975.rs create mode 100644 src/test/ui/let-else/let-else-drop-order.rs create mode 100644 src/test/ui/let-else/let-else-drop-order.run.stdout create mode 100644 src/test/ui/let-else/let-else-then-diverge.rs create mode 100644 src/test/ui/let-else/let-else-then-diverge.stderr create mode 100644 src/test/ui/let-else/let-else.rs create mode 100644 src/test/ui/lifetimes/fullwidth-ampersand.rs create mode 100644 src/test/ui/lifetimes/fullwidth-ampersand.stderr create mode 100644 src/test/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.rs create mode 100644 src/test/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr create mode 100644 src/test/ui/lint/issue-101284.rs create mode 100644 src/test/ui/lint/let_underscore/let_underscore_drop.rs create mode 100644 src/test/ui/lint/let_underscore/let_underscore_drop.stderr create mode 100644 src/test/ui/lint/let_underscore/let_underscore_lock.rs create mode 100644 src/test/ui/lint/let_underscore/let_underscore_lock.stderr create mode 100644 src/test/ui/lint/lint-attr-everywhere-early.rs create mode 100644 src/test/ui/lint/lint-attr-everywhere-early.stderr create mode 100644 src/test/ui/lint/lint-attr-everywhere-late.rs create mode 100644 src/test/ui/lint/lint-attr-everywhere-late.stderr create mode 100644 src/test/ui/lint/must_not_suspend/ref-drop-tracking.rs create mode 100644 src/test/ui/lint/must_not_suspend/ref-drop-tracking.stderr create mode 100644 src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr create mode 100644 src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr delete mode 100644 src/test/ui/lint/must_not_suspend/ref.stderr create mode 100644 src/test/ui/lint/unused_parens_multibyte_recovery.rs create mode 100644 src/test/ui/lint/unused_parens_multibyte_recovery.stderr create mode 100644 src/test/ui/lowering/issue-96847.rs delete mode 100644 src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr delete mode 100644 src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr create mode 100644 src/test/ui/macros/auxiliary/issue-100199.rs create mode 100644 src/test/ui/macros/issue-100199.rs create mode 100644 src/test/ui/macros/issue-100199.stderr delete mode 100644 src/test/ui/mir/issue-100476-recursion-check-blewup.rs create mode 100644 src/test/ui/mir/issue-101844.rs create mode 100644 src/test/ui/mir/issue-102389.rs create mode 100644 src/test/ui/mir/issue-102389.stderr create mode 100644 src/test/ui/mir/issue-99852.rs create mode 100644 src/test/ui/mir/issue-99866.rs create mode 100644 src/test/ui/mir/mir-inlining/ice-issue-100550-unnormalized-projection.rs create mode 100644 src/test/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.rs create mode 100644 src/test/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr create mode 100644 src/test/ui/mismatched_types/dont-point-return-on-E0308.rs create mode 100644 src/test/ui/mismatched_types/dont-point-return-on-E0308.stderr create mode 100644 src/test/ui/mismatched_types/normalize-fn-sig.rs create mode 100644 src/test/ui/mismatched_types/normalize-fn-sig.stderr create mode 100644 src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.fixed create mode 100644 src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.rs create mode 100644 src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.stderr create mode 100644 src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.fixed create mode 100644 src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.rs create mode 100644 src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr create mode 100644 src/test/ui/modules/auxiliary/dummy_lib.rs create mode 100644 src/test/ui/modules/special_module_name.rs create mode 100644 src/test/ui/modules/special_module_name.stderr create mode 100644 src/test/ui/modules/special_module_name_ignore.rs delete mode 100644 src/test/ui/on-unimplemented/enclosing-scope.rs delete mode 100644 src/test/ui/on-unimplemented/enclosing-scope.stderr create mode 100644 src/test/ui/on-unimplemented/parent-label.rs create mode 100644 src/test/ui/on-unimplemented/parent-label.stderr create mode 100644 src/test/ui/or-patterns/inner-or-pat.or3.stderr create mode 100644 src/test/ui/or-patterns/inner-or-pat.or4.stderr create mode 100644 src/test/ui/or-patterns/inner-or-pat.rs create mode 100644 src/test/ui/or-patterns/or-patterns-syntactic-pass.stderr create mode 100644 src/test/ui/parser/constraints-before-generic-args-syntactic-pass.stderr create mode 100644 src/test/ui/parser/do-not-suggest-semicolon-before-array.rs create mode 100644 src/test/ui/parser/do-not-suggest-semicolon-before-array.stderr create mode 100644 src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs create mode 100644 src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr create mode 100644 src/test/ui/parser/fn-defined-using-def.rs create mode 100644 src/test/ui/parser/fn-defined-using-def.stderr create mode 100644 src/test/ui/parser/fn-defined-using-fun.rs create mode 100644 src/test/ui/parser/fn-defined-using-fun.stderr create mode 100644 src/test/ui/parser/fn-defined-using-func.rs create mode 100644 src/test/ui/parser/fn-defined-using-func.stderr create mode 100644 src/test/ui/parser/fn-defined-using-function.rs create mode 100644 src/test/ui/parser/fn-defined-using-function.stderr create mode 100644 src/test/ui/parser/issue-100197-mut-let.fixed create mode 100644 src/test/ui/parser/issue-100197-mut-let.rs create mode 100644 src/test/ui/parser/issue-100197-mut-let.stderr create mode 100644 src/test/ui/parser/issue-101477-enum.fixed create mode 100644 src/test/ui/parser/issue-101477-enum.rs create mode 100644 src/test/ui/parser/issue-101477-enum.stderr create mode 100644 src/test/ui/parser/issue-101477-let.fixed create mode 100644 src/test/ui/parser/issue-101477-let.rs create mode 100644 src/test/ui/parser/issue-101477-let.stderr create mode 100644 src/test/ui/parser/issue-99910-const-let-mutually-exclusive.fixed create mode 100644 src/test/ui/parser/issue-99910-const-let-mutually-exclusive.rs create mode 100644 src/test/ui/parser/issue-99910-const-let-mutually-exclusive.stderr delete mode 100644 src/test/ui/parser/issues/issue-14303-enum.rs delete mode 100644 src/test/ui/parser/issues/issue-14303-enum.stderr delete mode 100644 src/test/ui/parser/issues/issue-14303-fn-def.rs delete mode 100644 src/test/ui/parser/issues/issue-14303-fn-def.stderr delete mode 100644 src/test/ui/parser/issues/issue-14303-impl.rs delete mode 100644 src/test/ui/parser/issues/issue-14303-impl.stderr delete mode 100644 src/test/ui/parser/issues/issue-14303-path.rs delete mode 100644 src/test/ui/parser/issues/issue-14303-path.stderr delete mode 100644 src/test/ui/parser/issues/issue-14303-struct.rs delete mode 100644 src/test/ui/parser/issues/issue-14303-struct.stderr delete mode 100644 src/test/ui/parser/issues/issue-14303-trait.rs delete mode 100644 src/test/ui/parser/issues/issue-14303-trait.stderr create mode 100644 src/test/ui/parser/issues/issue-14303.rs create mode 100644 src/test/ui/parser/issues/issue-14303.stderr create mode 100644 src/test/ui/parser/kw-in-trait-bounds.rs create mode 100644 src/test/ui/parser/kw-in-trait-bounds.stderr create mode 100644 src/test/ui/parser/public-instead-of-pub-1.fixed create mode 100644 src/test/ui/parser/public-instead-of-pub-1.rs create mode 100644 src/test/ui/parser/public-instead-of-pub-1.stderr create mode 100644 src/test/ui/parser/public-instead-of-pub-2.rs create mode 100644 src/test/ui/parser/public-instead-of-pub-2.stderr create mode 100644 src/test/ui/parser/public-instead-of-pub-3.fixed create mode 100644 src/test/ui/parser/public-instead-of-pub-3.rs create mode 100644 src/test/ui/parser/public-instead-of-pub-3.stderr create mode 100644 src/test/ui/parser/recover-field-semi.rs create mode 100644 src/test/ui/parser/recover-field-semi.stderr create mode 100644 src/test/ui/parser/recover-missing-semi-before-item.fixed create mode 100644 src/test/ui/parser/recover-missing-semi-before-item.rs create mode 100644 src/test/ui/parser/recover-missing-semi-before-item.stderr create mode 100644 src/test/ui/parser/struct-filed-with-attr.fixed create mode 100644 src/test/ui/parser/struct-filed-with-attr.rs create mode 100644 src/test/ui/parser/struct-filed-with-attr.stderr create mode 100644 src/test/ui/parser/suggest-assoc-const.fixed create mode 100644 src/test/ui/parser/suggest-assoc-const.rs create mode 100644 src/test/ui/parser/suggest-assoc-const.stderr create mode 100644 src/test/ui/parser/suggest-const-for-global-var.rs create mode 100644 src/test/ui/parser/suggest-const-for-global-var.stderr create mode 100644 src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.fixed create mode 100644 src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.rs create mode 100644 src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr create mode 100644 src/test/ui/parser/suggest-semicolon-before-array.fixed create mode 100644 src/test/ui/parser/suggest-semicolon-before-array.rs create mode 100644 src/test/ui/parser/suggest-semicolon-before-array.stderr create mode 100644 src/test/ui/parser/unnecessary-let.rs create mode 100644 src/test/ui/parser/unnecessary-let.stderr create mode 100644 src/test/ui/pattern/rest-pat-syntactic.stderr create mode 100644 src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed create mode 100644 src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.rs create mode 100644 src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr create mode 100644 src/test/ui/privacy/access_levels.rs create mode 100644 src/test/ui/privacy/access_levels.stderr create mode 100644 src/test/ui/proc-macro/auxiliary/re-export.rs create mode 100644 src/test/ui/proc-macro/dollar-crate-issue-101211.rs delete mode 100644 src/test/ui/proc-macro/expand-to-unstable-2.rs delete mode 100644 src/test/ui/proc-macro/expand-to-unstable-2.stderr delete mode 100644 src/test/ui/proc-macro/issue-41211.rs delete mode 100644 src/test/ui/proc-macro/issue-41211.stderr create mode 100644 src/test/ui/proc-macro/issue-79148.rs create mode 100644 src/test/ui/proc-macro/issue-79148.stderr create mode 100644 src/test/ui/recursion/issue-95134.rs create mode 100644 src/test/ui/recursion/issue-95134.stderr create mode 100644 src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs create mode 100644 src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr create mode 100644 src/test/ui/regions/outlives-with-missing.rs create mode 100644 src/test/ui/regions/outlives-with-missing.stderr create mode 100644 src/test/ui/repr/invalid_repr_list_help.rs create mode 100644 src/test/ui/repr/invalid_repr_list_help.stderr create mode 100644 src/test/ui/resolve/issue-100365.rs create mode 100644 src/test/ui/resolve/issue-100365.stderr create mode 100644 src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.rs create mode 100644 src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr create mode 100644 src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs create mode 100644 src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr create mode 100644 src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs create mode 100644 src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr create mode 100644 src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs create mode 100644 src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr create mode 100644 src/test/ui/rfc-2632-const-trait-impl/issue-100222.rs create mode 100644 src/test/ui/sanitize/memory-eager.rs create mode 100644 src/test/ui/simd/intrinsic/ptr-cast.rs delete mode 100644 src/test/ui/span/issue-36530.rs delete mode 100644 src/test/ui/span/issue-36530.stderr create mode 100644 src/test/ui/stability-attribute/auxiliary/ctor-stability.rs create mode 100644 src/test/ui/stability-attribute/auxiliary/default_body.rs create mode 100644 src/test/ui/stability-attribute/ctor-stability.rs create mode 100644 src/test/ui/stability-attribute/default-body-stability-err.rs create mode 100644 src/test/ui/stability-attribute/default-body-stability-err.stderr create mode 100644 src/test/ui/stability-attribute/default-body-stability-ok-enables.rs create mode 100644 src/test/ui/stability-attribute/default-body-stability-ok-impls.rs create mode 100644 src/test/ui/stats/hir-stats.rs create mode 100644 src/test/ui/stats/hir-stats.stderr delete mode 100644 src/test/ui/suggestions/as-ref-2.fixed create mode 100644 src/test/ui/suggestions/bool_typo_err_suggest.rs create mode 100644 src/test/ui/suggestions/bool_typo_err_suggest.stderr create mode 100644 src/test/ui/suggestions/call-boxed.rs create mode 100644 src/test/ui/suggestions/call-boxed.stderr create mode 100644 src/test/ui/suggestions/call-on-missing.rs create mode 100644 src/test/ui/suggestions/call-on-missing.stderr create mode 100644 src/test/ui/suggestions/copied-and-cloned.fixed create mode 100644 src/test/ui/suggestions/copied-and-cloned.rs create mode 100644 src/test/ui/suggestions/copied-and-cloned.stderr create mode 100644 src/test/ui/suggestions/deref-path-method.rs create mode 100644 src/test/ui/suggestions/deref-path-method.stderr create mode 100644 src/test/ui/suggestions/dont-try-removing-the-field.rs create mode 100644 src/test/ui/suggestions/dont-try-removing-the-field.stderr create mode 100644 src/test/ui/suggestions/field-access-considering-privacy.rs create mode 100644 src/test/ui/suggestions/field-access-considering-privacy.stderr create mode 100644 src/test/ui/suggestions/issue-101421.rs create mode 100644 src/test/ui/suggestions/issue-101421.stderr create mode 100644 src/test/ui/suggestions/issue-101465.rs create mode 100644 src/test/ui/suggestions/issue-101465.stderr create mode 100644 src/test/ui/suggestions/issue-101984.rs create mode 100644 src/test/ui/suggestions/issue-101984.stderr create mode 100644 src/test/ui/suggestions/issue-89064.rs create mode 100644 src/test/ui/suggestions/issue-89064.stderr create mode 100644 src/test/ui/suggestions/many-type-ascription.rs create mode 100644 src/test/ui/suggestions/many-type-ascription.stderr create mode 100644 src/test/ui/suggestions/move-generic-to-trait-in-method-with-params.rs create mode 100644 src/test/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr delete mode 100644 src/test/ui/suggestions/option-content-move.fixed create mode 100644 src/test/ui/suggestions/restrict-type-not-param.rs create mode 100644 src/test/ui/suggestions/restrict-type-not-param.stderr create mode 100644 src/test/ui/suggestions/return-closures.rs create mode 100644 src/test/ui/suggestions/return-closures.stderr create mode 100644 src/test/ui/suggestions/return-cycle-2.rs create mode 100644 src/test/ui/suggestions/return-cycle-2.stderr create mode 100644 src/test/ui/suggestions/return-cycle.rs create mode 100644 src/test/ui/suggestions/return-cycle.stderr create mode 100644 src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.rs create mode 100644 src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.stderr create mode 100644 src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.fixed create mode 100644 src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.rs create mode 100644 src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.stderr create mode 100644 src/test/ui/suggestions/too-many-field-suggestions.rs create mode 100644 src/test/ui/suggestions/too-many-field-suggestions.stderr create mode 100644 src/test/ui/suggestions/try-removing-the-field.rs create mode 100644 src/test/ui/suggestions/try-removing-the-field.stderr create mode 100644 src/test/ui/suggestions/type-ascription-and-other-error.rs create mode 100644 src/test/ui/suggestions/type-ascription-and-other-error.stderr delete mode 100644 src/test/ui/tag-variant-disr-dup.rs delete mode 100644 src/test/ui/tag-variant-disr-dup.stderr create mode 100644 src/test/ui/traits/alias/generic-default-in-dyn.rs create mode 100644 src/test/ui/traits/alias/generic-default-in-dyn.stderr create mode 100644 src/test/ui/traits/alias/self-in-const-generics.rs create mode 100644 src/test/ui/traits/alias/self-in-const-generics.stderr create mode 100644 src/test/ui/traits/alias/self-in-generics.rs create mode 100644 src/test/ui/traits/alias/self-in-generics.stderr create mode 100644 src/test/ui/traits/unspecified-self-in-trait-ref.rs create mode 100644 src/test/ui/traits/unspecified-self-in-trait-ref.stderr create mode 100644 src/test/ui/tuple/builtin-fail.rs create mode 100644 src/test/ui/tuple/builtin-fail.stderr create mode 100644 src/test/ui/tuple/builtin.rs create mode 100644 src/test/ui/type-alias-impl-trait/closure_args.rs create mode 100644 src/test/ui/type-alias-impl-trait/closure_args2.rs create mode 100644 src/test/ui/type-alias-impl-trait/constrain_inputs.stderr create mode 100644 src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.rs create mode 100644 src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr create mode 100644 src/test/ui/type/issue-100584.rs create mode 100644 src/test/ui/type/issue-100584.stderr create mode 100644 src/test/ui/typeck/assign-non-lval-needs-deref.rs create mode 100644 src/test/ui/typeck/assign-non-lval-needs-deref.stderr create mode 100644 src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs create mode 100644 src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr create mode 100644 src/test/ui/typeck/issue-100164.fixed create mode 100644 src/test/ui/typeck/issue-100164.rs create mode 100644 src/test/ui/typeck/issue-100164.stderr create mode 100644 src/test/ui/typeck/issue-100246.rs create mode 100644 src/test/ui/typeck/issue-100246.stderr create mode 100644 src/test/ui/typeck/issue-100285.rs create mode 100644 src/test/ui/typeck/issue-100285.stderr create mode 100644 src/test/ui/typeck/issue-91633.rs create mode 100644 src/test/ui/typeck/issue-98982.rs create mode 100644 src/test/ui/typeck/issue-98982.stderr create mode 100644 src/test/ui/typeck/point-at-type-param-in-path-expr.rs create mode 100644 src/test/ui/typeck/point-at-type-param-in-path-expr.stderr create mode 100644 src/test/ui/typeof/issue-100183.rs create mode 100644 src/test/ui/typeof/issue-100183.stderr create mode 100644 src/test/ui/unboxed-closures/non-tupled-arg-mismatch.rs create mode 100644 src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr create mode 100644 src/test/ui/unpretty/avoid-crash.rs create mode 100644 src/test/ui/unpretty/avoid-crash.stderr create mode 100644 src/test/ui/unpretty/bad-literal.rs create mode 100644 src/test/ui/unpretty/bad-literal.stderr create mode 100644 src/test/ui/unpretty/bad-literal.stdout create mode 100644 src/test/ui/unpretty/pretty-let-else.rs create mode 100644 src/test/ui/unpretty/pretty-let-else.stdout create mode 100644 src/test/ui/unsized/issue-75899-but-gats.rs create mode 100644 src/test/ui/unsized/issue-75899.rs delete mode 100644 src/test/ui/unspecified-self-in-trait-ref.rs delete mode 100644 src/test/ui/unspecified-self-in-trait-ref.stderr (limited to 'src/test/ui') diff --git a/src/test/ui/abi/issues/issue-97463-broken-abi-leaked-uninit-data.rs b/src/test/ui/abi/issues/issue-97463-broken-abi-leaked-uninit-data.rs new file mode 100644 index 000000000..fba880d4f --- /dev/null +++ b/src/test/ui/abi/issues/issue-97463-broken-abi-leaked-uninit-data.rs @@ -0,0 +1,39 @@ +// run-pass +// ignore-wasm +#![allow(dead_code)] +#![allow(improper_ctypes)] + +#[link(name = "rust_test_helpers", kind = "static")] +extern "C" { + pub fn issue_97463_leak_uninit_data(a: u32, b: u32, c: u32) -> u16; +} + +fn main() { + const C1: usize = 0x327b23c6; + const C2: usize = C1 & 0xFFFF; + + let r1: usize = 0x0; + let r2: usize = C1; + let r3: usize = 0x0; + let value: u16 = unsafe { issue_97463_leak_uninit_data(r1 as u32, r2 as u32, r3 as u32) }; + + // NOTE: as an example of the sensitivity of this test to optimization choices, + // uncommenting this block of code makes the bug go away on pnkfelix's machine. + // (But observing via `dbg!` doesn't hide the bug. At least sometimes.) + /* + println!("{}", value); + println!("{}", value as usize); + println!("{}", usize::from(value)); + println!("{}", (value as usize) & 0xFFFF); + */ + + let d1 = value; + let d2 = value as usize; + let d3 = usize::from(value); + let d4 = (value as usize) & 0xFFFF; + + let d = (&d1, &d2, &d3, &d4); + let d_ = (d1, d2, d3, d4); + + assert_eq!(((&(C2 as u16), &C2, &C2, &C2), (C2 as u16, C2, C2, C2)), (d, d_)); +} diff --git a/src/test/ui/allocator/no_std-alloc-error-handler-custom.rs b/src/test/ui/allocator/no_std-alloc-error-handler-custom.rs index 54b7c8bb9..851da231a 100644 --- a/src/test/ui/allocator/no_std-alloc-error-handler-custom.rs +++ b/src/test/ui/allocator/no_std-alloc-error-handler-custom.rs @@ -86,7 +86,7 @@ fn panic(panic_info: &core::panic::PanicInfo) -> ! { // Because we are compiling this code with `-C panic=abort`, this wouldn't normally be needed. // However, `core` and `alloc` are both compiled with `-C panic=unwind`, which means that functions -// in these libaries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't +// in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't // unwind. So, for this test case we will define the symbol. #[lang = "eh_personality"] extern fn rust_eh_personality() {} diff --git a/src/test/ui/allocator/no_std-alloc-error-handler-default.rs b/src/test/ui/allocator/no_std-alloc-error-handler-default.rs index ffa331a99..30ce0f162 100644 --- a/src/test/ui/allocator/no_std-alloc-error-handler-default.rs +++ b/src/test/ui/allocator/no_std-alloc-error-handler-default.rs @@ -73,7 +73,7 @@ fn panic(panic_info: &core::panic::PanicInfo) -> ! { // Because we are compiling this code with `-C panic=abort`, this wouldn't normally be needed. // However, `core` and `alloc` are both compiled with `-C panic=unwind`, which means that functions -// in these libaries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't +// in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't // unwind. So, for this test case we will define the symbol. #[lang = "eh_personality"] extern fn rust_eh_personality() {} diff --git a/src/test/ui/argument-suggestions/basic.stderr b/src/test/ui/argument-suggestions/basic.stderr index c495ad6b8..b118ce1bd 100644 --- a/src/test/ui/argument-suggestions/basic.stderr +++ b/src/test/ui/argument-suggestions/basic.stderr @@ -26,7 +26,7 @@ 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 @@ -42,7 +42,7 @@ LL | fn missing(_i: u32) {} help: provide the argument | LL | missing(/* u32 */); - | ~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/basic.rs:23:5 @@ -60,7 +60,7 @@ LL | fn swapped(_i: u32, _s: &str) {} help: swap these arguments | LL | swapped(1, ""); - | ~~~~~~~~~~~~~~ + | ~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/basic.rs:24:5 @@ -79,7 +79,7 @@ LL | fn permuted(_x: X, _y: Y, _z: Z) {} help: reorder these arguments | LL | permuted(X {}, Y {}, Z {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~ error[E0057]: this function takes 1 argument but 0 arguments were supplied --> $DIR/basic.rs:27:5 @@ -95,7 +95,7 @@ LL | let closure = |x| x; help: provide the argument | LL | closure(/* value */); - | ~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/test/ui/argument-suggestions/complex.stderr b/src/test/ui/argument-suggestions/complex.stderr index fa030a8f4..205a85298 100644 --- a/src/test/ui/argument-suggestions/complex.stderr +++ b/src/test/ui/argument-suggestions/complex.stderr @@ -8,11 +8,11 @@ note: function defined here --> $DIR/complex.rs:11:4 | LL | fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {} - | ^^^^^^^ ------- -------- ----- ----- ----- ----- ----- ------ + | ^^^^^^^ ------- -------- ----- ----- ----- ----- ----- ----- help: did you mean | LL | complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/exotic-calls.stderr b/src/test/ui/argument-suggestions/exotic-calls.stderr index ca93ecc4e..0580e53c5 100644 --- a/src/test/ui/argument-suggestions/exotic-calls.stderr +++ b/src/test/ui/argument-suggestions/exotic-calls.stderr @@ -12,7 +12,7 @@ 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 @@ -28,7 +28,7 @@ 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 @@ -44,7 +44,7 @@ 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 @@ -60,7 +60,7 @@ LL | let x = || {}; help: remove the extra argument | LL | x(); - | ~~~ + | ~~ error: aborting due to 4 previous errors diff --git a/src/test/ui/argument-suggestions/extra_arguments.stderr b/src/test/ui/argument-suggestions/extra_arguments.stderr index 32b1e1573..48787b0c3 100644 --- a/src/test/ui/argument-suggestions/extra_arguments.stderr +++ b/src/test/ui/argument-suggestions/extra_arguments.stderr @@ -12,7 +12,7 @@ LL | fn empty() {} help: remove the extra argument | LL | empty(); - | ~~~~~~~ + | ~~ error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/extra_arguments.rs:9:3 @@ -28,7 +28,7 @@ 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 @@ -44,7 +44,7 @@ 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 @@ -62,7 +62,7 @@ LL | fn one_arg(_a: i32) {} help: remove the extra arguments | LL | one_arg(1); - | ~~~~~~~~~~ + | ~~~ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:13:3 @@ -78,7 +78,7 @@ 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 @@ -94,7 +94,7 @@ 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 @@ -110,7 +110,7 @@ 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 @@ -126,7 +126,7 @@ 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 @@ -144,7 +144,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {} help: remove the extra arguments | LL | two_arg_diff(1, ""); - | ~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~ error[E0061]: this function takes 2 arguments but 4 arguments were supplied --> $DIR/extra_arguments.rs:19:3 @@ -162,7 +162,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {} help: remove the extra arguments | LL | two_arg_diff(1, ""); - | ~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~ error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/extra_arguments.rs:22:3 @@ -178,7 +178,7 @@ 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 @@ -194,7 +194,7 @@ 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 @@ -213,7 +213,7 @@ 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 @@ -232,7 +232,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {} help: remove the extra argument | LL | two_arg_diff(1, ""); - | ~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~ error: aborting due to 14 previous errors diff --git a/src/test/ui/argument-suggestions/invalid_arguments.stderr b/src/test/ui/argument-suggestions/invalid_arguments.stderr index 33f27d48f..303f08695 100644 --- a/src/test/ui/argument-suggestions/invalid_arguments.stderr +++ b/src/test/ui/argument-suggestions/invalid_arguments.stderr @@ -24,7 +24,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:6:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} - | ^^^^^^^^^^^^ ------- ------- + | ^^^^^^^^^^^^ ------- error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:17:16 @@ -38,7 +38,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:6:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} - | ^^^^^^^^^^^^ ------- ------- + | ^^^^^^^^^^^^ ------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:18:3 @@ -66,7 +66,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:7:4 | LL | fn two_arg_diff(_a: i32, _b: f32) {} - | ^^^^^^^^^^^^ ------- ------- + | ^^^^^^^^^^^^ ------- error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:20:16 @@ -80,7 +80,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:7:4 | LL | fn two_arg_diff(_a: i32, _b: f32) {} - | ^^^^^^^^^^^^ ------- ------- + | ^^^^^^^^^^^^ ------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:21:3 @@ -108,7 +108,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:8:4 | LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^ ------- error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:25:21 @@ -122,7 +122,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:8:4 | LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^ ------- error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:26:26 @@ -136,7 +136,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:8:4 | LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^ -------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:28:3 @@ -207,7 +207,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:9:4 | LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} - | ^^^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^^^ ------- error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:35:23 @@ -221,7 +221,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:9:4 | LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} - | ^^^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^^^ ------- error[E0308]: mismatched types --> $DIR/invalid_arguments.rs:36:26 @@ -235,7 +235,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:9:4 | LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} - | ^^^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^^^ -------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:38:3 diff --git a/src/test/ui/argument-suggestions/issue-100478.rs b/src/test/ui/argument-suggestions/issue-100478.rs new file mode 100644 index 000000000..6bef6ad10 --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-100478.rs @@ -0,0 +1,52 @@ +use std::sync::Arc; +macro_rules! GenT { + ($name:tt) => { + #[derive(Default, Debug)] + struct $name { + #[allow(unused)] + val: i32, + } + + impl $name { + #[allow(unused)] + fn new(val: i32) -> Self { + $name { val } + } + } + }; +} + +GenT!(T1); +GenT!(T2); +GenT!(T3); +GenT!(T4); +GenT!(T5); +GenT!(T6); +GenT!(T7); +GenT!(T8); + +#[allow(unused)] +fn foo(p1: T1, p2: Arc, p3: T3, p4: Arc, p5: T5, p6: T6, p7: T7, p8: Arc) {} +fn three_diff(_a: T1, _b: T2, _c: T3) {} +fn four_shuffle(_a: T1, _b: T2, _c: T3, _d: T4) {} + +fn main() { + three_diff(T2::new(0)); //~ ERROR this function takes + four_shuffle(T3::default(), T4::default(), T1::default(), T2::default()); //~ ERROR 35:5: 35:17: arguments to this function are incorrect [E0308] + four_shuffle(T3::default(), T2::default(), T1::default(), T3::default()); //~ ERROR 36:5: 36:17: arguments to this function are incorrect [E0308] + + let p1 = T1::new(0); + let p2 = Arc::new(T2::new(0)); + let p3 = T3::new(0); + let p4 = Arc::new(T4::new(1)); + let p5 = T5::new(0); + let p6 = T6::new(0); + let p7 = T7::new(0); + let p8 = Arc::default(); + + foo( + //~^ 47:5: 47:8: this function takes 8 arguments but 7 arguments were supplied [E0061] + p1, //p2, + p3, p4, p5, p6, p7, p8, + ); +} diff --git a/src/test/ui/argument-suggestions/issue-100478.stderr b/src/test/ui/argument-suggestions/issue-100478.stderr new file mode 100644 index 000000000..df02a312c --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-100478.stderr @@ -0,0 +1,81 @@ +error[E0061]: this function takes 3 arguments but 1 argument was supplied + --> $DIR/issue-100478.rs:34:5 + | +LL | three_diff(T2::new(0)); + | ^^^^^^^^^^------------ + | || + | |an argument of type `T1` is missing + | an argument of type `T3` is missing + | +note: function defined here + --> $DIR/issue-100478.rs:30:4 + | +LL | fn three_diff(_a: T1, _b: T2, _c: T3) {} + | ^^^^^^^^^^ ------ ------ ------ +help: provide the arguments + | +LL | three_diff(/* T1 */, T2::new(0), /* T3 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-100478.rs:35:5 + | +LL | four_shuffle(T3::default(), T4::default(), T1::default(), T2::default()); + | ^^^^^^^^^^^^ ------------- ------------- ------------- ------------- expected `T4`, found `T2` + | | | | + | | | expected `T3`, found `T1` + | | expected `T2`, found `T4` + | expected `T1`, found `T3` + | +note: function defined here + --> $DIR/issue-100478.rs:31:4 + | +LL | fn four_shuffle(_a: T1, _b: T2, _c: T3, _d: T4) {} + | ^^^^^^^^^^^^ ------ ------ ------ ------ +help: did you mean + | +LL | four_shuffle(T1::default(), T2::default(), T3::default(), T4::default()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +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 `T3`, found `T1` + | expected `T1`, found `T3` + | +note: function defined here + --> $DIR/issue-100478.rs:31:4 + | +LL | fn four_shuffle(_a: T1, _b: T2, _c: T3, _d: T4) {} + | ^^^^^^^^^^^^ ------ ------ ------ ------ +help: swap these arguments + | +LL | four_shuffle(T1::default(), T2::default(), T3::default(), /* T4 */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error[E0061]: this function takes 8 arguments but 7 arguments were supplied + --> $DIR/issue-100478.rs:47:5 + | +LL | foo( + | ^^^ +... +LL | p3, p4, p5, p6, p7, p8, + | -- an argument of type `Arc` is missing + | +note: function defined here + --> $DIR/issue-100478.rs:29:4 + | +LL | fn foo(p1: T1, p2: Arc, p3: T3, p4: Arc, p5: T5, p6: T6, p7: T7, p8: Arc) {} + | ^^^ ------ ----------- ------ ----------- ------ ------ ------ ----------- +help: provide the argument + | +LL | foo(p1, /* Arc */, p3, p4, p5, p6, p7, p8); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0061, E0308. +For more information about an error, try `rustc --explain E0061`. diff --git a/src/test/ui/argument-suggestions/issue-101097.rs b/src/test/ui/argument-suggestions/issue-101097.rs new file mode 100644 index 000000000..7994d3cd9 --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-101097.rs @@ -0,0 +1,21 @@ +struct A; +struct B; +struct C; +struct D; + +fn f( + a1: A, + a2: A, + b1: B, + b2: B, + c1: C, + c2: C, +) {} + +fn main() { + f(C, A, A, A, B, B, C); //~ ERROR this function takes 6 arguments but 7 arguments were supplied [E0061] + f(C, C, A, A, B, B); //~ ERROR arguments to this function are incorrect [E0308] + f(A, A, D, D, B, B); //~ arguments to this function are incorrect [E0308] + f(C, C, B, B, A, A); //~ arguments to this function are incorrect [E0308] + f(C, C, A, B, A, A); //~ arguments to this function are incorrect [E0308] +} diff --git a/src/test/ui/argument-suggestions/issue-101097.stderr b/src/test/ui/argument-suggestions/issue-101097.stderr new file mode 100644 index 000000000..096f8c226 --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-101097.stderr @@ -0,0 +1,160 @@ +error[E0061]: this function takes 6 arguments but 7 arguments were supplied + --> $DIR/issue-101097.rs:16:5 + | +LL | f(C, A, A, A, B, B, C); + | ^ - - - - expected `C`, found `B` + | | | | + | | | argument of type `A` unexpected + | | expected `B`, found `A` + | expected `A`, found `C` + | +note: function defined here + --> $DIR/issue-101097.rs:6:4 + | +LL | fn f( + | ^ +LL | a1: A, + | ----- +LL | a2: A, + | ----- +LL | b1: B, + | ----- +LL | b2: B, + | ----- +LL | c1: C, + | ----- +LL | c2: C, + | ----- +help: did you mean + | +LL | f(A, A, B, B, C, C); + | ~~~~~~~~~~~~~~~~~~ + +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-101097.rs:17:5 + | +LL | f(C, C, A, A, B, B); + | ^ + | +note: function defined here + --> $DIR/issue-101097.rs:6:4 + | +LL | fn f( + | ^ +LL | a1: A, + | ----- +LL | a2: A, + | ----- +LL | b1: B, + | ----- +LL | b2: B, + | ----- +LL | c1: C, + | ----- +LL | c2: C, + | ----- +help: did you mean + | +LL | f(A, A, B, B, C, C); + | ~~~~~~~~~~~~~~~~~~ + +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-101097.rs:18:5 + | +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 + | +note: function defined here + --> $DIR/issue-101097.rs:6:4 + | +LL | fn f( + | ^ +LL | a1: A, + | ----- +LL | a2: A, + | ----- +LL | b1: B, + | ----- +LL | b2: B, + | ----- +LL | c1: C, + | ----- +LL | c2: C, + | ----- +help: did you mean + | +LL | f(A, A, B, B, /* C */, /* C */); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-101097.rs:19:5 + | +LL | f(C, C, B, B, A, A); + | ^ - - - - expected `C`, found `A` + | | | | + | | | expected `C`, found `A` + | | expected `A`, found `C` + | expected `A`, found `C` + | +note: function defined here + --> $DIR/issue-101097.rs:6:4 + | +LL | fn f( + | ^ +LL | a1: A, + | ----- +LL | a2: A, + | ----- +LL | b1: B, + | ----- +LL | b2: B, + | ----- +LL | c1: C, + | ----- +LL | c2: C, + | ----- +help: did you mean + | +LL | f(A, A, B, B, C, C); + | ~~~~~~~~~~~~~~~~~~ + +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-101097.rs:20:5 + | +LL | f(C, C, A, B, A, A); + | ^ - - - - - expected `C`, found `A` + | | | | | + | | | | expected `C`, found `A` + | | | expected struct `B`, found struct `A` + | | expected `A`, found `C` + | expected `A`, found `C` + | +note: function defined here + --> $DIR/issue-101097.rs:6:4 + | +LL | fn f( + | ^ +LL | a1: A, + | ----- +LL | a2: A, + | ----- +LL | b1: B, + | ----- +LL | b2: B, + | ----- +LL | c1: C, + | ----- +LL | c2: C, + | ----- +help: did you mean + | +LL | f(A, A, /* B */, B, C, C); + | ~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0061, E0308. +For more information about an error, try `rustc --explain E0061`. diff --git a/src/test/ui/argument-suggestions/issue-96638.stderr b/src/test/ui/argument-suggestions/issue-96638.stderr index 8af31b8b7..4d18b97c9 100644 --- a/src/test/ui/argument-suggestions/issue-96638.stderr +++ b/src/test/ui/argument-suggestions/issue-96638.stderr @@ -2,7 +2,9 @@ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/issue-96638.rs:8:5 | LL | f(&x, ""); - | ^ -- an argument of type `usize` is missing + | ^ -- -- expected `usize`, found `&str` + | | + | an argument of type `usize` is missing | note: function defined here --> $DIR/issue-96638.rs:1:4 @@ -12,7 +14,7 @@ LL | fn f(_: usize, _: &usize, _: usize) {} help: provide the argument | LL | f(/* usize */, &x, /* usize */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/issue-97197.stderr b/src/test/ui/argument-suggestions/issue-97197.stderr index ac54adc5e..de221ba1f 100644 --- a/src/test/ui/argument-suggestions/issue-97197.stderr +++ b/src/test/ui/argument-suggestions/issue-97197.stderr @@ -12,7 +12,7 @@ LL | pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {} help: provide the arguments | LL | g((), /* bool */, /* bool */, /* bool */, /* bool */, ()); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/issue-97484.stderr b/src/test/ui/argument-suggestions/issue-97484.stderr index 9589e919c..caa50f14b 100644 --- a/src/test/ui/argument-suggestions/issue-97484.stderr +++ b/src/test/ui/argument-suggestions/issue-97484.stderr @@ -2,8 +2,9 @@ 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 - | | | + | ^^^ - - - - argument of type `F` unexpected + | | | | + | | | expected `&E`, found struct `E` | | argument of type `C` unexpected | argument of type `B` unexpected | @@ -19,7 +20,7 @@ LL | foo(&&A, B, C, D, &E, F, G); help: remove the extra arguments | LL | foo(&&A, D, /* &E */, G); - | ~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/issue-98894.stderr b/src/test/ui/argument-suggestions/issue-98894.stderr index 0c8b94901..f64a83ab7 100644 --- a/src/test/ui/argument-suggestions/issue-98894.stderr +++ b/src/test/ui/argument-suggestions/issue-98894.stderr @@ -12,7 +12,7 @@ LL | (|_, ()| ())(if true {} else {return;}); help: provide the argument | LL | (|_, ()| ())(if true {} else {return;}, ()); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/issue-98897.stderr b/src/test/ui/argument-suggestions/issue-98897.stderr index 8f0d98d09..f2c47d353 100644 --- a/src/test/ui/argument-suggestions/issue-98897.stderr +++ b/src/test/ui/argument-suggestions/issue-98897.stderr @@ -12,7 +12,7 @@ LL | (|_, ()| ())([return, ()]); help: provide the argument | LL | (|_, ()| ())([return, ()], ()); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/issue-99482.stderr b/src/test/ui/argument-suggestions/issue-99482.stderr index bc005e82a..bcf36e37c 100644 --- a/src/test/ui/argument-suggestions/issue-99482.stderr +++ b/src/test/ui/argument-suggestions/issue-99482.stderr @@ -12,7 +12,7 @@ LL | let f = |_: (), f: fn()| f; help: provide the argument | LL | let _f = f((), main); - | ~~~~~~~~~~~ + | ~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/argument-suggestions/missing_arguments.stderr b/src/test/ui/argument-suggestions/missing_arguments.stderr index 2509d22d7..ba9ece040 100644 --- a/src/test/ui/argument-suggestions/missing_arguments.stderr +++ b/src/test/ui/argument-suggestions/missing_arguments.stderr @@ -12,7 +12,7 @@ LL | fn one_arg(_a: i32) {} help: provide the argument | LL | one_arg(/* i32 */); - | ~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:14:3 @@ -28,7 +28,7 @@ LL | fn two_same(_a: i32, _b: i32) {} help: provide the arguments | LL | two_same(/* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:15:3 @@ -44,7 +44,7 @@ LL | fn two_same(_a: i32, _b: i32) {} help: provide the argument | LL | two_same(1, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:16:3 @@ -60,7 +60,7 @@ LL | fn two_diff(_a: i32, _b: f32) {} help: provide the arguments | LL | two_diff(/* i32 */, /* f32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:17:3 @@ -76,7 +76,7 @@ LL | fn two_diff(_a: i32, _b: f32) {} help: provide the argument | LL | two_diff(1, /* f32 */); - | ~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:18:3 @@ -92,7 +92,7 @@ LL | fn two_diff(_a: i32, _b: f32) {} help: provide the argument | LL | two_diff(/* i32 */, 1.0); - | ~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:21:3 @@ -108,7 +108,7 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {} help: provide the arguments | LL | three_same(/* i32 */, /* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:22:3 @@ -124,7 +124,7 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {} help: provide the arguments | LL | three_same(1, /* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:23:3 @@ -140,7 +140,7 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {} help: provide the argument | LL | three_same(1, 1, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:26:3 @@ -156,7 +156,7 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} help: provide the argument | LL | three_diff(/* i32 */, 1.0, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:27:3 @@ -172,7 +172,7 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} help: provide the argument | LL | three_diff(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:28:3 @@ -188,7 +188,7 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} help: provide the argument | LL | three_diff(1, 1.0, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:29:3 @@ -204,7 +204,7 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} help: provide the arguments | LL | three_diff(/* i32 */, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:30:3 @@ -223,7 +223,7 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} help: provide the arguments | LL | three_diff(/* i32 */, 1.0, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:31:3 @@ -239,7 +239,7 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} help: provide the arguments | LL | three_diff(1, /* f32 */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 4 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:34:3 @@ -255,7 +255,7 @@ LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {} help: provide the arguments | LL | four_repeated(/* i32 */, /* f32 */, /* f32 */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 4 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:35:3 @@ -271,7 +271,7 @@ LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {} help: provide the arguments | LL | four_repeated(1, /* f32 */, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 5 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:38:3 @@ -287,7 +287,7 @@ LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {} help: provide the arguments | LL | complex(/* i32 */, /* f32 */, /* i32 */, /* f32 */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 5 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:39:3 @@ -303,7 +303,7 @@ LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {} help: provide the arguments | LL | complex(1, /* f32 */, /* i32 */, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 19 previous errors diff --git a/src/test/ui/argument-suggestions/mixed_cases.stderr b/src/test/ui/argument-suggestions/mixed_cases.stderr index a52a30d78..8c525db1a 100644 --- a/src/test/ui/argument-suggestions/mixed_cases.stderr +++ b/src/test/ui/argument-suggestions/mixed_cases.stderr @@ -14,7 +14,7 @@ LL | fn two_args(_a: i32, _b: f32) {} help: remove the extra argument | LL | two_args(1, /* f32 */); - | ~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 4 arguments were supplied --> $DIR/mixed_cases.rs:11:3 @@ -33,7 +33,7 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} help: did you mean | LL | three_args(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/mixed_cases.rs:14:3 @@ -52,7 +52,7 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} help: provide the argument | LL | three_args(1, /* f32 */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/mixed_cases.rs:17:3 @@ -70,7 +70,7 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} help: did you mean | LL | three_args(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/mixed_cases.rs:20:3 @@ -89,7 +89,7 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} help: swap these arguments | LL | three_args(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/mixed_cases.rs:23:3 @@ -109,7 +109,7 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} help: did you mean | LL | three_args(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 6 previous errors diff --git a/src/test/ui/argument-suggestions/permuted_arguments.stderr b/src/test/ui/argument-suggestions/permuted_arguments.stderr index f16d22860..655807a7f 100644 --- a/src/test/ui/argument-suggestions/permuted_arguments.stderr +++ b/src/test/ui/argument-suggestions/permuted_arguments.stderr @@ -15,7 +15,7 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} help: reorder these arguments | LL | three_args(1, 1.0, ""); - | ~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/permuted_arguments.rs:12:3 @@ -36,7 +36,7 @@ LL | fn many_args(_a: i32, _b: f32, _c: &str, _d: X, _e: Y) {} help: reorder these arguments | LL | many_args(1, 1.0, "", X {}, Y {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/test/ui/argument-suggestions/swapped_arguments.stderr b/src/test/ui/argument-suggestions/swapped_arguments.stderr index a90792d0c..dabf5e952 100644 --- a/src/test/ui/argument-suggestions/swapped_arguments.stderr +++ b/src/test/ui/argument-suggestions/swapped_arguments.stderr @@ -14,7 +14,7 @@ LL | fn two_args(_a: i32, _b: f32) {} help: swap these arguments | LL | two_args(1, 1.0); - | ~~~~~~~~~~~~~~~~ + | ~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/swapped_arguments.rs:9:3 @@ -32,7 +32,7 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} help: swap these arguments | LL | three_args(1, 1.0, ""); - | ~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/swapped_arguments.rs:10:3 @@ -50,7 +50,7 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} help: swap these arguments | LL | three_args(1, 1.0, ""); - | ~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/swapped_arguments.rs:11:3 @@ -68,7 +68,7 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {} help: swap these arguments | LL | three_args(1, 1.0, ""); - | ~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~ error[E0308]: arguments to this function are incorrect --> $DIR/swapped_arguments.rs:13:3 @@ -88,7 +88,7 @@ LL | fn four_args(_a: i32, _b: f32, _c: &str, _d: X) {} help: did you mean | LL | four_args(1, 1.0, "", X {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/test/ui/argument-suggestions/too-long.rs b/src/test/ui/argument-suggestions/too-long.rs new file mode 100644 index 000000000..7ec56afae --- /dev/null +++ b/src/test/ui/argument-suggestions/too-long.rs @@ -0,0 +1,41 @@ +struct Qux; + +impl Qux { + fn foo( + &self, + a: i32, + b: i32, + c: i32, + d: i32, + e: i32, + f: i32, + g: i32, + h: i32, + i: i32, + j: i32, + k: i32, + l: i32, + ) { + } +} + +fn what( + qux: &Qux, + a: i32, + b: i32, + c: i32, + d: i32, + e: i32, + f: &i32, + g: i32, + h: i32, + i: i32, + j: i32, + k: i32, + l: i32, +) { + qux.foo(a, b, c, d, e, f, g, h, i, j, k, l); + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/src/test/ui/argument-suggestions/too-long.stderr b/src/test/ui/argument-suggestions/too-long.stderr new file mode 100644 index 000000000..bd430194c --- /dev/null +++ b/src/test/ui/argument-suggestions/too-long.stderr @@ -0,0 +1,24 @@ +error[E0308]: mismatched types + --> $DIR/too-long.rs:37:28 + | +LL | qux.foo(a, b, c, d, e, f, g, h, i, j, k, l); + | --- ^ expected `i32`, found `&i32` + | | + | arguments to this function are incorrect + | +note: associated function defined here + --> $DIR/too-long.rs:4:8 + | +LL | fn foo( + | ^^^ +... +LL | f: i32, + | ------ +help: consider dereferencing the borrow + | +LL | qux.foo(a, b, c, d, e, *f, g, h, i, j, k, l); + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/argument-suggestions/two-mismatch-notes.rs b/src/test/ui/argument-suggestions/two-mismatch-notes.rs new file mode 100644 index 000000000..1309041ab --- /dev/null +++ b/src/test/ui/argument-suggestions/two-mismatch-notes.rs @@ -0,0 +1,11 @@ +#[derive(Copy, Clone)] +struct Wrapper(T); + +fn foo(_: fn(i32), _: Wrapper) {} + +fn f(_: u32) {} + +fn main() { + let w = Wrapper::(1isize); + foo(f, w); //~ ERROR arguments to this function are incorrect +} diff --git a/src/test/ui/argument-suggestions/two-mismatch-notes.stderr b/src/test/ui/argument-suggestions/two-mismatch-notes.stderr new file mode 100644 index 000000000..7873cf964 --- /dev/null +++ b/src/test/ui/argument-suggestions/two-mismatch-notes.stderr @@ -0,0 +1,29 @@ +error[E0308]: arguments to this function are incorrect + --> $DIR/two-mismatch-notes.rs:10:5 + | +LL | foo(f, w); + | ^^^ + | +note: expected `i32`, found `u32` + --> $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` + --> $DIR/two-mismatch-notes.rs:10:12 + | +LL | foo(f, w); + | ^ + = note: expected struct `Wrapper` + found struct `Wrapper` +note: function defined here + --> $DIR/two-mismatch-notes.rs:4:4 + | +LL | fn foo(_: fn(i32), _: Wrapper) {} + | ^^^ ---------- --------------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/array-slice-vec/suggest-array-length.fixed b/src/test/ui/array-slice-vec/suggest-array-length.fixed new file mode 100644 index 000000000..867c18a7d --- /dev/null +++ b/src/test/ui/array-slice-vec/suggest-array-length.fixed @@ -0,0 +1,26 @@ +// run-rustfix +#![allow(unused_variables, dead_code, non_upper_case_globals)] + +fn main() { + const Foo: [i32; 3] = [1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + const REF_FOO: &[u8; 1] = &[1]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let foo: [i32; 3] = [1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let bar: [i32; 3] = [0; 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let ref_foo: &[i32; 3] = &[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let ref_bar: &[i32; 3] = &[0; 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let multiple_ref_foo: &&[i32; 3] = &&[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable +} diff --git a/src/test/ui/array-slice-vec/suggest-array-length.rs b/src/test/ui/array-slice-vec/suggest-array-length.rs new file mode 100644 index 000000000..f66b3d4a8 --- /dev/null +++ b/src/test/ui/array-slice-vec/suggest-array-length.rs @@ -0,0 +1,26 @@ +// run-rustfix +#![allow(unused_variables, dead_code, non_upper_case_globals)] + +fn main() { + const Foo: [i32; _] = [1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + const REF_FOO: &[u8; _] = &[1]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let foo: [i32; _] = [1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let bar: [i32; _] = [0; 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let ref_foo: &[i32; _] = &[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let ref_bar: &[i32; _] = &[0; 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable +} diff --git a/src/test/ui/array-slice-vec/suggest-array-length.stderr b/src/test/ui/array-slice-vec/suggest-array-length.stderr new file mode 100644 index 000000000..16c90a047 --- /dev/null +++ b/src/test/ui/array-slice-vec/suggest-array-length.stderr @@ -0,0 +1,108 @@ +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:11:20 + | +LL | let foo: [i32; _] = [1, 2, 3]; + | ^ `_` not allowed here + +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:14:20 + | +LL | let bar: [i32; _] = [0; 3]; + | ^ `_` not allowed here + +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:17:25 + | +LL | let ref_foo: &[i32; _] = &[1, 2, 3]; + | ^ `_` not allowed here + +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:20:25 + | +LL | let ref_bar: &[i32; _] = &[0; 3]; + | ^ `_` not allowed here + +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:23:35 + | +LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; + | ^ `_` not allowed here + +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:5:22 + | +LL | const Foo: [i32; _] = [1, 2, 3]; + | ^ `_` not allowed here + +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/suggest-array-length.rs:8:26 + | +LL | const REF_FOO: &[u8; _] = &[1]; + | ^ `_` not allowed here + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:5:22 + | +LL | const Foo: [i32; _] = [1, 2, 3]; + | ^ help: consider specifying the array length: `3` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:8:26 + | +LL | const REF_FOO: &[u8; _] = &[1]; + | ^ help: consider specifying the array length: `1` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:11:20 + | +LL | let foo: [i32; _] = [1, 2, 3]; + | ^ help: consider specifying the array length: `3` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:14:20 + | +LL | let bar: [i32; _] = [0; 3]; + | ^ help: consider specifying the array length: `3` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:17:25 + | +LL | let ref_foo: &[i32; _] = &[1, 2, 3]; + | ^ help: consider specifying the array length: `3` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:20:25 + | +LL | let ref_bar: &[i32; _] = &[0; 3]; + | ^ help: consider specifying the array length: `3` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/suggest-array-length.rs:23:35 + | +LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; + | ^ help: consider specifying the array length: `3` + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error: aborting due to 14 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/asm/aarch64/may_unwind.rs b/src/test/ui/asm/aarch64/may_unwind.rs index ac8cc6202..dfd891b42 100644 --- a/src/test/ui/asm/aarch64/may_unwind.rs +++ b/src/test/ui/asm/aarch64/may_unwind.rs @@ -1,4 +1,3 @@ -// min-llvm-version: 13.0.0 // only-aarch64 // run-pass // needs-asm-support diff --git a/src/test/ui/asm/aarch64/type-check-3.stderr b/src/test/ui/asm/aarch64/type-check-3.stderr index b320abdc0..49292982e 100644 --- a/src/test/ui/asm/aarch64/type-check-3.stderr +++ b/src/test/ui/asm/aarch64/type-check-3.stderr @@ -5,8 +5,8 @@ LL | asm!("{}", in(reg) 0u8); | ^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:50:15 @@ -14,8 +14,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(reg) 0u16); | ^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:52:15 @@ -23,8 +23,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(reg) 0i32); | ^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:54:15 @@ -32,8 +32,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(reg) 0f32); | ^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:57:15 @@ -41,8 +41,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(vreg) 0i16); | ^^ ---- for this argument | - = help: use the `h` modifier to have the register formatted as `h0` - = help: or use the `v` modifier to keep the default formatting of `v0` + = help: use `{0:h}` to have the register formatted as `h0` + = help: or use `{0:v}` to keep the default formatting of `v0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:59:15 @@ -50,8 +50,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(vreg) 0f32); | ^^ ---- for this argument | - = help: use the `s` modifier to have the register formatted as `s0` - = help: or use the `v` modifier to keep the default formatting of `v0` + = help: use `{0:s}` to have the register formatted as `s0` + = help: or use `{0:v}` to keep the default formatting of `v0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:61:15 @@ -59,8 +59,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(vreg) 0f64); | ^^ ---- for this argument | - = help: use the `d` modifier to have the register formatted as `d0` - = help: or use the `v` modifier to keep the default formatting of `v0` + = help: use `{0:d}` to have the register formatted as `d0` + = help: or use `{0:v}` to keep the default formatting of `v0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:63:15 @@ -68,8 +68,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(vreg_low16) 0f64); | ^^ ---- for this argument | - = help: use the `d` modifier to have the register formatted as `d0` - = help: or use the `v` modifier to keep the default formatting of `v0` + = help: use `{0:d}` to have the register formatted as `d0` + = help: or use `{0:v}` to keep the default formatting of `v0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:66:15 @@ -77,8 +77,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{0} {0}", in(reg) 0i16); | ^^^ ^^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:68:15 @@ -86,8 +86,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{0} {0:x}", in(reg) 0i16); | ^^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` error: type `i128` cannot be used with this register class --> $DIR/type-check-3.rs:73:28 diff --git a/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr b/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr index 7ef93e15f..5dac693cc 100644 --- a/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr +++ b/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` error: aborting due to 21 previous errors; 1 warning emitted diff --git a/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr b/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr index 7ef93e15f..5dac693cc 100644 --- a/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr +++ b/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` error: aborting due to 21 previous errors; 1 warning emitted diff --git a/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr b/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr index 250bc3be4..b29b74bac 100644 --- a/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr +++ b/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `e` modifier to have the register formatted as `eax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:e}` to have the register formatted as `eax` + = help: or use `{0:r}` to keep the default formatting of `rax` error: aborting due to 21 previous errors; 1 warning emitted diff --git a/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr b/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr index 250bc3be4..b29b74bac 100644 --- a/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr +++ b/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `e` modifier to have the register formatted as `eax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:e}` to have the register formatted as `eax` + = help: or use `{0:r}` to keep the default formatting of `rax` error: aborting due to 21 previous errors; 1 warning emitted diff --git a/src/test/ui/asm/may_unwind.rs b/src/test/ui/asm/may_unwind.rs index 117c0a63a..b9479c44b 100644 --- a/src/test/ui/asm/may_unwind.rs +++ b/src/test/ui/asm/may_unwind.rs @@ -1,4 +1,3 @@ -// min-llvm-version: 13.0.0 // run-pass // needs-asm-support diff --git a/src/test/ui/asm/naked-functions.stderr b/src/test/ui/asm/naked-functions.stderr index 1828066b6..f90967fbe 100644 --- a/src/test/ui/asm/naked-functions.stderr +++ b/src/test/ui/asm/naked-functions.stderr @@ -57,13 +57,11 @@ LL | a + 1 error[E0787]: naked functions must contain a single asm block --> $DIR/naked-functions.rs:33:1 | -LL | / pub unsafe extern "C" fn inc(a: u32) -> u32 { -LL | | -LL | | a + 1 - | | ----- non-asm is unsupported in naked functions -LL | | -LL | | } - | |_^ +LL | pub unsafe extern "C" fn inc(a: u32) -> u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | a + 1 + | ----- non-asm is unsupported in naked functions error: referencing function parameters is not allowed in naked functions --> $DIR/naked-functions.rs:42:31 @@ -82,12 +80,11 @@ LL | asm!("/* {0} */", in(reg) a, options(noreturn)); error[E0787]: naked functions must contain a single asm block --> $DIR/naked-functions.rs:48:1 | -LL | / pub unsafe extern "C" fn inc_closure(a: u32) -> u32 { -LL | | -LL | | (|| a + 1)() - | | ------------ non-asm is unsupported in naked functions -LL | | } - | |_^ +LL | pub unsafe extern "C" fn inc_closure(a: u32) -> u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | (|| a + 1)() + | ------------ non-asm is unsupported in naked functions error[E0787]: only `const` and `sym` operands are supported in naked functions --> $DIR/naked-functions.rs:65:10 @@ -124,30 +121,25 @@ LL | sym G, options(noreturn), error[E0787]: naked functions must contain a single asm block --> $DIR/naked-functions.rs:54:1 | -LL | / pub unsafe extern "C" fn unsupported_operands() { -LL | | -LL | | let mut a = 0usize; - | | ------------------- non-asm is unsupported in naked functions -LL | | let mut b = 0usize; - | | ------------------- non-asm is unsupported in naked functions -LL | | let mut c = 0usize; - | | ------------------- non-asm is unsupported in naked functions -LL | | let mut d = 0usize; - | | ------------------- non-asm is unsupported in naked functions -LL | | let mut e = 0usize; - | | ------------------- non-asm is unsupported in naked functions -... | -LL | | ); -LL | | } - | |_^ +LL | pub unsafe extern "C" fn unsupported_operands() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | let mut a = 0usize; + | ------------------- non-asm is unsupported in naked functions +LL | let mut b = 0usize; + | ------------------- non-asm is unsupported in naked functions +LL | let mut c = 0usize; + | ------------------- non-asm is unsupported in naked functions +LL | let mut d = 0usize; + | ------------------- non-asm is unsupported in naked functions +LL | let mut e = 0usize; + | ------------------- non-asm is unsupported in naked functions error[E0787]: naked functions must contain a single asm block --> $DIR/naked-functions.rs:77:1 | -LL | / pub extern "C" fn missing_assembly() { -LL | | -LL | | } - | |_^ +LL | pub extern "C" fn missing_assembly() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0787]: asm in naked functions must use `noreturn` option --> $DIR/naked-functions.rs:84:5 @@ -185,20 +177,17 @@ LL | asm!("", options(noreturn)); error[E0787]: naked functions must contain a single asm block --> $DIR/naked-functions.rs:82:1 | -LL | / pub extern "C" fn too_many_asm_blocks() { -LL | | -LL | | asm!(""); -LL | | -LL | | asm!(""); - | | -------- multiple asm blocks are unsupported in naked functions -LL | | -LL | | asm!(""); - | | -------- multiple asm blocks are unsupported in naked functions -LL | | -LL | | asm!("", options(noreturn)); - | | --------------------------- multiple asm blocks are unsupported in naked functions -LL | | } - | |_^ +LL | pub extern "C" fn too_many_asm_blocks() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | asm!(""); + | -------- multiple asm blocks are unsupported in naked functions +LL | +LL | asm!(""); + | -------- multiple asm blocks are unsupported in naked functions +LL | +LL | asm!("", options(noreturn)); + | --------------------------- multiple asm blocks are unsupported in naked functions error: referencing function parameters is not allowed in naked functions --> $DIR/naked-functions.rs:97:11 @@ -211,13 +200,11 @@ LL | *&y error[E0787]: naked functions must contain a single asm block --> $DIR/naked-functions.rs:95:5 | -LL | / pub extern "C" fn inner(y: usize) -> usize { -LL | | -LL | | *&y - | | --- non-asm is unsupported in naked functions -LL | | -LL | | } - | |_____^ +LL | pub extern "C" fn inner(y: usize) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | *&y + | --- non-asm is unsupported in naked functions error[E0787]: asm options unsupported in naked functions: `nomem`, `preserves_flags` --> $DIR/naked-functions.rs:105:5 @@ -249,18 +236,18 @@ LL | asm!("", options(noreturn, may_unwind)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: Rust ABI is unsupported in naked functions - --> $DIR/naked-functions.rs:124:15 + --> $DIR/naked-functions.rs:124:1 | LL | pub unsafe fn default_abi() { - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(undefined_naked_function_abi)]` on by default warning: Rust ABI is unsupported in naked functions - --> $DIR/naked-functions.rs:130:15 + --> $DIR/naked-functions.rs:130:1 | LL | pub unsafe fn rust_abi() { - | ^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: naked functions cannot be inlined --> $DIR/naked-functions.rs:170:1 diff --git a/src/test/ui/asm/type-check-1.stderr b/src/test/ui/asm/type-check-1.stderr index 162ff1d32..184513965 100644 --- a/src/test/ui/asm/type-check-1.stderr +++ b/src/test/ui/asm/type-check-1.stderr @@ -106,7 +106,7 @@ error[E0308]: mismatched types --> $DIR/type-check-1.rs:60:26 | LL | asm!("{}", const 0 as *mut u8); - | ^^^^^^^^^^^^ expected integer, found *-ptr + | ^^^^^^^^^^^^ expected integer, found `*mut u8` | = note: expected type `{integer}` found raw pointer `*mut u8` @@ -133,7 +133,7 @@ error[E0308]: mismatched types --> $DIR/type-check-1.rs:78:25 | LL | global_asm!("{}", const 0 as *mut u8); - | ^^^^^^^^^^^^ expected integer, found *-ptr + | ^^^^^^^^^^^^ expected integer, found `*mut u8` | = note: expected type `{integer}` found raw pointer `*mut u8` diff --git a/src/test/ui/asm/unpretty-expanded.rs b/src/test/ui/asm/unpretty-expanded.rs new file mode 100644 index 000000000..6128f49b8 --- /dev/null +++ b/src/test/ui/asm/unpretty-expanded.rs @@ -0,0 +1,3 @@ +// check-pass +// compile-flags: -Zunpretty=expanded +core::arch::global_asm!("x: .byte 42"); diff --git a/src/test/ui/asm/unpretty-expanded.stdout b/src/test/ui/asm/unpretty-expanded.stdout new file mode 100644 index 000000000..15b60d155 --- /dev/null +++ b/src/test/ui/asm/unpretty-expanded.stdout @@ -0,0 +1,9 @@ +#![feature(prelude_import)] +#![no_std] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +// check-pass +// compile-flags: -Zunpretty=expanded +global_asm! ("x: .byte 42"); diff --git a/src/test/ui/asm/x86_64/may_unwind.rs b/src/test/ui/asm/x86_64/may_unwind.rs index 9844d63f0..2f5d1a360 100644 --- a/src/test/ui/asm/x86_64/may_unwind.rs +++ b/src/test/ui/asm/x86_64/may_unwind.rs @@ -1,7 +1,7 @@ -// min-llvm-version: 13.0.0 // only-x86_64 // run-pass // needs-asm-support +// needs-unwind #![feature(asm_sym, asm_unwind)] diff --git a/src/test/ui/asm/x86_64/sym.rs b/src/test/ui/asm/x86_64/sym.rs index 622365bc7..447e11e6e 100644 --- a/src/test/ui/asm/x86_64/sym.rs +++ b/src/test/ui/asm/x86_64/sym.rs @@ -1,4 +1,3 @@ -// min-llvm-version: 12.0.1 // only-x86_64 // only-linux // needs-asm-support diff --git a/src/test/ui/asm/x86_64/type-check-3.stderr b/src/test/ui/asm/x86_64/type-check-3.stderr index b38ea8cc4..366038fea 100644 --- a/src/test/ui/asm/x86_64/type-check-3.stderr +++ b/src/test/ui/asm/x86_64/type-check-3.stderr @@ -45,8 +45,8 @@ LL | asm!("{0} {0}", in(reg) 0i16); | ^^^ ^^^ ---- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `x` modifier to have the register formatted as `ax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:x}` to have the register formatted as `ax` + = help: or use `{0:r}` to keep the default formatting of `rax` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:36:15 @@ -54,8 +54,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{0} {0:x}", in(reg) 0i16); | ^^^ ---- for this argument | - = help: use the `x` modifier to have the register formatted as `ax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:x}` to have the register formatted as `ax` + = help: or use `{0:r}` to keep the default formatting of `rax` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:38:15 @@ -63,8 +63,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(reg) 0i32); | ^^ ---- for this argument | - = help: use the `e` modifier to have the register formatted as `eax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:e}` to have the register formatted as `eax` + = help: or use `{0:r}` to keep the default formatting of `rax` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:41:15 @@ -72,8 +72,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(ymm_reg) 0i64); | ^^ ---- for this argument | - = help: use the `x` modifier to have the register formatted as `xmm0` - = help: or use the `y` modifier to keep the default formatting of `ymm0` + = help: use `{0:x}` to have the register formatted as `xmm0` + = help: or use `{0:y}` to keep the default formatting of `ymm0` error: type `i8` cannot be used with this register class --> $DIR/type-check-3.rs:52:28 diff --git a/src/test/ui/associated-consts/defaults-cyclic-fail.stderr b/src/test/ui/associated-consts/defaults-cyclic-fail.stderr index 582473905..c4cd9c2a4 100644 --- a/src/test/ui/associated-consts/defaults-cyclic-fail.stderr +++ b/src/test/ui/associated-consts/defaults-cyclic-fail.stderr @@ -2,13 +2,13 @@ error[E0391]: cycle detected when const-evaluating + checking `Tr::A` --> $DIR/defaults-cyclic-fail.rs:5:5 | LL | const A: u8 = Self::B; - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `Tr::B`... --> $DIR/defaults-cyclic-fail.rs:8:5 | LL | const B: u8 = Self::A; - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires const-evaluating + checking `Tr::A`, completing the cycle note: cycle used when const-evaluating + checking `main::promoted[1]` --> $DIR/defaults-cyclic-fail.rs:16:16 diff --git a/src/test/ui/associated-consts/issue-102335-const.rs b/src/test/ui/associated-consts/issue-102335-const.rs new file mode 100644 index 000000000..f60cb92da --- /dev/null +++ b/src/test/ui/associated-consts/issue-102335-const.rs @@ -0,0 +1,12 @@ +#![feature(associated_const_equality)] + +trait T { + type A: S = 34>; + //~^ ERROR associated type bindings are not allowed here +} + +trait S { + const C: i32; +} + +fn main() {} diff --git a/src/test/ui/associated-consts/issue-102335-const.stderr b/src/test/ui/associated-consts/issue-102335-const.stderr new file mode 100644 index 000000000..531d15c59 --- /dev/null +++ b/src/test/ui/associated-consts/issue-102335-const.stderr @@ -0,0 +1,9 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-102335-const.rs:4:17 + | +LL | type A: S = 34>; + | ^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. diff --git a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr index 51a50cfda..c8c57bccb 100644 --- a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr +++ b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr @@ -13,7 +13,7 @@ note: ...which requires const-evaluating + checking `IMPL_REF_BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1 | LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires const-evaluating + checking `::BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5 | diff --git a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr index b9d1808fe..76ed8d4a6 100644 --- a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr +++ b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr @@ -13,7 +13,7 @@ note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1 | LL | const DEFAULT_REF_BAR: u32 = ::BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires const-evaluating + checking `FooDefault::BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5 | diff --git a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr index 271e69206..6a98f08f3 100644 --- a/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr +++ b/src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr @@ -13,7 +13,7 @@ note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1 | LL | const TRAIT_REF_BAR: u32 = ::BAR; - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires const-evaluating + checking `::BAR`... --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5 | diff --git a/src/test/ui/associated-type-bounds/binder-on-bound.rs b/src/test/ui/associated-type-bounds/binder-on-bound.rs index 0b4b24b98..6cba45129 100644 --- a/src/test/ui/associated-type-bounds/binder-on-bound.rs +++ b/src/test/ui/associated-type-bounds/binder-on-bound.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Trait { type Bound<'a>; } diff --git a/src/test/ui/associated-type-bounds/binder-on-bound.stderr b/src/test/ui/associated-type-bounds/binder-on-bound.stderr index 3432672e0..f71f72bfb 100644 --- a/src/test/ui/associated-type-bounds/binder-on-bound.stderr +++ b/src/test/ui/associated-type-bounds/binder-on-bound.stderr @@ -1,5 +1,5 @@ error: `for<...>` is not allowed on associated type bounds - --> $DIR/binder-on-bound.rs:7:22 + --> $DIR/binder-on-bound.rs:5:22 | LL | fn foo() where Trait Bound<'a> = &'a ()> { | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-type-bounds/elision.rs b/src/test/ui/associated-type-bounds/elision.rs index 4a5339399..d00def571 100644 --- a/src/test/ui/associated-type-bounds/elision.rs +++ b/src/test/ui/associated-type-bounds/elision.rs @@ -1,7 +1,7 @@ #![feature(associated_type_bounds)] #![feature(anonymous_lifetime_in_impl_trait)] -// The same thing should happen for constaints in dyn trait. +// The same thing should happen for constraints in dyn trait. fn f(x: &mut dyn Iterator>) -> Option<&'_ ()> { x.next() } //~^ ERROR missing lifetime specifier //~| ERROR mismatched types diff --git a/src/test/ui/associated-type-bounds/issue-102335-ty.rs b/src/test/ui/associated-type-bounds/issue-102335-ty.rs new file mode 100644 index 000000000..363df73c1 --- /dev/null +++ b/src/test/ui/associated-type-bounds/issue-102335-ty.rs @@ -0,0 +1,12 @@ +trait T { + type A: S = ()>; + //~^ ERROR associated type bindings are not allowed here +} + +trait Q {} + +trait S { + type C: Q; +} + +fn main() {} diff --git a/src/test/ui/associated-type-bounds/issue-102335-ty.stderr b/src/test/ui/associated-type-bounds/issue-102335-ty.stderr new file mode 100644 index 000000000..8777b2965 --- /dev/null +++ b/src/test/ui/associated-type-bounds/issue-102335-ty.stderr @@ -0,0 +1,9 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-102335-ty.rs:2:17 + | +LL | type A: S = ()>; + | ^^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. diff --git a/src/test/ui/associated-type-bounds/issue-79949.rs b/src/test/ui/associated-type-bounds/issue-79949.rs index 9f924f1fd..9dd37f981 100644 --- a/src/test/ui/associated-type-bounds/issue-79949.rs +++ b/src/test/ui/associated-type-bounds/issue-79949.rs @@ -2,7 +2,6 @@ #![allow(incomplete_features)] #![feature(associated_type_bounds)] -#![feature(generic_associated_types)] trait MP { type T<'a>; diff --git a/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr b/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr index b904ad102..e761c6c62 100644 --- a/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr +++ b/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr @@ -10,7 +10,7 @@ note: function defined here --> $DIR/associated-type-projection-from-supertrait.rs:25:4 | LL | fn dent(c: C, color: C::Color) { c.chip_paint(color) } - | ^^^^ ---- --------------- + | ^^^^ --------------- error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:28:23 @@ -24,7 +24,7 @@ note: function defined here --> $DIR/associated-type-projection-from-supertrait.rs:25:4 | LL | fn dent(c: C, color: C::Color) { c.chip_paint(color) } - | ^^^^ ---- --------------- + | ^^^^ --------------- error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:32:28 @@ -38,7 +38,7 @@ note: associated function defined here --> $DIR/associated-type-projection-from-supertrait.rs:12:8 | LL | fn chip_paint(&self, c: Self::Color) { } - | ^^^^^^^^^^ ----- -------------- + | ^^^^^^^^^^ -------------- error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:33:28 @@ -52,7 +52,7 @@ note: associated function defined here --> $DIR/associated-type-projection-from-supertrait.rs:12:8 | LL | fn chip_paint(&self, c: Self::Color) { } - | ^^^^^^^^^^ ----- -------------- + | ^^^^^^^^^^ -------------- error: aborting due to 4 previous errors diff --git a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr index 0cccc6b38..a777e064f 100644 --- a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr @@ -1,8 +1,10 @@ error[E0271]: type mismatch resolving `::Color == Blue` - --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:31:10 + --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:31:19 | LL | fn b() { blue_car(ModelT); } - | ^^^^^^^^ type mismatch resolving `::Color == Blue` + | -------- ^^^^^^ type mismatch resolving `::Color == Blue` + | | + | required by a bound introduced by this call | note: expected this to be `Blue` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:16:40 @@ -16,10 +18,12 @@ LL | fn blue_car>(c: C) { | ^^^^^^^^^^ required by this bound in `blue_car` error[E0271]: type mismatch resolving `::Color == Black` - --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:10 + --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:20 | LL | fn c() { black_car(ModelU); } - | ^^^^^^^^^ type mismatch resolving `::Color == Black` + | --------- ^^^^^^ type mismatch resolving `::Color == Black` + | | + | required by a bound introduced by this call | note: expected this to be `Black` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:21:40 diff --git a/src/test/ui/associated-types/associated-types-eq-3.stderr b/src/test/ui/associated-types/associated-types-eq-3.stderr index bed63a5e6..fbe1a1ee8 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.stderr +++ b/src/test/ui/associated-types/associated-types-eq-3.stderr @@ -14,10 +14,12 @@ LL | fn foo2>(x: I) { | +++++++++ error[E0271]: type mismatch resolving `::A == Bar` - --> $DIR/associated-types-eq-3.rs:38:5 + --> $DIR/associated-types-eq-3.rs:38:10 | LL | foo1(a); - | ^^^^ type mismatch resolving `::A == Bar` + | ---- ^ type mismatch resolving `::A == Bar` + | | + | required by a bound introduced by this call | note: expected this to be `Bar` --> $DIR/associated-types-eq-3.rs:12:14 diff --git a/src/test/ui/associated-types/associated-types-eq-hr.stderr b/src/test/ui/associated-types/associated-types-eq-hr.stderr index b306ae273..6cff403b3 100644 --- a/src/test/ui/associated-types/associated-types-eq-hr.stderr +++ b/src/test/ui/associated-types/associated-types-eq-hr.stderr @@ -1,8 +1,8 @@ error[E0271]: type mismatch resolving `for<'x> >::A == &'x isize` - --> $DIR/associated-types-eq-hr.rs:87:5 + --> $DIR/associated-types-eq-hr.rs:87:11 | LL | foo::(); - | ^^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> >::A == &'x isize` + | ^^^^^^^^^^ type mismatch resolving `for<'x> >::A == &'x isize` | note: expected this to be `&isize` --> $DIR/associated-types-eq-hr.rs:26:14 @@ -21,10 +21,10 @@ 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` - --> $DIR/associated-types-eq-hr.rs:91:5 + --> $DIR/associated-types-eq-hr.rs:91:11 | LL | bar::(); - | ^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> >::A == &'x usize` + | ^^^^^^^^^ type mismatch resolving `for<'x> >::A == &'x usize` | note: expected this to be `&usize` --> $DIR/associated-types-eq-hr.rs:14:14 diff --git a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr index 6552c8be7..389cc7bed 100644 --- a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr +++ b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `Self: Get` is not satisfied - --> $DIR/associated-types-for-unimpl-trait.rs:10:40 + --> $DIR/associated-types-for-unimpl-trait.rs:10:5 | LL | fn uhoh(&self, foo: U, bar: ::Value) {} - | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | help: consider further restricting `Self` | diff --git a/src/test/ui/associated-types/associated-types-issue-20346.stderr b/src/test/ui/associated-types/associated-types-issue-20346.stderr index a67cf9928..b1708b96e 100644 --- a/src/test/ui/associated-types/associated-types-issue-20346.stderr +++ b/src/test/ui/associated-types/associated-types-issue-20346.stderr @@ -1,11 +1,13 @@ error[E0271]: type mismatch resolving ` as Iterator>::Item == Option` - --> $DIR/associated-types-issue-20346.rs:34:5 + --> $DIR/associated-types-issue-20346.rs:34:36 | LL | fn test_adapter>>(it: I) { | - this type parameter ... LL | is_iterator_of::, _>(&adapter); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving ` as Iterator>::Item == Option` + | ------------------------------ ^^^^^^^^ type mismatch resolving ` as Iterator>::Item == Option` + | | + | required by a bound introduced by this call | note: expected this to be `Option` --> $DIR/associated-types-issue-20346.rs:23:17 diff --git a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr index 922cf88a0..89cdba524 100644 --- a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr +++ b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr @@ -1,8 +1,10 @@ error[E0271]: type mismatch resolving `::Y == i32` - --> $DIR/associated-types-multiple-types-one-trait.rs:13:5 + --> $DIR/associated-types-multiple-types-one-trait.rs:13:12 | LL | want_y(t); - | ^^^^^^ expected `i32`, found associated type + | ------ ^ expected `i32`, found associated type + | | + | required by a bound introduced by this call | = note: expected type `i32` found associated type `::Y` @@ -17,10 +19,12 @@ LL | fn have_x_want_y>(t: &T) | +++++++++ error[E0271]: type mismatch resolving `::X == u32` - --> $DIR/associated-types-multiple-types-one-trait.rs:18:5 + --> $DIR/associated-types-multiple-types-one-trait.rs:18:12 | LL | want_x(t); - | ^^^^^^ expected `u32`, found associated type + | ------ ^ expected `u32`, found associated type + | | + | required by a bound introduced by this call | = note: expected type `u32` found associated type `::X` diff --git a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr index b2ee1b5e6..1feaa612e 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `T: Get` is not satisfied - --> $DIR/associated-types-no-suitable-bound.rs:11:21 + --> $DIR/associated-types-no-suitable-bound.rs:11:5 | LL | fn uhoh(foo: ::Value) {} - | ^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` | help: consider restricting type parameter `T` | diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr index 2e40dbd06..cc3ed5561 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `Self: Get` is not satisfied - --> $DIR/associated-types-no-suitable-supertrait-2.rs:17:40 + --> $DIR/associated-types-no-suitable-supertrait-2.rs:17:5 | LL | fn uhoh(&self, foo: U, bar: ::Value) {} - | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | help: consider further restricting `Self` | diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr index bd3ee2abd..18f2830d8 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr @@ -1,14 +1,14 @@ error[E0277]: the trait bound `(T, U): Get` is not satisfied - --> $DIR/associated-types-no-suitable-supertrait.rs:22:40 + --> $DIR/associated-types-no-suitable-supertrait.rs:22:5 | LL | fn uhoh(&self, foo: U, bar: <(T, U) as Get>::Value) {} - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` error[E0277]: the trait bound `Self: Get` is not satisfied - --> $DIR/associated-types-no-suitable-supertrait.rs:17:40 + --> $DIR/associated-types-no-suitable-supertrait.rs:17:5 | LL | fn uhoh(&self, foo: U, bar: ::Value) {} - | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | help: consider further restricting `Self` | diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs index 109feb8e9..26b9f4b3a 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs @@ -4,5 +4,5 @@ trait I32Iterator = Iterator; fn main() { let _: &dyn I32Iterator = &vec![42].into_iter(); - //~^ ERROR type mismatch + //~^ ERROR expected `std::vec::IntoIter` to be an iterator that yields `i32`, but it yields `u32` } diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr index dbd9a44ed..2d25f68de 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving ` as Iterator>::Item == i32` +error[E0271]: expected `std::vec::IntoIter` to be an iterator that yields `i32`, but it yields `u32` --> $DIR/associated-types-overridden-binding-2.rs:6:43 | LL | let _: &dyn I32Iterator = &vec![42].into_iter(); diff --git a/src/test/ui/associated-types/associated-types-path-2.rs b/src/test/ui/associated-types/associated-types-path-2.rs index c993e1d27..00066efcc 100644 --- a/src/test/ui/associated-types/associated-types-path-2.rs +++ b/src/test/ui/associated-types/associated-types-path-2.rs @@ -29,12 +29,14 @@ pub fn f1_uint_uint() { f1(2u32, 4u32); //~^ ERROR `u32: Foo` is not satisfied //~| ERROR `u32: Foo` is not satisfied + //~| ERROR `u32: Foo` is not satisfied } pub fn f1_uint_int() { f1(2u32, 4i32); //~^ ERROR `u32: Foo` is not satisfied //~| ERROR `u32: Foo` is not satisfied + //~| ERROR `u32: Foo` is not satisfied } pub fn f2_int() { diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr index 1d0b84d31..206f49024 100644 --- a/src/test/ui/associated-types/associated-types-path-2.stderr +++ b/src/test/ui/associated-types/associated-types-path-2.stderr @@ -10,17 +10,19 @@ note: function defined here --> $DIR/associated-types-path-2.rs:13:8 | LL | pub fn f1(a: T, x: T::A) {} - | ^^ ---- ------- + | ^^ ------- help: change the type of the numeric literal from `i32` to `u32` | LL | f1(2i32, 4u32); | ~~~ error[E0277]: the trait bound `u32: Foo` is not satisfied - --> $DIR/associated-types-path-2.rs:29:5 + --> $DIR/associated-types-path-2.rs:29:8 | LL | f1(2u32, 4u32); - | ^^ the trait `Foo` is not implemented for `u32` + | -- ^^^^ the trait `Foo` is not implemented for `u32` + | | + | required by a bound introduced by this call | = help: the trait `Foo` is implemented for `i32` note: required by a bound in `f1` @@ -29,6 +31,14 @@ note: required by a bound in `f1` LL | pub fn f1(a: T, x: T::A) {} | ^^^ required by this bound in `f1` +error[E0277]: the trait bound `u32: Foo` is not satisfied + --> $DIR/associated-types-path-2.rs:29:5 + | +LL | f1(2u32, 4u32); + | ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32` + | + = help: the trait `Foo` is implemented for `i32` + error[E0277]: the trait bound `u32: Foo` is not satisfied --> $DIR/associated-types-path-2.rs:29:14 | @@ -38,7 +48,7 @@ LL | f1(2u32, 4u32); = help: the trait `Foo` is implemented for `i32` error[E0277]: the trait bound `u32: Foo` is not satisfied - --> $DIR/associated-types-path-2.rs:35:8 + --> $DIR/associated-types-path-2.rs:36:8 | LL | f1(2u32, 4i32); | -- ^^^^ the trait `Foo` is not implemented for `u32` @@ -53,7 +63,15 @@ LL | pub fn f1(a: T, x: T::A) {} | ^^^ required by this bound in `f1` error[E0277]: the trait bound `u32: Foo` is not satisfied - --> $DIR/associated-types-path-2.rs:35:14 + --> $DIR/associated-types-path-2.rs:36:5 + | +LL | f1(2u32, 4i32); + | ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32` + | + = help: the trait `Foo` is implemented for `i32` + +error[E0277]: the trait bound `u32: Foo` is not satisfied + --> $DIR/associated-types-path-2.rs:36:14 | LL | f1(2u32, 4i32); | ^^^^ the trait `Foo` is not implemented for `u32` @@ -61,7 +79,7 @@ LL | f1(2u32, 4i32); = help: the trait `Foo` is implemented for `i32` error[E0308]: mismatched types - --> $DIR/associated-types-path-2.rs:41:18 + --> $DIR/associated-types-path-2.rs:43:18 | LL | let _: i32 = f2(2i32); | --- ^^^^^^^^ expected `i32`, found `u32` @@ -73,7 +91,7 @@ help: you can convert a `u32` to an `i32` and panic if the converted value doesn LL | let _: i32 = f2(2i32).try_into().unwrap(); | ++++++++++++++++++++ -error: aborting due to 6 previous errors +error: aborting due to 8 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr index 2e67c2194..66d59bccd 100644 --- a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr +++ b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `Self: Get` is not satisfied - --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:10:40 + --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:10:5 | LL | fn okay(&self, foo: U, bar: ::Value); - | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | help: consider further restricting `Self` | diff --git a/src/test/ui/associated-types/defaults-suitability.stderr b/src/test/ui/associated-types/defaults-suitability.stderr index 43541c5df..eadad4cd5 100644 --- a/src/test/ui/associated-types/defaults-suitability.stderr +++ b/src/test/ui/associated-types/defaults-suitability.stderr @@ -39,7 +39,7 @@ error[E0277]: the trait bound `T: Clone` is not satisfied LL | type Bar: Clone = Vec; | ^^^^^^ the trait `Clone` is not implemented for `T` | - = note: required because of the requirements on the impl of `Clone` for `Vec` + = note: required for `Vec` to implement `Clone` note: required by a bound in `Foo::Bar` --> $DIR/defaults-suitability.rs:28:15 | @@ -83,7 +83,7 @@ error[E0277]: the trait bound `>::Baz: Clone` is not satisfied LL | type Bar: Clone = Vec; | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `>::Baz` | - = note: required because of the requirements on the impl of `Clone` for `Vec<>::Baz>` + = note: required for `Vec<>::Baz>` to implement `Clone` note: required by a bound in `Foo2::Bar` --> $DIR/defaults-suitability.rs:65:15 | @@ -100,7 +100,7 @@ error[E0277]: the trait bound `>::Baz: Clone` is not satisfied LL | type Bar: Clone = Vec; | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `>::Baz` | - = note: required because of the requirements on the impl of `Clone` for `Vec<>::Baz>` + = note: required for `Vec<>::Baz>` to implement `Clone` note: required by a bound in `Foo25::Bar` --> $DIR/defaults-suitability.rs:74:15 | diff --git a/src/test/ui/associated-types/higher-ranked-projection.badbase.stderr b/src/test/ui/associated-types/higher-ranked-projection.badbase.stderr deleted file mode 100644 index 8b2b87223..000000000 --- a/src/test/ui/associated-types/higher-ranked-projection.badbase.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/higher-ranked-projection.rs:25:5 - | -LL | foo(()); - | ^^^^^^^ one type is more general than the other - | - = note: expected reference `&'a ()` - found reference `&()` -note: the lifetime requirement is introduced here - --> $DIR/higher-ranked-projection.rs:16:33 - | -LL | where for<'a> &'a T: Mirror - | ^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/associated-types/higher-ranked-projection.badnll.stderr b/src/test/ui/associated-types/higher-ranked-projection.badnll.stderr deleted file mode 100644 index 217392aa3..000000000 --- a/src/test/ui/associated-types/higher-ranked-projection.badnll.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown debugging option: `borrowck` - diff --git a/src/test/ui/associated-types/hr-associated-type-bound-2.stderr b/src/test/ui/associated-types/hr-associated-type-bound-2.stderr index e007f5a16..a85edd7a0 100644 --- a/src/test/ui/associated-types/hr-associated-type-bound-2.stderr +++ b/src/test/ui/associated-types/hr-associated-type-bound-2.stderr @@ -5,13 +5,13 @@ LL | impl X<'_> for u32 | ^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hr_associated_type_bound_2`) -note: required because of the requirements on the impl of `for<'b> X<'b>` for `u32` +note: required for `u32` to implement `for<'b> X<'b>` --> $DIR/hr-associated-type-bound-2.rs:11:6 | LL | impl X<'_> for u32 | ^^^^^ ^^^ = note: 128 redundant requirements hidden - = note: required because of the requirements on the impl of `for<'b> X<'b>` for `u32` + = note: required for `u32` to implement `for<'b> X<'b>` error: aborting due to previous error diff --git a/src/test/ui/associated-types/impl-wf-cycle-1.stderr b/src/test/ui/associated-types/impl-wf-cycle-1.stderr index 939c9bbdb..6661347e4 100644 --- a/src/test/ui/associated-types/impl-wf-cycle-1.stderr +++ b/src/test/ui/associated-types/impl-wf-cycle-1.stderr @@ -4,13 +4,13 @@ error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` LL | impl Grault for (T,) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: required because of the requirements on the impl of `Grault` for `(T,)` +note: required for `(T,)` to implement `Grault` --> $DIR/impl-wf-cycle-1.rs:15:17 | LL | impl Grault for (T,) | ^^^^^^ ^^^^ = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `Grault` for `(T,)` + = note: required for `(T,)` to implement `Grault` error: aborting due to previous error diff --git a/src/test/ui/associated-types/impl-wf-cycle-2.stderr b/src/test/ui/associated-types/impl-wf-cycle-2.stderr index d02ed2cac..ec4ffe27c 100644 --- a/src/test/ui/associated-types/impl-wf-cycle-2.stderr +++ b/src/test/ui/associated-types/impl-wf-cycle-2.stderr @@ -4,7 +4,7 @@ error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` LL | impl Grault for (T,) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: required because of the requirements on the impl of `Grault` for `(T,)` +note: required for `(T,)` to implement `Grault` --> $DIR/impl-wf-cycle-2.rs:7:17 | LL | impl Grault for (T,) diff --git a/src/test/ui/associated-types/issue-22560.stderr b/src/test/ui/associated-types/issue-22560.stderr index 700923c1b..2b88cf0b4 100644 --- a/src/test/ui/associated-types/issue-22560.stderr +++ b/src/test/ui/associated-types/issue-22560.stderr @@ -1,25 +1,3 @@ -error[E0393]: the type parameter `Rhs` must be explicitly specified - --> $DIR/issue-22560.rs:9:23 - | -LL | trait Sub { - | ------------------- type parameter `Rhs` must be specified for this -... -LL | type Test = dyn Add + Sub; - | ^^^ help: set the type parameter to the desired type: `Sub` - | - = note: because of the default `Self` reference, type parameters must be specified on object types - -error[E0393]: the type parameter `Rhs` must be explicitly specified - --> $DIR/issue-22560.rs:9:17 - | -LL | trait Add { - | ------------------- type parameter `Rhs` must be specified for this -... -LL | type Test = dyn Add + Sub; - | ^^^ help: set the type parameter to the desired type: `Add` - | - = note: because of the default `Self` reference, type parameters must be specified on object types - error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/issue-22560.rs:9:23 | @@ -28,7 +6,7 @@ LL | type Test = dyn Add + Sub; | | | first non-auto trait | - = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<[type error]> + Sub<[type error]> {}` + = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified @@ -50,6 +28,28 @@ help: specify the associated types LL | type Test = dyn Add + Sub; | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ +error[E0393]: the type parameter `Rhs` must be explicitly specified + --> $DIR/issue-22560.rs:9:17 + | +LL | trait Add { + | ------------------- type parameter `Rhs` must be specified for this +... +LL | type Test = dyn Add + Sub; + | ^^^ help: set the type parameter to the desired type: `Add` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error[E0393]: the type parameter `Rhs` must be explicitly specified + --> $DIR/issue-22560.rs:9:23 + | +LL | trait Sub { + | ------------------- type parameter `Rhs` must be specified for this +... +LL | type Test = dyn Add + Sub; + | ^^^ help: set the type parameter to the desired type: `Sub` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + error: aborting due to 4 previous errors Some errors have detailed explanations: E0191, E0225, E0393. diff --git a/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr b/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr index 22daaf329..a14a273b3 100644 --- a/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr +++ b/src/test/ui/associated-types/issue-27675-unchecked-bounds.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/issue-27675-unchecked-bounds.rs:15:31 + --> $DIR/issue-27675-unchecked-bounds.rs:15:12 | LL | copy::>(t) - | ------------------------- ^ the trait `Copy` is not implemented for `T` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | note: required by a bound in `copy` --> $DIR/issue-27675-unchecked-bounds.rs:10:12 diff --git a/src/test/ui/associated-types/issue-44153.stderr b/src/test/ui/associated-types/issue-44153.stderr index 200efbe02..9c92f19d8 100644 --- a/src/test/ui/associated-types/issue-44153.stderr +++ b/src/test/ui/associated-types/issue-44153.stderr @@ -9,7 +9,7 @@ note: expected this to be `&()` | LL | type Element = (); | ^^ -note: required because of the requirements on the impl of `Visit` for `()` +note: required for `()` to implement `Visit` --> $DIR/issue-44153.rs:13:10 | LL | impl<'a> Visit for () where diff --git a/src/test/ui/associated-types/issue-59324.rs b/src/test/ui/associated-types/issue-59324.rs index 162f9e00e..9e68e9e77 100644 --- a/src/test/ui/associated-types/issue-59324.rs +++ b/src/test/ui/associated-types/issue-59324.rs @@ -15,9 +15,9 @@ pub trait ThriftService: { fn get_service( //~^ ERROR the trait bound `Bug: Foo` is not satisfied + //~| ERROR the trait bound `Bug: Foo` is not satisfied &self, ) -> Self::AssocType; - //~^ the trait bound `Bug: Foo` is not satisfied } fn with_factory(factory: dyn ThriftService<()>) {} diff --git a/src/test/ui/associated-types/issue-59324.stderr b/src/test/ui/associated-types/issue-59324.stderr index a84b599b5..62cf1f37a 100644 --- a/src/test/ui/associated-types/issue-59324.stderr +++ b/src/test/ui/associated-types/issue-59324.stderr @@ -20,7 +20,7 @@ LL | | LL | | LL | | Service::OnlyFoo> ... | -LL | | +LL | | ) -> Self::AssocType; LL | | } | |_^ the trait `Foo` is not implemented for `Bug` | @@ -34,6 +34,7 @@ error[E0277]: the trait bound `Bug: Foo` is not satisfied | LL | / fn get_service( LL | | +LL | | LL | | &self, LL | | ) -> Self::AssocType; | |_________________________^ the trait `Foo` is not implemented for `Bug` @@ -44,16 +45,20 @@ LL | pub trait ThriftService: | +++++ error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/issue-59324.rs:23:29 + --> $DIR/issue-59324.rs:23:1 | LL | fn with_factory(factory: dyn ThriftService<()>) {} - | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` error[E0277]: the trait bound `Bug: Foo` is not satisfied - --> $DIR/issue-59324.rs:19:10 + --> $DIR/issue-59324.rs:16:5 | -LL | ) -> Self::AssocType; - | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bug` +LL | / fn get_service( +LL | | +LL | | +LL | | &self, +LL | | ) -> Self::AssocType; + | |_________________________^ the trait `Foo` is not implemented for `Bug` | help: consider further restricting this bound | diff --git a/src/test/ui/associated-types/issue-62200.rs b/src/test/ui/associated-types/issue-62200.rs index 9d18690e9..499bbd6b6 100644 --- a/src/test/ui/associated-types/issue-62200.rs +++ b/src/test/ui/associated-types/issue-62200.rs @@ -10,6 +10,7 @@ impl T<'_> for S { fn foo(x: impl Fn(>::A) -> >::A) {} //~^ ERROR binding for associated type `Output` references an anonymous lifetime -//~^^ NOTE lifetimes appearing in an associated type are not considered constrained +//~| NOTE lifetimes appearing in an associated or opaque type are not considered constrained +//~| NOTE consider introducing a named lifetime parameter fn main() {} diff --git a/src/test/ui/associated-types/issue-62200.stderr b/src/test/ui/associated-types/issue-62200.stderr index f14cd81fd..04f0728f5 100644 --- a/src/test/ui/associated-types/issue-62200.stderr +++ b/src/test/ui/associated-types/issue-62200.stderr @@ -4,7 +4,8 @@ error[E0582]: binding for associated type `Output` references an anonymous lifet LL | fn foo(x: impl Fn(>::A) -> >::A) {} | ^^^^^^^^^^^^^^^ | - = note: lifetimes appearing in an associated type are not considered constrained + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/associated-types/issue-65774-1.stderr b/src/test/ui/associated-types/issue-65774-1.stderr index 419de689c..3b294d65d 100644 --- a/src/test/ui/associated-types/issue-65774-1.stderr +++ b/src/test/ui/associated-types/issue-65774-1.stderr @@ -18,7 +18,7 @@ LL | let closure = |config: &mut ::MpuConfig| writer.my_write( | ^^^^^^^ the trait `MyDisplay` is not implemented for `T` | = help: the trait `MyDisplay` is implemented for `&'a mut T` -note: required because of the requirements on the impl of `MyDisplay` for `&mut T` +note: required for `&mut T` to implement `MyDisplay` --> $DIR/issue-65774-1.rs:5:24 | LL | impl<'a, T: MyDisplay> MyDisplay for &'a mut T { } diff --git a/src/test/ui/associated-types/issue-87261.stderr b/src/test/ui/associated-types/issue-87261.stderr index 8db4a49da..f24423dd1 100644 --- a/src/test/ui/associated-types/issue-87261.stderr +++ b/src/test/ui/associated-types/issue-87261.stderr @@ -1,8 +1,10 @@ error[E0271]: type mismatch resolving `::Associated == ()` - --> $DIR/issue-87261.rs:56:5 + --> $DIR/issue-87261.rs:56:19 | LL | accepts_trait(a); - | ^^^^^^^^^^^^^ expected `()`, found associated type + | ------------- ^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `::Associated` @@ -17,10 +19,12 @@ LL | A: Trait + 'static, | +++++++++++++++++ error[E0271]: type mismatch resolving `::Associated == ()` - --> $DIR/issue-87261.rs:59:5 + --> $DIR/issue-87261.rs:59:19 | LL | accepts_trait(b); - | ^^^^^^^^^^^^^ expected `()`, found associated type + | ------------- ^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `::Associated` @@ -33,10 +37,12 @@ LL | fn accepts_trait>(_: T) {} | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` error[E0271]: type mismatch resolving `::Associated == ()` - --> $DIR/issue-87261.rs:62:5 + --> $DIR/issue-87261.rs:62:19 | LL | accepts_trait(c); - | ^^^^^^^^^^^^^ expected `()`, found associated type + | ------------- ^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `::Associated` @@ -51,10 +57,12 @@ LL | C: Trait + Foo, | +++++++++++++++++ error[E0271]: type mismatch resolving `::Associated == ()` - --> $DIR/issue-87261.rs:65:5 + --> $DIR/issue-87261.rs:65:19 | LL | accepts_trait(d); - | ^^^^^^^^^^^^^ expected `()`, found associated type + | ------------- ^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `::Associated` @@ -67,10 +75,12 @@ LL | fn accepts_trait>(_: T) {} | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` error[E0271]: type mismatch resolving `>::Associated == ()` - --> $DIR/issue-87261.rs:68:5 + --> $DIR/issue-87261.rs:68:27 | LL | accepts_generic_trait(e); - | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | --------------------- ^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `>::Associated` @@ -85,10 +95,12 @@ LL | E: GenericTrait<(), Associated = ()> + 'static, | +++++++++++++++++ error[E0271]: type mismatch resolving `>::Associated == ()` - --> $DIR/issue-87261.rs:71:5 + --> $DIR/issue-87261.rs:71:27 | LL | accepts_generic_trait(f); - | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | --------------------- ^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `>::Associated` @@ -103,10 +115,12 @@ LL | F: GenericTrait<(), Associated = ()> + Foo, | +++++++++++++++++ error[E0271]: type mismatch resolving `>::Associated == ()` - --> $DIR/issue-87261.rs:74:5 + --> $DIR/issue-87261.rs:74:27 | LL | accepts_generic_trait(g); - | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | --------------------- ^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `>::Associated` @@ -119,13 +133,15 @@ LL | fn accepts_generic_trait>(_: T) {} | ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait` error[E0271]: type mismatch resolving `::Associated == ()` - --> $DIR/issue-87261.rs:79:5 + --> $DIR/issue-87261.rs:79:19 | LL | fn returns_opaque() -> impl Trait + 'static { | -------------------- the found opaque type ... LL | accepts_trait(returns_opaque()); - | ^^^^^^^^^^^^^ expected `()`, found associated type + | ------------- ^^^^^^^^^^^^^^^^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `::Associated` @@ -140,13 +156,15 @@ LL | fn returns_opaque() -> impl Trait + 'static { | +++++++++++++++++ error[E0271]: type mismatch resolving `::Associated == ()` - --> $DIR/issue-87261.rs:82:5 + --> $DIR/issue-87261.rs:82:19 | LL | fn returns_opaque_derived() -> impl DerivedTrait + 'static { | --------------------------- the found opaque type ... LL | accepts_trait(returns_opaque_derived()); - | ^^^^^^^^^^^^^ expected `()`, found associated type + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `::Associated` @@ -161,13 +179,15 @@ LL | fn returns_opaque_derived() -> impl DerivedTrait + 'static | +++++++++++++++++ error[E0271]: type mismatch resolving `::Associated == ()` - --> $DIR/issue-87261.rs:85:5 + --> $DIR/issue-87261.rs:85:19 | LL | fn returns_opaque_foo() -> impl Trait + Foo { | ---------------- the found opaque type ... LL | accepts_trait(returns_opaque_foo()); - | ^^^^^^^^^^^^^ expected `()`, found associated type + | ------------- ^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `::Associated` @@ -182,13 +202,15 @@ LL | fn returns_opaque_foo() -> impl Trait + Foo { | +++++++++++++++++ error[E0271]: type mismatch resolving `::Associated == ()` - --> $DIR/issue-87261.rs:88:5 + --> $DIR/issue-87261.rs:88:19 | LL | fn returns_opaque_derived_foo() -> impl DerivedTrait + Foo { | ----------------------- the found opaque type ... LL | accepts_trait(returns_opaque_derived_foo()); - | ^^^^^^^^^^^^^ expected `()`, found associated type + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type `::Associated` @@ -201,13 +223,15 @@ LL | fn accepts_trait>(_: T) {} | ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait` error[E0271]: type mismatch resolving ` as GenericTrait<()>>::Associated == ()` - --> $DIR/issue-87261.rs:91:5 + --> $DIR/issue-87261.rs:91:27 | LL | fn returns_opaque_generic() -> impl GenericTrait<()> + 'static { | ------------------------------- the found opaque type ... LL | accepts_generic_trait(returns_opaque_generic()); - | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type ` as GenericTrait<()>>::Associated` @@ -222,13 +246,15 @@ LL | fn returns_opaque_generic() -> impl GenericTrait<(), Associated = ()> + 'st | +++++++++++++++++ error[E0271]: type mismatch resolving ` + Foo as GenericTrait<()>>::Associated == ()` - --> $DIR/issue-87261.rs:94:5 + --> $DIR/issue-87261.rs:94:27 | LL | fn returns_opaque_generic_foo() -> impl GenericTrait<()> + Foo { | --------------------------- the found opaque type ... LL | accepts_generic_trait(returns_opaque_generic_foo()); - | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type ` + Foo as GenericTrait<()>>::Associated` @@ -243,13 +269,15 @@ LL | fn returns_opaque_generic_foo() -> impl GenericTrait<(), Associated = ()> + | +++++++++++++++++ error[E0271]: type mismatch resolving ` + GenericTrait as GenericTrait<()>>::Associated == ()` - --> $DIR/issue-87261.rs:97:5 + --> $DIR/issue-87261.rs:97:27 | LL | fn returns_opaque_generic_duplicate() -> impl GenericTrait<()> + GenericTrait { | ---------------------------------------- the found opaque type ... LL | accepts_generic_trait(returns_opaque_generic_duplicate()); - | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | | + | required by a bound introduced by this call | = note: expected unit type `()` found associated type ` + GenericTrait as GenericTrait<()>>::Associated` diff --git a/src/test/ui/associated-types/substs-ppaux.normal.stderr b/src/test/ui/associated-types/substs-ppaux.normal.stderr index 085c56870..3f180cf4f 100644 --- a/src/test/ui/associated-types/substs-ppaux.normal.stderr +++ b/src/test/ui/associated-types/substs-ppaux.normal.stderr @@ -11,7 +11,7 @@ LL | let x: () = >::bar::<'static, char>; | = note: expected unit type `()` found fn item `fn() {>::bar::<'static, char>}` -help: use parentheses to call this function +help: use parentheses to call this associated function | LL | let x: () = >::bar::<'static, char>(); | ++ @@ -29,7 +29,7 @@ LL | let x: () = >::bar::<'static, char>; | = note: expected unit type `()` found fn item `fn() {>::bar::<'static, char>}` -help: use parentheses to call this function +help: use parentheses to call this associated function | LL | let x: () = >::bar::<'static, char>(); | ++ @@ -47,7 +47,7 @@ LL | let x: () = >::baz; | = note: expected unit type `()` found fn item `fn() {>::baz}` -help: use parentheses to call this function +help: use parentheses to call this associated function | LL | let x: () = >::baz(); | ++ @@ -77,7 +77,7 @@ LL | >::bar; | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` -note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for `str` +note: required for `str` to implement `Foo<'_, '_, u8>` --> $DIR/substs-ppaux.rs:11:17 | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} diff --git a/src/test/ui/associated-types/substs-ppaux.verbose.stderr b/src/test/ui/associated-types/substs-ppaux.verbose.stderr index b831f3b7a..16dd29de2 100644 --- a/src/test/ui/associated-types/substs-ppaux.verbose.stderr +++ b/src/test/ui/associated-types/substs-ppaux.verbose.stderr @@ -11,7 +11,7 @@ LL | let x: () = >::bar::<'static, char>; | = note: expected unit type `()` found fn item `fn() {>::bar::}` -help: use parentheses to call this function +help: use parentheses to call this associated function | LL | let x: () = >::bar::<'static, char>(); | ++ @@ -29,7 +29,7 @@ LL | let x: () = >::bar::<'static, char>; | = note: expected unit type `()` found fn item `fn() {>::bar::}` -help: use parentheses to call this function +help: use parentheses to call this associated function | LL | let x: () = >::bar::<'static, char>(); | ++ @@ -47,7 +47,7 @@ LL | let x: () = >::baz; | = note: expected unit type `()` found fn item `fn() {>::baz}` -help: use parentheses to call this function +help: use parentheses to call this associated function | LL | let x: () = >::baz(); | ++ @@ -77,7 +77,7 @@ LL | >::bar; | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` -note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8>` for `str` +note: required for `str` to implement `Foo<'_#0r, '_#1r, u8>` --> $DIR/substs-ppaux.rs:11:17 | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} diff --git a/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr new file mode 100644 index 000000000..3be7f370d --- /dev/null +++ b/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr @@ -0,0 +1,110 @@ +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:48:13 + | +LL | is_send(foo(Some(true))); + | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:11:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await + | ^^^^^^ await occurs here, with `r` maybe used later +LL | }; + | - `r` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error[E0277]: `Rc<()>` cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:50:13 + | +LL | async fn foo2(x: Option) { + | - within this `impl Future` +... +LL | is_send(foo2(Some(true))); + | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: required because it's used within this `async fn` body + --> $DIR/async-await-let-else.rs:27:29 + | +LL | async fn bar2(_: T) -> ! { + | _____________________________^ +LL | | panic!() +LL | | } + | |_^ + = note: required because it captures the following types: `ResumeTy`, `Option`, `impl Future`, `()` +note: required because it's used within this `async fn` body + --> $DIR/async-await-let-else.rs:21:32 + | +LL | async fn foo2(x: Option) { + | ________________________________^ +LL | | let Some(_) = x else { +LL | | bar2(Rc::new(())).await +LL | | }; +LL | | } + | |_^ +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:52:13 + | +LL | is_send(foo3(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:33:28 + | +LL | (Rc::new(()), bar().await); + | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later + | | + | has type `Rc<()>` which is not `Send` +note: `Rc::new(())` is later dropped here + --> $DIR/async-await-let-else.rs:33:35 + | +LL | (Rc::new(()), bar().await); + | ^ +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:54:13 + | +LL | is_send(foo4(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:41:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await; + | ^^^^^^ await occurs here, with `r` maybe used later +... +LL | }; + | - `r` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr new file mode 100644 index 000000000..7f93563e2 --- /dev/null +++ b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr @@ -0,0 +1,94 @@ +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:48:13 + | +LL | is_send(foo(Some(true))); + | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:11:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await + | ^^^^^^ await occurs here, with `r` maybe used later +LL | }; + | - `r` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:50:13 + | +LL | is_send(foo2(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:23:26 + | +LL | bar2(Rc::new(())).await + | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later + | | + | has type `Rc<()>` which is not `Send` +LL | }; + | - `Rc::new(())` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:52:13 + | +LL | is_send(foo3(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:33:28 + | +LL | (Rc::new(()), bar().await); + | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later + | | + | has type `Rc<()>` which is not `Send` +note: `Rc::new(())` is later dropped here + --> $DIR/async-await-let-else.rs:33:35 + | +LL | (Rc::new(()), bar().await); + | ^ +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:54:13 + | +LL | is_send(foo4(Some(true))); + | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>` +note: future is not `Send` as this value is used across an await + --> $DIR/async-await-let-else.rs:41:14 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await; + | ^^^^^^ await occurs here, with `r` maybe used later +... +LL | }; + | - `r` is later dropped here +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:19:15 + | +LL | fn is_send(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/async-await/async-await-let-else.rs b/src/test/ui/async-await/async-await-let-else.rs index 7ea07ae9a..3fb2142b9 100644 --- a/src/test/ui/async-await/async-await-let-else.rs +++ b/src/test/ui/async-await/async-await-let-else.rs @@ -1,5 +1,8 @@ // edition:2021 -#![feature(let_else)] +// revisions: drop-tracking no-drop-tracking +// [drop-tracking] compile-flags: -Zdrop-tracking=yes +// [no-drop-tracking] compile-flags: -Zdrop-tracking=no + use std::rc::Rc; async fn foo(x: Option) { @@ -43,11 +46,11 @@ async fn foo4(x: Option) { fn main() { is_send(foo(Some(true))); - //~^ ERROR future cannot be sent between threads safely + //~^ ERROR cannot be sent between threads safely is_send(foo2(Some(true))); - //~^ ERROR future cannot be sent between threads safely + //~^ ERROR cannot be sent between threads safely is_send(foo3(Some(true))); - //~^ ERROR future cannot be sent between threads safely + //~^ ERROR cannot be sent between threads safely is_send(foo4(Some(true))); - //~^ ERROR future cannot be sent between threads safely + //~^ ERROR cannot be sent between threads safely } diff --git a/src/test/ui/async-await/async-await-let-else.stderr b/src/test/ui/async-await/async-await-let-else.stderr deleted file mode 100644 index 4d23e27c4..000000000 --- a/src/test/ui/async-await/async-await-let-else.stderr +++ /dev/null @@ -1,94 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/async-await-let-else.rs:45:13 - | -LL | is_send(foo(Some(true))); - | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` - | - = help: within `impl Future`, 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:8: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:16: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:47: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:20: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:16: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:49: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:30:28 - | -LL | (Rc::new(()), bar().await); - | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later - | | - | has type `Rc<()>` which is not `Send` -note: `Rc::new(())` is later dropped here - --> $DIR/async-await-let-else.rs:30:35 - | -LL | (Rc::new(()), bar().await); - | ^ -note: required by a bound in `is_send` - --> $DIR/async-await-let-else.rs:16: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:51: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:38: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:16:15 - | -LL | fn is_send(_: T) {} - | ^^^^ required by this bound in `is_send` - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs b/src/test/ui/async-await/async-block-control-flow-static-semantics.rs index b831d6102..446212ca7 100644 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs +++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.rs @@ -15,7 +15,7 @@ fn return_targets_async_block_not_fn() -> u8 { return 0u8; }; let _: &dyn Future = █ - //~^ ERROR type mismatch + //~^ ERROR expected `impl Future` to be a future that resolves to `()`, but it resolves to `u8` } async fn return_targets_async_block_not_async_fn() -> u8 { @@ -24,7 +24,7 @@ async fn return_targets_async_block_not_async_fn() -> u8 { return 0u8; }; let _: &dyn Future = █ - //~^ ERROR type mismatch resolving ` as Future>::Output == ()` + //~^ ERROR expected `impl Future` to be a future that resolves to `()`, but it resolves to `u8` } fn no_break_in_async_block() { @@ -42,7 +42,9 @@ fn no_break_in_async_block_even_with_outer_loop() { } struct MyErr; -fn err() -> Result { Err(MyErr) } +fn err() -> Result { + Err(MyErr) +} fn rethrow_targets_async_block_not_fn() -> Result { //~^ ERROR mismatched types diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr index e58876896..2a08d5d6c 100644 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -31,7 +31,7 @@ LL | | LL | | } | |_^ expected `u8`, found `()` -error[E0271]: type mismatch resolving ` as Future>::Output == ()` +error[E0271]: expected `impl Future` to be a future that resolves to `()`, but it resolves to `u8` --> $DIR/async-block-control-flow-static-semantics.rs:26:39 | LL | let _: &dyn Future = █ @@ -47,7 +47,7 @@ LL | fn return_targets_async_block_not_fn() -> u8 { | | | implicitly returns `()` as its body has no tail or `return` expression -error[E0271]: type mismatch resolving ` as Future>::Output == ()` +error[E0271]: expected `impl Future` to be a future that resolves to `()`, but it resolves to `u8` --> $DIR/async-block-control-flow-static-semantics.rs:17:39 | LL | let _: &dyn Future = █ @@ -56,7 +56,7 @@ LL | let _: &dyn Future = █ = note: required for the cast from `impl Future` to the object type `dyn Future` error[E0308]: mismatched types - --> $DIR/async-block-control-flow-static-semantics.rs:47:44 + --> $DIR/async-block-control-flow-static-semantics.rs:49:44 | LL | fn rethrow_targets_async_block_not_fn() -> Result { | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` @@ -67,7 +67,7 @@ LL | fn rethrow_targets_async_block_not_fn() -> Result { found unit type `()` error[E0308]: mismatched types - --> $DIR/async-block-control-flow-static-semantics.rs:56:50 + --> $DIR/async-block-control-flow-static-semantics.rs:58:50 | LL | fn rethrow_targets_async_block_not_async_fn() -> Result { | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` diff --git a/src/test/ui/async-await/async-trait-fn.rs b/src/test/ui/async-await/async-trait-fn.rs index e2062e827..0ea685986 100644 --- a/src/test/ui/async-await/async-trait-fn.rs +++ b/src/test/ui/async-await/async-trait-fn.rs @@ -1,8 +1,11 @@ // edition:2018 trait T { async fn foo() {} //~ ERROR functions in traits cannot be declared `async` + //~^ ERROR mismatched types async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async` + //~^ ERROR mismatched types async fn baz() { //~ ERROR functions in traits cannot be declared `async` + //~^ ERROR mismatched types // Nested item must not ICE. fn a() {} } diff --git a/src/test/ui/async-await/async-trait-fn.stderr b/src/test/ui/async-await/async-trait-fn.stderr index 1eb8969a8..e5c584e31 100644 --- a/src/test/ui/async-await/async-trait-fn.stderr +++ b/src/test/ui/async-await/async-trait-fn.stderr @@ -2,40 +2,89 @@ error[E0706]: functions in traits cannot be declared `async` --> $DIR/async-trait-fn.rs:3:5 | LL | async fn foo() {} - | -----^^^^^^^^^^^^ + | -----^^^^^^^^^ | | | `async` because of this | = note: `async` trait functions are not currently supported = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` - --> $DIR/async-trait-fn.rs:4:5 + --> $DIR/async-trait-fn.rs:5:5 | LL | async fn bar(&self) {} - | -----^^^^^^^^^^^^^^^^^ + | -----^^^^^^^^^^^^^^ | | | `async` because of this | = note: `async` trait functions are not currently supported = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` - --> $DIR/async-trait-fn.rs:5:5 + --> $DIR/async-trait-fn.rs:7:5 + | +LL | async fn baz() { + | -----^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + +error[E0308]: mismatched types + --> $DIR/async-trait-fn.rs:3:20 + | +LL | async fn foo() {} + | ^^ expected associated type, found opaque type + | + ::: $SRC_DIR/core/src/future/mod.rs:LL:COL + | +LL | pub const fn from_generator(gen: T) -> impl Future + | ------------------------------- the found opaque type + | + = note: expected associated type `impl Future` (trait associated opaque type at <$DIR/async-trait-fn.rs:3:20>) + found opaque type `impl Future` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>) + +error[E0308]: mismatched types + --> $DIR/async-trait-fn.rs:5:25 + | +LL | async fn bar(&self) {} + | ^^ expected associated type, found opaque type + | + ::: $SRC_DIR/core/src/future/mod.rs:LL:COL + | +LL | pub const fn from_generator(gen: T) -> impl Future + | ------------------------------- the found opaque type + | + = note: expected associated type `impl Future` (trait associated opaque type at <$DIR/async-trait-fn.rs:5:25>) + found opaque type `impl Future` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>) + +error[E0308]: mismatched types + --> $DIR/async-trait-fn.rs:7:20 | LL | async fn baz() { - | ^---- - | | - | _____`async` because of this - | | + | ____________________^ +LL | | LL | | // Nested item must not ICE. LL | | fn a() {} LL | | } - | |_____^ + | |_____^ expected associated type, found opaque type | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + ::: $SRC_DIR/core/src/future/mod.rs:LL:COL + | +LL | pub const fn from_generator(gen: T) -> impl Future + | ------------------------------- the found opaque type + | + = note: expected associated type `impl Future` (trait associated opaque type at <$DIR/async-trait-fn.rs:7:20>) + found opaque type `impl Future` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>) -error: aborting due to 3 previous errors +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0706`. +Some errors have detailed explanations: E0308, E0706. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/async-await/edition-deny-async-fns-2015.rs b/src/test/ui/async-await/edition-deny-async-fns-2015.rs index e5dc9c8a5..22a61dcd2 100644 --- a/src/test/ui/async-await/edition-deny-async-fns-2015.rs +++ b/src/test/ui/async-await/edition-deny-async-fns-2015.rs @@ -16,7 +16,8 @@ impl Foo { trait Bar { async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 - //~^ ERROR functions in traits cannot be declared `async` + //~^ ERROR functions in traits cannot be declared `async` + //~| ERROR mismatched types } fn main() { diff --git a/src/test/ui/async-await/edition-deny-async-fns-2015.stderr b/src/test/ui/async-await/edition-deny-async-fns-2015.stderr index 35f9c581c..8c2902d9b 100644 --- a/src/test/ui/async-await/edition-deny-async-fns-2015.stderr +++ b/src/test/ui/async-await/edition-deny-async-fns-2015.stderr @@ -53,7 +53,7 @@ LL | async fn foo() {} = note: for more on editions, read https://doc.rust-lang.org/edition-guide error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:36:9 + --> $DIR/edition-deny-async-fns-2015.rs:37:9 | LL | async fn bar() {} | ^^^^^ to use `async fn`, switch to Rust 2018 or later @@ -62,7 +62,7 @@ LL | async fn bar() {} = note: for more on editions, read https://doc.rust-lang.org/edition-guide error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:26:9 + --> $DIR/edition-deny-async-fns-2015.rs:27:9 | LL | async fn foo() {} | ^^^^^ to use `async fn`, switch to Rust 2018 or later @@ -71,7 +71,7 @@ LL | async fn foo() {} = note: for more on editions, read https://doc.rust-lang.org/edition-guide error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/edition-deny-async-fns-2015.rs:31:13 + --> $DIR/edition-deny-async-fns-2015.rs:32:13 | LL | async fn bar() {} | ^^^^^ to use `async fn`, switch to Rust 2018 or later @@ -83,14 +83,30 @@ error[E0706]: functions in traits cannot be declared `async` --> $DIR/edition-deny-async-fns-2015.rs:18:5 | LL | async fn foo() {} - | -----^^^^^^^^^^^^ + | -----^^^^^^^^^ | | | `async` because of this | = note: `async` trait functions are not currently supported = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable -error: aborting due to 10 previous errors +error[E0308]: mismatched types + --> $DIR/edition-deny-async-fns-2015.rs:18:20 + | +LL | async fn foo() {} + | ^^ expected associated type, found opaque type + | + ::: $SRC_DIR/core/src/future/mod.rs:LL:COL + | +LL | pub const fn from_generator(gen: T) -> impl Future + | ------------------------------- the found opaque type + | + = note: expected associated type `impl Future` (trait associated opaque type at <$DIR/edition-deny-async-fns-2015.rs:18:20>) + found opaque type `impl Future` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>) + +error: aborting due to 11 previous errors -Some errors have detailed explanations: E0670, E0706. -For more information about an error, try `rustc --explain E0670`. +Some errors have detailed explanations: E0308, E0670, E0706. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/async-await/generator-desc.stderr b/src/test/ui/async-await/generator-desc.stderr index 3be8c5520..2494c3feb 100644 --- a/src/test/ui/async-await/generator-desc.stderr +++ b/src/test/ui/async-await/generator-desc.stderr @@ -42,7 +42,7 @@ note: function defined here --> $DIR/generator-desc.rs:8:4 | LL | fn fun>(f1: F, f2: F) {} - | ^^^ ----- ----- + | ^^^ ----- error[E0308]: mismatched types --> $DIR/generator-desc.rs:14:26 @@ -67,7 +67,7 @@ note: function defined here --> $DIR/generator-desc.rs:8:4 | LL | fn fun>(f1: F, f2: F) {} - | ^^^ ----- ----- + | ^^^ ----- error: aborting due to 3 previous errors diff --git a/src/test/ui/async-await/issue-101715.rs b/src/test/ui/async-await/issue-101715.rs new file mode 100644 index 000000000..1be5d0248 --- /dev/null +++ b/src/test/ui/async-await/issue-101715.rs @@ -0,0 +1,17 @@ +// edition:2018 + +struct S; + +impl S { + fn very_long_method_name_the_longest_method_name_in_the_whole_universe(self) {} +} + +async fn foo() { + S.very_long_method_name_the_longest_method_name_in_the_whole_universe() + .await + //~^ error: `()` is not a future + //~| help: remove the `.await` + //~| help: the trait `Future` is not implemented for `()` +} + +fn main() {} diff --git a/src/test/ui/async-await/issue-101715.stderr b/src/test/ui/async-await/issue-101715.stderr new file mode 100644 index 000000000..a0e8d2a89 --- /dev/null +++ b/src/test/ui/async-await/issue-101715.stderr @@ -0,0 +1,16 @@ +error[E0277]: `()` is not a future + --> $DIR/issue-101715.rs:11:9 + | +LL | .await + | ^^^^^^ + | | + | `()` is not a future + | help: remove the `.await` + | + = help: the trait `Future` is not implemented for `()` + = note: () must be a future or must implement `IntoFuture` to be awaited + = note: required for `()` to implement `IntoFuture` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr b/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr new file mode 100644 index 000000000..f609e3636 --- /dev/null +++ b/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr @@ -0,0 +1,26 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-64130-4-async-move.rs:19:17 + | +LL | pub fn foo() -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` +note: future is not `Send` as this value is used across an await + --> $DIR/issue-64130-4-async-move.rs:25:31 + | +LL | match client.status() { + | ------ has type `&Client` which is not `Send` +LL | 200 => { +LL | let _x = get().await; + | ^^^^^^ await occurs here, with `client` maybe used later +... +LL | } + | - `client` is later dropped here +help: consider moving this into a `let` binding to create a shorter lived borrow + --> $DIR/issue-64130-4-async-move.rs:23:15 + | +LL | match client.status() { + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr new file mode 100644 index 000000000..f609e3636 --- /dev/null +++ b/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr @@ -0,0 +1,26 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-64130-4-async-move.rs:19:17 + | +LL | pub fn foo() -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` +note: future is not `Send` as this value is used across an await + --> $DIR/issue-64130-4-async-move.rs:25:31 + | +LL | match client.status() { + | ------ has type `&Client` which is not `Send` +LL | 200 => { +LL | let _x = get().await; + | ^^^^^^ await occurs here, with `client` maybe used later +... +LL | } + | - `client` is later dropped here +help: consider moving this into a `let` binding to create a shorter lived borrow + --> $DIR/issue-64130-4-async-move.rs:23:15 + | +LL | match client.status() { + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/async-await/issue-64130-4-async-move.rs b/src/test/ui/async-await/issue-64130-4-async-move.rs index 2538f3435..a38428fc0 100644 --- a/src/test/ui/async-await/issue-64130-4-async-move.rs +++ b/src/test/ui/async-await/issue-64130-4-async-move.rs @@ -1,4 +1,8 @@ // edition:2018 +// revisions: no_drop_tracking drop_tracking +// [drop_tracking] check-pass +// [drop_tracking] compile-flags: -Zdrop-tracking=yes +// [no_drop_tracking] compile-flags: -Zdrop-tracking=no use std::any::Any; use std::future::Future; @@ -10,16 +14,16 @@ impl Client { } } -async fn get() { } +async fn get() {} pub fn foo() -> impl Future + Send { - //~^ ERROR future cannot be sent between threads safely + //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely let client = Client(Box::new(true)); async move { match client.status() { 200 => { let _x = get().await; - }, + } _ => (), } } diff --git a/src/test/ui/async-await/issue-64130-4-async-move.stderr b/src/test/ui/async-await/issue-64130-4-async-move.stderr deleted file mode 100644 index d631e6dc7..000000000 --- a/src/test/ui/async-await/issue-64130-4-async-move.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-64130-4-async-move.rs:15: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:21:31 - | -LL | match client.status() { - | ------ has type `&Client` which is not `Send` -LL | 200 => { -LL | let _x = get().await; - | ^^^^^^ await occurs here, with `client` maybe used later -... -LL | } - | - `client` is later dropped here -help: consider moving this into a `let` binding to create a shorter lived borrow - --> $DIR/issue-64130-4-async-move.rs:19:15 - | -LL | match client.status() { - | ^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-67252-unnamed-future.stderr b/src/test/ui/async-await/issue-67252-unnamed-future.stderr index 01c0d3225..af99b608c 100644 --- a/src/test/ui/async-await/issue-67252-unnamed-future.stderr +++ b/src/test/ui/async-await/issue-67252-unnamed-future.stderr @@ -1,8 +1,12 @@ error: future cannot be sent between threads safely - --> $DIR/issue-67252-unnamed-future.rs:18:5 + --> $DIR/issue-67252-unnamed-future.rs:18:11 | -LL | spawn(async { - | ^^^^^ future created by async block is not `Send` +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 `impl Future`, the trait `Send` is not implemented for `*mut ()` note: future is not `Send` as this value is used across an await diff --git a/src/test/ui/async-await/issue-68112.drop_tracking.stderr b/src/test/ui/async-await/issue-68112.drop_tracking.stderr new file mode 100644 index 000000000..c915164cf --- /dev/null +++ b/src/test/ui/async-await/issue-68112.drop_tracking.stderr @@ -0,0 +1,79 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-68112.rs:37:18 + | +LL | require_send(send_fut); + | ^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` +note: future is not `Send` as it awaits another future which is not `Send` + --> $DIR/issue-68112.rs:34:17 + | +LL | let _ = non_send_fut.await; + | ^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:14:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: future cannot be sent between threads safely + --> $DIR/issue-68112.rs:46:18 + | +LL | require_send(send_fut); + | ^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` +note: future is not `Send` as it awaits another future which is not `Send` + --> $DIR/issue-68112.rs:43:17 + | +LL | let _ = make_non_send_future1().await; + | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:14:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/issue-68112.rs:65:18 + | +LL | require_send(send_fut); + | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: required for `Arc>` to implement `Send` +note: required because it's used within this `async fn` body + --> $DIR/issue-68112.rs:50:31 + | +LL | async fn ready2(t: T) -> T { + | _______________________________^ +LL | | t +LL | | } + | |_^ +note: required because it appears within the type `impl Future>>` + --> $DIR/issue-68112.rs:53:31 + | +LL | fn make_non_send_future2() -> impl Future>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `ResumeTy`, `impl Future>>`, `()`, `Ready` +note: required because it's used within this `async` block + --> $DIR/issue-68112.rs:60:26 + | +LL | let send_fut = async { + | __________________________^ +LL | | let non_send_fut = make_non_send_future2(); +LL | | let _ = non_send_fut.await; +LL | | ready(0).await; +LL | | }; + | |_____^ +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:14:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr b/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr new file mode 100644 index 000000000..11b7d1aaa --- /dev/null +++ b/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr @@ -0,0 +1,79 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-68112.rs:37:18 + | +LL | require_send(send_fut); + | ^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` +note: future is not `Send` as it awaits another future which is not `Send` + --> $DIR/issue-68112.rs:34:17 + | +LL | let _ = non_send_fut.await; + | ^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:14:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: future cannot be sent between threads safely + --> $DIR/issue-68112.rs:46:18 + | +LL | require_send(send_fut); + | ^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `Sync` is not implemented for `RefCell` +note: future is not `Send` as it awaits another future which is not `Send` + --> $DIR/issue-68112.rs:43:17 + | +LL | let _ = make_non_send_future1().await; + | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future>>`, which is not `Send` +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:14:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error[E0277]: `RefCell` cannot be shared between threads safely + --> $DIR/issue-68112.rs:65:18 + | +LL | require_send(send_fut); + | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Sync` is not implemented for `RefCell` + = note: required for `Arc>` to implement `Send` +note: required because it's used within this `async fn` body + --> $DIR/issue-68112.rs:50:31 + | +LL | async fn ready2(t: T) -> T { + | _______________________________^ +LL | | t +LL | | } + | |_^ +note: required because it appears within the type `impl Future>>` + --> $DIR/issue-68112.rs:53:31 + | +LL | fn make_non_send_future2() -> impl Future>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `ResumeTy`, `impl Future>>`, `()`, `i32`, `Ready` +note: required because it's used within this `async` block + --> $DIR/issue-68112.rs:60:26 + | +LL | let send_fut = async { + | __________________________^ +LL | | let non_send_fut = make_non_send_future2(); +LL | | let _ = non_send_fut.await; +LL | | ready(0).await; +LL | | }; + | |_____^ +note: required by a bound in `require_send` + --> $DIR/issue-68112.rs:14:25 + | +LL | fn require_send(_: impl Send) {} + | ^^^^ required by this bound in `require_send` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-68112.rs b/src/test/ui/async-await/issue-68112.rs index bfabf81d1..9c705137a 100644 --- a/src/test/ui/async-await/issue-68112.rs +++ b/src/test/ui/async-await/issue-68112.rs @@ -1,10 +1,13 @@ // edition:2018 +// revisions: no_drop_tracking drop_tracking +// [drop_tracking] compile-flags: -Zdrop-tracking=yes +// [no_drop_tracking] compile-flags: -Zdrop-tracking=no use std::{ - future::Future, cell::RefCell, - sync::Arc, + future::Future, pin::Pin, + sync::Arc, task::{Context, Poll}, }; @@ -44,7 +47,9 @@ fn test1_no_let() { //~^ ERROR future cannot be sent between threads } -async fn ready2(t: T) -> T { t } +async fn ready2(t: T) -> T { + t +} fn make_non_send_future2() -> impl Future>> { ready2(Arc::new(RefCell::new(0))) } diff --git a/src/test/ui/async-await/issue-68112.stderr b/src/test/ui/async-await/issue-68112.stderr deleted file mode 100644 index 4285fbbec..000000000 --- a/src/test/ui/async-await/issue-68112.stderr +++ /dev/null @@ -1,74 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:34:5 - | -LL | require_send(send_fut); - | ^^^^^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `RefCell` -note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/issue-68112.rs:31: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:11:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:43:5 - | -LL | require_send(send_fut); - | ^^^^^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `RefCell` -note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/issue-68112.rs:40: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:11: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:60:5 - | -LL | require_send(send_fut); - | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely - | - = help: the trait `Sync` is not implemented for `RefCell` - = note: required because of the requirements on the impl of `Send` for `Arc>` -note: required because it's used within this `async fn` body - --> $DIR/issue-68112.rs:47:31 - | -LL | async fn ready2(t: T) -> T { t } - | ^^^^^ -note: required because it appears within the type `impl Future>>` - --> $DIR/issue-68112.rs:48:31 - | -LL | fn make_non_send_future2() -> impl Future>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `ResumeTy`, `impl Future>>`, `()`, `i32`, `Ready` -note: required because it's used within this `async` block - --> $DIR/issue-68112.rs:55:26 - | -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:11:25 - | -LL | fn require_send(_: impl Send) {} - | ^^^^ required by this bound in `require_send` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr index a88bce6cc..d3cf57d3b 100644 --- a/src/test/ui/async-await/issue-70594.stderr +++ b/src/test/ui/async-await/issue-70594.stderr @@ -22,16 +22,14 @@ error[E0277]: `()` is not a future --> $DIR/issue-70594.rs:4:11 | LL | [1; ().await]; - | ^^^^^^ `()` is not a future + | ^^^^^^ + | | + | `()` is not a future + | help: remove the `.await` | = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` -help: remove the `.await` - | -LL - [1; ().await]; -LL + [1; ()]; - | + = note: required for `()` to implement `IntoFuture` error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr index 2ce7309e1..198de7bf7 100644 --- a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr +++ b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr @@ -1,18 +1,18 @@ error[E0277]: `Sender` cannot be shared between threads safely - --> $DIR/issue-70935-complex-spans.rs:12:45 + --> $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 because of the requirements on the impl of `Send` for `&Sender` + = note: required for `&Sender` to implement `Send` note: required because it's used within this closure - --> $DIR/issue-70935-complex-spans.rs:16:13 + --> $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:9:67 + --> $DIR/issue-70935-complex-spans.rs:10:67 | LL | async fn baz(_c: impl FnMut() -> T) where T: Future { | ___________________________________________________________________^ @@ -20,7 +20,7 @@ LL | | } | |_^ = note: required because it captures the following types: `ResumeTy`, `impl for<'r, 's, 't0> Future`, `()` note: required because it's used within this `async` block - --> $DIR/issue-70935-complex-spans.rs:15:16 + --> $DIR/issue-70935-complex-spans.rs:16:16 | LL | async move { | ________________^ diff --git a/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr new file mode 100644 index 000000000..34b31198e --- /dev/null +++ b/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr @@ -0,0 +1,25 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-70935-complex-spans.rs:13:45 + | +LL | fn foo(tx: std::sync::mpsc::Sender) -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `Sync` is not implemented for `Sender` +note: future is not `Send` as this value is used across an await + --> $DIR/issue-70935-complex-spans.rs:19:11 + | +LL | baz(|| async{ + | _____________- +LL | | foo(tx.clone()); +LL | | }).await; + | | - ^^^^^^ await occurs here, with the value maybe used later + | |_________| + | has type `[closure@$DIR/issue-70935-complex-spans.rs:17:13: 17:15]` which is not `Send` +note: the value is later dropped here + --> $DIR/issue-70935-complex-spans.rs:19:17 + | +LL | }).await; + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/async-await/issue-70935-complex-spans.normal.stderr b/src/test/ui/async-await/issue-70935-complex-spans.normal.stderr deleted file mode 100644 index 2b81b4000..000000000 --- a/src/test/ui/async-await/issue-70935-complex-spans.normal.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-70935-complex-spans.rs:12:45 - | -LL | fn foo(tx: std::sync::mpsc::Sender) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `Sender` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-70935-complex-spans.rs:18:11 - | -LL | baz(|| async{ - | _____________- -LL | | foo(tx.clone()); -LL | | }).await; - | | - ^^^^^^ await occurs here, with the value maybe used later - | |_________| - | has type `[closure@$DIR/issue-70935-complex-spans.rs:16:13: 16:15]` which is not `Send` -note: the value is later dropped here - --> $DIR/issue-70935-complex-spans.rs:18:17 - | -LL | }).await; - | ^ - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issue-70935-complex-spans.rs b/src/test/ui/async-await/issue-70935-complex-spans.rs index 48847cdf9..b6d17f93a 100644 --- a/src/test/ui/async-await/issue-70935-complex-spans.rs +++ b/src/test/ui/async-await/issue-70935-complex-spans.rs @@ -1,5 +1,6 @@ // edition:2018 -// revisions: normal drop_tracking +// revisions: no_drop_tracking drop_tracking +// [no_drop_tracking]compile-flags:-Zdrop-tracking=no // [drop_tracking]compile-flags:-Zdrop-tracking // #70935: Check if we do not emit snippet // with newlines which lead complex diagnostics. @@ -10,7 +11,7 @@ async fn baz(_c: impl FnMut() -> T) where T: Future { } fn foo(tx: std::sync::mpsc::Sender) -> impl Future + Send { - //[normal]~^ ERROR future cannot be sent between threads safely + //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely //[drop_tracking]~^^ ERROR `Sender` cannot be shared between threads async move { baz(|| async{ diff --git a/src/test/ui/async-await/issue-73137.rs b/src/test/ui/async-await/issue-73137.rs index c43ce2cad..dcbe7765a 100644 --- a/src/test/ui/async-await/issue-73137.rs +++ b/src/test/ui/async-await/issue-73137.rs @@ -2,6 +2,9 @@ // run-pass // edition:2018 +// revisions: normal drop-tracking +// [normal]compile-flags: -Zdrop-tracking=no +// [drop-tracking]compile-flags: -Zdrop-tracking #![allow(dead_code)] use std::future::Future; diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr index 5cbbf89a2..222afb2c7 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.stderr +++ b/src/test/ui/async-await/issues/issue-62009-1.stderr @@ -28,16 +28,14 @@ error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future --> $DIR/issue-62009-1.rs:12:15 | LL | (|_| 2333).await; - | ^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future + | ^^^^^^ + | | + | `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future + | help: remove the `.await` | - = help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` + = help: the trait `Future` is not implemented for closure `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` = note: [closure@$DIR/issue-62009-1.rs:12:6: 12:9] must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` -help: remove the `.await` - | -LL - (|_| 2333).await; -LL + (|_| 2333); - | + = note: required for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` to implement `IntoFuture` error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr new file mode 100644 index 000000000..a72350377 --- /dev/null +++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr @@ -0,0 +1,36 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-65436-raw-ptr-not-send.rs:16:17 + | +LL | assert_send(async { + | _________________^ +LL | | +LL | | bar(Foo(std::ptr::null())).await; +LL | | }) + | |_____^ future created by async block is not `Send` + | + = help: within `impl Future`, the trait `Send` is not implemented for `*const u8` +note: future is not `Send` as this value is used across an await + --> $DIR/issue-65436-raw-ptr-not-send.rs:18:35 + | +LL | bar(Foo(std::ptr::null())).await; + | ---------------- ^^^^^^ await occurs here, with `std::ptr::null()` maybe used later + | | + | has type `*const u8` which is not `Send` +note: `std::ptr::null()` is later dropped here + --> $DIR/issue-65436-raw-ptr-not-send.rs:18:41 + | +LL | bar(Foo(std::ptr::null())).await; + | ^ +help: consider moving this into a `let` binding to create a shorter lived borrow + --> $DIR/issue-65436-raw-ptr-not-send.rs:18:13 + | +LL | bar(Foo(std::ptr::null())).await; + | ^^^^^^^^^^^^^^^^^^^^^ +note: required by a bound in `assert_send` + --> $DIR/issue-65436-raw-ptr-not-send.rs:13:19 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs index 3a814b475..91edbc10d 100644 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs +++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs @@ -1,4 +1,8 @@ // edition:2018 +// revisions: no_drop_tracking drop_tracking +// [drop_tracking] check-pass +// [drop_tracking] compile-flags: -Zdrop-tracking=yes +// [no_drop_tracking] compile-flags: -Zdrop-tracking=no struct Foo(*const u8); @@ -10,7 +14,7 @@ fn assert_send(_: T) {} fn main() { assert_send(async { - //~^ ERROR future cannot be sent between threads safely + //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely bar(Foo(std::ptr::null())).await; }) } diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr deleted file mode 100644 index b23093001..000000000 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-65436-raw-ptr-not-send.rs:12:5 - | -LL | assert_send(async { - | ^^^^^^^^^^^ future created by async block is not `Send` - | - = help: within `impl Future`, 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:14:35 - | -LL | bar(Foo(std::ptr::null())).await; - | ---------------- ^^^^^^ await occurs here, with `std::ptr::null()` maybe used later - | | - | has type `*const u8` which is not `Send` -note: `std::ptr::null()` is later dropped here - --> $DIR/issue-65436-raw-ptr-not-send.rs:14:41 - | -LL | bar(Foo(std::ptr::null())).await; - | ^ -help: consider moving this into a `let` binding to create a shorter lived borrow - --> $DIR/issue-65436-raw-ptr-not-send.rs:14:13 - | -LL | bar(Foo(std::ptr::null())).await; - | ^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `assert_send` - --> $DIR/issue-65436-raw-ptr-not-send.rs:9:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to previous error - diff --git a/src/test/ui/async-await/issues/issue-95307.stderr b/src/test/ui/async-await/issues/issue-95307.stderr index 60fca71eb..1c12f1e48 100644 --- a/src/test/ui/async-await/issues/issue-95307.stderr +++ b/src/test/ui/async-await/issues/issue-95307.stderr @@ -8,6 +8,14 @@ LL | async fn new() -> [u8; _]; | = 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(return_position_impl_trait_in_trait)]` to the crate attributes to enable + +error: in expressions, `_` can only be used on the left-hand side of an assignment + --> $DIR/issue-95307.rs:7:28 + | +LL | async fn new() -> [u8; _]; + | ^ `_` not allowed here error[E0658]: using `_` for array lengths is unstable --> $DIR/issue-95307.rs:7:28 @@ -18,12 +26,6 @@ LL | async fn new() -> [u8; _]; = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/issue-95307.rs:7:28 - | -LL | async fn new() -> [u8; _]; - | ^ `_` not allowed here - error: aborting due to 3 previous errors Some errors have detailed explanations: E0658, E0706. diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr new file mode 100644 index 000000000..17b4ef7bd --- /dev/null +++ b/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr @@ -0,0 +1,35 @@ +error[E0277]: `NotSend` cannot be sent between threads safely + --> $DIR/partial-drop-partial-reinit.rs:9:16 + | +LL | gimme_send(foo()); + | ---------- ^^^^^ `NotSend` cannot be sent between threads safely + | | + | required by a bound introduced by this call +... +LL | async fn foo() { + | - within this `impl Future` + | + = help: within `impl Future`, the trait `Send` is not implemented for `NotSend` + = note: required because it appears within the type `(NotSend,)` + = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `()`, `impl Future` +note: required because it's used within this `async fn` body + --> $DIR/partial-drop-partial-reinit.rs:31:16 + | +LL | async fn foo() { + | ________________^ +LL | | +LL | | +LL | | let mut x = (NotSend {},); +... | +LL | | bar().await; +LL | | } + | |_^ +note: required by a bound in `gimme_send` + --> $DIR/partial-drop-partial-reinit.rs:17:18 + | +LL | fn gimme_send(t: T) { + | ^^^^ required by this bound in `gimme_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr new file mode 100644 index 000000000..34d8a159f --- /dev/null +++ b/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr @@ -0,0 +1,35 @@ +error[E0277]: `NotSend` cannot be sent between threads safely + --> $DIR/partial-drop-partial-reinit.rs:9:16 + | +LL | gimme_send(foo()); + | ---------- ^^^^^ `NotSend` cannot be sent between threads safely + | | + | required by a bound introduced by this call +... +LL | async fn foo() { + | - within this `impl Future` + | + = help: within `impl Future`, the trait `Send` is not implemented for `NotSend` + = note: required because it appears within the type `(NotSend,)` + = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future`, `()` +note: required because it's used within this `async fn` body + --> $DIR/partial-drop-partial-reinit.rs:31:16 + | +LL | async fn foo() { + | ________________^ +LL | | +LL | | +LL | | let mut x = (NotSend {},); +... | +LL | | bar().await; +LL | | } + | |_^ +note: required by a bound in `gimme_send` + --> $DIR/partial-drop-partial-reinit.rs:17:18 + | +LL | fn gimme_send(t: T) { + | ^^^^ required by this bound in `gimme_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.rs b/src/test/ui/async-await/partial-drop-partial-reinit.rs index fe0fce7af..7d097e72f 100644 --- a/src/test/ui/async-await/partial-drop-partial-reinit.rs +++ b/src/test/ui/async-await/partial-drop-partial-reinit.rs @@ -1,4 +1,7 @@ // edition:2021 +// revisions: no_drop_tracking drop_tracking +// [drop_tracking] compile-flags: -Zdrop-tracking=yes +// [no_drop_tracking] compile-flags: -Zdrop-tracking=no #![feature(negative_impls)] #![allow(unused)] @@ -12,8 +15,8 @@ fn main() { } fn gimme_send(t: T) { -//~^ NOTE required by this bound -//~| NOTE required by a bound + //~^ NOTE required by this bound + //~| NOTE required by a bound drop(t); } @@ -26,8 +29,8 @@ impl Drop for NotSend { impl !Send for NotSend {} async fn foo() { -//~^ NOTE used within this `async fn` body -//~| NOTE within this `impl Future + //~^ NOTE used within this `async fn` body + //~| NOTE within this `impl Future let mut x = (NotSend {},); drop(x.0); x.0 = NotSend {}; diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.stderr deleted file mode 100644 index 05f535834..000000000 --- a/src/test/ui/async-await/partial-drop-partial-reinit.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0277]: `NotSend` cannot be sent between threads safely - --> $DIR/partial-drop-partial-reinit.rs:6:16 - | -LL | gimme_send(foo()); - | ---------- ^^^^^ `NotSend` cannot be sent between threads safely - | | - | required by a bound introduced by this call -... -LL | async fn foo() { - | - within this `impl Future` - | - = help: within `impl Future`, the trait `Send` is not implemented for `NotSend` - = note: required because it appears within the type `(NotSend,)` - = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future`, `()` -note: required because it's used within this `async fn` body - --> $DIR/partial-drop-partial-reinit.rs:28:16 - | -LL | async fn foo() { - | ________________^ -LL | | -LL | | -LL | | let mut x = (NotSend {},); -... | -LL | | bar().await; -LL | | } - | |_^ -note: required by a bound in `gimme_send` - --> $DIR/partial-drop-partial-reinit.rs:14:18 - | -LL | fn gimme_send(t: T) { - | ^^^^ required by this bound in `gimme_send` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/unnecessary-await.stderr b/src/test/ui/async-await/unnecessary-await.stderr index e7e61c2ba..dc3089336 100644 --- a/src/test/ui/async-await/unnecessary-await.stderr +++ b/src/test/ui/async-await/unnecessary-await.stderr @@ -8,7 +8,7 @@ LL | boo().await; | = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` + = note: required for `()` to implement `IntoFuture` help: remove the `.await` | LL - boo().await; diff --git a/src/test/ui/attempted-access-non-fatal.rs b/src/test/ui/attempted-access-non-fatal.rs index e50c1f23c..15deb9e2f 100644 --- a/src/test/ui/attempted-access-non-fatal.rs +++ b/src/test/ui/attempted-access-non-fatal.rs @@ -3,4 +3,8 @@ fn main() { let x = 0; let _ = x.foo; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] let _ = x.bar; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 0.f; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 2.l; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 12.F; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 34.L; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] } diff --git a/src/test/ui/attempted-access-non-fatal.stderr b/src/test/ui/attempted-access-non-fatal.stderr index 5b7db0e9d..bff669727 100644 --- a/src/test/ui/attempted-access-non-fatal.stderr +++ b/src/test/ui/attempted-access-non-fatal.stderr @@ -10,6 +10,50 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | let _ = x.bar; | ^^^ -error: aborting due to 2 previous errors +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/attempted-access-non-fatal.rs:6:15 + | +LL | let _ = 0.f; + | ^ + | +help: if intended to be a floating point literal, consider adding a `0` after the period and a `f32` suffix + | +LL | let _ = 0.0f32; + | ~~~~ + +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/attempted-access-non-fatal.rs:7:15 + | +LL | let _ = 2.l; + | ^ + | +help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix + | +LL | let _ = 2.0f64; + | ~~~~ + +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/attempted-access-non-fatal.rs:8:16 + | +LL | let _ = 12.F; + | ^ + | +help: if intended to be a floating point literal, consider adding a `0` after the period and a `f32` suffix + | +LL | let _ = 12.0f32; + | ~~~~ + +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/attempted-access-non-fatal.rs:9:16 + | +LL | let _ = 34.L; + | ^ + | +help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix + | +LL | let _ = 34.0f64; + | ~~~~ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0610`. diff --git a/src/test/ui/attributes/collapse-debuginfo-invalid.rs b/src/test/ui/attributes/collapse-debuginfo-invalid.rs new file mode 100644 index 000000000..42d8982c1 --- /dev/null +++ b/src/test/ui/attributes/collapse-debuginfo-invalid.rs @@ -0,0 +1,110 @@ +#![feature(collapse_debuginfo)] +#![feature(stmt_expr_attributes)] +#![feature(type_alias_impl_trait)] +#![no_std] + +// Test that the `#[collapse_debuginfo]` attribute can only be used on macro definitions. + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +extern crate std; + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +use std::collections::HashMap; + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +static FOO: u32 = 3; + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +const BAR: u32 = 3; + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +fn foo() { + let _ = #[collapse_debuginfo] || { }; +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions + #[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions + let _ = 3; + let _ = #[collapse_debuginfo] 3; +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions + match (3, 4) { + #[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions + _ => (), + } +} + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +mod bar { +} + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +type Map = HashMap; + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +enum Foo { + #[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions + Variant, +} + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +struct Bar { + #[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions + field: u32, +} + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +union Qux { + a: u32, + b: u16 +} + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +trait Foobar { + #[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions + type Bar; +} + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +type AFoobar = impl Foobar; + +impl Foobar for Bar { + type Bar = u32; +} + +fn constraining() -> AFoobar { + Bar { field: 3 } +} + +#[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions +impl Bar { + #[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions + const FOO: u32 = 3; + + #[collapse_debuginfo] +//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions + fn bar(&self) {} +} + +#[collapse_debuginfo] +macro_rules! finally { + ($e:expr) => { $e } +} + +fn main() {} diff --git a/src/test/ui/attributes/collapse-debuginfo-invalid.stderr b/src/test/ui/attributes/collapse-debuginfo-invalid.stderr new file mode 100644 index 000000000..01c476091 --- /dev/null +++ b/src/test/ui/attributes/collapse-debuginfo-invalid.stderr @@ -0,0 +1,222 @@ +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:8:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | extern crate std; + | ----------------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:12:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | use std::collections::HashMap; + | ------------------------------ not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:16:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | static FOO: u32 = 3; + | -------------------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:20:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | const BAR: u32 = 3; + | ------------------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:24:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | / fn foo() { +LL | | let _ = #[collapse_debuginfo] || { }; +LL | | +LL | | #[collapse_debuginfo] +... | +LL | | } +LL | | } + | |_- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:27:13 + | +LL | let _ = #[collapse_debuginfo] || { }; + | ^^^^^^^^^^^^^^^^^^^^^ ------ not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:29:5 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | let _ = 3; + | ---------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:32:13 + | +LL | let _ = #[collapse_debuginfo] 3; + | ^^^^^^^^^^^^^^^^^^^^^ - not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:35:9 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | _ => (), + | ------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:41:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | / mod bar { +LL | | } + | |_- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:46:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | type Map = HashMap; + | ----------------------------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:50:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | / enum Foo { +LL | | #[collapse_debuginfo] +LL | | +LL | | Variant, +LL | | } + | |_- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:53:5 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | Variant, + | ------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:58:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | / struct Bar { +LL | | #[collapse_debuginfo] +LL | | +LL | | field: u32, +LL | | } + | |_- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:61:5 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | field: u32, + | ---------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:66:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | / union Qux { +LL | | a: u32, +LL | | b: u16 +LL | | } + | |_- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:73:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | / trait Foobar { +LL | | #[collapse_debuginfo] +LL | | +LL | | type Bar; +LL | | } + | |_- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:81:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | type AFoobar = impl Foobar; + | --------------------------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:93:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | / impl Bar { +LL | | #[collapse_debuginfo] +LL | | +LL | | const FOO: u32 = 3; +... | +LL | | fn bar(&self) {} +LL | | } + | |_- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:76:5 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | type Bar; + | --------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:96:5 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | const FOO: u32 = 3; + | ------------------- not a macro definition + +error: `collapse_debuginfo` attribute should be applied to macro definitions + --> $DIR/collapse-debuginfo-invalid.rs:100:5 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | fn bar(&self) {} + | ---------------- not a macro definition + +error: aborting due to 22 previous errors + diff --git a/src/test/ui/attributes/issue-100631.rs b/src/test/ui/attributes/issue-100631.rs new file mode 100644 index 000000000..0fefcf83f --- /dev/null +++ b/src/test/ui/attributes/issue-100631.rs @@ -0,0 +1,8 @@ +// issue #100631, make sure `TyCtxt::get_attr` only called by case that compiler +// can reasonably deal with multiple attributes. +// `repr` will use `TyCtxt::get_attrs` since it's `DuplicatesOk`. +#[repr(C)] //~ ERROR: unsupported representation for zero-variant enum [E0084] +#[repr(C)] +enum Foo {} + +fn main() {} diff --git a/src/test/ui/attributes/issue-100631.stderr b/src/test/ui/attributes/issue-100631.stderr new file mode 100644 index 000000000..caa5351dd --- /dev/null +++ b/src/test/ui/attributes/issue-100631.stderr @@ -0,0 +1,12 @@ +error[E0084]: unsupported representation for zero-variant enum + --> $DIR/issue-100631.rs:4:1 + | +LL | #[repr(C)] + | ^^^^^^^^^^ +LL | #[repr(C)] +LL | enum Foo {} + | -------- zero-variant enum + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0084`. diff --git a/src/test/ui/attributes/issue-90873.stderr b/src/test/ui/attributes/issue-90873.stderr index 0852bb7ca..894ec8341 100644 --- a/src/test/ui/attributes/issue-90873.stderr +++ b/src/test/ui/attributes/issue-90873.stderr @@ -34,10 +34,10 @@ LL | #![a={impl std::ops::Neg for i8 {}}] | ^ consider adding a `main` function to `$DIR/issue-90873.rs` error: missing type for `static` item - --> $DIR/issue-90873.rs:1:16 + --> $DIR/issue-90873.rs:1:17 | LL | #![u=||{static d=||1;}] - | ^ help: provide a type for the item: `d: ` + | ^ help: provide a type for the item: `: ` error: aborting due to 6 previous errors diff --git a/src/test/ui/attributes/register-attr-tool-fail.rs b/src/test/ui/attributes/register-attr-tool-fail.rs deleted file mode 100644 index 84736be84..000000000 --- a/src/test/ui/attributes/register-attr-tool-fail.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(register_attr)] -#![feature(register_tool)] - -#![register_attr] //~ ERROR malformed `register_attr` attribute input -#![register_tool] //~ ERROR malformed `register_tool` attribute input - -#![register_attr(a::b)] //~ ERROR `register_attr` only accepts identifiers -#![register_tool(a::b)] //~ ERROR `register_tool` only accepts identifiers - -#![register_attr(attr, attr)] //~ ERROR attribute `attr` was already registered -#![register_tool(tool, tool)] //~ ERROR tool `tool` was already registered - -fn main() {} diff --git a/src/test/ui/attributes/register-attr-tool-fail.stderr b/src/test/ui/attributes/register-attr-tool-fail.stderr deleted file mode 100644 index 8f6977cb5..000000000 --- a/src/test/ui/attributes/register-attr-tool-fail.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error: `register_attr` only accepts identifiers - --> $DIR/register-attr-tool-fail.rs:7:18 - | -LL | #![register_attr(a::b)] - | ^^^^ not an identifier - -error: attribute `attr` was already registered - --> $DIR/register-attr-tool-fail.rs:10:24 - | -LL | #![register_attr(attr, attr)] - | ---- ^^^^ - | | - | already registered here - -error: `register_tool` only accepts identifiers - --> $DIR/register-attr-tool-fail.rs:8:18 - | -LL | #![register_tool(a::b)] - | ^^^^ not an identifier - -error: tool `tool` was already registered - --> $DIR/register-attr-tool-fail.rs:11:24 - | -LL | #![register_tool(tool, tool)] - | ---- ^^^^ - | | - | already registered here - -error: malformed `register_attr` attribute input - --> $DIR/register-attr-tool-fail.rs:4:1 - | -LL | #![register_attr] - | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#![register_attr(attr1, attr2, ...)]` - -error: malformed `register_tool` attribute input - --> $DIR/register-attr-tool-fail.rs:5:1 - | -LL | #![register_tool] - | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#![register_tool(tool1, tool2, ...)]` - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/attributes/register-attr-tool-import.rs b/src/test/ui/attributes/register-attr-tool-import.rs deleted file mode 100644 index d3502c71f..000000000 --- a/src/test/ui/attributes/register-attr-tool-import.rs +++ /dev/null @@ -1,17 +0,0 @@ -// edition:2018 -// compile-flags: -Zsave-analysis -// ~^ Also regression test for #69588 - -#![feature(register_attr)] -#![feature(register_tool)] - -#![register_attr(attr)] -#![register_tool(tool)] - -use attr as renamed_attr; // OK -use tool as renamed_tool; // OK - -#[renamed_attr] //~ ERROR cannot use an explicitly registered attribute through an import -#[renamed_tool::attr] //~ ERROR cannot use a tool module through an import - //~| ERROR cannot use a tool module through an import -fn main() {} diff --git a/src/test/ui/attributes/register-attr-tool-import.stderr b/src/test/ui/attributes/register-attr-tool-import.stderr deleted file mode 100644 index 90b7e169a..000000000 --- a/src/test/ui/attributes/register-attr-tool-import.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: cannot use an explicitly registered attribute through an import - --> $DIR/register-attr-tool-import.rs:14:3 - | -LL | #[renamed_attr] - | ^^^^^^^^^^^^ - | -note: the explicitly registered attribute imported here - --> $DIR/register-attr-tool-import.rs:11:5 - | -LL | use attr as renamed_attr; // OK - | ^^^^^^^^^^^^^^^^^^^^ - -error: cannot use a tool module through an import - --> $DIR/register-attr-tool-import.rs:15:3 - | -LL | #[renamed_tool::attr] - | ^^^^^^^^^^^^ - | -note: the tool module imported here - --> $DIR/register-attr-tool-import.rs:12:5 - | -LL | use tool as renamed_tool; // OK - | ^^^^^^^^^^^^^^^^^^^^ - -error: cannot use a tool module through an import - --> $DIR/register-attr-tool-import.rs:15:3 - | -LL | #[renamed_tool::attr] - | ^^^^^^^^^^^^ - | -note: the tool module imported here - --> $DIR/register-attr-tool-import.rs:12:5 - | -LL | use tool as renamed_tool; // OK - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/attributes/register-attr-tool-prelude.rs b/src/test/ui/attributes/register-attr-tool-prelude.rs deleted file mode 100644 index d217a8146..000000000 --- a/src/test/ui/attributes/register-attr-tool-prelude.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(register_attr)] -#![feature(register_tool)] - -#![register_attr(attr)] -#![register_tool(tool)] - -#[no_implicit_prelude] -mod m { - #[attr] //~ ERROR cannot find attribute `attr` in this scope - #[tool::attr] //~ ERROR failed to resolve: use of undeclared crate or module `tool` - fn check() {} -} - -fn main() {} diff --git a/src/test/ui/attributes/register-attr-tool-prelude.stderr b/src/test/ui/attributes/register-attr-tool-prelude.stderr deleted file mode 100644 index 905b66120..000000000 --- a/src/test/ui/attributes/register-attr-tool-prelude.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0433]: failed to resolve: use of undeclared crate or module `tool` - --> $DIR/register-attr-tool-prelude.rs:10:7 - | -LL | #[tool::attr] - | ^^^^ use of undeclared crate or module `tool` - -error: cannot find attribute `attr` in this scope - --> $DIR/register-attr-tool-prelude.rs:9:7 - | -LL | #[attr] - | ^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/attributes/register-attr-tool-unused.rs b/src/test/ui/attributes/register-attr-tool-unused.rs deleted file mode 100644 index 680614656..000000000 --- a/src/test/ui/attributes/register-attr-tool-unused.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![deny(unused)] - -#![feature(register_attr)] -#![feature(register_tool)] - -#[register_attr(attr)] //~ ERROR crate-level attribute should be an inner attribute -#[register_tool(tool)] //~ ERROR crate-level attribute should be an inner attribute -fn main() {} diff --git a/src/test/ui/attributes/register-attr-tool-unused.stderr b/src/test/ui/attributes/register-attr-tool-unused.stderr deleted file mode 100644 index 8d2e1b6bc..000000000 --- a/src/test/ui/attributes/register-attr-tool-unused.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/register-attr-tool-unused.rs:6:1 - | -LL | #[register_attr(attr)] - | ^^^^^^^^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/register-attr-tool-unused.rs:1:9 - | -LL | #![deny(unused)] - | ^^^^^^ - = note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]` - -error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/register-attr-tool-unused.rs:7:1 - | -LL | #[register_tool(tool)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/attributes/register-attr-tool.rs b/src/test/ui/attributes/register-attr-tool.rs deleted file mode 100644 index ee9da74d4..000000000 --- a/src/test/ui/attributes/register-attr-tool.rs +++ /dev/null @@ -1,19 +0,0 @@ -// check-pass -// compile-flags: --cfg foo - -#![feature(register_attr)] -#![feature(register_tool)] - -#![register_attr(attr)] -#![register_tool(tool)] -#![register_tool(rustfmt, clippy)] // OK -#![cfg_attr(foo, register_attr(conditional_attr))] -#![cfg_attr(foo, register_tool(conditional_tool))] - -#[attr] -#[tool::attr] -#[rustfmt::attr] -#[clippy::attr] -#[conditional_attr] -#[conditional_tool::attr] -fn main() {} diff --git a/src/test/ui/attributes/unix_sigpipe/auxiliary/sigpipe-utils.rs b/src/test/ui/attributes/unix_sigpipe/auxiliary/sigpipe-utils.rs new file mode 100644 index 000000000..e8b4fe7ae --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/auxiliary/sigpipe-utils.rs @@ -0,0 +1,31 @@ +#![feature(rustc_private)] +extern crate libc; + +/// So tests don't have to bring libc in scope themselves +pub enum SignalHandler { + Ignore, + Default, +} + +/// Helper to assert that [`libc::SIGPIPE`] has the expected signal handler. +pub fn assert_sigpipe_handler(expected_handler: SignalHandler) { + #[cfg(unix)] + #[cfg(not(any( + target_os = "emscripten", + target_os = "fuchsia", + target_os = "horizon", + target_os = "android", + )))] + { + let prev = unsafe { libc::signal(libc::SIGPIPE, libc::SIG_IGN) }; + + let expected = match expected_handler { + SignalHandler::Ignore => libc::SIG_IGN, + SignalHandler::Default => libc::SIG_DFL, + }; + assert_eq!(prev, expected); + + // Unlikely to matter, but restore the old value anyway + unsafe { libc::signal(libc::SIGPIPE, prev); }; + } +} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-crate.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-crate.rs new file mode 100644 index 000000000..d6d020c52 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-crate.rs @@ -0,0 +1,4 @@ +#![feature(unix_sigpipe)] +#![unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute cannot be used at crate level + +fn main() {} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr new file mode 100644 index 000000000..a1fb4d678 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr @@ -0,0 +1,13 @@ +error: `unix_sigpipe` attribute cannot be used at crate level + --> $DIR/unix_sigpipe-crate.rs:2:1 + | +LL | #![unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[unix_sigpipe = "inherit"] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs new file mode 100644 index 000000000..294cb3852 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs @@ -0,0 +1,5 @@ +#![feature(unix_sigpipe)] + +#[unix_sigpipe = "sig_ign"] +#[unix_sigpipe = "inherit"] //~ error: multiple `unix_sigpipe` attributes +fn main() {} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr new file mode 100644 index 000000000..2362c17a0 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr @@ -0,0 +1,14 @@ +error: multiple `unix_sigpipe` attributes + --> $DIR/unix_sigpipe-duplicates.rs:4:1 + | +LL | #[unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unix_sigpipe-duplicates.rs:3:1 + | +LL | #[unix_sigpipe = "sig_ign"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-error.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-error.rs new file mode 100644 index 000000000..0a42a5b5e --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-error.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:sigpipe-utils.rs + +#![feature(unix_sigpipe)] + +#[unix_sigpipe = "sig_ign"] +fn main() { + extern crate sigpipe_utils; + + // #[unix_sigpipe = "sig_ign"] is active, so the legacy behavior of ignoring + // SIGPIPE shall be in effect + sigpipe_utils::assert_sigpipe_handler(sigpipe_utils::SignalHandler::Ignore); +} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.rs new file mode 100644 index 000000000..4f8648077 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-inherit.rs @@ -0,0 +1,14 @@ +// run-pass +// aux-build:sigpipe-utils.rs + +#![feature(unix_sigpipe)] + +#[unix_sigpipe = "inherit"] +fn main() { + extern crate sigpipe_utils; + + // #[unix_sigpipe = "inherit"] is active, so SIGPIPE shall NOT be ignored, + // instead the default handler shall be installed. (We assume that the + // process that runs these tests have the default handler.) + sigpipe_utils::assert_sigpipe_handler(sigpipe_utils::SignalHandler::Default); +} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs new file mode 100644 index 000000000..b5ebc07a0 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs @@ -0,0 +1,4 @@ +#![feature(unix_sigpipe)] + +#[unix_sigpipe(inherit)] //~ error: malformed `unix_sigpipe` attribute input +fn main() {} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr new file mode 100644 index 000000000..59a87e139 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr @@ -0,0 +1,15 @@ +error: malformed `unix_sigpipe` attribute input + --> $DIR/unix_sigpipe-list.rs:3:1 + | +LL | #[unix_sigpipe(inherit)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: the following are the possible correct uses + | +LL | #[unix_sigpipe = "inherit|sig_ign|sig_dfl"] + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL | #[unix_sigpipe] + | ~~~~~~~~~~~~~~~ + +error: aborting due to previous error + diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.rs new file mode 100644 index 000000000..cde6719fc --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.rs @@ -0,0 +1,6 @@ +#![feature(unix_sigpipe)] + +#[unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` +fn f() {} + +fn main() {} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.stderr b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.stderr new file mode 100644 index 000000000..c4b81118c --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-main-fn.stderr @@ -0,0 +1,8 @@ +error: `unix_sigpipe` attribute can only be used on `fn main()` + --> $DIR/unix_sigpipe-non-main-fn.rs:3:1 + | +LL | #[unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.rs new file mode 100644 index 000000000..16f727639 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.rs @@ -0,0 +1,8 @@ +#![feature(unix_sigpipe)] + +mod m { + #[unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute can only be used on root `fn main()` + fn main() {} +} + +fn main() {} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.stderr b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.stderr new file mode 100644 index 000000000..a04f605ed --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-non-root-main.stderr @@ -0,0 +1,8 @@ +error: `unix_sigpipe` attribute can only be used on root `fn main()` + --> $DIR/unix_sigpipe-non-root-main.rs:4:5 + | +LL | #[unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs new file mode 100644 index 000000000..100b4ce9f --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs @@ -0,0 +1,9 @@ +// run-pass +// aux-build:sigpipe-utils.rs + +fn main() { + extern crate sigpipe_utils; + + // SIGPIPE shall be ignored since #[unix_sigpipe = "..."] is not used + sigpipe_utils::assert_sigpipe_handler(sigpipe_utils::SignalHandler::Ignore); +} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs new file mode 100644 index 000000000..b5adc2e55 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:sigpipe-utils.rs + +#![feature(unix_sigpipe)] + +fn main() { + extern crate sigpipe_utils; + + // Only #![feature(unix_sigpipe)] is enabled, not #[unix_sigpipe = "..."]. + // This shall not change any behavior, so we still expect SIGPIPE to be + // ignored + sigpipe_utils::assert_sigpipe_handler(sigpipe_utils::SignalHandler::Ignore); +} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-rustc_main.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-rustc_main.rs new file mode 100644 index 000000000..6befb9e95 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-rustc_main.rs @@ -0,0 +1,15 @@ +// run-pass +// aux-build:sigpipe-utils.rs + +#![feature(unix_sigpipe)] +#![feature(rustc_attrs)] + +#[unix_sigpipe = "sig_dfl"] +#[rustc_main] +fn rustc_main() { + extern crate sigpipe_utils; + + // #[unix_sigpipe = "sig_dfl"] is active, so SIGPIPE handler shall be + // SIG_DFL. Note that we have a #[rustc_main], but it should still work. + sigpipe_utils::assert_sigpipe_handler(sigpipe_utils::SignalHandler::Default); +} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-sig_dfl.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-sig_dfl.rs new file mode 100644 index 000000000..238c0d57a --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-sig_dfl.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:sigpipe-utils.rs + +#![feature(unix_sigpipe)] + +#[unix_sigpipe = "sig_dfl"] +fn main() { + extern crate sigpipe_utils; + + // #[unix_sigpipe = "sig_dfl"] is active, so SIGPIPE shall NOT be ignored, instead + // the default handler shall be installed + sigpipe_utils::assert_sigpipe_handler(sigpipe_utils::SignalHandler::Default); +} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs new file mode 100644 index 000000000..64fd5ec4f --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-start.rs @@ -0,0 +1,6 @@ +#![feature(start)] +#![feature(unix_sigpipe)] + +#[start] +#[unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` +fn custom_start(argc: isize, argv: *const *const u8) -> isize { 0 } diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-start.stderr b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-start.stderr new file mode 100644 index 000000000..2c9ce479b --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-start.stderr @@ -0,0 +1,8 @@ +error: `unix_sigpipe` attribute can only be used on `fn main()` + --> $DIR/unix_sigpipe-start.rs:5:1 + | +LL | #[unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs new file mode 100644 index 000000000..a5e47cfeb --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-struct.rs @@ -0,0 +1,6 @@ +#![feature(unix_sigpipe)] + +#[unix_sigpipe = "inherit"] //~ error: `unix_sigpipe` attribute can only be used on `fn main()` +struct S; + +fn main() {} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-struct.stderr b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-struct.stderr new file mode 100644 index 000000000..c56ee60bb --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-struct.stderr @@ -0,0 +1,8 @@ +error: `unix_sigpipe` attribute can only be used on `fn main()` + --> $DIR/unix_sigpipe-struct.rs:3:1 + | +LL | #[unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.rs new file mode 100644 index 000000000..4ec25de00 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.rs @@ -0,0 +1,4 @@ +#![feature(unix_sigpipe)] + +#[unix_sigpipe = "wrong"] //~ error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` +fn main() {} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.stderr b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.stderr new file mode 100644 index 000000000..a66e45aa2 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe-wrong.stderr @@ -0,0 +1,8 @@ +error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` + --> $DIR/unix_sigpipe-wrong.rs:3:1 + | +LL | #[unix_sigpipe = "wrong"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe.rs b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe.rs new file mode 100644 index 000000000..7bf1c7350 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe.rs @@ -0,0 +1,4 @@ +#![feature(unix_sigpipe)] + +#[unix_sigpipe] //~ error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` +fn main() {} diff --git a/src/test/ui/attributes/unix_sigpipe/unix_sigpipe.stderr b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe.stderr new file mode 100644 index 000000000..1b1eda825 --- /dev/null +++ b/src/test/ui/attributes/unix_sigpipe/unix_sigpipe.stderr @@ -0,0 +1,8 @@ +error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` + --> $DIR/unix_sigpipe.rs:3:1 + | +LL | #[unix_sigpipe] + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/auto-ref-slice-plus-ref.stderr b/src/test/ui/auto-ref-slice-plus-ref.stderr index eb8447ff0..e28830507 100644 --- a/src/test/ui/auto-ref-slice-plus-ref.stderr +++ b/src/test/ui/auto-ref-slice-plus-ref.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `test_mut` found for struct `Vec<{integer}>` in th --> $DIR/auto-ref-slice-plus-ref.rs:7:7 | LL | a.test_mut(); - | ^^^^^^^^ help: there is an associated function with a similar name: `get_mut` + | ^^^^^^^^ help: there is a method with a similar name: `get_mut` | = help: items from traits can only be used if the trait is implemented and in scope note: `MyIter` defines an item `test_mut`, perhaps you need to implement it diff --git a/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr b/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr index 7d6bf58f5..0c4970a72 100644 --- a/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr +++ b/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied in `(MyS2, MyS)` - --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:17:5 + --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:17:18 | LL | is_mytrait::<(MyS2, MyS)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` + | ^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` | = note: required because it appears within the type `(MyS2, MyS)` note: required by a bound in `is_mytrait` diff --git a/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr b/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr index 985cdce12..ce7095664 100644 --- a/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr +++ b/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `u32: Signed` is not satisfied - --> $DIR/typeck-default-trait-impl-precedence.rs:19:5 + --> $DIR/typeck-default-trait-impl-precedence.rs:19:20 | LL | is_defaulted::<&'static u32>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32` + | ^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32` | = help: the trait `Signed` is implemented for `i32` -note: required because of the requirements on the impl of `Defaulted` for `&'static u32` +note: required for `&'static u32` to implement `Defaulted` --> $DIR/typeck-default-trait-impl-precedence.rs:10:19 | LL | impl<'a,T:Signed> Defaulted for &'a T { } diff --git a/src/test/ui/backtrace-apple-no-dsymutil.rs b/src/test/ui/backtrace-apple-no-dsymutil.rs index d32ad11a1..3844ebcfd 100644 --- a/src/test/ui/backtrace-apple-no-dsymutil.rs +++ b/src/test/ui/backtrace-apple-no-dsymutil.rs @@ -4,8 +4,6 @@ // compile-flags:-g -Csplit-debuginfo=unpacked // only-macos -#![feature(backtrace)] - use std::process::Command; use std::str; diff --git a/src/test/ui/binop/binary-op-on-double-ref.stderr b/src/test/ui/binop/binary-op-on-double-ref.stderr index 1651f70d5..34826d2f4 100644 --- a/src/test/ui/binop/binary-op-on-double-ref.stderr +++ b/src/test/ui/binop/binary-op-on-double-ref.stderr @@ -6,7 +6,7 @@ LL | x % 2 == 0 | | | &&{integer} | -help: `%` can be used on `{integer}`, you can dereference `x` +help: `%` can be used on `&{integer}` if you dereference the left-hand side | LL | *x % 2 == 0 | + diff --git a/src/test/ui/binop/issue-77910-1.stderr b/src/test/ui/binop/issue-77910-1.stderr index 68303b842..097a14f26 100644 --- a/src/test/ui/binop/issue-77910-1.stderr +++ b/src/test/ui/binop/issue-77910-1.stderr @@ -18,7 +18,7 @@ LL | fn foo(s: &i32) -> &i32 { LL | assert_eq!(foo, y); | ^^^^^^^^^^^^^^^^^^ `for<'r> fn(&'r i32) -> &'r i32 {foo}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = help: the trait `Debug` is not implemented for `for<'r> fn(&'r i32) -> &'r i32 {foo}` + = help: the trait `Debug` is not implemented for fn item `for<'r> fn(&'r i32) -> &'r i32 {foo}` = help: use parentheses to call the function: `foo(s)` = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/binop/issue-77910-2.stderr b/src/test/ui/binop/issue-77910-2.stderr index 5477a5762..a334bd856 100644 --- a/src/test/ui/binop/issue-77910-2.stderr +++ b/src/test/ui/binop/issue-77910-2.stderr @@ -5,6 +5,11 @@ LL | if foo == y {} | --- ^^ - _ | | | for<'r> fn(&'r i32) -> &'r i32 {foo} + | +help: use parentheses to call this function + | +LL | if foo(/* &i32 */) == y {} + | ++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/block-result/issue-22645.stderr b/src/test/ui/block-result/issue-22645.stderr index 31663e8e8..28debd60a 100644 --- a/src/test/ui/block-result/issue-22645.stderr +++ b/src/test/ui/block-result/issue-22645.stderr @@ -5,7 +5,7 @@ LL | b + 3 | ^ the trait `Scalar` is not implemented for `{integer}` | = help: the trait `Scalar` is implemented for `f64` -note: required because of the requirements on the impl of `Add<{integer}>` for `Bob` +note: required for `Bob` to implement `Add<{integer}>` --> $DIR/issue-22645.rs:8:19 | LL | impl Add for Bob { diff --git a/src/test/ui/block-result/issue-3563.stderr b/src/test/ui/block-result/issue-3563.stderr index 5255e48be..be551f6e8 100644 --- a/src/test/ui/block-result/issue-3563.stderr +++ b/src/test/ui/block-result/issue-3563.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `b` found for reference `&Self` in the current sco --> $DIR/issue-3563.rs:3:17 | LL | || self.b() - | ^ help: there is an associated function with a similar name: `a` + | ^ help: there is a method with a similar name: `a` error: aborting due to previous error diff --git a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr index d4f819308..1fd1eb128 100644 --- a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr +++ b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr @@ -23,7 +23,7 @@ LL | fn bindings_after_at_slice_patterns_move_binding(x: [String; 4]) { | - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait LL | match x { LL | a @ [.., _] => (), - | ----------- value moved here + | - value moved here ... LL | &x; | ^^ value borrowed here after move @@ -32,7 +32,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:28:5 | LL | ref mut foo @ [.., _] => Some(foo), - | --------------------- mutable borrow occurs here + | ----------- mutable borrow occurs here ... LL | &x; | ^^ immutable borrow occurs here @@ -44,7 +44,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:50:5 | LL | [ref foo @ .., ref bar] => Some(foo), - | ------------ immutable borrow occurs here + | ------- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -56,7 +56,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:62:5 | LL | ref foo @ [.., ref bar] => Some(foo), - | ----------------------- immutable borrow occurs here + | ------- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -71,7 +71,7 @@ LL | fn bindings_after_at_or_patterns_move(x: Option) { | - move occurs because `x` has type `Option`, which does not implement the `Copy` trait LL | match x { LL | foo @ Some(Test::Foo | Test::Bar) => (), - | --------------------------------- + | --- | | | value moved here | value moved here @@ -83,7 +83,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:86:5 | LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo), - | ------------------------------------- immutable borrow occurs here + | ------- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -95,7 +95,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:98:5 | LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo), - | ----------------------------------------- mutable borrow occurs here + | ----------- mutable borrow occurs here ... LL | &x; | ^^ immutable borrow occurs here @@ -107,7 +107,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:112:5 | LL | ref foo @ Some(box ref s) => Some(foo), - | ------------------------- immutable borrow occurs here + | ------- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -122,7 +122,7 @@ LL | fn bindings_after_at_slice_patterns_or_patterns_moves(x: [Option; 4]) | - move occurs because `x` has type `[Option; 4]`, which does not implement the `Copy` trait LL | match x { LL | a @ [.., Some(Test::Foo | Test::Bar)] => (), - | ------------------------------------- + | - | | | value moved here | value moved here @@ -134,7 +134,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:144:5 | LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a), - | ------------------------------------------------- immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -146,7 +146,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:156:5 | LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b), - | ---------- immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -158,7 +158,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:170:5 | LL | [_, ref a @ Some(box ref b), ..] => Some(a), - | ----------------------- immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -170,7 +170,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:186:5 | LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), - | ------------------------------------------- immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -182,7 +182,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:200:5 | LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), - | ----------------------------------------------- mutable borrow occurs here + | --------- mutable borrow occurs here ... LL | &x; | ^^ immutable borrow occurs here @@ -194,7 +194,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:214:5 | LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), - | ------------------------------------------------------------ immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr index f909dbc40..2c1b9c10d 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr @@ -36,6 +36,10 @@ LL | | } | = 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 | move || { + | ++++ error[E0503]: cannot use `f.x` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:37:9 @@ -196,7 +200,7 @@ LL | let x = &mut v; | ------ borrow of `v` occurs here LL | match v { LL | &[x @ ..] => println!("{:?}", x), - | ^^^^^^ use of borrowed `v` + | ^ use of borrowed `v` ... LL | drop(x); | - borrow later used here @@ -208,7 +212,7 @@ LL | let x = &mut v; | ------ borrow of `v` occurs here ... LL | &[_, x @ ..] => println!("{:?}", x), - | ^^^^^^ use of borrowed `v` + | ^ use of borrowed `v` ... LL | drop(x); | - borrow later used here @@ -220,7 +224,7 @@ LL | let x = &mut v; | ------ borrow of `v` occurs here ... LL | &[x @ .., _] => println!("{:?}", x), - | ^^^^^^ use of borrowed `v` + | ^ use of borrowed `v` ... LL | drop(x); | - borrow later used here @@ -232,7 +236,7 @@ LL | let x = &mut v; | ------ borrow of `v` occurs here ... LL | &[_, x @ .., _] => println!("{:?}", x), - | ^^^^^^ use of borrowed `v` + | ^ use of borrowed `v` ... LL | drop(x); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr index 3249aae8f..346b82a26 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr @@ -79,7 +79,7 @@ error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array-match.rs:89:11 | LL | [_y @ .., _, _] => {} - | ------- value moved here + | -- value moved here ... LL | [(_x, _), _, _] => {} | ^^ value used here after move @@ -90,7 +90,7 @@ error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array-match.rs:99:15 | LL | [_, _, _y @ ..] => {} - | ------- value moved here + | -- value moved here ... LL | [.., (_x, _)] => {} | ^^ value used here after move @@ -101,7 +101,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-match.rs:110:11 | LL | [x @ .., _] => {} - | ------ value partially moved here + | - value partially moved here LL | } LL | match a { | ^ value used here after partial move diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr index c19800226..6c6a25c25 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr @@ -68,7 +68,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11 | LL | [_, _y @ ..] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -79,7 +79,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11 | LL | [_y @ .., _] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -90,7 +90,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11 | LL | [x @ .., _, _] => {} - | ------ value partially moved here + | - value partially moved here LL | } LL | match a { | ^ value used here after partial move diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr index 8f2da9d20..77702e145 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr @@ -79,7 +79,7 @@ error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use-match.rs:89:11 | LL | [_y @ .., _, _] => {} - | ------- value moved here + | -- value moved here ... LL | [(ref _x, _), _, _] => {} | ^^^^^^ value borrowed here after move @@ -90,7 +90,7 @@ error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use-match.rs:99:15 | LL | [_, _, _y @ ..] => {} - | ------- value moved here + | -- value moved here ... LL | [.., (ref _x, _)] => {} | ^^^^^^ value borrowed here after move @@ -101,7 +101,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:110:11 | LL | [x @ .., _] => {} - | ------ value partially moved here + | - value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -134,7 +134,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:139:5 | LL | [_, _, _x @ ..] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | a[0] = Default::default(); | ^^^^ value used here after partial move @@ -145,7 +145,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:147:5 | LL | [_, _, _x @ ..] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | a[0].1 = Default::default(); | ^^^^ value used here after partial move diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr index 4b27f03dc..6cc2c2f7a 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr @@ -68,7 +68,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11 | LL | [_, _y @ ..] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -79,7 +79,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11 | LL | [_y @ .., _] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -90,7 +90,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11 | LL | [x @ .., _, _] => {} - | ------ value partially moved here + | - value partially moved here LL | } LL | match a { | ^ value used here after partial move diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr index b0bad6e99..9add7553a 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr @@ -34,7 +34,7 @@ error[E0382]: borrow of partially moved value: `a` LL | let [_x, _, _] = a; | -- value partially moved here LL | let [ref _y @ .., _, _] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -44,7 +44,7 @@ error[E0382]: borrow of partially moved value: `a` LL | let [.., _x] = a; | -- value partially moved here LL | let [_, _, ref _y @ ..] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -54,7 +54,7 @@ error[E0382]: borrow of partially moved value: `a` LL | let [(_x, _), _, _] = a; | -- value partially moved here LL | let [ref _y @ .., _, _] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait @@ -64,7 +64,7 @@ error[E0382]: borrow of partially moved value: `a` LL | let [.., (_x, _)] = a; | -- value partially moved here LL | let [_, _, ref _y @ ..] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait @@ -72,7 +72,7 @@ error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use.rs:54:11 | LL | let [_y @ .., _, _] = a; - | ------- value moved here + | -- value moved here LL | let [(ref _x, _), _, _] = a; | ^^^^^^ value borrowed here after move | @@ -82,7 +82,7 @@ error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use.rs:60:15 | LL | let [_, _, _y @ ..] = a; - | ------- value moved here + | -- value moved here LL | let [.., (ref _x, _)] = a; | ^^^^^^ value borrowed here after move | @@ -92,9 +92,9 @@ error[E0382]: borrow of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:68:13 | LL | let [x @ .., _] = a; - | ------ value partially moved here + | - value partially moved here LL | let [_, ref _y @ ..] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -122,7 +122,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:88:5 | LL | let [_, _, _x @ ..] = a; - | ------- value partially moved here + | -- value partially moved here LL | a[0] = Default::default(); | ^^^^ value used here after partial move | @@ -132,7 +132,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:94:5 | LL | let [_, _, _x @ ..] = a; - | ------- value partially moved here + | -- value partially moved here LL | a[0].1 = Default::default(); | ^^^^ value used here after partial move | diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr index 1fc2b292b..363effcfe 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr @@ -34,7 +34,7 @@ error[E0382]: use of partially moved value: `a` LL | let [_x, _, _] = a; | -- value partially moved here LL | let [_y @ .., _, _] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -44,7 +44,7 @@ error[E0382]: use of partially moved value: `a` LL | let [.., _x] = a; | -- value partially moved here LL | let [_, _, _y @ ..] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -54,7 +54,7 @@ error[E0382]: use of partially moved value: `a` LL | let [(_x, _), _, _] = a; | -- value partially moved here LL | let [_y @ .., _, _] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait @@ -64,7 +64,7 @@ error[E0382]: use of partially moved value: `a` LL | let [.., (_x, _)] = a; | -- value partially moved here LL | let [_, _, _y @ ..] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait @@ -72,7 +72,7 @@ error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array.rs:54:11 | LL | let [_y @ .., _, _] = a; - | ------- value moved here + | -- value moved here LL | let [(_x, _), _, _] = a; | ^^ value used here after move | @@ -82,7 +82,7 @@ error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array.rs:60:15 | LL | let [_, _, _y @ ..] = a; - | ------- value moved here + | -- value moved here LL | let [.., (_x, _)] = a; | ^^ value used here after move | @@ -92,9 +92,9 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array.rs:68:13 | LL | let [x @ .., _] = a; - | ------ value partially moved here + | - value partially moved here LL | let [_, _y @ ..] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr index b8ac7a3a4..f4324110c 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr @@ -57,7 +57,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | let [ref first, ref second, ..] = *s; | ---------- immutable borrow occurs here LL | let [_, ref mut tail @ ..] = *s; - | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -67,7 +67,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | let [.., ref second, ref first] = *s; | ---------- immutable borrow occurs here LL | let [ref mut tail @ .., _] = *s; - | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -75,9 +75,9 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im --> $DIR/borrowck-slice-pattern-element-loan-array.rs:46:10 | LL | let [_, ref s1 @ ..] = *s; - | ----------- immutable borrow occurs here + | ------ immutable borrow occurs here LL | let [ref mut s2 @ .., _, _] = *s; - | ^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^ mutable borrow occurs here LL | nop_subslice(s1); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr index d3388e071..f9a63bd49 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr @@ -88,7 +88,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here LL | if let [_, ref mut tail @ ..] = *s { - | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -98,7 +98,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [.., ref second, ref first] = *s { | ---------- immutable borrow occurs here LL | if let [ref mut tail @ .., _] = *s { - | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -106,9 +106,9 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:65:17 | LL | if let [_, _, _, ref s1 @ ..] = *s { - | ----------- immutable borrow occurs here + | ------ immutable borrow occurs here LL | if let [ref mut s2 @ .., _, _, _] = *s { - | ^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^ mutable borrow occurs here LL | nop_subslice(s1); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr index ff70ba9fc..0ac7df944 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr @@ -2,7 +2,7 @@ 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 + | -------- borrow of `a[_]` occurs here ... LL | a[2] = 0; | ^^^^^^^^ assignment to borrowed `a[_]` occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr index ddd89afe5..c3bcb7de6 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -14,7 +14,7 @@ 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 + | ------ borrow of `vec[_]` occurs here LL | LL | vec[0] = Box::new(4); | ^^^^^^ assignment to borrowed `vec[_]` occurs here diff --git a/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs b/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs new file mode 100644 index 000000000..524459291 --- /dev/null +++ b/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs @@ -0,0 +1,8 @@ +fn main() { + let mut vec: Vec = Vec::new(); + let closure = move || { + vec.clear(); + let mut iter = vec.iter(); + move || { iter.next() } //~ ERROR captured variable cannot escape `FnMut` closure bod + }; +} diff --git a/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr b/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr new file mode 100644 index 000000000..78ca090fe --- /dev/null +++ b/src/test/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.stderr @@ -0,0 +1,18 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs:6:9 + | +LL | let mut vec: Vec = Vec::new(); + | ------- variable defined here +LL | let closure = move || { + | - inferred to be a `FnMut` closure +LL | vec.clear(); + | --- variable captured here +LL | let mut iter = vec.iter(); +LL | move || { iter.next() } + | ^^^^^^^^^^^^^^^^^^^^^^^ 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 + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/index-mut-help.rs b/src/test/ui/borrowck/index-mut-help.rs index d57ef975d..35266e113 100644 --- a/src/test/ui/borrowck/index-mut-help.rs +++ b/src/test/ui/borrowck/index-mut-help.rs @@ -1,10 +1,9 @@ // When mutably indexing a type that implements `Index` but not `IndexMut`, a // special 'help' message is added to the output. +use std::collections::HashMap; fn main() { - use std::collections::HashMap; - let mut map = HashMap::new(); map.insert("peter", "23".to_string()); diff --git a/src/test/ui/borrowck/index-mut-help.stderr b/src/test/ui/borrowck/index-mut-help.stderr index 057c6ee15..f42d7e015 100644 --- a/src/test/ui/borrowck/index-mut-help.stderr +++ b/src/test/ui/borrowck/index-mut-help.stderr @@ -1,26 +1,39 @@ error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutable - --> $DIR/index-mut-help.rs:11:5 + --> $DIR/index-mut-help.rs:10:5 | LL | map["peter"].clear(); | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>` +help: to modify a `HashMap<&str, String>` use `.get_mut()` + | +LL | map.get_mut("peter").map(|val| val.clear()); + | ~~~~~~~~~ ~~~~~~~~~~~~~~~ + error[E0594]: cannot assign to data in an index of `HashMap<&str, String>` - --> $DIR/index-mut-help.rs:12:5 + --> $DIR/index-mut-help.rs:11:5 | LL | map["peter"] = "0".to_string(); | ^^^^^^^^^^^^ cannot assign | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>` +help: to modify a `HashMap<&str, String>`, use `.get_mut()`, `.insert()` or the entry API + | +LL | map.insert("peter", "0".to_string()); + | ~~~~~~~~ ~ + +LL | map.get_mut("peter").map(|val| { *val = "0".to_string(); }); + | ~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ++++ +LL | let val = map.entry("peter").or_insert("0".to_string()); + | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ + error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutable - --> $DIR/index-mut-help.rs:13:13 + --> $DIR/index-mut-help.rs:12:13 | LL | let _ = &mut map["peter"]; | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>` + = help: to modify a `HashMap<&str, String>`, use `.get_mut()`, `.insert()` or the entry API error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/issue-101119.rs b/src/test/ui/borrowck/issue-101119.rs new file mode 100644 index 000000000..64e52eaac --- /dev/null +++ b/src/test/ui/borrowck/issue-101119.rs @@ -0,0 +1,16 @@ +struct State; + +fn once(_: impl FnOnce()) {} + +fn fill_memory_blocks_mt(state: &mut State) { + loop { + once(move || { + //~^ ERROR use of moved value: `state` + fill_segment(state); + }); + } +} + +fn fill_segment(_: &mut State) {} + +fn main() {} diff --git a/src/test/ui/borrowck/issue-101119.stderr b/src/test/ui/borrowck/issue-101119.stderr new file mode 100644 index 000000000..a22afdc67 --- /dev/null +++ b/src/test/ui/borrowck/issue-101119.stderr @@ -0,0 +1,15 @@ +error[E0382]: use of moved value: `state` + --> $DIR/issue-101119.rs:7:14 + | +LL | fn fill_memory_blocks_mt(state: &mut State) { + | ----- move occurs because `state` has type `&mut State`, which does not implement the `Copy` trait +LL | loop { +LL | once(move || { + | ^^^^^^^ value moved into closure here, in previous iteration of loop +LL | +LL | fill_segment(state); + | ----- use occurs due to use in closure + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr index d98b3bae4..f0b574846 100644 --- a/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr +++ b/src/test/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr @@ -10,6 +10,10 @@ LL | || f() // The `nested` closure | ^^^^^^ returning this value requires that `'1` must outlive `'2` | = note: closure implements `Fn`, so references to captured variables can't escape the closure +help: consider adding 'move' keyword before the nested closure + | +LL | move || f() // The `nested` closure + | ++++ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-64453.stderr b/src/test/ui/borrowck/issue-64453.stderr index 1f8a1acb8..245c3a40e 100644 --- a/src/test/ui/borrowck/issue-64453.stderr +++ b/src/test/ui/borrowck/issue-64453.stderr @@ -14,6 +14,7 @@ LL | static settings_dir: String = format!(""); | ^^^^^^^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0507]: cannot move out of static item `settings_dir` diff --git a/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs b/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs new file mode 100644 index 000000000..95847d8d3 --- /dev/null +++ b/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.rs @@ -0,0 +1,14 @@ +fn foo1(s: &str) -> impl Iterator + '_ { + None.into_iter() + .flat_map(move |()| s.chars().map(|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(|c| format!("{}{}", c, s)) + //~^ ERROR lifetime may not live long enough + //~| HELP consider adding 'move' keyword before the nested closure +} + +fn main() {} diff --git a/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr b/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr new file mode 100644 index 000000000..2eae614a2 --- /dev/null +++ b/src/test/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr @@ -0,0 +1,37 @@ +error: captured variable cannot escape `FnMut` closure body + --> $DIR/issue-95079-missing-move-in-nested-closure.rs:3:29 + | +LL | fn foo1(s: &str) -> impl Iterator + '_ { + | - variable defined here +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 + | | variable captured here + | inferred to be a `FnMut` closure + | + = 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 | .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 + | +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` + | lifetime `'1` represents this closure's body + | + = note: closure implements `Fn`, so references to captured variables can't escape the closure +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 + diff --git a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr index af26169c8..b1af090ae 100644 --- a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr +++ b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr @@ -5,6 +5,7 @@ LL | cb.map(|cb| cb()); | ^^^-------------- | | | | | `*cb` moved due to this method call + | help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents | move occurs because `*cb` has type `Option<&mut dyn FnMut()>`, which does not implement the `Copy` trait | note: this function takes ownership of the receiver `self`, which moves `*cb` @@ -12,10 +13,6 @@ note: this function takes ownership of the receiver `self`, which moves `*cb` | LL | pub const fn map(self, f: F) -> Option | ^^^^ -help: consider calling `.as_ref()` to borrow the type's contents - | -LL | cb.as_ref().map(|cb| cb()); - | +++++++++ error[E0596]: cannot borrow `*cb` as mutable, as it is behind a `&` reference --> $DIR/suggest-as-ref-on-mut-closure.rs:12:26 diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs index 3d395d1f2..da238205b 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs @@ -131,13 +131,13 @@ fn coerce_index_op() { let mut i = I(10); i[i[3]] = 4; //~^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502] - // Shoud be accepted with g2p + // Should be accepted with g2p i[3] = i[4]; i[i[3]] = i[4]; //~^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502] - // Shoud be accepted with g2p + // Should be accepted with g2p } fn main() { diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs index e0f4afa75..0463e22b3 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs @@ -40,6 +40,6 @@ fn main() { // // (At least in theory; part of the reason this test fails is that // the constructed MIR throws in extra &mut reborrows which - // flummoxes our attmpt to delay the activation point here.) + // flummoxes our attempt to delay the activation point here.) delay.push(2); } diff --git a/src/test/ui/btreemap/btreemap-index-mut.rs b/src/test/ui/btreemap/btreemap-index-mut.rs new file mode 100644 index 000000000..62972acab --- /dev/null +++ b/src/test/ui/btreemap/btreemap-index-mut.rs @@ -0,0 +1,6 @@ +use std::collections::BTreeMap; + +fn main() { + let mut map = BTreeMap::::new(); + map[&0] = 1; //~ ERROR cannot assign +} diff --git a/src/test/ui/btreemap/btreemap-index-mut.stderr b/src/test/ui/btreemap/btreemap-index-mut.stderr new file mode 100644 index 000000000..26f2a4c4b --- /dev/null +++ b/src/test/ui/btreemap/btreemap-index-mut.stderr @@ -0,0 +1,19 @@ +error[E0594]: cannot assign to data in an index of `BTreeMap` + --> $DIR/btreemap-index-mut.rs:5:5 + | +LL | map[&0] = 1; + | ^^^^^^^^^^^ cannot assign + | + = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap` +help: to modify a `BTreeMap`, use `.get_mut()`, `.insert()` or the entry API + | +LL | map.insert(&0, 1); + | ~~~~~~~~ ~ + +LL | map.get_mut(&0).map(|val| { *val = 1; }); + | ~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ++++ +LL | let val = map.entry(&0).or_insert(1); + | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/c-variadic/issue-86053-1.stderr b/src/test/ui/c-variadic/issue-86053-1.stderr index 5d119bb85..60b379faf 100644 --- a/src/test/ui/c-variadic/issue-86053-1.stderr +++ b/src/test/ui/c-variadic/issue-86053-1.stderr @@ -44,19 +44,19 @@ error: `...` must be the last argument of a C-variadic function --> $DIR/issue-86053-1.rs:11:12 | LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^^ + | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/issue-86053-1.rs:11:12 | LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^^ + | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic --> $DIR/issue-86053-1.rs:11:36 | LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^^ + | ^^^ error[E0412]: cannot find type `F` in this scope --> $DIR/issue-86053-1.rs:11:48 diff --git a/src/test/ui/c-variadic/variadic-ffi-1.stderr b/src/test/ui/c-variadic/variadic-ffi-1.stderr index 176bec819..2ffb80f7e 100644 --- a/src/test/ui/c-variadic/variadic-ffi-1.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-1.stderr @@ -18,7 +18,7 @@ LL | fn foo(f: isize, x: u8, ...); help: provide the arguments | LL | foo(/* isize */, /* u8 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~ error[E0060]: this function takes at least 2 arguments but 1 argument was supplied --> $DIR/variadic-ffi-1.rs:21:9 @@ -34,7 +34,7 @@ LL | fn foo(f: isize, x: u8, ...); help: provide the argument | LL | foo(1, /* u8 */); - | ~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/variadic-ffi-1.rs:23:56 diff --git a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs index 6cb2ff9d8..1f23dadc4 100644 --- a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs +++ b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.rs @@ -1,7 +1,6 @@ // check-fail // compile-flags:--cfg foo -#![deny(warnings)] #![cfg_attr(foo, crate_type="bin")] //~^ERROR `crate_type` within //~| WARN this was previously accepted diff --git a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr index 5609f8e9d..b52535ffd 100644 --- a/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr +++ b/src/test/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr @@ -1,20 +1,15 @@ error: `crate_type` within an `#![cfg_attr] attribute is deprecated` - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18 + --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:18 | LL | #![cfg_attr(foo, crate_type="bin")] | ^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(deprecated_cfg_attr_crate_type_name)]` implied by `#[deny(warnings)]` + = note: `#[deny(deprecated_cfg_attr_crate_type_name)]` on by 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 #91632 error: `crate_name` within an `#![cfg_attr] attribute is deprecated` - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18 + --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18 | LL | #![cfg_attr(foo, crate_name="bar")] | ^^^^^^^^^^^^^^^^ @@ -23,7 +18,7 @@ LL | #![cfg_attr(foo, crate_name="bar")] = note: for more information, see issue #91632 error: `crate_type` within an `#![cfg_attr] attribute is deprecated` - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:5:18 + --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:4:18 | LL | #![cfg_attr(foo, crate_type="bin")] | ^^^^^^^^^^^^^^^^ @@ -32,7 +27,7 @@ LL | #![cfg_attr(foo, crate_type="bin")] = note: for more information, see issue #91632 error: `crate_name` within an `#![cfg_attr] attribute is deprecated` - --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:10:18 + --> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18 | LL | #![cfg_attr(foo, crate_name="bar")] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/chalkify/type_wf.rs b/src/test/ui/chalkify/type_wf.rs index dd83a03fd..eeeefcfb7 100644 --- a/src/test/ui/chalkify/type_wf.rs +++ b/src/test/ui/chalkify/type_wf.rs @@ -15,8 +15,8 @@ fn main() { x: 5, }; - let s = S { //~ ERROR the trait bound `{float}: Foo` is not satisfied - x: 5.0, + let s = S { + x: 5.0, //~ ERROR the trait bound `{float}: Foo` is not satisfied }; let s = S { diff --git a/src/test/ui/chalkify/type_wf.stderr b/src/test/ui/chalkify/type_wf.stderr index 7f8566082..6e8daf635 100644 --- a/src/test/ui/chalkify/type_wf.stderr +++ b/src/test/ui/chalkify/type_wf.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `{float}: Foo` is not satisfied - --> $DIR/type_wf.rs:18:13 + --> $DIR/type_wf.rs:19:12 | -LL | let s = S { - | ^ the trait `Foo` is not implemented for `{float}` +LL | x: 5.0, + | ^^^ the trait `Foo` is not implemented for `{float}` | = help: the trait `Foo` is implemented for `i32` note: required by a bound in `S` diff --git a/src/test/ui/check-cfg/allow-at-crate-level.rs b/src/test/ui/check-cfg/allow-at-crate-level.rs new file mode 100644 index 000000000..ce3383a29 --- /dev/null +++ b/src/test/ui/check-cfg/allow-at-crate-level.rs @@ -0,0 +1,8 @@ +// This test check that #![allow(unexpected_cfgs)] works with --cfg +// +// check-pass +// compile-flags: --cfg=unexpected --check-cfg=names() -Z unstable-options + +#![allow(unexpected_cfgs)] + +fn main() {} diff --git a/src/test/ui/check-cfg/invalid-arguments.names_simple_ident.stderr b/src/test/ui/check-cfg/invalid-arguments.names_simple_ident.stderr index bdfbc3d54..8fadcc1f9 100644 --- a/src/test/ui/check-cfg/invalid-arguments.names_simple_ident.stderr +++ b/src/test/ui/check-cfg/invalid-arguments.names_simple_ident.stderr @@ -1,2 +1,2 @@ -error: invalid `--check-cfg` argument: `names("NOT_IDENT")` (`names()` arguments must be simple identifers) +error: invalid `--check-cfg` argument: `names("NOT_IDENT")` (`names()` arguments must be simple identifiers) diff --git a/src/test/ui/check-cfg/invalid-arguments.values_simple_ident.stderr b/src/test/ui/check-cfg/invalid-arguments.values_simple_ident.stderr index b25882baa..061d3f0e9 100644 --- a/src/test/ui/check-cfg/invalid-arguments.values_simple_ident.stderr +++ b/src/test/ui/check-cfg/invalid-arguments.values_simple_ident.stderr @@ -1,2 +1,2 @@ -error: invalid `--check-cfg` argument: `values("NOT_IDENT")` (`values()` first argument must be a simple identifer) +error: invalid `--check-cfg` argument: `values("NOT_IDENT")` (`values()` first argument must be a simple identifier) diff --git a/src/test/ui/check-cfg/invalid-cfg-value.stderr b/src/test/ui/check-cfg/invalid-cfg-value.stderr index 6cce31d33..7db2aadec 100644 --- a/src/test/ui/check-cfg/invalid-cfg-value.stderr +++ b/src/test/ui/check-cfg/invalid-cfg-value.stderr @@ -15,5 +15,9 @@ LL | #[cfg(feature = "rand")] | = note: expected values for `feature` are: full, serde -warning: 2 warnings emitted +warning: unexpected condition value `rand` for condition name `feature` + | + = help: was set with `--cfg` but isn't in the `--check-cfg` expected values + +warning: 3 warnings emitted diff --git a/src/test/ui/check-cfg/mix.rs b/src/test/ui/check-cfg/mix.rs index 8e3d20d50..4e488fc03 100644 --- a/src/test/ui/check-cfg/mix.rs +++ b/src/test/ui/check-cfg/mix.rs @@ -3,7 +3,7 @@ // we correctly lint on the `cfg!` macro and `cfg_attr` attribute. // // check-pass -// compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo") --cfg feature="bar" -Z unstable-options +// compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo") --cfg feature="bar" --cfg unknown_name -Z unstable-options #[cfg(windows)] fn do_windows_stuff() {} diff --git a/src/test/ui/check-cfg/mix.stderr b/src/test/ui/check-cfg/mix.stderr index e51b75b3d..9cf887ec7 100644 --- a/src/test/ui/check-cfg/mix.stderr +++ b/src/test/ui/check-cfg/mix.stderr @@ -28,6 +28,14 @@ warning: unexpected `cfg` condition name LL | #[cfg_attr(uu, test)] | ^^ +warning: unexpected condition value `bar` for condition name `feature` + | + = help: was set with `--cfg` but isn't in the `--check-cfg` expected values + +warning: unexpected `unknown_name` as condition name + | + = help: was set with `--cfg` but isn't in the `--check-cfg` expected names + warning: unexpected `cfg` condition name --> $DIR/mix.rs:35:10 | @@ -170,5 +178,5 @@ LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra")); | = note: expected values for `feature` are: foo -warning: 25 warnings emitted +warning: 27 warnings emitted diff --git a/src/test/ui/check-static-values-constraints.stderr b/src/test/ui/check-static-values-constraints.stderr index b28cf0d6b..3c193ca34 100644 --- a/src/test/ui/check-static-values-constraints.stderr +++ b/src/test/ui/check-static-values-constraints.stderr @@ -22,6 +22,7 @@ LL | field2: SafeEnum::Variant4("str".to_string()) | ^^^^^^^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:94:5 diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr index 26f47eb68..284fc1c21 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr @@ -25,8 +25,8 @@ error[E0308]: mismatched types LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); | ^ one type is more general than the other | - = note: expected fn pointer `for<'r> fn(&'r u32)` - found fn pointer `fn(&u32)` + = note: expected fn pointer `fn(&u32)` + found fn pointer `for<'r> fn(&'r u32)` error[E0308]: mismatched types --> $DIR/expect-fn-supply-fn.rs:39:50 @@ -34,8 +34,8 @@ error[E0308]: mismatched types LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); | ^ one type is more general than the other | - = note: expected fn pointer `fn(&'x u32)` - found fn pointer `for<'r> fn(&'r u32)` + = note: expected fn pointer `for<'r> fn(&'r u32)` + found fn pointer `fn(&u32)` error[E0308]: mismatched types --> $DIR/expect-fn-supply-fn.rs:48:50 @@ -43,8 +43,8 @@ error[E0308]: mismatched types LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { | ^ one type is more general than the other | - = note: expected fn pointer `fn(&u32)` - found fn pointer `for<'r> fn(&'r u32)` + = note: expected fn pointer `for<'r> fn(&'r u32)` + found fn pointer `fn(&u32)` error: aborting due to 5 previous errors diff --git a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr index db7586bee..d5432755c 100644 --- a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr +++ b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr @@ -6,7 +6,7 @@ LL | with_closure(|x: u32, y| {}); | help: consider giving this closure parameter an explicit type | -LL | with_closure(|x: u32, y: B| {}); +LL | with_closure(|x: u32, y: _| {}); | +++ error: aborting due to previous error diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.stderr b/src/test/ui/closure_context/issue-26046-fn-mut.stderr index 74d3c4977..f744b71c2 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-mut.stderr @@ -8,6 +8,8 @@ LL | num += 1; ... LL | Box::new(closure) | ----------------- the requirement to implement `Fn` derives from here + | + = note: required for the cast from `[closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21]` to the object type `dyn Fn()` error: aborting due to previous error diff --git a/src/test/ui/closure_context/issue-26046-fn-once.stderr b/src/test/ui/closure_context/issue-26046-fn-once.stderr index 473e8e841..34f94f9dc 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-once.stderr @@ -8,6 +8,8 @@ LL | vec ... LL | Box::new(closure) | ----------------- the requirement to implement `Fn` derives from here + | + = note: required for the cast from `[closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26]` to the object type `dyn Fn() -> Vec` error: aborting due to previous error diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.rs index 93131b2ac..f97e60daf 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.rs @@ -68,7 +68,7 @@ fn arrays_5() { arr[1] += 10; }; - // c will capture `arr` completely, therefore we cannot borrow other indecies + // c will capture `arr` completely, therefore we cannot borrow other indices // into the array. println!("{:#?}", &arr[3..2]); //~^ ERROR: cannot borrow `arr` as immutable because it is also borrowed as mutable diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr index bcde35983..309c63e52 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr @@ -7,7 +7,15 @@ LL | let [_, _s] = s; | - closure is `FnOnce` because it moves the variable `s` out of its environment LL | }; LL | expect_fn(c); - | --------- the requirement to implement `Fn` derives from here + | --------- - the requirement to implement `Fn` derives from here + | | + | required by a bound introduced by this call + | +note: required by a bound in `expect_fn` + --> $DIR/closure-origin-array-diagnostics.rs:5:17 + | +LL | fn expect_fn(_f: F) {} + | ^^^^ required by this bound in `expect_fn` error: aborting due to previous error diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr index df33c4f1f..3e77635f9 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr @@ -7,7 +7,15 @@ LL | let s = s.1; | --- closure is `FnOnce` because it moves the variable `s.1` out of its environment LL | }; LL | expect_fn(c); - | --------- the requirement to implement `Fn` derives from here + | --------- - the requirement to implement `Fn` derives from here + | | + | required by a bound introduced by this call + | +note: required by a bound in `expect_fn` + --> $DIR/closure-origin-tuple-diagnostics.rs:5:17 + | +LL | fn expect_fn(_f: F) {} + | ^^^^ required by this bound in `expect_fn` error: aborting due to previous error diff --git a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.rs b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.rs index 318673ef8..972c24c23 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.rs +++ b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.rs @@ -24,7 +24,7 @@ fn main() { let _a = || { match l1 { L1::A => (), L1::B => () } }; // (except if the match is already non-exhaustive) let _b = || { match l1 { L1::A => () } }; - //~^ ERROR: non-exhaustive patterns: `B` not covered [E0004] + //~^ ERROR: non-exhaustive patterns: `L1::B` not covered [E0004] // l2 should not be captured as it is a non-exhaustive SingleVariant // defined in this crate diff --git a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr index e0678bc71..3a5fad154 100644 --- a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr +++ b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `B` not covered +error[E0004]: non-exhaustive patterns: `L1::B` not covered --> $DIR/non-exhaustive-match.rs:26:25 | LL | let _b = || { match l1 { L1::A => () } }; - | ^^ pattern `B` not covered + | ^^ pattern `L1::B` not covered | note: `L1` defined here --> $DIR/non-exhaustive-match.rs:12:14 @@ -12,8 +12,8 @@ LL | enum L1 { A, B } = note: the matched value is of type `L1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL | let _b = || { match l1 { L1::A => (), B => todo!() } }; - | ++++++++++++++ +LL | let _b = || { match l1 { L1::A => (), L1::B => todo!() } }; + | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: type `E1` is non-empty --> $DIR/non-exhaustive-match.rs:37:25 diff --git a/src/test/ui/closures/2229_closure_analysis/repr_packed.rs b/src/test/ui/closures/2229_closure_analysis/repr_packed.rs index 3ed780f51..f23670f63 100644 --- a/src/test/ui/closures/2229_closure_analysis/repr_packed.rs +++ b/src/test/ui/closures/2229_closure_analysis/repr_packed.rs @@ -31,7 +31,7 @@ fn test_alignment_not_affected() { c(); } -// `String`, `u16` are not aligned at a one byte boundry and are thus affected by repr(packed). +// `String`, `u16` are not aligned at a one byte boundary and are thus affected by repr(packed). // // Here we test that the closure doesn't capture a reference point to `foo.x` but // rather capture `foo` entirely. diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.rs index 2c828aed5..f8752fe1c 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/by_value.rs @@ -1,8 +1,8 @@ // edition:2021 // run-pass -// Test that ByValue captures compile sucessefully especially when the captures are -// derefenced within the closure. +// Test that ByValue captures compile successfully especially when the captures are +// dereferenced within the closure. #[derive(Debug, Default)] struct SomeLargeType; diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr index 40274c883..cf8bd7a0a 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.stderr @@ -1,8 +1,8 @@ -warning: unused variable: `t2` - --> $DIR/destructure-pattern-closure-within-closure.rs:13:21 +warning: unused variable: `g2` + --> $DIR/destructure-pattern-closure-within-closure.rs:10:17 | -LL | let (_, t2) = t; - | ^^ help: if this is intentional, prefix it with an underscore: `_t2` +LL | let (_, g2) = g; + | ^^ help: if this is intentional, prefix it with an underscore: `_g2` | note: the lint level is defined here --> $DIR/destructure-pattern-closure-within-closure.rs:3:9 @@ -11,11 +11,11 @@ LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` -warning: unused variable: `g2` - --> $DIR/destructure-pattern-closure-within-closure.rs:10:17 +warning: unused variable: `t2` + --> $DIR/destructure-pattern-closure-within-closure.rs:13:21 | -LL | let (_, g2) = g; - | ^^ help: if this is intentional, prefix it with an underscore: `_g2` +LL | let (_, t2) = t; + | ^^ help: if this is intentional, prefix it with an underscore: `_t2` warning: 2 warnings emitted diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs index 88a9816a0..03400e0ee 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/disjoint-capture-in-same-closure.rs @@ -1,7 +1,7 @@ // edition:2021 // run-pass -// Tests that if a closure uses indivual fields of the same object +// Tests that if a closure uses individual fields of the same object // then that case is handled properly. #![allow(unused)] diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.rs index b8e464031..624e0ff22 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-1.rs @@ -1,10 +1,10 @@ // edition:2021 // run-pass -// Test that closures can catpure paths that are more precise than just one level +// Test that closures can capture paths that are more precise than just one level // from the root variable. // -// If the closures can handle such precison we should be able to mutate one path in the closure +// If the closures can handle such precision we should be able to mutate one path in the closure // while being able to mutate another path outside the closure, where the two paths are disjoint // after applying two projections on the root variable. diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.rs index 11a324d8a..bd8addd37 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/multilevel-path-2.rs @@ -3,7 +3,7 @@ #![allow(unused)] -// If the closures can handle such precison we should be able to read one path in the closure +// If the closures can handle such precision we should be able to read one path in the closure // while being able mutate another path outside the closure, where the two paths are disjoint // after applying two projections on the root variable. diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.rs index bb784774b..a85335438 100644 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.rs +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/mut_ref_struct_mem.rs @@ -5,7 +5,7 @@ // that is captured by the closure // More specifically we test that the if the mutable reference isn't root variable of a capture -// but rather accessed while acessing the precise capture. +// but rather accessed while accessing the precise capture. fn mut_tuple() { let mut t = (10, 10); diff --git a/src/test/ui/closures/binder/disallow-const.rs b/src/test/ui/closures/binder/disallow-const.rs new file mode 100644 index 000000000..72ad6185d --- /dev/null +++ b/src/test/ui/closures/binder/disallow-const.rs @@ -0,0 +1,6 @@ +#![feature(closure_lifetime_binder)] + +fn main() { + for || -> () {}; + //~^ ERROR only lifetime parameters can be used in this context +} diff --git a/src/test/ui/closures/binder/disallow-const.stderr b/src/test/ui/closures/binder/disallow-const.stderr new file mode 100644 index 000000000..3c3b43d8c --- /dev/null +++ b/src/test/ui/closures/binder/disallow-const.stderr @@ -0,0 +1,8 @@ +error: only lifetime parameters can be used in this context + --> $DIR/disallow-const.rs:4:15 + | +LL | for || -> () {}; + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/closures/binder/disallow-ty.rs b/src/test/ui/closures/binder/disallow-ty.rs new file mode 100644 index 000000000..bbe3d8488 --- /dev/null +++ b/src/test/ui/closures/binder/disallow-ty.rs @@ -0,0 +1,6 @@ +#![feature(closure_lifetime_binder)] + +fn main() { + for || -> () {}; + //~^ ERROR only lifetime parameters can be used in this context +} diff --git a/src/test/ui/closures/binder/disallow-ty.stderr b/src/test/ui/closures/binder/disallow-ty.stderr new file mode 100644 index 000000000..51b6773ed --- /dev/null +++ b/src/test/ui/closures/binder/disallow-ty.stderr @@ -0,0 +1,8 @@ +error: only lifetime parameters can be used in this context + --> $DIR/disallow-ty.rs:4:9 + | +LL | for || -> () {}; + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr index 1086cfa29..a2ca06b4e 100644 --- a/src/test/ui/closures/closure-move-sync.stderr +++ b/src/test/ui/closures/closure-move-sync.stderr @@ -1,11 +1,17 @@ error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:6:13 + --> $DIR/closure-move-sync.rs:6:27 | -LL | let t = thread::spawn(|| { - | ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely +LL | let t = thread::spawn(|| { + | _____________-------------_^ + | | | + | | required by a bound introduced by this call +LL | | recv.recv().unwrap(); +LL | | +LL | | }); + | |_____^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>` - = note: required because of the requirements on the impl of `Send` for `&std::sync::mpsc::Receiver<()>` + = note: required for `&std::sync::mpsc::Receiver<()>` to implement `Send` note: required because it's used within this closure --> $DIR/closure-move-sync.rs:6:27 | @@ -18,13 +24,15 @@ LL | F: Send + 'static, | ^^^^ required by this bound in `spawn` error[E0277]: `Sender<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:18:5 + --> $DIR/closure-move-sync.rs:18:19 | LL | thread::spawn(|| tx.send(()).unwrap()); - | ^^^^^^^^^^^^^ `Sender<()>` cannot be shared between threads safely + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^ `Sender<()>` cannot be shared between threads safely + | | + | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `Sender<()>` - = note: required because of the requirements on the impl of `Send` for `&Sender<()>` + = note: required for `&Sender<()>` to implement `Send` note: required because it's used within this closure --> $DIR/closure-move-sync.rs:18:19 | diff --git a/src/test/ui/closures/closure-wrong-kind.stderr b/src/test/ui/closures/closure-wrong-kind.stderr index 35caf71a5..9ea55d764 100644 --- a/src/test/ui/closures/closure-wrong-kind.stderr +++ b/src/test/ui/closures/closure-wrong-kind.stderr @@ -6,7 +6,15 @@ LL | let closure = |_| foo(x); | | | this closure implements `FnOnce`, not `Fn` LL | bar(closure); - | --- the requirement to implement `Fn` derives from here + | --- ------- the requirement to implement `Fn` derives from here + | | + | required by a bound introduced by this call + | +note: required by a bound in `bar` + --> $DIR/closure-wrong-kind.rs:6:11 + | +LL | fn bar(_: T) {} + | ^^^^^^^ required by this bound in `bar` error: aborting due to previous error diff --git a/src/test/ui/closures/coerce-unsafe-to-closure.stderr b/src/test/ui/closures/coerce-unsafe-to-closure.stderr index bd095c2d8..6ce63e829 100644 --- a/src/test/ui/closures/coerce-unsafe-to-closure.stderr +++ b/src/test/ui/closures/coerce-unsafe-to-closure.stderr @@ -6,7 +6,7 @@ LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); | | | required by a bound introduced by this call | - = help: the trait `FnOnce<(&str,)>` is not implemented for `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` + = help: the trait `FnOnce<(&str,)>` is not implemented for fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `Option::::map` --> $SRC_DIR/core/src/option.rs:LL:COL diff --git a/src/test/ui/closures/issue-10398.rs b/src/test/ui/closures/issue-10398.rs index 0405b2d01..f76d09cd0 100644 --- a/src/test/ui/closures/issue-10398.rs +++ b/src/test/ui/closures/issue-10398.rs @@ -1,7 +1,5 @@ -#![feature(box_syntax)] - fn main() { - let x: Box<_> = box 1; + let x: Box<_> = Box::new(1); let f = move|| { let _a = x; drop(x); diff --git a/src/test/ui/closures/issue-10398.stderr b/src/test/ui/closures/issue-10398.stderr index 8d9faf324..423b79daf 100644 --- a/src/test/ui/closures/issue-10398.stderr +++ b/src/test/ui/closures/issue-10398.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/issue-10398.rs:7:14 + --> $DIR/issue-10398.rs:5:14 | LL | let _a = x; | - value moved here diff --git a/src/test/ui/closures/issue-52437.rs b/src/test/ui/closures/issue-52437.rs index f79a0bd35..6ac5380a5 100644 --- a/src/test/ui/closures/issue-52437.rs +++ b/src/test/ui/closures/issue-52437.rs @@ -2,5 +2,4 @@ fn main() { [(); &(&'static: loop { |x| {}; }) as *const _ as usize] //~^ ERROR: invalid label name `'static` //~| ERROR: type annotations needed - //~| ERROR mismatched types } diff --git a/src/test/ui/closures/issue-52437.stderr b/src/test/ui/closures/issue-52437.stderr index 38d9d08ce..4c24a54bb 100644 --- a/src/test/ui/closures/issue-52437.stderr +++ b/src/test/ui/closures/issue-52437.stderr @@ -15,15 +15,6 @@ help: consider giving this closure parameter an explicit type LL | [(); &(&'static: loop { |x: _| {}; }) as *const _ as usize] | +++ -error[E0308]: mismatched types - --> $DIR/issue-52437.rs:2:5 - | -LL | fn main() { - | - expected `()` because of default return type -LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found array `[(); _]` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0282, E0308. -For more information about an error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/closures/issue-6801.rs b/src/test/ui/closures/issue-6801.rs index 694d86feb..cecb08f00 100644 --- a/src/test/ui/closures/issue-6801.rs +++ b/src/test/ui/closures/issue-6801.rs @@ -2,7 +2,7 @@ // transferring ownership of the box before invoking the stack // closure results in a crash. -#![feature(box_syntax)] + fn twice(x: Box) -> usize { *x * 2 @@ -13,7 +13,7 @@ fn invoke(f: F) where F: FnOnce() -> usize { } fn main() { - let x : Box = box 9; + let x : Box = Box::new(9); let sq = || { *x * *x }; twice(x); //~ ERROR: cannot move out of diff --git a/src/test/ui/closures/issue-84128.rs b/src/test/ui/closures/issue-84128.rs index f81d7cfaa..30733871b 100644 --- a/src/test/ui/closures/issue-84128.rs +++ b/src/test/ui/closures/issue-84128.rs @@ -1,5 +1,5 @@ // test for issue 84128 -// missing suggestion for similar ADT type with diffetent generic paramenter +// missing suggestion for similar ADT type with diffetent generic parameter // on closure ReturnNoExpression struct Foo(T); diff --git a/src/test/ui/closures/issue-84128.stderr b/src/test/ui/closures/issue-84128.stderr index 09c44d261..59607afec 100644 --- a/src/test/ui/closures/issue-84128.stderr +++ b/src/test/ui/closures/issue-84128.stderr @@ -6,11 +6,6 @@ LL | Foo(()) | | | arguments to this struct are incorrect | -note: return type inferred to be `{integer}` here - --> $DIR/issue-84128.rs:10:20 - | -LL | return Foo(0); - | ^^^^^^ note: tuple struct defined here --> $DIR/issue-84128.rs:5:8 | diff --git a/src/test/ui/closures/print/closure-print-generic-verbose-1.stderr b/src/test/ui/closures/print/closure-print-generic-verbose-1.stderr index fdaf353fe..3ab7c66d1 100644 --- a/src/test/ui/closures/print/closure-print-generic-verbose-1.stderr +++ b/src/test/ui/closures/print/closure-print-generic-verbose-1.stderr @@ -2,7 +2,7 @@ error[E0382]: use of moved value: `c` --> $DIR/closure-print-generic-verbose-1.rs:17:5 | LL | let c = to_fn_once(move|| { - | - move occurs because `c` has type `[f::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'_#10r str>, T)]`, which does not implement the `Copy` trait + | - move occurs because `c` has type `[f::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'_#9r str>, T)]`, which does not implement the `Copy` trait ... LL | c(); | --- `c` moved due to this call diff --git a/src/test/ui/codegen/issue-101585-128bit-repeat.rs b/src/test/ui/codegen/issue-101585-128bit-repeat.rs new file mode 100644 index 000000000..c6a686597 --- /dev/null +++ b/src/test/ui/codegen/issue-101585-128bit-repeat.rs @@ -0,0 +1,14 @@ +// Regression test for issue 101585. +// run-pass + +fn main() { + fn min_array_ok() -> [i128; 1] { + [i128::MIN] + } + assert_eq!(min_array_ok(), [-170141183460469231731687303715884105728i128]); + + fn min_array_nok() -> [i128; 1] { + [i128::MIN; 1] + } + assert_eq!(min_array_nok(), [-170141183460469231731687303715884105728i128]); +} diff --git a/src/test/ui/codegen/issue-99551.rs b/src/test/ui/codegen/issue-99551.rs new file mode 100644 index 000000000..f24874c99 --- /dev/null +++ b/src/test/ui/codegen/issue-99551.rs @@ -0,0 +1,21 @@ +// build-pass +#![feature(trait_upcasting)] +#![allow(incomplete_features)] + +pub trait A {} +pub trait B {} + +pub trait C: A + B {} +impl C for X {} + +pub fn test<'a, T>(view: T) -> Option<&'a mut dyn B> +where + T: IntoIterator, +{ + return Some(view.into_iter().next().unwrap()); +} + +fn main() { + let mut a: Vec> = Vec::new(); + test(a.iter_mut().map(|c| c.as_mut() as &mut dyn B)); +} diff --git a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr index 36551e5af..5cbdef218 100644 --- a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr +++ b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr @@ -12,7 +12,7 @@ note: function defined here --> $DIR/coerce-reborrow-multi-arg-fail.rs:1:4 | LL | fn test(_a: T, _b: T) {} - | ^^^^ ----- ----- + | ^^^^ ----- error: aborting due to previous error diff --git a/src/test/ui/coercion/coerce-to-bang.stderr b/src/test/ui/coercion/coerce-to-bang.stderr index add8f14cf..1207dc7e7 100644 --- a/src/test/ui/coercion/coerce-to-bang.stderr +++ b/src/test/ui/coercion/coerce-to-bang.stderr @@ -12,7 +12,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:18:13 @@ -28,7 +28,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:26:12 @@ -44,7 +44,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:36:12 @@ -60,7 +60,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:45:12 @@ -76,7 +76,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:50:21 diff --git a/src/test/ui/coercion/issue-101066.rs b/src/test/ui/coercion/issue-101066.rs new file mode 100644 index 000000000..b658ed1e9 --- /dev/null +++ b/src/test/ui/coercion/issue-101066.rs @@ -0,0 +1,16 @@ +// check-pass + +use std::convert::TryFrom; + +pub trait FieldElement { + type Integer: TryFrom; + + fn valid_integer_try_from(i: N) -> Result + where + Self::Integer: TryFrom, + { + Self::Integer::try_from(i).map_err(|_| ()) + } +} + +fn main() {} diff --git a/src/test/ui/coherence/auxiliary/trait-with-const-param.rs b/src/test/ui/coherence/auxiliary/trait-with-const-param.rs new file mode 100644 index 000000000..a44eb14f8 --- /dev/null +++ b/src/test/ui/coherence/auxiliary/trait-with-const-param.rs @@ -0,0 +1 @@ +pub trait Trait {} diff --git a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs index 159788b1b..3acf0d8d3 100644 --- a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs +++ b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.rs @@ -1,12 +1,17 @@ -#![feature(negative_impls)] +// revisions: stock with_negative_coherence +//[with_negative_coherence] check-pass -// FIXME: this should compile +#![feature(negative_impls)] +#![cfg_attr(with_negative_coherence, feature(with_negative_coherence))] trait MyPredicate<'a> {} -impl<'a, T> !MyPredicate<'a> for &T where T: 'a {} + +impl<'a, T> !MyPredicate<'a> for &'a T where T: 'a {} + trait MyTrait<'a> {} + impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {} impl<'a, T> MyTrait<'a> for &'a T {} -//~^ ERROR: conflicting implementations of trait `MyTrait<'_>` for type `&_` +//[stock]~^ ERROR: conflicting implementations of trait `MyTrait<'_>` for type `&_` fn main() {} diff --git a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr deleted file mode 100644 index 263bd19b4..000000000 --- a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait<'_>` for type `&_` - --> $DIR/coherence-negative-outlives-lifetimes.rs:9:1 - | -LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {} - | ---------------------------------------------- first implementation here -LL | impl<'a, T> MyTrait<'a> for &'a T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr new file mode 100644 index 000000000..097cc4e0f --- /dev/null +++ b/src/test/ui/coherence/coherence-negative-outlives-lifetimes.stock.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `MyTrait<'_>` for type `&_` + --> $DIR/coherence-negative-outlives-lifetimes.rs:14:1 + | +LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {} + | ---------------------------------------------- first implementation here +LL | impl<'a, T> MyTrait<'a> for &'a T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/const-generics-orphan-check-ok.rs b/src/test/ui/coherence/const-generics-orphan-check-ok.rs new file mode 100644 index 000000000..217e8aed2 --- /dev/null +++ b/src/test/ui/coherence/const-generics-orphan-check-ok.rs @@ -0,0 +1,28 @@ +// check-pass +// aux-build:trait-with-const-param.rs +extern crate trait_with_const_param; +use trait_with_const_param::*; + +// Trivial case, const param after local type. +struct Local1; +impl Trait for Local1 {} + +// Concrete consts behave the same as foreign types, +// so this also trivially works. +impl Trait<3, Local1> for i32 {} + +// This case isn't as trivial as we would forbid type +// parameters here, we do allow const parameters though. +// +// The reason that type parameters are forbidden for +// `impl Trait for i32 {}` is that another +// downstream crate can add `impl Trait for i32`. +// As these two impls would overlap we forbid any impls which +// have a type parameter in front of a local type. +// +// With const parameters this issue does not exist as there are no +// constants local to another downstream crate. +struct Local2; +impl Trait for i32 {} + +fn main() {} diff --git a/src/test/ui/coherence/issue-100191-2.rs b/src/test/ui/coherence/issue-100191-2.rs new file mode 100644 index 000000000..1c8316f87 --- /dev/null +++ b/src/test/ui/coherence/issue-100191-2.rs @@ -0,0 +1,12 @@ +//~ ERROR overflow evaluating the requirement `T: Trait<_>` + +#![feature(specialization, with_negative_coherence)] +#![allow(incomplete_features)] + +pub trait Trait {} + +default impl Trait for U {} + +impl Trait<::Item> for T {} + +fn main() {} diff --git a/src/test/ui/coherence/issue-100191-2.stderr b/src/test/ui/coherence/issue-100191-2.stderr new file mode 100644 index 000000000..d50c220bc --- /dev/null +++ b/src/test/ui/coherence/issue-100191-2.stderr @@ -0,0 +1,14 @@ +error[E0275]: overflow evaluating the requirement `T: Trait<_>` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_100191_2`) +note: required for `T` to implement `Trait<_>` + --> $DIR/issue-100191-2.rs:8:20 + | +LL | default impl Trait for U {} + | ^^^^^^^^ ^ + = note: 128 redundant requirements hidden + = note: required for `T` to implement `Trait<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/coherence/issue-100191.rs b/src/test/ui/coherence/issue-100191.rs new file mode 100644 index 000000000..e8597fde5 --- /dev/null +++ b/src/test/ui/coherence/issue-100191.rs @@ -0,0 +1,21 @@ +#![crate_type = "lib"] +#![feature(specialization, with_negative_coherence)] +#![allow(incomplete_features)] + +trait X {} +trait Y: X {} +trait Z { + type Assoc: Y; +} +struct A(T); + +impl Y for T where T: X {} +impl Z for A { + type Assoc = T; +} + +// this impl is invalid, but causes an ICE anyway +impl From< as Z>::Assoc> for T {} +//~^ ERROR type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + +fn main() {} diff --git a/src/test/ui/coherence/issue-100191.stderr b/src/test/ui/coherence/issue-100191.stderr new file mode 100644 index 000000000..1adb0f1e4 --- /dev/null +++ b/src/test/ui/coherence/issue-100191.stderr @@ -0,0 +1,12 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/issue-100191.rs:18:6 + | +LL | impl From< as Z>::Assoc> for T {} + | ^ type parameter `T` must be used as the type parameter for some local type + | + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/command/command-current-dir.rs b/src/test/ui/command/command-current-dir.rs index 91d8e4f38..69a0b486d 100644 --- a/src/test/ui/command/command-current-dir.rs +++ b/src/test/ui/command/command-current-dir.rs @@ -18,7 +18,7 @@ fn main() { let exe = me.file_name().unwrap(); let cwd = me.parent().unwrap(); eprintln!("cwd={:?}", cwd); - // Change directory to where the exectuable is located, since this test + // Change directory to where the executable is located, since this test // fundamentally needs to use relative paths. In some cases (like // remote-test-server), the current_dir can be somewhere else, so make // sure it is something we can use. We assume we can write to this diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index a057fd19b..d4bd673b8 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -50,7 +50,9 @@ error[E0565]: literal in `cfg` predicate value must be a string --> $DIR/cfg-attr-syntax-validation.rs:25:11 | LL | #[cfg(a = b"hi")] - | ^^^^^ help: consider removing the prefix: `"hi"` + | -^^^^ + | | + | help: consider removing the prefix error: expected unsuffixed literal or identifier, found `concat!("nonexistent")` --> $DIR/cfg-attr-syntax-validation.rs:30:25 diff --git a/src/test/ui/const-generics/argument_order.stderr b/src/test/ui/const-generics/argument_order.stderr index 6b33dffb4..99122c6f5 100644 --- a/src/test/ui/const-generics/argument_order.stderr +++ b/src/test/ui/const-generics/argument_order.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/argument_order.rs:6:32 | LL | struct AlsoBad { @@ -11,7 +11,7 @@ LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>; | ^^^^^^^ | = note: lifetime arguments must be provided before type arguments - = help: reorder the arguments: lifetimes, then consts: `<'a, 'b, N, T, M, U>` + = help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, N, T, M, U>` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const-param-before-other-params.rs b/src/test/ui/const-generics/const-param-before-other-params.rs index da06aca30..cb1cebe1f 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.rs +++ b/src/test/ui/const-generics/const-param-before-other-params.rs @@ -1,5 +1,5 @@ fn bar(_: &'a ()) { - //~^ ERROR lifetime parameters must be declared prior to const parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters } fn foo(_: &T) {} diff --git a/src/test/ui/const-generics/const-param-before-other-params.stderr b/src/test/ui/const-generics/const-param-before-other-params.stderr index 607d20c4a..2c7a47bbc 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.stderr +++ b/src/test/ui/const-generics/const-param-before-other-params.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/const-param-before-other-params.rs:1:21 | LL | fn bar(_: &'a ()) { diff --git a/src/test/ui/const-generics/defaults/generic-expr-default-concrete.stderr b/src/test/ui/const-generics/defaults/generic-expr-default-concrete.stderr index e8826ce43..61b355118 100644 --- a/src/test/ui/const-generics/defaults/generic-expr-default-concrete.stderr +++ b/src/test/ui/const-generics/defaults/generic-expr-default-concrete.stderr @@ -4,8 +4,8 @@ error[E0308]: mismatched types LL | Foo::<10, 12> | ^^^^^^^^^^^^^ expected `11`, found `12` | - = note: expected type `11` - found type `12` + = note: expected constant `11` + found constant `12` error: aborting due to previous error diff --git a/src/test/ui/const-generics/defaults/generic-expr-default-mismatched-types.stderr b/src/test/ui/const-generics/defaults/generic-expr-default-mismatched-types.stderr index d5a3071b7..e83f89a60 100644 --- a/src/test/ui/const-generics/defaults/generic-expr-default-mismatched-types.stderr +++ b/src/test/ui/const-generics/defaults/generic-expr-default-mismatched-types.stderr @@ -4,8 +4,8 @@ error[E0308]: mismatched types LL | Foo:: | ^^^^^^^^^^^^^^^^^^^ expected `{ N + 1 }`, found `{ N + 2 }` | - = note: expected type `{ N + 1 }` - found type `{ N + 2 }` + = note: expected constant `{ N + 1 }` + found constant `{ N + 2 }` error: aborting due to previous error diff --git a/src/test/ui/const-generics/defaults/intermixed-lifetime.rs b/src/test/ui/const-generics/defaults/intermixed-lifetime.rs index 578938db4..beaf7fc60 100644 --- a/src/test/ui/const-generics/defaults/intermixed-lifetime.rs +++ b/src/test/ui/const-generics/defaults/intermixed-lifetime.rs @@ -1,9 +1,9 @@ // Checks that lifetimes cannot be interspersed between consts and types. struct Foo(&'a (), T); -//~^ Error lifetime parameters must be declared prior to const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters struct Bar(&'a (), T); -//~^ Error lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn main() {} diff --git a/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr b/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr index e27976deb..5cff61dd9 100644 --- a/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr +++ b/src/test/ui/const-generics/defaults/intermixed-lifetime.stderr @@ -1,10 +1,10 @@ -error: lifetime parameters must be declared prior to const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/intermixed-lifetime.rs:3:28 | LL | struct Foo(&'a (), T); | -----------------^^---------- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T = u32>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/intermixed-lifetime.rs:6:37 | LL | struct Bar(&'a (), T); diff --git a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs index da087ffc3..f928fc9e7 100644 --- a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs +++ b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.rs @@ -1,4 +1,4 @@ struct Foo(&'a u32); -//~^ Error lifetime parameters must be declared prior to const parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn main() {} diff --git a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr index 55f5a5353..ba08b4646 100644 --- a/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr +++ b/src/test/ui/const-generics/defaults/param-order-err-pretty-prints-default.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to const parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/param-order-err-pretty-prints-default.rs:1:33 | LL | struct Foo(&'a u32); diff --git a/src/test/ui/const-generics/defaults/trait_objects_fail.stderr b/src/test/ui/const-generics/defaults/trait_objects_fail.stderr index a9c185e5f..0e8334d03 100644 --- a/src/test/ui/const-generics/defaults/trait_objects_fail.stderr +++ b/src/test/ui/const-generics/defaults/trait_objects_fail.stderr @@ -2,9 +2,7 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied --> $DIR/trait_objects_fail.rs:26:9 | LL | foo(&10_u32); - | --- ^^^^^^^ the trait `Trait` is not implemented for `u32` - | | - | required by a bound introduced by this call + | ^^^^^^^ the trait `Trait` is not implemented for `u32` | = help: the trait `Trait<2>` is implemented for `u32` = note: required for the cast from `u32` to the object type `dyn Trait` @@ -13,9 +11,7 @@ error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied --> $DIR/trait_objects_fail.rs:28:9 | LL | bar(&true); - | --- ^^^^^ the trait `Traitor<_>` is not implemented for `bool` - | | - | required by a bound introduced by this call + | ^^^^^ the trait `Traitor<_>` is not implemented for `bool` | = help: the trait `Traitor<2, 3>` is implemented for `bool` = note: required for the cast from `bool` to the object type `dyn Traitor<_>` diff --git a/src/test/ui/const-generics/early/const-param-from-outer-fn.stderr b/src/test/ui/const-generics/early/const-param-from-outer-fn.stderr index a9f9787d8..e3bf38b70 100644 --- a/src/test/ui/const-generics/early/const-param-from-outer-fn.stderr +++ b/src/test/ui/const-generics/early/const-param-from-outer-fn.stderr @@ -4,7 +4,7 @@ error[E0401]: can't use generic parameters from outer function LL | fn foo() { | - const parameter from outer function LL | fn bar() -> u32 { - | --- try adding a local generic parameter in this method instead + | - help: try using a local generic parameter instead: `` LL | X | ^ use of generic parameter from outer function diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index ababb27a8..ada1050d3 100644 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -1,11 +1,11 @@ error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:17:5 + --> $DIR/abstract-const-as-cast-3.rs:17:19 | LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` -note: required because of the requirements on the impl of `Trait` for `HasCastInTraitImpl<{ N + 1 }, { N as u128 }>` +note: required for `HasCastInTraitImpl<{ N + 1 }, { N as u128 }>` to implement `Trait` --> $DIR/abstract-const-as-cast-3.rs:8:22 | LL | impl Trait for HasCastInTraitImpl {} @@ -22,17 +22,22 @@ error[E0308]: mismatched types LL | assert_impl::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as u128 }`, found `{ O as u128 }` | - = note: expected type `{ N as u128 }` - found type `{ O as u128 }` + = note: expected constant `{ N as u128 }` + found constant `{ O as u128 }` +note: required by a bound in `use_trait_impl::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:14:23 + | +LL | fn assert_impl() {} + | ^^^^^ required by this bound in `use_trait_impl::assert_impl` error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:20:5 + --> $DIR/abstract-const-as-cast-3.rs:20:19 | LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` -note: required because of the requirements on the impl of `Trait` for `HasCastInTraitImpl<{ N + 1 }, { N as _ }>` +note: required for `HasCastInTraitImpl<{ N + 1 }, { N as _ }>` to implement `Trait` --> $DIR/abstract-const-as-cast-3.rs:8:22 | LL | impl Trait for HasCastInTraitImpl {} @@ -49,8 +54,13 @@ error[E0308]: mismatched types LL | assert_impl::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as _ }`, found `{ O as u128 }` | - = note: expected type `{ N as _ }` - found type `{ O as u128 }` + = note: expected constant `{ N as _ }` + found constant `{ O as u128 }` +note: required by a bound in `use_trait_impl::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:14:23 + | +LL | fn assert_impl() {} + | ^^^^^ required by this bound in `use_trait_impl::assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:23:5 @@ -58,8 +68,13 @@ error[E0308]: mismatched types LL | assert_impl::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `12`, found `13` | - = note: expected type `12` - found type `13` + = note: expected constant `12` + found constant `13` +note: required by a bound in `use_trait_impl::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:14:23 + | +LL | fn assert_impl() {} + | ^^^^^ required by this bound in `use_trait_impl::assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:25:5 @@ -67,17 +82,22 @@ error[E0308]: mismatched types LL | assert_impl::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `13`, found `14` | - = note: expected type `13` - found type `14` + = note: expected constant `13` + found constant `14` +note: required by a bound in `use_trait_impl::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:14:23 + | +LL | fn assert_impl() {} + | ^^^^^ required by this bound in `use_trait_impl::assert_impl` error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:35:5 + --> $DIR/abstract-const-as-cast-3.rs:35:19 | LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` -note: required because of the requirements on the impl of `Trait` for `HasCastInTraitImpl<{ N + 1 }, { N as u128 }>` +note: required for `HasCastInTraitImpl<{ N + 1 }, { N as u128 }>` to implement `Trait` --> $DIR/abstract-const-as-cast-3.rs:8:22 | LL | impl Trait for HasCastInTraitImpl {} @@ -94,17 +114,22 @@ error[E0308]: mismatched types LL | assert_impl::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as u128 }`, found `{ O as u128 }` | - = note: expected type `{ N as u128 }` - found type `{ O as u128 }` + = note: expected constant `{ N as u128 }` + found constant `{ O as u128 }` +note: required by a bound in `use_trait_impl_2::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:32:23 + | +LL | fn assert_impl() {} + | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:38:5 + --> $DIR/abstract-const-as-cast-3.rs:38:19 | LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` -note: required because of the requirements on the impl of `Trait` for `HasCastInTraitImpl<{ N + 1 }, { N as _ }>` +note: required for `HasCastInTraitImpl<{ N + 1 }, { N as _ }>` to implement `Trait` --> $DIR/abstract-const-as-cast-3.rs:8:22 | LL | impl Trait for HasCastInTraitImpl {} @@ -121,8 +146,13 @@ error[E0308]: mismatched types LL | assert_impl::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as _ }`, found `{ O as u128 }` | - = note: expected type `{ N as _ }` - found type `{ O as u128 }` + = note: expected constant `{ N as _ }` + found constant `{ O as u128 }` +note: required by a bound in `use_trait_impl_2::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:32:23 + | +LL | fn assert_impl() {} + | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:41:5 @@ -130,8 +160,13 @@ error[E0308]: mismatched types LL | assert_impl::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `12`, found `13` | - = note: expected type `12` - found type `13` + = note: expected constant `12` + found constant `13` +note: required by a bound in `use_trait_impl_2::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:32:23 + | +LL | fn assert_impl() {} + | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:43:5 @@ -139,8 +174,13 @@ error[E0308]: mismatched types LL | assert_impl::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `13`, found `14` | - = note: expected type `13` - found type `14` + = note: expected constant `13` + found constant `14` +note: required by a bound in `use_trait_impl_2::assert_impl` + --> $DIR/abstract-const-as-cast-3.rs:32:23 + | +LL | fn assert_impl() {} + | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` error: aborting due to 12 previous errors diff --git a/src/test/ui/const-generics/generic_const_exprs/different-fn.stderr b/src/test/ui/const-generics/generic_const_exprs/different-fn.stderr index 2aeb9b961..83a2f3740 100644 --- a/src/test/ui/const-generics/generic_const_exprs/different-fn.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/different-fn.stderr @@ -4,8 +4,8 @@ error[E0308]: mismatched types LL | [0; size_of::>()] | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `size_of::()`, found `size_of::>()` | - = note: expected type `size_of::()` - found type `size_of::>()` + = note: expected constant `size_of::()` + found constant `size_of::>()` error: unconstrained generic constant --> $DIR/different-fn.rs:10:9 diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-100217.rs b/src/test/ui/const-generics/generic_const_exprs/issue-100217.rs new file mode 100644 index 000000000..acdc348a3 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-100217.rs @@ -0,0 +1,42 @@ +// build-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +trait TraitOne { + const MY_NUM: usize; + type MyErr: std::fmt::Debug; + + fn do_one_stuff(arr: [u8; Self::MY_NUM]) -> Result<(), Self::MyErr>; +} + +trait TraitTwo { + fn do_two_stuff(); +} + +impl TraitTwo for O +where + [(); Self::MY_NUM]:, +{ + fn do_two_stuff() { + O::do_one_stuff([5; Self::MY_NUM]).unwrap() + } +} + +struct Blargotron; + +#[derive(Debug)] +struct ErrTy([(); N]); + +impl TraitOne for Blargotron { + const MY_NUM: usize = 3; + type MyErr = ErrTy<{ Self::MY_NUM }>; + + fn do_one_stuff(_arr: [u8; Self::MY_NUM]) -> Result<(), Self::MyErr> { + Ok(()) + } +} + +fn main() { + Blargotron::do_two_stuff(); +} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-100360.rs b/src/test/ui/const-generics/generic_const_exprs/issue-100360.rs new file mode 100644 index 000000000..5572f1f88 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-100360.rs @@ -0,0 +1,13 @@ +// check-pass +// (this requires debug assertions) + +#![feature(adt_const_params)] +#![allow(incomplete_features)] + +fn foo(arg: &'static bool) -> bool { + B == arg +} + +fn main() { + foo::<{ &true }>(&false); +} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-62504.full.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-62504.full.stderr index f2ae361dc..0742db398 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-62504.full.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-62504.full.stderr @@ -4,8 +4,8 @@ error[E0308]: mismatched types LL | ArrayHolder([0; Self::SIZE]) | ^^^^^^^^^^^^^^^ expected `X`, found `Self::SIZE` | - = note: expected type `X` - found type `Self::SIZE` + = note: expected constant `X` + found constant `Self::SIZE` error: unconstrained generic constant --> $DIR/issue-62504.rs:18:25 diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-69654.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-69654.stderr index 7a083733a..c3e2f8e16 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-69654.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-69654.stderr @@ -2,7 +2,9 @@ error[E0423]: expected value, found type parameter `T` --> $DIR/issue-69654.rs:5:25 | LL | impl Bar for [u8; T] {} - | ^ not a value + | - ^ not a value + | | + | found this type parameter error[E0599]: the function or associated item `foo` exists for struct `Foo<_>`, but its trait bounds were not satisfied --> $DIR/issue-69654.rs:17:10 diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr index d536f6fd1..f2fddfbfb 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr @@ -4,8 +4,15 @@ error[E0308]: mismatched types LL | let x: Arr<{usize::MAX}> = Arr {}; | ^^^^^^^^^^^^^^^^^ expected `false`, found `true` | - = note: expected type `false` - found type `true` + = note: expected constant `false` + found constant `true` +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 +LL | where Assert::<{N < usize::MAX / 2}>: IsTrue, + | ^^^^^^ required by this bound in `Arr` error[E0308]: mismatched types --> $DIR/issue-72819-generic-in-const-eval.rs:20:32 @@ -13,8 +20,15 @@ error[E0308]: mismatched types LL | let x: Arr<{usize::MAX}> = Arr {}; | ^^^ expected `false`, found `true` | - = note: expected type `false` - found type `true` + = note: expected constant `false` + found constant `true` +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 +LL | where Assert::<{N < usize::MAX / 2}>: IsTrue, + | ^^^^^^ required by this bound in `Arr` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-73298.rs b/src/test/ui/const-generics/generic_const_exprs/issue-73298.rs new file mode 100644 index 000000000..3c59e1b79 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-73298.rs @@ -0,0 +1,23 @@ +// build-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +use std::convert::AsMut; +use std::default::Default; + +trait Foo: Sized { + type Baz: Default + AsMut<[u8]>; + fn bar() { + Self::Baz::default().as_mut(); + } +} + +impl Foo for () { + type Baz = [u8; 1 * 1]; + //type Baz = [u8; 1]; +} + +fn main() { + <() as Foo>::bar(); +} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-82268.rs b/src/test/ui/const-generics/generic_const_exprs/issue-82268.rs new file mode 100644 index 000000000..d08fc5beb --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-82268.rs @@ -0,0 +1,73 @@ +// build-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +trait Collate { + type Pass; + type Fail; + + fn collate(self) -> (Self::Pass, Self::Fail); +} + +impl Collate for () { + type Pass = (); + type Fail = (); + + fn collate(self) -> ((), ()) { + ((), ()) + } +} + +trait CollateStep { + type Pass; + type Fail; + fn collate_step(x: X, prev: Prev) -> (Self::Pass, Self::Fail); +} + +impl CollateStep for () { + type Pass = (X, P); + type Fail = F; + + fn collate_step(x: X, (p, f): (P, F)) -> ((X, P), F) { + ((x, p), f) + } +} + +struct CollateOpImpl; +trait CollateOpStep { + type NextOp; + type Apply; +} + +impl CollateOpStep for CollateOpImpl +where + CollateOpImpl<{ MASK >> 1 }>: Sized, +{ + type NextOp = CollateOpImpl<{ MASK >> 1 }>; + type Apply = (); +} + +impl Collate for (H, T) +where + T: Collate, + Op::Apply: CollateStep, +{ + type Pass = >::Pass; + type Fail = >::Fail; + + fn collate(self) -> (Self::Pass, Self::Fail) { + >::collate_step(self.0, self.1.collate()) + } +} + +fn collate(x: X) -> (X::Pass, X::Fail) +where + X: Collate>, +{ + x.collate() +} + +fn main() { + dbg!(collate::<_, 5>(("Hello", (42, ('!', ()))))); +} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr index 0332e82fe..b693023f1 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr @@ -4,8 +4,8 @@ error[E0308]: method not compatible with trait LL | fn size(&self) -> [usize; DIM] { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` | - = note: expected type `Self::DIM` - found type `DIM` + = note: expected constant `Self::DIM` + found constant `DIM` error: unconstrained generic constant --> $DIR/issue-83765.rs:32:24 @@ -26,8 +26,8 @@ error[E0308]: mismatched types LL | self.reference.size() | ^^^^^^^^^^^^^^^^^^^^^ expected `DIM`, found `Self::DIM` | - = note: expected type `DIM` - found type `Self::DIM` + = note: expected constant `DIM` + found constant `Self::DIM` error: aborting due to 3 previous errors diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-83972.rs b/src/test/ui/const-generics/generic_const_exprs/issue-83972.rs new file mode 100644 index 000000000..0063719b8 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-83972.rs @@ -0,0 +1,38 @@ +// build-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +pub trait Foo { + fn foo(&self); +} + +pub struct FooImpl; +impl Foo for FooImpl { + fn foo(&self) {} +} + +pub trait Bar: 'static { + type Foo: Foo; + fn get() -> &'static Self::Foo; +} + +struct BarImpl; +impl Bar for BarImpl { + type Foo = FooImpl< + { + { 4 } + }, + >; + fn get() -> &'static Self::Foo { + &FooImpl + } +} + +pub fn boom() { + B::get().foo(); +} + +fn main() { + boom::(); +} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-84669.rs b/src/test/ui/const-generics/generic_const_exprs/issue-84669.rs new file mode 100644 index 000000000..3933ff20a --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-84669.rs @@ -0,0 +1,30 @@ +// build-pass + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +trait Foo { + type Output; + + fn foo() -> Self::Output; +} + +impl Foo for [u8; 3] { + type Output = [u8; 1 + 2]; + + fn foo() -> [u8; 3] { + [1u8; 3] + } +} + +fn bug() +where + [u8; N]: Foo, + <[u8; N] as Foo>::Output: AsRef<[u8]>, +{ + <[u8; N]>::foo().as_ref(); +} + +fn main() { + bug::<3>(); +} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr index d45dfde9a..09bcb0860 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr @@ -7,12 +7,12 @@ LL | writes_to_specific_path(&cap); | required by a bound introduced by this call | = help: the trait `Delegates` is implemented for `T` -note: required because of the requirements on the impl of `Contains<(), true>` for `&C` +note: required for `&C` to implement `Contains<(), true>` --> $DIR/issue-85848.rs:21:12 | LL | impl Contains() }> for U where T: _Contains {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required because of the requirements on the impl of `Delegates<()>` for `&C` +note: required for `&C` to implement `Delegates<()>` --> $DIR/issue-85848.rs:12:12 | LL | impl Delegates for T where T: Contains {} @@ -32,12 +32,12 @@ LL | writes_to_specific_path(&cap); | required by a bound introduced by this call | = help: try adding a `where` bound using this expression: `where [(); { contains::() }]:` -note: required because of the requirements on the impl of `Contains<(), true>` for `&C` +note: required for `&C` to implement `Contains<(), true>` --> $DIR/issue-85848.rs:21:12 | LL | impl Contains() }> for U where T: _Contains {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required because of the requirements on the impl of `Delegates<()>` for `&C` +note: required for `&C` to implement `Delegates<()>` --> $DIR/issue-85848.rs:12:12 | LL | impl Delegates for T where T: Contains {} @@ -54,8 +54,8 @@ error[E0308]: mismatched types LL | writes_to_specific_path(&cap); | ^^^^^^^^^^^^^^^^^^^^^^^ expected `true`, found `{ contains::() }` | - = note: expected type `true` - found type `{ contains::() }` + = note: expected constant `true` + found constant `{ contains::() }` error: aborting due to 3 previous errors diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-86710.rs b/src/test/ui/const-generics/generic_const_exprs/issue-86710.rs new file mode 100644 index 000000000..bdd8a21b3 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-86710.rs @@ -0,0 +1,73 @@ +// build-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +use std::marker::PhantomData; + +fn main() { + let x = FooImpl::> { phantom: PhantomData }; + let _ = x.foo::>(); +} + +trait Foo +where + T: Bar, +{ + fn foo(&self) + where + T: Operation, + >::Output: Bar; +} + +struct FooImpl +where + T: Bar, +{ + phantom: PhantomData, +} + +impl Foo for FooImpl +where + T: Bar, +{ + fn foo(&self) + where + T: Operation, + >::Output: Bar, + { + <>::Output as Bar>::error_occurs_here(); + } +} + +trait Bar { + fn error_occurs_here(); +} + +struct BarImpl; + +impl Bar for BarImpl { + fn error_occurs_here() {} +} + +trait Operation { + type Output; +} + +//// Part-A: This causes error. +impl Operation> for BarImpl +where + BarImpl<{ N + M }>: Sized, +{ + type Output = BarImpl<{ N + M }>; +} + +//// Part-B: This doesn't cause error. +// impl Operation> for BarImpl { +// type Output = BarImpl; +// } + +//// Part-C: This also doesn't cause error. +// impl Operation> for BarImpl { +// type Output = BarImpl<{ M }>; +// } diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-89851.rs b/src/test/ui/const-generics/generic_const_exprs/issue-89851.rs new file mode 100644 index 000000000..cde849d90 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-89851.rs @@ -0,0 +1,12 @@ +// check-pass +// (this requires debug assertions) + +#![feature(adt_const_params)] +#![allow(incomplete_features)] + +pub const BAR: () = ice::<"">(); +pub const fn ice() { + &10; +} + +fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/obligation-cause.rs b/src/test/ui/const-generics/generic_const_exprs/obligation-cause.rs new file mode 100644 index 000000000..e7c8e4f66 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/obligation-cause.rs @@ -0,0 +1,24 @@ +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +trait True {} + +struct Is; + +impl True for Is {} + +fn g() +//~^ NOTE required by a bound in this +where + Is<{ std::mem::size_of::() == 0 }>: True, + //~^ NOTE required by a bound in `g` + //~| NOTE required by this bound in `g` +{ +} + +fn main() { + g::(); + //~^ ERROR mismatched types + //~| NOTE expected `false`, found `true` + //~| NOTE expected constant `false` +} diff --git a/src/test/ui/const-generics/generic_const_exprs/obligation-cause.stderr b/src/test/ui/const-generics/generic_const_exprs/obligation-cause.stderr new file mode 100644 index 000000000..a253ec676 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/obligation-cause.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/obligation-cause.rs:20:5 + | +LL | g::(); + | ^^^^^^^^^^ expected `false`, found `true` + | + = note: expected constant `false` + found constant `true` +note: required by a bound in `g` + --> $DIR/obligation-cause.rs:13:44 + | +LL | fn g() + | - required by a bound in this +... +LL | Is<{ std::mem::size_of::() == 0 }>: True, + | ^^^^ required by this bound in `g` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr b/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr index b1b359619..d955b4f96 100644 --- a/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -2,15 +2,22 @@ error[E0107]: this associated function takes 0 generic arguments but 1 generic a --> $DIR/invalid-const-arg-for-type-param.rs:6:23 | LL | let _: u32 = 5i32.try_into::<32>().unwrap(); - | ^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^ expected 0 generic arguments | note: associated function defined here, with 0 generic parameters --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | LL | fn try_into(self) -> Result; | ^^^^^^^^ +help: consider moving this generic argument to the `TryInto` trait, which takes up to 1 argument + | +LL | let _: u32 = TryInto::<32>::try_into(5i32).unwrap(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +help: remove these generics + | +LL - let _: u32 = 5i32.try_into::<32>().unwrap(); +LL + let _: u32 = 5i32.try_into().unwrap(); + | error[E0599]: no method named `f` found for struct `S` in the current scope --> $DIR/invalid-const-arg-for-type-param.rs:9:7 diff --git a/src/test/ui/const-generics/issue-103243.rs b/src/test/ui/const-generics/issue-103243.rs new file mode 100644 index 000000000..78c73522b --- /dev/null +++ b/src/test/ui/const-generics/issue-103243.rs @@ -0,0 +1,37 @@ +// build-pass + +pub trait CSpace: Sized { + type Traj; +} + +pub trait FullTrajectory {} + +pub struct Const; + +pub trait Obstacle +where + CS: CSpace, +{ + fn trajectory_free(&self, t: &FT) + where + FT: FullTrajectory; +} + +// ----- + +const N: usize = 4; + +struct ObstacleSpace2df32; + +impl Obstacle for ObstacleSpace2df32 +where + CS: CSpace, +{ + fn trajectory_free(&self, t: &TF) + where + TF: FullTrajectory, + { + } +} + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-100313.rs b/src/test/ui/const-generics/issues/issue-100313.rs new file mode 100644 index 000000000..4e9d3626a --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-100313.rs @@ -0,0 +1,21 @@ +#![allow(incomplete_features)] +#![feature(const_mut_refs)] +#![feature(adt_const_params)] + +struct T; + +impl T { + const fn set_false(&self) { + unsafe { + *(B as *const bool as *mut bool) = false; + //~^ ERROR evaluation of constant value failed [E0080] + } + } +} + +const _: () = { + let x = T::<{&true}>; + x.set_false(); +}; + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-100313.stderr b/src/test/ui/const-generics/issues/issue-100313.stderr new file mode 100644 index 000000000..f3ce357c2 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-100313.stderr @@ -0,0 +1,15 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/issue-100313.rs:10:13 + | +LL | *(B as *const bool as *mut bool) = false; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | writing to alloc7 which is read-only + | inside `T::<&true>::set_false` at $DIR/issue-100313.rs:10:13 +... +LL | x.set_false(); + | ------------- inside `_` at $DIR/issue-100313.rs:18:5 + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/const-generics/issues/issue-73260.stderr b/src/test/ui/const-generics/issues/issue-73260.stderr index f1fc50e6e..7670032e5 100644 --- a/src/test/ui/const-generics/issues/issue-73260.stderr +++ b/src/test/ui/const-generics/issues/issue-73260.stderr @@ -4,8 +4,16 @@ error[E0308]: mismatched types LL | let x: Arr<{usize::MAX}> = Arr {}; | ^^^^^^^^^^^^^^^^^ expected `false`, found `true` | - = note: expected type `false` - found type `true` + = note: expected constant `false` + found constant `true` +note: required by a bound in `Arr` + --> $DIR/issue-73260.rs:6:37 + | +LL | struct Arr + | --- required by a bound in this +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 @@ -13,8 +21,16 @@ error[E0308]: mismatched types LL | let x: Arr<{usize::MAX}> = Arr {}; | ^^^ expected `false`, found `true` | - = note: expected type `false` - found type `true` + = note: expected constant `false` + found constant `true` +note: required by a bound in `Arr` + --> $DIR/issue-73260.rs:6:37 + | +LL | struct Arr + | --- required by a bound in this +LL | where +LL | Assert::<{N < usize::MAX / 2}>: IsTrue, + | ^^^^^^ required by this bound in `Arr` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-79674.stderr b/src/test/ui/const-generics/issues/issue-79674.stderr index 8c029289c..02b48b55f 100644 --- a/src/test/ui/const-generics/issues/issue-79674.stderr +++ b/src/test/ui/const-generics/issues/issue-79674.stderr @@ -4,8 +4,16 @@ error[E0308]: mismatched types LL | requires_distinct("str", 12); | ^^^^^^^^^^^^^^^^^ expected `true`, found `false` | - = note: expected type `true` - found type `false` + = note: expected constant `true` + found constant `false` +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 +LL | A: MiniTypeId, B: MiniTypeId, +LL | Lift<{is_same_type::()}>: IsFalse {} + | ^^^^^^^ required by this bound in `requires_distinct` error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-83466.rs b/src/test/ui/const-generics/issues/issue-83466.rs index c488a663f..73c930101 100644 --- a/src/test/ui/const-generics/issues/issue-83466.rs +++ b/src/test/ui/const-generics/issues/issue-83466.rs @@ -1,5 +1,5 @@ // regression test for #83466- tests that generic arg mismatch errors between -// consts and types are not supressed when there are explicit late bound lifetimes +// consts and types are not suppressed when there are explicit late bound lifetimes struct S; impl S { diff --git a/src/test/ui/const-generics/issues/issue-83765.stderr b/src/test/ui/const-generics/issues/issue-83765.stderr index 28ddddf1b..d5f914f46 100644 --- a/src/test/ui/const-generics/issues/issue-83765.stderr +++ b/src/test/ui/const-generics/issues/issue-83765.stderr @@ -4,13 +4,13 @@ error[E0391]: cycle detected when resolving instance ` as TensorDimension>`... --> $DIR/issue-83765.rs:4:1 | LL | trait TensorDimension { | ^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires resolving instance ` as TensorDimension>::DIM`, completing the cycle -note: cycle used when checking if `TensorDimension` fulfills its obligations +note: cycle used when computing candidate for ` as TensorDimension>` --> $DIR/issue-83765.rs:4:1 | LL | trait TensorDimension { diff --git a/src/test/ui/const-generics/issues/issue-87493.stderr b/src/test/ui/const-generics/issues/issue-87493.stderr index f998c1187..653afae21 100644 --- a/src/test/ui/const-generics/issues/issue-87493.stderr +++ b/src/test/ui/const-generics/issues/issue-87493.stderr @@ -13,15 +13,17 @@ error[E0107]: this trait takes 0 generic arguments but 1 generic argument was su --> $DIR/issue-87493.rs:8:8 | LL | T: MyTrait, - | ^^^^^^^ ----------------- help: replace the generic bound with the associated type: `Assoc = Assoc == S::Assoc` - | | - | expected 0 generic arguments + | ^^^^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/issue-87493.rs:1:11 | LL | pub trait MyTrait { | ^^^^^^^ +help: replace the generic bound with the associated type + | +LL | T: MyTrait, + | +++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr b/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr index f5396b838..be92429e3 100644 --- a/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr +++ b/src/test/ui/const-generics/min_const_generics/invalid-patterns.32bit.stderr @@ -22,19 +22,14 @@ error[E0308]: mismatched types LL | get_flag::<42, 0x5ad>(); | ^^^^^ expected `char`, found `u8` -error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:38:21 +error[E0080]: evaluation of constant value failed + --> $DIR/invalid-patterns.rs:38:32 | LL | get_flag::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - | - = 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) { - __ __ __ __ │ â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:40:14 + --> $DIR/invalid-patterns.rs:41:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean @@ -45,7 +40,7 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:42:14 + --> $DIR/invalid-patterns.rs:43:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean @@ -55,16 +50,11 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character 42 │ B } -error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:42:47 +error[E0080]: evaluation of constant value failed + --> $DIR/invalid-patterns.rs:43:58 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - | - = 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) { - __ __ __ __ │ â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to 8 previous errors diff --git a/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr b/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr index f5396b838..be92429e3 100644 --- a/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr +++ b/src/test/ui/const-generics/min_const_generics/invalid-patterns.64bit.stderr @@ -22,19 +22,14 @@ error[E0308]: mismatched types LL | get_flag::<42, 0x5ad>(); | ^^^^^ expected `char`, found `u8` -error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:38:21 +error[E0080]: evaluation of constant value failed + --> $DIR/invalid-patterns.rs:38:32 | LL | get_flag::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - | - = 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) { - __ __ __ __ │ â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:40:14 + --> $DIR/invalid-patterns.rs:41:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean @@ -45,7 +40,7 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:42:14 + --> $DIR/invalid-patterns.rs:43:14 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x42, but expected a boolean @@ -55,16 +50,11 @@ LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character 42 │ B } -error[E0080]: it is undefined behavior to use this value - --> $DIR/invalid-patterns.rs:42:47 +error[E0080]: evaluation of constant value failed + --> $DIR/invalid-patterns.rs:43:58 | LL | get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - | - = 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) { - __ __ __ __ │ â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to 8 previous errors diff --git a/src/test/ui/const-generics/min_const_generics/invalid-patterns.rs b/src/test/ui/const-generics/min_const_generics/invalid-patterns.rs index 682e0eced..13b2cca2f 100644 --- a/src/test/ui/const-generics/min_const_generics/invalid-patterns.rs +++ b/src/test/ui/const-generics/min_const_generics/invalid-patterns.rs @@ -36,10 +36,12 @@ fn main() { get_flag::(); - //~^ ERROR it is undefined behavior + //~^ ERROR evaluation of constant value failed + //~| uninitialized get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>(); //~^ ERROR it is undefined behavior get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>(); - //~^ ERROR it is undefined behavior + //~^ ERROR evaluation of constant value failed + //~| uninitialized //~| ERROR it is undefined behavior } diff --git a/src/test/ui/const-generics/types-mismatch-const-args.full.stderr b/src/test/ui/const-generics/types-mismatch-const-args.full.stderr index 486506239..b6a22df74 100644 --- a/src/test/ui/const-generics/types-mismatch-const-args.full.stderr +++ b/src/test/ui/const-generics/types-mismatch-const-args.full.stderr @@ -4,8 +4,8 @@ error[E0308]: mismatched types LL | let _: A<'a, u32, {2u32}, {3u32}> = A::<'a, u32, {2u32 + 2u32}, {3u32}> { data: PhantomData }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `4` | - = note: expected type `2` - found type `4` + = note: expected constant `2` + found constant `4` error[E0308]: mismatched types --> $DIR/types-mismatch-const-args.rs:16:41 diff --git a/src/test/ui/consts/assert-type-intrinsics.rs b/src/test/ui/consts/assert-type-intrinsics.rs index 38e5c454e..3ce3e1bdb 100644 --- a/src/test/ui/consts/assert-type-intrinsics.rs +++ b/src/test/ui/consts/assert-type-intrinsics.rs @@ -13,10 +13,10 @@ fn main() { const _BAD1: () = unsafe { MaybeUninit::::uninit().assume_init(); }; - const _BAD2: () = unsafe { + const _BAD2: () = { intrinsics::assert_uninit_valid::(); }; - const _BAD3: () = unsafe { + const _BAD3: () = { intrinsics::assert_zero_valid::<&'static i32>(); }; } diff --git a/src/test/ui/consts/assert-type-intrinsics.stderr b/src/test/ui/consts/assert-type-intrinsics.stderr index f3b9170d4..6eab10197 100644 --- a/src/test/ui/consts/assert-type-intrinsics.stderr +++ b/src/test/ui/consts/assert-type-intrinsics.stderr @@ -13,7 +13,7 @@ LL | MaybeUninit::::uninit().assume_init(); error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:17:9 | -LL | const _BAD2: () = unsafe { +LL | const _BAD2: () = { | --------------- LL | intrinsics::assert_uninit_valid::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `bool` uninitialized, which is invalid @@ -24,7 +24,7 @@ LL | intrinsics::assert_uninit_valid::(); error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:20:9 | -LL | const _BAD3: () = unsafe { +LL | const _BAD3: () = { | --------------- LL | intrinsics::assert_zero_valid::<&'static i32>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid @@ -51,7 +51,7 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:17:9 | -LL | const _BAD2: () = unsafe { +LL | const _BAD2: () = { | --------------- LL | intrinsics::assert_uninit_valid::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `bool` uninitialized, which is invalid @@ -64,7 +64,7 @@ Future breakage diagnostic: error: any use of this value will cause an error --> $DIR/assert-type-intrinsics.rs:20:9 | -LL | const _BAD3: () = unsafe { +LL | const _BAD3: () = { | --------------- LL | intrinsics::assert_zero_valid::<&'static i32>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid diff --git a/src/test/ui/consts/const-block-const-bound.stderr b/src/test/ui/consts/const-block-const-bound.stderr index 87ca771e5..b9c4d8866 100644 --- a/src/test/ui/consts/const-block-const-bound.stderr +++ b/src/test/ui/consts/const-block-const-bound.stderr @@ -2,7 +2,7 @@ error[E0277]: can't drop `UnconstDrop` in const contexts --> $DIR/const-block-const-bound.rs:20:11 | LL | f(UnconstDrop); - | - ^^^^^^^^^^^ expected an implementor of trait `~const Destruct` + | - ^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `UnconstDrop` | | | required by a bound introduced by this call | @@ -23,7 +23,7 @@ error[E0277]: can't drop `NonDrop` in const contexts --> $DIR/const-block-const-bound.rs:22:11 | LL | f(NonDrop); - | - ^^^^^^^ expected an implementor of trait `~const Destruct` + | - ^^^^^^^ the trait `~const Destruct` is not implemented for `NonDrop` | | | required by a bound introduced by this call | diff --git a/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr b/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr index 5306fed22..ee352700c 100644 --- a/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr +++ b/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied LL | let _: [Option; 2] = [no_copy(); 2]; | ^^^^^^^^^ the trait `Copy` is not implemented for `Bar` | - = note: required because of the requirements on the impl of `Copy` for `Option` + = note: required for `Option` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];` = help: create an inline `const` block, see RFC #2920 for more information diff --git a/src/test/ui/consts/const-blocks/migrate-fail.stderr b/src/test/ui/consts/const-blocks/migrate-fail.stderr index 803281c07..928ffd083 100644 --- a/src/test/ui/consts/const-blocks/migrate-fail.stderr +++ b/src/test/ui/consts/const-blocks/migrate-fail.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied LL | let arr: [Option; 2] = [x; 2]; | ^ the trait `Copy` is not implemented for `Bar` | - = note: required because of the requirements on the impl of `Copy` for `Option` + = note: required for `Option` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array help: consider annotating `Bar` with `#[derive(Copy)]` | @@ -17,7 +17,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied LL | let arr: [Option; 2] = [x; 2]; | ^ the trait `Copy` is not implemented for `Bar` | - = note: required because of the requirements on the impl of `Copy` for `Option` + = note: required for `Option` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array help: consider annotating `Bar` with `#[derive(Copy)]` | diff --git a/src/test/ui/consts/const-blocks/nll-fail.stderr b/src/test/ui/consts/const-blocks/nll-fail.stderr index 8841af15d..fede00845 100644 --- a/src/test/ui/consts/const-blocks/nll-fail.stderr +++ b/src/test/ui/consts/const-blocks/nll-fail.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied LL | let arr: [Option; 2] = [x; 2]; | ^ the trait `Copy` is not implemented for `Bar` | - = note: required because of the requirements on the impl of `Copy` for `Option` + = note: required for `Option` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array help: consider annotating `Bar` with `#[derive(Copy)]` | @@ -17,7 +17,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied LL | let arr: [Option; 2] = [x; 2]; | ^ the trait `Copy` is not implemented for `Bar` | - = note: required because of the requirements on the impl of `Copy` for `Option` + = note: required for `Option` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array help: consider annotating `Bar` with `#[derive(Copy)]` | diff --git a/src/test/ui/consts/const-blocks/trait-error.stderr b/src/test/ui/consts/const-blocks/trait-error.stderr index ece200ad1..b11dd4b80 100644 --- a/src/test/ui/consts/const-blocks/trait-error.stderr +++ b/src/test/ui/consts/const-blocks/trait-error.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied LL | [Foo(String::new()); 4]; | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | -note: required because of the requirements on the impl of `Copy` for `Foo` +note: required for `Foo` to implement `Copy` --> $DIR/trait-error.rs:1:10 | LL | #[derive(Copy, Clone)] diff --git a/src/test/ui/consts/const-err4.32bit.stderr b/src/test/ui/consts/const-err4.32bit.stderr index a55384783..1cbf78173 100644 --- a/src/test/ui/consts/const-err4.32bit.stderr +++ b/src/test/ui/consts/const-err4.32bit.stderr @@ -1,13 +1,8 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/const-err4.rs:9:11 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err4.rs:9:21 | LL | Boo = [unsafe { Foo { b: () }.a }; 4][3], - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes - | - = 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) { - __ __ __ __ │ â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to previous error diff --git a/src/test/ui/consts/const-err4.64bit.stderr b/src/test/ui/consts/const-err4.64bit.stderr index 66bfc30c3..1cbf78173 100644 --- a/src/test/ui/consts/const-err4.64bit.stderr +++ b/src/test/ui/consts/const-err4.64bit.stderr @@ -1,13 +1,8 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/const-err4.rs:9:11 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err4.rs:9:21 | LL | Boo = [unsafe { Foo { b: () }.a }; 4][3], - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes - | - = 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) { - __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to previous error diff --git a/src/test/ui/consts/const-err4.rs b/src/test/ui/consts/const-err4.rs index f0625faa8..107dc3f82 100644 --- a/src/test/ui/consts/const-err4.rs +++ b/src/test/ui/consts/const-err4.rs @@ -7,7 +7,8 @@ union Foo { enum Bar { Boo = [unsafe { Foo { b: () }.a }; 4][3], - //~^ ERROR it is undefined behavior to use this value + //~^ ERROR evaluation of constant value failed + //~| uninitialized } fn main() { diff --git a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr index b7b00f7d7..12d5b7bd6 100644 --- a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr +++ b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr @@ -54,19 +54,14 @@ LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uin = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error[E0080]: it is undefined behavior to use this value - --> $DIR/const-pointer-values-in-various-types.rs:46:5 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:46:47 | LL | const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 16, align: 8) { - __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:49:43 + --> $DIR/const-pointer-values-in-various-types.rs:50:43 | LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -77,7 +72,7 @@ LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:53:45 + --> $DIR/const-pointer-values-in-various-types.rs:54:45 | LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -88,7 +83,7 @@ LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:57:45 + --> $DIR/const-pointer-values-in-various-types.rs:58:45 | LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -99,7 +94,7 @@ LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:61:45 + --> $DIR/const-pointer-values-in-various-types.rs:62:45 | LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -109,19 +104,14 @@ LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error[E0080]: it is undefined behavior to use this value - --> $DIR/const-pointer-values-in-various-types.rs:65:5 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:66:47 | LL | const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 16, align: 8) { - __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:68:45 + --> $DIR/const-pointer-values-in-various-types.rs:70:45 | LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -132,7 +122,7 @@ LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.flo = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:72:45 + --> $DIR/const-pointer-values-in-various-types.rs:74:45 | LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -143,7 +133,7 @@ LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.flo = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:76:47 + --> $DIR/const-pointer-values-in-various-types.rs:78:47 | LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey }; | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -154,7 +144,7 @@ LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.t = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:80:47 + --> $DIR/const-pointer-values-in-various-types.rs:82:47 | LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character }; | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -165,7 +155,7 @@ LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.c = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:84:39 + --> $DIR/const-pointer-values-in-various-types.rs:86:39 | LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 }; | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -176,7 +166,7 @@ LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:88:41 + --> $DIR/const-pointer-values-in-various-types.rs:90:41 | LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -187,7 +177,7 @@ LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 } = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:92:41 + --> $DIR/const-pointer-values-in-various-types.rs:94:41 | LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -198,7 +188,7 @@ LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 } = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:96:41 + --> $DIR/const-pointer-values-in-various-types.rs:98:41 | LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -209,7 +199,7 @@ LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 } = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:100:43 + --> $DIR/const-pointer-values-in-various-types.rs:102:43 | LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -220,7 +210,7 @@ LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_12 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:104:39 + --> $DIR/const-pointer-values-in-various-types.rs:106:39 | LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 }; | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -231,7 +221,7 @@ LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:108:41 + --> $DIR/const-pointer-values-in-various-types.rs:110:41 | LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -242,7 +232,7 @@ LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:112:41 + --> $DIR/const-pointer-values-in-various-types.rs:114:41 | LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -253,7 +243,7 @@ LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:116:41 + --> $DIR/const-pointer-values-in-various-types.rs:118:41 | LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -264,7 +254,7 @@ LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:120:43 + --> $DIR/const-pointer-values-in-various-types.rs:122:43 | LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -275,7 +265,7 @@ LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:124:41 + --> $DIR/const-pointer-values-in-various-types.rs:126:41 | LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -286,7 +276,7 @@ LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:128:41 + --> $DIR/const-pointer-values-in-various-types.rs:130:41 | LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -297,7 +287,7 @@ LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:132:43 + --> $DIR/const-pointer-values-in-various-types.rs:134:43 | LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -308,7 +298,7 @@ LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:136:43 + --> $DIR/const-pointer-values-in-various-types.rs:138:43 | LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -388,7 +378,7 @@ LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uin Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:49:43 + --> $DIR/const-pointer-values-in-various-types.rs:50:43 | LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -401,7 +391,7 @@ LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:53:45 + --> $DIR/const-pointer-values-in-various-types.rs:54:45 | LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -414,7 +404,7 @@ LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:57:45 + --> $DIR/const-pointer-values-in-various-types.rs:58:45 | LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -427,7 +417,7 @@ LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:61:45 + --> $DIR/const-pointer-values-in-various-types.rs:62:45 | LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -440,7 +430,7 @@ LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:68:45 + --> $DIR/const-pointer-values-in-various-types.rs:70:45 | LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -453,7 +443,7 @@ LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.flo Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:72:45 + --> $DIR/const-pointer-values-in-various-types.rs:74:45 | LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 }; | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -466,7 +456,7 @@ LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.flo Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:76:47 + --> $DIR/const-pointer-values-in-various-types.rs:78:47 | LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey }; | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -479,7 +469,7 @@ LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.t Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:80:47 + --> $DIR/const-pointer-values-in-various-types.rs:82:47 | LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character }; | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -492,7 +482,7 @@ LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.c Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:84:39 + --> $DIR/const-pointer-values-in-various-types.rs:86:39 | LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 }; | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -505,7 +495,7 @@ LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:88:41 + --> $DIR/const-pointer-values-in-various-types.rs:90:41 | LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -518,7 +508,7 @@ LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 } Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:92:41 + --> $DIR/const-pointer-values-in-various-types.rs:94:41 | LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -531,7 +521,7 @@ LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 } Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:96:41 + --> $DIR/const-pointer-values-in-various-types.rs:98:41 | LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -544,7 +534,7 @@ LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 } Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:100:43 + --> $DIR/const-pointer-values-in-various-types.rs:102:43 | LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -557,7 +547,7 @@ LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_12 Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:104:39 + --> $DIR/const-pointer-values-in-various-types.rs:106:39 | LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 }; | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -570,7 +560,7 @@ LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:108:41 + --> $DIR/const-pointer-values-in-various-types.rs:110:41 | LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -583,7 +573,7 @@ LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:112:41 + --> $DIR/const-pointer-values-in-various-types.rs:114:41 | LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -596,7 +586,7 @@ LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:116:41 + --> $DIR/const-pointer-values-in-various-types.rs:118:41 | LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -609,7 +599,7 @@ LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:120:43 + --> $DIR/const-pointer-values-in-various-types.rs:122:43 | LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -622,7 +612,7 @@ LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:124:41 + --> $DIR/const-pointer-values-in-various-types.rs:126:41 | LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -635,7 +625,7 @@ LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:128:41 + --> $DIR/const-pointer-values-in-various-types.rs:130:41 | LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 }; | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -648,7 +638,7 @@ LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:132:43 + --> $DIR/const-pointer-values-in-various-types.rs:134:43 | LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -661,7 +651,7 @@ LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_ Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:136:43 + --> $DIR/const-pointer-values-in-various-types.rs:138:43 | LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character }; | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes diff --git a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs index f10a67392..f6a5e4d3c 100644 --- a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs +++ b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs @@ -44,7 +44,8 @@ fn main() { //~| WARN this was previously accepted by the compiler but is being phased out const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 }; - //~^ ERROR it is undefined behavior to use this value + //~^ ERROR evaluation of constant value failed + //~| uninitialized const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 }; //~^ ERROR any use of this value will cause an error @@ -63,7 +64,8 @@ fn main() { //~| WARN this was previously accepted by the compiler but is being phased out const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 }; - //~^ ERROR it is undefined behavior to use this value + //~^ ERROR evaluation of constant value failed + //~| uninitialized const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 }; //~^ ERROR any use of this value will cause an error diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr index f1a780926..a0f4519ea 100644 --- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr +++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/alloc_intrinsic_uninit.rs:8:1 | LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32) }; - | ^^^^^^^^^^^^^^^ constructing invalid value at .: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^ constructing invalid value at .: encountered uninitialized memory, but expected an integer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 4, align: 4) { diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr index 2eb401226..d2bffa425 100644 --- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr +++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/alloc_intrinsic_uninit.rs:8:1 | LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32) }; - | ^^^^^^^^^^^^^^^ constructing invalid value at .: encountered uninitialized bytes, but expected initialized bytes + | ^^^^^^^^^^^^^^^ constructing invalid value at .: encountered uninitialized memory, but expected an integer | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 8) { diff --git a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs index e1f5e8ae1..43c99799f 100644 --- a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs +++ b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs @@ -3,7 +3,6 @@ // Test that we can handle unsized types with an extern type tail part. // Regression test for issue #91827. -#![feature(const_ptr_offset_from)] #![feature(extern_types)] use std::ptr::addr_of; diff --git a/src/test/ui/consts/const-eval/ub-enum-overwrite.rs b/src/test/ui/consts/const-eval/ub-enum-overwrite.rs index c56778492..086a1001d 100644 --- a/src/test/ui/consts/const-eval/ub-enum-overwrite.rs +++ b/src/test/ui/consts/const-eval/ub-enum-overwrite.rs @@ -6,12 +6,13 @@ enum E { } const _: u8 = { - //~^ ERROR is undefined behavior let mut e = E::A(1); let p = if let E::A(x) = &mut e { x as *mut u8 } else { unreachable!() }; // Make sure overwriting `e` uninitializes other bytes e = E::B; unsafe { *p } + //~^ ERROR evaluation of constant value failed + //~| uninitialized }; fn main() {} diff --git a/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr b/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr index 8560112ae..5750212b4 100644 --- a/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr +++ b/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr @@ -1,13 +1,8 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum-overwrite.rs:8:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum-overwrite.rs:13:14 | -LL | const _: u8 = { - | ^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes - | - = 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: 1, align: 1) { - __ │ â–‘ - } +LL | unsafe { *p } + | ^^ using uninitialized data, but this operation requires initialized memory error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/ub-enum.32bit.stderr b/src/test/ui/consts/const-eval/ub-enum.32bit.stderr index ce3bc9474..752fd01f3 100644 --- a/src/test/ui/consts/const-eval/ub-enum.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.32bit.stderr @@ -65,19 +65,14 @@ LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:59:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:59:42 | LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .: encountered uninitialized bytes, but expected initialized bytes - | - = 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) { - __ __ __ __ │ â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: any use of this value will cause an error - --> $DIR/ub-enum.rs:63:1 + --> $DIR/ub-enum.rs:64:1 | LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -88,7 +83,7 @@ LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:81:1 + --> $DIR/ub-enum.rs:82:1 | LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered a value of the never type `!` @@ -99,7 +94,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:83:1 + --> $DIR/ub-enum.rs:84:1 | LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered a value of uninhabited type Never @@ -110,7 +105,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:91:1 + --> $DIR/ub-enum.rs:92:1 | LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) @@ -121,13 +116,13 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran } error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:96:77 + --> $DIR/ub-enum.rs:97:77 | LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:98:77 + --> $DIR/ub-enum.rs:99:77 | LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type @@ -189,7 +184,7 @@ LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-enum.rs:63:1 + --> $DIR/ub-enum.rs:64:1 | LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes diff --git a/src/test/ui/consts/const-eval/ub-enum.64bit.stderr b/src/test/ui/consts/const-eval/ub-enum.64bit.stderr index d8fc20c98..3f1546a27 100644 --- a/src/test/ui/consts/const-eval/ub-enum.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.64bit.stderr @@ -65,19 +65,14 @@ LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:59:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:59:42 | LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .: encountered uninitialized bytes, but expected initialized bytes - | - = 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) { - __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: any use of this value will cause an error - --> $DIR/ub-enum.rs:63:1 + --> $DIR/ub-enum.rs:64:1 | LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -88,7 +83,7 @@ LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:81:1 + --> $DIR/ub-enum.rs:82:1 | LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered a value of the never type `!` @@ -99,7 +94,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:83:1 + --> $DIR/ub-enum.rs:84:1 | LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered a value of uninhabited type Never @@ -110,7 +105,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:91:1 + --> $DIR/ub-enum.rs:92:1 | LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) @@ -121,13 +116,13 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran } error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:96:77 + --> $DIR/ub-enum.rs:97:77 | LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:98:77 + --> $DIR/ub-enum.rs:99:77 | LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type @@ -189,7 +184,7 @@ LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-enum.rs:63:1 + --> $DIR/ub-enum.rs:64:1 | LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes diff --git a/src/test/ui/consts/const-eval/ub-enum.rs b/src/test/ui/consts/const-eval/ub-enum.rs index d8d2a499b..d8dc6d057 100644 --- a/src/test/ui/consts/const-eval/ub-enum.rs +++ b/src/test/ui/consts/const-eval/ub-enum.rs @@ -57,7 +57,8 @@ union MaybeUninit { init: T, } const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init }; -//~^ ERROR is undefined behavior +//~^ ERROR evaluation of constant value failed +//~| uninitialized // Pointer value in an enum with a niche that is not just 0. const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; @@ -92,7 +93,7 @@ const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute //~^ ERROR is undefined behavior // All variants are uninhabited but also have data. -// Use `0` as constant to make behavior endianess-independent. +// Use `0` as constant to make behavior endianness-independent. const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; //~^ ERROR evaluation of constant value failed const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; diff --git a/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr b/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr index 8eece9e30..6100a98d1 100644 --- a/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr @@ -1,35 +1,20 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-int-array.rs:14:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-int-array.rs:16:9 | -LL | const UNINIT_INT_0: [u32; 3] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized bytes - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 12, align: 4) { - __ __ __ __ 01 00 00 00 02 00 00 00 │ â–‘â–‘â–‘â–‘........ - } +LL | MaybeUninit { uninit: () }.init, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-int-array.rs:23:1 - | -LL | const UNINIT_INT_1: [u32; 3] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized bytes +error[E0080]: evaluation of constant value failed + --> $DIR/ub-int-array.rs:31:13 | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 12, align: 4) { - 00 00 00 00 01 __ 01 01 02 02 __ 02 │ .....â–‘....â–‘. - } +LL | MaybeUninit { uninit: () }.init, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-int-array.rs:43:1 - | -LL | const UNINIT_INT_2: [u32; 3] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized bytes +error[E0080]: evaluation of constant value failed + --> $DIR/ub-int-array.rs:57:13 | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 12, align: 4) { - 00 00 00 00 01 01 01 01 02 02 02 __ │ ...........â–‘ - } +LL | MaybeUninit { uninit: () }.init, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr b/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr index 8eece9e30..6100a98d1 100644 --- a/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr @@ -1,35 +1,20 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-int-array.rs:14:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-int-array.rs:16:9 | -LL | const UNINIT_INT_0: [u32; 3] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized bytes - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 12, align: 4) { - __ __ __ __ 01 00 00 00 02 00 00 00 │ â–‘â–‘â–‘â–‘........ - } +LL | MaybeUninit { uninit: () }.init, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-int-array.rs:23:1 - | -LL | const UNINIT_INT_1: [u32; 3] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized bytes +error[E0080]: evaluation of constant value failed + --> $DIR/ub-int-array.rs:31:13 | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 12, align: 4) { - 00 00 00 00 01 __ 01 01 02 02 __ 02 │ .....â–‘....â–‘. - } +LL | MaybeUninit { uninit: () }.init, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-int-array.rs:43:1 - | -LL | const UNINIT_INT_2: [u32; 3] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized bytes +error[E0080]: evaluation of constant value failed + --> $DIR/ub-int-array.rs:57:13 | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 12, align: 4) { - 00 00 00 00 01 01 01 01 02 02 02 __ │ ...........â–‘ - } +LL | MaybeUninit { uninit: () }.init, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const-eval/ub-int-array.rs b/src/test/ui/consts/const-eval/ub-int-array.rs index 1221f71d1..cb85e3b01 100644 --- a/src/test/ui/consts/const-eval/ub-int-array.rs +++ b/src/test/ui/consts/const-eval/ub-int-array.rs @@ -12,17 +12,15 @@ union MaybeUninit { } const UNINIT_INT_0: [u32; 3] = unsafe { -//~^ ERROR it is undefined behavior to use this value -//~| constructing invalid value at [0]: encountered uninitialized bytes [ MaybeUninit { uninit: () }.init, + //~^ ERROR evaluation of constant value failed + //~| uninitialized 1, 2, ] }; const UNINIT_INT_1: [u32; 3] = unsafe { -//~^ ERROR it is undefined behavior to use this value -//~| constructing invalid value at [1]: encountered uninitialized bytes mem::transmute( [ 0u8, @@ -31,6 +29,8 @@ const UNINIT_INT_1: [u32; 3] = unsafe { 0u8, 1u8, MaybeUninit { uninit: () }.init, + //~^ ERROR evaluation of constant value failed + //~| uninitialized 1u8, 1u8, 2u8, @@ -41,8 +41,6 @@ const UNINIT_INT_1: [u32; 3] = unsafe { ) }; const UNINIT_INT_2: [u32; 3] = unsafe { -//~^ ERROR it is undefined behavior to use this value -//~| constructing invalid value at [2]: encountered uninitialized bytes mem::transmute( [ 0u8, @@ -57,6 +55,8 @@ const UNINIT_INT_2: [u32; 3] = unsafe { 2u8, 2u8, MaybeUninit { uninit: () }.init, + //~^ ERROR evaluation of constant value failed + //~| uninitialized ] ) }; diff --git a/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr b/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr index d450a814c..693c0e99b 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr @@ -37,19 +37,14 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; 00 00 00 00 │ .... } -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:33:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-nonnull.rs:33:36 | LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered uninitialized bytes, but expected initialized bytes - | - = 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: 1, align: 1) { - __ │ â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:41:1 + --> $DIR/ub-nonnull.rs:42:1 | LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30 @@ -60,7 +55,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:47:1 + --> $DIR/ub-nonnull.rs:48:1 | LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30 diff --git a/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr b/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr index ed0d91aab..d22191213 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr @@ -37,19 +37,14 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; 00 00 00 00 00 00 00 00 │ ........ } -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:33:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-nonnull.rs:33:36 | LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered uninitialized bytes, but expected initialized bytes - | - = 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: 1, align: 1) { - __ │ â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:41:1 + --> $DIR/ub-nonnull.rs:42:1 | LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30 @@ -60,7 +55,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:47:1 + --> $DIR/ub-nonnull.rs:48:1 | LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30 diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/src/test/ui/consts/const-eval/ub-nonnull.rs index 259707b80..777c6d988 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.rs +++ b/src/test/ui/consts/const-eval/ub-nonnull.rs @@ -31,7 +31,8 @@ union MaybeUninit { init: T, } const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed +//~| uninitialized // Also test other uses of rustc_layout_scalar_valid_range_start diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr b/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr index e86b37929..3e93219c8 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr @@ -116,19 +116,14 @@ LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; 39 05 00 00 │ 9... } -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:53:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:53:41 | LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - __ __ __ __ │ â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:56:1 + --> $DIR/ub-ref-ptr.rs:57:1 | LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer @@ -138,19 +133,14 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; 00 00 00 00 │ .... } -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:58:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:59:38 | LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a proper pointer or integer value - | - = 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) { - __ __ __ __ │ â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:60:1 + --> $DIR/ub-ref-ptr.rs:62:1 | LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer @@ -161,7 +151,7 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:62:1 + --> $DIR/ub-ref-ptr.rs:64:1 | LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr b/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr index eeec2dc4b..bc2aa12a2 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr @@ -116,19 +116,14 @@ LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; 39 05 00 00 00 00 00 00 │ 9....... } -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:53:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:53:41 | LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 8, align: 8) { - __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:56:1 + --> $DIR/ub-ref-ptr.rs:57:1 | LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer @@ -138,19 +133,14 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; 00 00 00 00 00 00 00 00 │ ........ } -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:58:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:59:38 | LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a proper pointer or integer value - | - = 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) { - __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:60:1 + --> $DIR/ub-ref-ptr.rs:62:1 | LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer @@ -161,7 +151,7 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:62:1 + --> $DIR/ub-ref-ptr.rs:64:1 | LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.rs b/src/test/ui/consts/const-eval/ub-ref-ptr.rs index d0216f746..c62848f70 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.rs +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.rs @@ -51,12 +51,14 @@ const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; //~^ ERROR it is undefined behavior to use this value const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init }; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed +//~| uninitialized const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; //~^ ERROR it is undefined behavior to use this value const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init }; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed +//~| uninitialized const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; //~^ ERROR it is undefined behavior to use this value const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr index c4f0e3ab4..4cd974e7b 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr @@ -76,19 +76,14 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni ╾─allocN─╼ 01 00 00 00 │ ╾──╼.... } -error[E0080]: it is undefined behavior to use this value +error[E0080]: evaluation of constant value failed --> $DIR/ub-wide-ptr.rs:63:1 | LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized reference - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 8, align: 4) { - 2a 00 00 00 __ __ __ __ │ *...â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:69:1 + --> $DIR/ub-wide-ptr.rs:70:1 | LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) @@ -99,7 +94,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:72:1 + --> $DIR/ub-wide-ptr.rs:73:1 | LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object @@ -110,7 +105,7 @@ LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, is } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:75:1 + --> $DIR/ub-wide-ptr.rs:76:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -121,7 +116,7 @@ LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:79:1 + --> $DIR/ub-wide-ptr.rs:80:1 | LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation) @@ -132,7 +127,7 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:82:1 + --> $DIR/ub-wide-ptr.rs:83:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -143,7 +138,7 @@ LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3) = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:87:1 + --> $DIR/ub-wide-ptr.rs:88:1 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .[0]: encountered 0x03, but expected a boolean @@ -154,7 +149,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:87:40 + --> $DIR/ub-wide-ptr.rs:88:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -163,7 +158,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; = note: for more information, see issue #71800 error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:95:1 + --> $DIR/ub-wide-ptr.rs:96:1 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered 0x03, but expected a boolean @@ -174,7 +169,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:95:42 + --> $DIR/ub-wide-ptr.rs:96:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -183,7 +178,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 = note: for more information, see issue #71800 error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:100:1 + --> $DIR/ub-wide-ptr.rs:101:1 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..1[0]: encountered 0x03, but expected a boolean @@ -194,7 +189,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:100:42 + --> $DIR/ub-wide-ptr.rs:101:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -202,19 +197,14 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran = 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 #71800 -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:109:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:110:1 | LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 8, align: 4) { - 2a 00 00 00 __ __ __ __ │ *...â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:117:1 + --> $DIR/ub-wide-ptr.rs:119:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -225,7 +215,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:121:1 + --> $DIR/ub-wide-ptr.rs:123:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -236,7 +226,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:125:1 + --> $DIR/ub-wide-ptr.rs:127:1 | LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer @@ -247,25 +237,25 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:128:57 + --> $DIR/ub-wide-ptr.rs:130:57 | LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:131:57 + --> $DIR/ub-wide-ptr.rs:133:57 | LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:134:56 + --> $DIR/ub-wide-ptr.rs:136:56 | LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:137:1 + --> $DIR/ub-wide-ptr.rs:139:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -276,7 +266,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::trans } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:142:1 + --> $DIR/ub-wide-ptr.rs:144:1 | LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..: encountered 0x03, but expected a boolean @@ -286,17 +276,27 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, ╾allocN─╼ ╾allocN─╼ │ ╾──╼╾──╼ } -error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:147:62 +error[E0080]: it is undefined behavior to use this value + --> $DIR/ub-wide-ptr.rs:149:1 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 8, align: 4) { + ╾allocN─╼ 00 00 00 00 │ ╾──╼.... + } -error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:150:65 +error[E0080]: it is undefined behavior to use this value + --> $DIR/ub-wide-ptr.rs:151:1 | LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 8, align: 4) { + ╾allocN─╼ ╾allocN─╼ │ ╾──╼╾──╼ + } error[E0080]: could not evaluate static initializer --> $DIR/ub-wide-ptr.rs:157:5 @@ -341,7 +341,7 @@ LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:75:1 + --> $DIR/ub-wide-ptr.rs:76:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -354,7 +354,7 @@ LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:82:1 + --> $DIR/ub-wide-ptr.rs:83:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -367,7 +367,7 @@ LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3) Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:87:40 + --> $DIR/ub-wide-ptr.rs:88:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -378,7 +378,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:95:42 + --> $DIR/ub-wide-ptr.rs:96:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -389,7 +389,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:100:42 + --> $DIR/ub-wide-ptr.rs:101:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr index d6c612bb4..1d84b7bce 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr @@ -76,19 +76,14 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni ╾───────allocN───────╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........ } -error[E0080]: it is undefined behavior to use this value +error[E0080]: evaluation of constant value failed --> $DIR/ub-wide-ptr.rs:63:1 | LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized reference - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 16, align: 8) { - __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:69:1 + --> $DIR/ub-wide-ptr.rs:70:1 | LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) @@ -99,7 +94,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:72:1 + --> $DIR/ub-wide-ptr.rs:73:1 | LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object @@ -110,7 +105,7 @@ LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, is } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:75:1 + --> $DIR/ub-wide-ptr.rs:76:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -121,7 +116,7 @@ LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:79:1 + --> $DIR/ub-wide-ptr.rs:80:1 | LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation) @@ -132,7 +127,7 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:82:1 + --> $DIR/ub-wide-ptr.rs:83:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -143,7 +138,7 @@ LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3) = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:87:1 + --> $DIR/ub-wide-ptr.rs:88:1 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .[0]: encountered 0x03, but expected a boolean @@ -154,7 +149,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:87:40 + --> $DIR/ub-wide-ptr.rs:88:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -163,7 +158,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; = note: for more information, see issue #71800 error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:95:1 + --> $DIR/ub-wide-ptr.rs:96:1 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered 0x03, but expected a boolean @@ -174,7 +169,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:95:42 + --> $DIR/ub-wide-ptr.rs:96:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -183,7 +178,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 = note: for more information, see issue #71800 error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:100:1 + --> $DIR/ub-wide-ptr.rs:101:1 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..1[0]: encountered 0x03, but expected a boolean @@ -194,7 +189,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran } error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:100:42 + --> $DIR/ub-wide-ptr.rs:101:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -202,19 +197,14 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran = 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 #71800 -error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:109:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:110:1 | LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 16, align: 8) { - __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:117:1 + --> $DIR/ub-wide-ptr.rs:119:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -225,7 +215,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:121:1 + --> $DIR/ub-wide-ptr.rs:123:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -236,7 +226,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:125:1 + --> $DIR/ub-wide-ptr.rs:127:1 | LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer @@ -247,25 +237,25 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:128:57 + --> $DIR/ub-wide-ptr.rs:130:57 | LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:131:57 + --> $DIR/ub-wide-ptr.rs:133:57 | LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:134:56 + --> $DIR/ub-wide-ptr.rs:136:56 | LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:137:1 + --> $DIR/ub-wide-ptr.rs:139:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -276,7 +266,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::trans } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:142:1 + --> $DIR/ub-wide-ptr.rs:144:1 | LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..: encountered 0x03, but expected a boolean @@ -286,17 +276,27 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, ╾──────allocN───────╼ ╾──────allocN───────╼ │ ╾──────╼╾──────╼ } -error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:147:62 +error[E0080]: it is undefined behavior to use this value + --> $DIR/ub-wide-ptr.rs:149:1 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 16, align: 8) { + ╾──────allocN───────╼ 00 00 00 00 00 00 00 00 │ ╾──────╼........ + } -error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:150:65 +error[E0080]: it is undefined behavior to use this value + --> $DIR/ub-wide-ptr.rs:151:1 | LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 16, align: 8) { + ╾──────allocN───────╼ ╾──────allocN───────╼ │ ╾──────╼╾──────╼ + } error[E0080]: could not evaluate static initializer --> $DIR/ub-wide-ptr.rs:157:5 @@ -341,7 +341,7 @@ LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:75:1 + --> $DIR/ub-wide-ptr.rs:76:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -354,7 +354,7 @@ LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:82:1 + --> $DIR/ub-wide-ptr.rs:83:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -367,7 +367,7 @@ LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3) Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:87:40 + --> $DIR/ub-wide-ptr.rs:88:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -378,7 +378,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:95:42 + --> $DIR/ub-wide-ptr.rs:96:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors @@ -389,7 +389,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:100:42 + --> $DIR/ub-wide-ptr.rs:101:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.rs b/src/test/ui/consts/const-eval/ub-wide-ptr.rs index a0377ab1e..788403a6d 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.rs +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.rs @@ -61,7 +61,8 @@ const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:: const SLICE_VALID: &[u8] = unsafe { mem::transmute((&42u8, 1usize)) }; // bad slice: length uninit const SLICE_LENGTH_UNINIT: &[u8] = unsafe { -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed +//~| uninitialized let uninit_len = MaybeUninit:: { uninit: () }; mem::transmute((42, uninit_len)) }; @@ -107,7 +108,8 @@ const RAW_SLICE_VALID: *const [u8] = unsafe { mem::transmute((&42u8, 1usize)) }; const RAW_SLICE_TOO_LONG: *const [u8] = unsafe { mem::transmute((&42u8, 999usize)) }; // ok because raw const RAW_SLICE_MUCH_TOO_LONG: *const [u8] = unsafe { mem::transmute((&42u8, usize::MAX)) }; // ok because raw const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed +//~| uninitialized let uninit_len = MaybeUninit:: { uninit: () }; mem::transmute((42, uninit_len)) }; @@ -145,11 +147,9 @@ const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool // # raw trait object const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; -//~^ ERROR evaluation of constant value failed -//~| null pointer +//~^ ERROR it is undefined behavior to use this value const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; -//~^ ERROR evaluation of constant value failed -//~| does not point to a vtable +//~^ ERROR it is undefined behavior to use this value const RAW_TRAIT_OBJ_CONTENT_INVALID: *const dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) } as *const dyn Trait; // ok because raw // Const eval fails for these, so they need to be statics to error. diff --git a/src/test/ui/consts/const-eval/union-const-eval-field.rs b/src/test/ui/consts/const-eval/union-const-eval-field.rs index a1e48cac4..d88bf2a84 100644 --- a/src/test/ui/consts/const-eval/union-const-eval-field.rs +++ b/src/test/ui/consts/const-eval/union-const-eval-field.rs @@ -26,7 +26,8 @@ const fn read_field2() -> Field2 { const fn read_field3() -> Field3 { const FIELD3: Field3 = unsafe { UNION.field3 }; - //~^ ERROR it is undefined behavior to use this value + //~^ ERROR evaluation of constant value failed + //~| uninitialized FIELD3 //~^ ERROR erroneous constant used [E0080] } diff --git a/src/test/ui/consts/const-eval/union-const-eval-field.stderr b/src/test/ui/consts/const-eval/union-const-eval-field.stderr index c512e6825..00964489e 100644 --- a/src/test/ui/consts/const-eval/union-const-eval-field.stderr +++ b/src/test/ui/consts/const-eval/union-const-eval-field.stderr @@ -1,16 +1,11 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/union-const-eval-field.rs:28:5 +error[E0080]: evaluation of constant value failed + --> $DIR/union-const-eval-field.rs:28:37 | LL | const FIELD3: Field3 = unsafe { UNION.field3 }; - | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes - | - = 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) { - __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: erroneous constant used - --> $DIR/union-const-eval-field.rs:30:5 + --> $DIR/union-const-eval-field.rs:31:5 | LL | FIELD3 | ^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/union-ice.rs b/src/test/ui/consts/const-eval/union-ice.rs index 4189619b2..dd970a355 100644 --- a/src/test/ui/consts/const-eval/union-ice.rs +++ b/src/test/ui/consts/const-eval/union-ice.rs @@ -11,11 +11,15 @@ union DummyUnion { const UNION: DummyUnion = DummyUnion { field1: 1065353216 }; -const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined behavior to use this value +const FIELD3: Field3 = unsafe { UNION.field3 }; +//~^ ERROR evaluation of constant value failed +//~| uninitialized -const FIELD_PATH: Struct = Struct { //~ ERROR it is undefined behavior to use this value +const FIELD_PATH: Struct = Struct { a: 42, b: unsafe { UNION.field3 }, + //~^ ERROR evaluation of constant value failed + //~| uninitialized }; struct Struct { @@ -23,10 +27,12 @@ struct Struct { b: Field3, } -const FIELD_PATH2: Struct2 = Struct2 { //~ ERROR it is undefined behavior to use this value +const FIELD_PATH2: Struct2 = Struct2 { b: [ 21, unsafe { UNION.field3 }, + //~^ ERROR evaluation of constant value failed + //~| uninitialized 23, 24, ], diff --git a/src/test/ui/consts/const-eval/union-ice.stderr b/src/test/ui/consts/const-eval/union-ice.stderr index 21a545509..bd39a0551 100644 --- a/src/test/ui/consts/const-eval/union-ice.stderr +++ b/src/test/ui/consts/const-eval/union-ice.stderr @@ -1,37 +1,20 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ice.rs:14:1 +error[E0080]: evaluation of constant value failed + --> $DIR/union-ice.rs:14:33 | LL | const FIELD3: Field3 = unsafe { UNION.field3 }; - | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected initialized bytes - | - = 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) { - __ __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } + | ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ice.rs:16:1 - | -LL | const FIELD_PATH: Struct = Struct { - | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .b: encountered uninitialized bytes, but expected initialized bytes +error[E0080]: evaluation of constant value failed + --> $DIR/union-ice.rs:20:17 | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 16, align: 8) { - __ __ __ __ __ __ __ __ 2a __ __ __ __ __ __ __ │ â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘*â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } +LL | b: unsafe { UNION.field3 }, + | ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ice.rs:26:1 - | -LL | const FIELD_PATH2: Struct2 = Struct2 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .b[1]: encountered uninitialized bytes +error[E0080]: evaluation of constant value failed + --> $DIR/union-ice.rs:33:18 | - = 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: 40, align: 8) { - 0x00 │ 15 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........â–‘â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - 0x10 │ 17 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 │ ................ - 0x20 │ 2a __ __ __ __ __ __ __ │ *â–‘â–‘â–‘â–‘â–‘â–‘â–‘ - } +LL | unsafe { UNION.field3 }, + | ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const-eval/union-ub.32bit.stderr b/src/test/ui/consts/const-eval/union-ub.32bit.stderr index baf682596..38ded4d65 100644 --- a/src/test/ui/consts/const-eval/union-ub.32bit.stderr +++ b/src/test/ui/consts/const-eval/union-ub.32bit.stderr @@ -9,16 +9,11 @@ LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; 2a │ * } -error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub.rs:35:1 +error[E0080]: evaluation of constant value failed + --> $DIR/union-ub.rs:35:36 | LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool}; - | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a boolean - | - = 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: 1, align: 1) { - __ │ â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-eval/union-ub.64bit.stderr b/src/test/ui/consts/const-eval/union-ub.64bit.stderr index baf682596..38ded4d65 100644 --- a/src/test/ui/consts/const-eval/union-ub.64bit.stderr +++ b/src/test/ui/consts/const-eval/union-ub.64bit.stderr @@ -9,16 +9,11 @@ LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; 2a │ * } -error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub.rs:35:1 +error[E0080]: evaluation of constant value failed + --> $DIR/union-ub.rs:35:36 | LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool}; - | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a boolean - | - = 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: 1, align: 1) { - __ │ â–‘ - } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-eval/union-ub.rs b/src/test/ui/consts/const-eval/union-ub.rs index c1bfe69a7..bb29edcf8 100644 --- a/src/test/ui/consts/const-eval/union-ub.rs +++ b/src/test/ui/consts/const-eval/union-ub.rs @@ -33,7 +33,8 @@ union Bar { const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; //~^ ERROR it is undefined behavior to use this value const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool}; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR evaluation of constant value failed +//~| uninitialized // The value is not valid for any union variant, but that's fine // unions are just a convenient way to transmute bits around diff --git a/src/test/ui/consts/const-float-bits-reject-conv.stderr b/src/test/ui/consts/const-float-bits-reject-conv.stderr index d6e993a10..01f2f4895 100644 --- a/src/test/ui/consts/const-float-bits-reject-conv.stderr +++ b/src/test/ui/consts/const-float-bits-reject-conv.stderr @@ -10,16 +10,6 @@ LL | panic!("const-eval error: cannot use f32::to_bits on a LL | unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) } | -------------------------------------------------------------------- inside `core::f32::::to_bits` at $SRC_DIR/core/src/num/f32.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output; - | ------------------------------------------------------------------ inside ` u32 {core::f32::::to_bits::ct_f32_to_u32} as FnOnce<(f32,)>>::call_once - shim(fn(f32) -> u32 {core::f32::::to_bits::ct_f32_to_u32})` at $SRC_DIR/core/src/ops/function.rs:LL:COL - | - ::: $SRC_DIR/core/src/intrinsics.rs:LL:COL - | -LL | called_in_const.call_once(arg) - | ------------------------------ inside `const_eval_select::<(f32,), fn(f32) -> u32 {core::f32::::to_bits::ct_f32_to_u32}, [closure@core::f32::::to_bits::{closure#0}], u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL - | ::: $DIR/const-float-bits-reject-conv.rs:27:30 | LL | const MASKED_NAN1: u32 = f32::NAN.to_bits() ^ 0x002A_AAAA; @@ -39,16 +29,6 @@ LL | panic!("const-eval error: cannot use f32::to_bits on a LL | unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) } | -------------------------------------------------------------------- inside `core::f32::::to_bits` at $SRC_DIR/core/src/num/f32.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output; - | ------------------------------------------------------------------ inside ` u32 {core::f32::::to_bits::ct_f32_to_u32} as FnOnce<(f32,)>>::call_once - shim(fn(f32) -> u32 {core::f32::::to_bits::ct_f32_to_u32})` at $SRC_DIR/core/src/ops/function.rs:LL:COL - | - ::: $SRC_DIR/core/src/intrinsics.rs:LL:COL - | -LL | called_in_const.call_once(arg) - | ------------------------------ inside `const_eval_select::<(f32,), fn(f32) -> u32 {core::f32::::to_bits::ct_f32_to_u32}, [closure@core::f32::::to_bits::{closure#0}], u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL - | ::: $DIR/const-float-bits-reject-conv.rs:28:30 | LL | const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555; @@ -117,16 +97,6 @@ LL | panic!("const-eval error: cannot use f64::to_bits on a LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) } | -------------------------------------------------------------------- inside `core::f64::::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output; - | ------------------------------------------------------------------ inside ` u64 {core::f64::::to_bits::ct_f64_to_u64} as FnOnce<(f64,)>>::call_once - shim(fn(f64) -> u64 {core::f64::::to_bits::ct_f64_to_u64})` at $SRC_DIR/core/src/ops/function.rs:LL:COL - | - ::: $SRC_DIR/core/src/intrinsics.rs:LL:COL - | -LL | called_in_const.call_once(arg) - | ------------------------------ inside `const_eval_select::<(f64,), fn(f64) -> u64 {core::f64::::to_bits::ct_f64_to_u64}, [closure@core::f64::::to_bits::{closure#0}], u64>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL - | ::: $DIR/const-float-bits-reject-conv.rs:54:30 | LL | const MASKED_NAN1: u64 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA; @@ -146,16 +116,6 @@ LL | panic!("const-eval error: cannot use f64::to_bits on a LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) } | -------------------------------------------------------------------- inside `core::f64::::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output; - | ------------------------------------------------------------------ inside ` u64 {core::f64::::to_bits::ct_f64_to_u64} as FnOnce<(f64,)>>::call_once - shim(fn(f64) -> u64 {core::f64::::to_bits::ct_f64_to_u64})` at $SRC_DIR/core/src/ops/function.rs:LL:COL - | - ::: $SRC_DIR/core/src/intrinsics.rs:LL:COL - | -LL | called_in_const.call_once(arg) - | ------------------------------ inside `const_eval_select::<(f64,), fn(f64) -> u64 {core::f64::::to_bits::ct_f64_to_u64}, [closure@core::f64::::to_bits::{closure#0}], u64>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL - | ::: $DIR/const-float-bits-reject-conv.rs:55:30 | LL | const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555; diff --git a/src/test/ui/consts/const-points-to-static.32bit.stderr b/src/test/ui/consts/const-points-to-static.32bit.stderr index 97825dd0e..c7a435a1e 100644 --- a/src/test/ui/consts/const-points-to-static.32bit.stderr +++ b/src/test/ui/consts/const-points-to-static.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const-points-to-static.rs:6:1 | LL | const TEST: &u8 = &MY_STATIC; - | ^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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/src/test/ui/consts/const-points-to-static.64bit.stderr b/src/test/ui/consts/const-points-to-static.64bit.stderr index 0d4a5a8ce..4d5b8eac5 100644 --- a/src/test/ui/consts/const-points-to-static.64bit.stderr +++ b/src/test/ui/consts/const-points-to-static.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const-points-to-static.rs:6:1 | LL | const TEST: &u8 = &MY_STATIC; - | ^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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/src/test/ui/consts/const_in_pattern/incomplete-slice.rs b/src/test/ui/consts/const_in_pattern/incomplete-slice.rs new file mode 100644 index 000000000..e1ccda71d --- /dev/null +++ b/src/test/ui/consts/const_in_pattern/incomplete-slice.rs @@ -0,0 +1,15 @@ +#[derive(PartialEq)] +enum E { + A, +} + +const E_SL: &[E] = &[E::A]; + +fn main() { + match &[][..] { + //~^ ERROR non-exhaustive patterns: `&_` not covered [E0004] + E_SL => {} + //~^ WARN to use a constant of type `E` in a pattern, `E` must be annotated with `#[derive(PartialEq, Eq)]` + //~| WARN this was previously accepted by the compiler but is being phased out + } +} diff --git a/src/test/ui/consts/const_in_pattern/incomplete-slice.stderr b/src/test/ui/consts/const_in_pattern/incomplete-slice.stderr new file mode 100644 index 000000000..0ff708371 --- /dev/null +++ b/src/test/ui/consts/const_in_pattern/incomplete-slice.stderr @@ -0,0 +1,26 @@ +warning: to use a constant of type `E` in a pattern, `E` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/incomplete-slice.rs:11:9 + | +LL | E_SL => {} + | ^^^^ + | + = note: `#[warn(indirect_structural_match)]` on by 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 #62411 + +error[E0004]: non-exhaustive patterns: `&_` not covered + --> $DIR/incomplete-slice.rs:9:11 + | +LL | match &[][..] { + | ^^^^^^^ pattern `&_` not covered + | + = note: the matched value is of type `&[E]` +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown + | +LL ~ E_SL => {} +LL + &_ => todo!() + | + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs b/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs new file mode 100644 index 000000000..86fbadb94 --- /dev/null +++ b/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs @@ -0,0 +1,45 @@ +// revisions: no_flag with_flag +// [no_flag] check-pass +// [with_flag] compile-flags: -Zextra-const-ub-checks +#![feature(const_ptr_read)] + +use std::mem::transmute; + +const INVALID_BOOL: () = unsafe { + let _x: bool = transmute(3u8); + //[with_flag]~^ ERROR: evaluation of constant value failed + //[with_flag]~| invalid value +}; + +const INVALID_PTR_IN_INT: () = unsafe { + let _x: usize = transmute(&3u8); + //[with_flag]~^ ERROR: any use of this value will cause an error + //[with_flag]~| previously accepted +}; + +const INVALID_SLICE_TO_USIZE_TRANSMUTE: () = unsafe { + let x: &[u8] = &[0; 32]; + let _x: (usize, usize) = transmute(x); + //[with_flag]~^ ERROR: any use of this value will cause an error + //[with_flag]~| previously accepted +}; + +const UNALIGNED_PTR: () = unsafe { + let _x: &u32 = transmute(&[0u8; 4]); + //[with_flag]~^ ERROR: evaluation of constant value failed + //[with_flag]~| invalid value +}; + +const UNALIGNED_READ: () = { + INNER; //[with_flag]~ERROR any use of this value will cause an error + //[with_flag]~| previously accepted + // There is an error here but its span is in the standard library so we cannot match it... + // so we have this in a *nested* const, such that the *outer* const fails to use it. + const INNER: () = unsafe { + let x = &[0u8; 4]; + let ptr = x.as_ptr().cast::(); + ptr.read(); + }; +}; + +fn main() {} diff --git a/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr b/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr new file mode 100644 index 000000000..793725d3b --- /dev/null +++ b/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr @@ -0,0 +1,117 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/detect-extra-ub.rs:9:20 + | +LL | let _x: bool = transmute(3u8); + | ^^^^^^^^^^^^^^ constructing invalid value: encountered 0x03, but expected a boolean + +error: any use of this value will cause an error + --> $DIR/detect-extra-ub.rs:15:21 + | +LL | const INVALID_PTR_IN_INT: () = unsafe { + | ---------------------------- +LL | let _x: usize = transmute(&3u8); + | ^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | + = note: `#[deny(const_err)]` on by 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 #71800 + = help: this code performed an operation that depends on the underlying bytes representing a pointer + = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported + +error: any use of this value will cause an error + --> $DIR/detect-extra-ub.rs:22:30 + | +LL | const INVALID_SLICE_TO_USIZE_TRANSMUTE: () = unsafe { + | ------------------------------------------ +LL | let x: &[u8] = &[0; 32]; +LL | let _x: (usize, usize) = transmute(x); + | ^^^^^^^^^^^^ unable to turn pointer into raw bytes + | + = 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 #71800 + = help: this code performed an operation that depends on the underlying bytes representing a pointer + = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported + +error[E0080]: evaluation of constant value failed + --> $DIR/detect-extra-ub.rs:28:20 + | +LL | let _x: &u32 = transmute(&[0u8; 4]); + | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 4 byte alignment but found 1) + +error[E0080]: evaluation of constant value failed + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | +LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | accessing memory with alignment 1, but alignment 4 is required + | inside `std::ptr::read::` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | + ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + | +LL | unsafe { read(self) } + | ---------- inside `ptr::const_ptr::::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + | + ::: $DIR/detect-extra-ub.rs:41:9 + | +LL | ptr.read(); + | ---------- inside `INNER` at $DIR/detect-extra-ub.rs:41:9 + +error: any use of this value will cause an error + --> $DIR/detect-extra-ub.rs:34:5 + | +LL | const UNALIGNED_READ: () = { + | ------------------------ +LL | INNER; + | ^^^^^ referenced constant has errors + | + = 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 #71800 + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0080`. +Future incompatibility report: Future breakage diagnostic: +error: any use of this value will cause an error + --> $DIR/detect-extra-ub.rs:15:21 + | +LL | const INVALID_PTR_IN_INT: () = unsafe { + | ---------------------------- +LL | let _x: usize = transmute(&3u8); + | ^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | + = note: `#[deny(const_err)]` on by 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 #71800 + = help: this code performed an operation that depends on the underlying bytes representing a pointer + = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported + +Future breakage diagnostic: +error: any use of this value will cause an error + --> $DIR/detect-extra-ub.rs:22:30 + | +LL | const INVALID_SLICE_TO_USIZE_TRANSMUTE: () = unsafe { + | ------------------------------------------ +LL | let x: &[u8] = &[0; 32]; +LL | let _x: (usize, usize) = transmute(x); + | ^^^^^^^^^^^^ unable to turn pointer into raw bytes + | + = note: `#[deny(const_err)]` on by 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 #71800 + = help: this code performed an operation that depends on the underlying bytes representing a pointer + = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported + +Future breakage diagnostic: +error: any use of this value will cause an error + --> $DIR/detect-extra-ub.rs:34:5 + | +LL | const UNALIGNED_READ: () = { + | ------------------------ +LL | INNER; + | ^^^^^ referenced constant has errors + | + = note: `#[deny(const_err)]` on by 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 #71800 + diff --git a/src/test/ui/consts/extra-const-ub/issue-100771.rs b/src/test/ui/consts/extra-const-ub/issue-100771.rs new file mode 100644 index 000000000..a32960328 --- /dev/null +++ b/src/test/ui/consts/extra-const-ub/issue-100771.rs @@ -0,0 +1,20 @@ +// check-pass +// compile-flags: -Zextra-const-ub-checks + +#[derive(PartialEq, Eq, Copy, Clone)] +#[repr(packed)] +struct Foo { + field: (i64, u32, u32, u32), +} + +const FOO: Foo = Foo { + field: (5, 6, 7, 8), +}; + +fn main() { + match FOO { + Foo { field: (5, 6, 7, 8) } => {}, + FOO => unreachable!(), + _ => unreachable!(), + } +} diff --git a/src/test/ui/consts/extra-const-ub/issue-101034.rs b/src/test/ui/consts/extra-const-ub/issue-101034.rs new file mode 100644 index 000000000..e0de705c4 --- /dev/null +++ b/src/test/ui/consts/extra-const-ub/issue-101034.rs @@ -0,0 +1,17 @@ +// check-pass +// compile-flags: -Zextra-const-ub-checks + +#[repr(packed)] +pub struct Foo { + bar: u8, + baa: [u32; 1], +} + +const FOOMP: Foo = Foo { + bar: 0, + baa: [69; 1], +}; + +fn main() { + let _val = FOOMP; +} diff --git a/src/test/ui/consts/issue-32829-2.stderr b/src/test/ui/consts/issue-32829-2.stderr index b94bdc0e3..0fec35818 100644 --- a/src/test/ui/consts/issue-32829-2.stderr +++ b/src/test/ui/consts/issue-32829-2.stderr @@ -13,6 +13,7 @@ LL | invalid(); | ^^^^^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error[E0015]: cannot call non-const fn `invalid` in statics --> $DIR/issue-32829-2.rs:54:9 @@ -21,6 +22,7 @@ LL | invalid(); | ^^^^^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/issue-36163.stderr b/src/test/ui/consts/issue-36163.stderr index 4797d10b7..9ac6c984c 100644 --- a/src/test/ui/consts/issue-36163.stderr +++ b/src/test/ui/consts/issue-36163.stderr @@ -8,7 +8,7 @@ note: ...which requires const-evaluating + checking `A`... --> $DIR/issue-36163.rs:1:1 | LL | const A: isize = Foo::B as isize; - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires const-evaluating + checking `Foo::B::{constant#0}`, completing the cycle note: cycle used when simplifying constant for the type system `Foo::B::{constant#0}` --> $DIR/issue-36163.rs:4:9 diff --git a/src/test/ui/consts/issue-miri-1910.rs b/src/test/ui/consts/issue-miri-1910.rs index 2b23626e3..29e0ea950 100644 --- a/src/test/ui/consts/issue-miri-1910.rs +++ b/src/test/ui/consts/issue-miri-1910.rs @@ -1,4 +1,5 @@ // error-pattern unable to turn pointer into raw bytes +// normalize-stderr-test: "alloc[0-9]+\+0x[a-z0-9]+" -> "ALLOC" #![feature(const_ptr_read)] const C: () = unsafe { diff --git a/src/test/ui/consts/issue-miri-1910.stderr b/src/test/ui/consts/issue-miri-1910.stderr index d953c7819..0f0539e09 100644 --- a/src/test/ui/consts/issue-miri-1910.stderr +++ b/src/test/ui/consts/issue-miri-1910.stderr @@ -4,12 +4,12 @@ error: any use of this value will cause an error LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | unable to turn pointer into raw bytes + | unable to copy parts of a pointer from memory at ALLOC | inside `std::ptr::read::` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | inside `ptr::const_ptr::::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `C` at $DIR/issue-miri-1910.rs:7:5 + | inside `C` at $DIR/issue-miri-1910.rs:8:5 | - ::: $DIR/issue-miri-1910.rs:4:1 + ::: $DIR/issue-miri-1910.rs:5:1 | LL | const C: () = unsafe { | ----------- @@ -29,12 +29,12 @@ error: any use of this value will cause an error LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | unable to turn pointer into raw bytes + | unable to copy parts of a pointer from memory at ALLOC | inside `std::ptr::read::` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | inside `ptr::const_ptr::::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `C` at $DIR/issue-miri-1910.rs:7:5 + | inside `C` at $DIR/issue-miri-1910.rs:8:5 | - ::: $DIR/issue-miri-1910.rs:4:1 + ::: $DIR/issue-miri-1910.rs:5:1 | LL | const C: () = unsafe { | ----------- diff --git a/src/test/ui/consts/mir_check_nonconst.stderr b/src/test/ui/consts/mir_check_nonconst.stderr index 2bac995ee..1e0652722 100644 --- a/src/test/ui/consts/mir_check_nonconst.stderr +++ b/src/test/ui/consts/mir_check_nonconst.stderr @@ -5,6 +5,7 @@ LL | static foo: Foo = bar(); | ^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error: aborting due to previous error diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr index b3ad81e49..14173ac9f 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static2.rs:11:1 | LL | const REF_INTERIOR_MUT: &usize = { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static2.rs:18:1 | LL | const READ_IMMUT: &usize = { - | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr index 24bd07092..e7e51a418 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static2.rs:11:1 | LL | const REF_INTERIOR_MUT: &usize = { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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) { @@ -13,7 +13,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static2.rs:18:1 | LL | const READ_IMMUT: &usize = { - | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr index 20a96b57f..3a22b0689 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:12:1 | LL | const SLICE_MUT: &[u8; 1] = { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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) { @@ -19,7 +19,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:17:1 | LL | const U8_MUT: &u8 = { - | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr index dfa0f76ba..39c874d64 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:12:1 | LL | const SLICE_MUT: &[u8; 1] = { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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) { @@ -19,7 +19,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:17:1 | LL | const U8_MUT: &u8 = { - | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable + | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant | = 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/src/test/ui/consts/miri_unleashed/ptr_arith.rs b/src/test/ui/consts/miri_unleashed/ptr_arith.rs index 13e6af36e..6a19b2945 100644 --- a/src/test/ui/consts/miri_unleashed/ptr_arith.rs +++ b/src/test/ui/consts/miri_unleashed/ptr_arith.rs @@ -8,7 +8,7 @@ static PTR_INT_CAST: () = { let x = &0 as *const _ as usize; //~^ ERROR could not evaluate static initializer - //~| "exposing pointers" needs an rfc before being allowed inside constants + //~| exposing pointers let _v = x == x; }; @@ -19,4 +19,7 @@ static PTR_INT_TRANSMUTE: () = unsafe { //~| unable to turn pointer into raw bytes }; +// I'd love to test pointer comparison, but that is not possible since +// their `PartialEq` impl is non-`const`. + fn main() {} diff --git a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr b/src/test/ui/consts/miri_unleashed/ptr_arith.stderr index f67ac4802..e0c4fa175 100644 --- a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr +++ b/src/test/ui/consts/miri_unleashed/ptr_arith.stderr @@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer --> $DIR/ptr_arith.rs:9:13 | LL | let x = &0 as *const _ as usize; - | ^^^^^^^^^^^^^^^^^^^^^^^ "exposing pointers" needs an rfc before being allowed inside constants + | ^^^^^^^^^^^^^^^^^^^^^^^ exposing pointers is not possible at compile-time error[E0080]: could not evaluate static initializer --> $DIR/ptr_arith.rs:17:14 diff --git a/src/test/ui/consts/miri_unleashed/slice_eq.rs b/src/test/ui/consts/miri_unleashed/slice_eq.rs index fd843105d..83e10bf12 100644 --- a/src/test/ui/consts/miri_unleashed/slice_eq.rs +++ b/src/test/ui/consts/miri_unleashed/slice_eq.rs @@ -4,14 +4,10 @@ #![feature(const_raw_ptr_comparison)] const EMPTY_SLICE: &[i32] = &[]; -const EMPTY_EQ: bool = EMPTY_SLICE.as_ptr().guaranteed_eq(&[] as *const _); -const EMPTY_EQ2: bool = EMPTY_SLICE.as_ptr().guaranteed_ne(&[] as *const _); -const EMPTY_NE: bool = EMPTY_SLICE.as_ptr().guaranteed_ne(&[1] as *const _); -const EMPTY_NE2: bool = EMPTY_SLICE.as_ptr().guaranteed_eq(&[1] as *const _); +const EMPTY_EQ: Option = EMPTY_SLICE.as_ptr().guaranteed_eq(&[] as *const _); +const EMPTY_EQ2: Option = EMPTY_SLICE.as_ptr().guaranteed_eq(&[1] as *const _); fn main() { - assert!(!EMPTY_EQ); - assert!(!EMPTY_EQ2); - assert!(!EMPTY_NE); - assert!(!EMPTY_NE2); + assert!(EMPTY_EQ.is_none()); + assert!(EMPTY_EQ2.is_none()); } diff --git a/src/test/ui/consts/offset.rs b/src/test/ui/consts/offset.rs index f9ddda554..b2c663fe6 100644 --- a/src/test/ui/consts/offset.rs +++ b/src/test/ui/consts/offset.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(const_ptr_offset_from)] use std::ptr; #[repr(C)] diff --git a/src/test/ui/consts/offset_from.rs b/src/test/ui/consts/offset_from.rs index b53718316..465147041 100644 --- a/src/test/ui/consts/offset_from.rs +++ b/src/test/ui/consts/offset_from.rs @@ -1,6 +1,5 @@ // run-pass -#![feature(const_ptr_offset_from)] #![feature(const_ptr_sub_ptr)] #![feature(ptr_sub_ptr)] diff --git a/src/test/ui/consts/offset_from_ub.rs b/src/test/ui/consts/offset_from_ub.rs index 1f29a6905..51163e650 100644 --- a/src/test/ui/consts/offset_from_ub.rs +++ b/src/test/ui/consts/offset_from_ub.rs @@ -1,4 +1,4 @@ -#![feature(const_ptr_offset_from)] +#![feature(const_ptr_sub_ptr)] #![feature(core_intrinsics)] use std::intrinsics::{ptr_offset_from, ptr_offset_from_unsigned}; diff --git a/src/test/ui/consts/ptr_comparisons.rs b/src/test/ui/consts/ptr_comparisons.rs index 20233db09..0a3c2d4be 100644 --- a/src/test/ui/consts/ptr_comparisons.rs +++ b/src/test/ui/consts/ptr_comparisons.rs @@ -14,38 +14,30 @@ const FOO: &usize = &42; macro_rules! check { (eq, $a:expr, $b:expr) => { pub const _: () = - assert!(std::intrinsics::ptr_guaranteed_eq($a as *const u8, $b as *const u8)); + assert!(std::intrinsics::ptr_guaranteed_cmp($a as *const u8, $b as *const u8) == 1); }; (ne, $a:expr, $b:expr) => { pub const _: () = - assert!(std::intrinsics::ptr_guaranteed_ne($a as *const u8, $b as *const u8)); + assert!(std::intrinsics::ptr_guaranteed_cmp($a as *const u8, $b as *const u8) == 0); }; - (!eq, $a:expr, $b:expr) => { + (!, $a:expr, $b:expr) => { pub const _: () = - assert!(!std::intrinsics::ptr_guaranteed_eq($a as *const u8, $b as *const u8)); - }; - (!ne, $a:expr, $b:expr) => { - pub const _: () = - assert!(!std::intrinsics::ptr_guaranteed_ne($a as *const u8, $b as *const u8)); + assert!(std::intrinsics::ptr_guaranteed_cmp($a as *const u8, $b as *const u8) == 2); }; } check!(eq, 0, 0); check!(ne, 0, 1); -check!(!eq, 0, 1); -check!(!ne, 0, 0); check!(ne, FOO as *const _, 0); -check!(!eq, FOO as *const _, 0); +check!(ne, unsafe { (FOO as *const usize).offset(1) }, 0); +check!(ne, unsafe { (FOO as *const usize as *const u8).offset(3) }, 0); + // We want pointers to be equal to themselves, but aren't checking this yet because // there are some open questions (e.g. whether function pointers to the same function // compare equal, they don't necessarily at runtime). // The case tested here should work eventually, but does not work yet. -check!(!eq, FOO as *const _, FOO as *const _); -check!(ne, unsafe { (FOO as *const usize).offset(1) }, 0); -check!(!eq, unsafe { (FOO as *const usize).offset(1) }, 0); +check!(!, FOO as *const _, FOO as *const _); -check!(ne, unsafe { (FOO as *const usize as *const u8).offset(3) }, 0); -check!(!eq, unsafe { (FOO as *const usize as *const u8).offset(3) }, 0); /////////////////////////////////////////////////////////////////////////////// // If any of the below start compiling, make sure to add a `check` test for it. diff --git a/src/test/ui/consts/ptr_comparisons.stderr b/src/test/ui/consts/ptr_comparisons.stderr index 1d47f243f..3de2aba5b 100644 --- a/src/test/ui/consts/ptr_comparisons.stderr +++ b/src/test/ui/consts/ptr_comparisons.stderr @@ -7,19 +7,19 @@ LL | unsafe { intrinsics::offset(self, count) } | out-of-bounds pointer arithmetic: alloc3 has size $WORD, so pointer to $TWO_WORDS bytes starting at offset 0 is out-of-bounds | inside `ptr::const_ptr::::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - ::: $DIR/ptr_comparisons.rs:58:34 + ::: $DIR/ptr_comparisons.rs:50:34 | LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) }; - | ------------------------------- inside `_` at $DIR/ptr_comparisons.rs:58:34 + | ------------------------------- inside `_` at $DIR/ptr_comparisons.rs:50:34 error[E0080]: evaluation of constant value failed - --> $DIR/ptr_comparisons.rs:61:33 + --> $DIR/ptr_comparisons.rs:53:33 | LL | unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: alloc3 has size $WORD, so pointer to 1000 bytes starting at offset 0 is out-of-bounds error: any use of this value will cause an error - --> $DIR/ptr_comparisons.rs:65:27 + --> $DIR/ptr_comparisons.rs:57:27 | LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 }; | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -31,7 +31,7 @@ LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: any use of this value will cause an error - --> $DIR/ptr_comparisons.rs:70:27 + --> $DIR/ptr_comparisons.rs:62:27 | LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 }; | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -46,7 +46,7 @@ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0080`. Future incompatibility report: Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ptr_comparisons.rs:65:27 + --> $DIR/ptr_comparisons.rs:57:27 | LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 }; | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -59,7 +59,7 @@ LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + Future breakage diagnostic: error: any use of this value will cause an error - --> $DIR/ptr_comparisons.rs:70:27 + --> $DIR/ptr_comparisons.rs:62:27 | LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 }; | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes diff --git a/src/test/ui/consts/unnormalized-param-env.rs b/src/test/ui/consts/unnormalized-param-env.rs new file mode 100644 index 000000000..a7bbe4db9 --- /dev/null +++ b/src/test/ui/consts/unnormalized-param-env.rs @@ -0,0 +1,31 @@ +// check-pass + +pub trait CSpace { + type Traj; +} + +pub struct Const; + +pub trait Obstacle { + fn trajectory_free(&self, t: &FT) + where + CS::Traj: Sized, + CS: CSpace; +} + +// ----- + +const N: usize = 4; + +struct ObstacleSpace2df32; + +impl Obstacle for ObstacleSpace2df32 { + fn trajectory_free(&self, t: &TF) + where + CS::Traj: Sized, + CS: CSpace, + { + } +} + +fn main() {} diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs index b2edc1a1f..6175b7df1 100644 --- a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs +++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs @@ -3,7 +3,6 @@ trait Foo> { //~^ ERROR cycle detected - //~| ERROR cycle detected } fn main() { } diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr index d4976a0f9..9d715f494 100644 --- a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr +++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr @@ -10,30 +10,11 @@ note: cycle used when collecting item types in top-level module | LL | / trait Foo> { LL | | -LL | | -LL | | } -LL | | -LL | | fn main() { } - | |_____________^ - -error[E0391]: cycle detected when computing type of `Foo::X` - --> $DIR/cycle-trait-default-type-trait.rs:4:23 - | -LL | trait Foo> { - | ^^^ - | - = note: ...which immediately requires computing type of `Foo::X` again -note: cycle used when collecting item types in top-level module - --> $DIR/cycle-trait-default-type-trait.rs:4:1 - | -LL | / trait Foo> { -LL | | -LL | | LL | | } LL | | LL | | fn main() { } | |_____________^ -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs b/src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs index 043011b33..ff764015d 100644 --- a/src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs +++ b/src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs @@ -1,6 +1,7 @@ // build-pass +// only-linux // -// compile-flags: -g --emit=llvm-ir -Zunstable-options -Csplit-debuginfo=unpacked +// compile-flags: -g --emit=llvm-ir -Csplit-debuginfo=unpacked // // Make sure that we don't explode with an error if we don't actually end up emitting any `dwo`s, // as would be the case if we don't actually codegen anything. diff --git a/src/test/ui/deprecation/deprecation-sanity.stderr b/src/test/ui/deprecation/deprecation-sanity.stderr index 973c672df..8b2b480d1 100644 --- a/src/test/ui/deprecation/deprecation-sanity.stderr +++ b/src/test/ui/deprecation/deprecation-sanity.stderr @@ -44,7 +44,9 @@ error[E0565]: literal in `deprecated` value must be a string --> $DIR/deprecation-sanity.rs:19:25 | LL | #[deprecated(note = b"test")] - | ^^^^^^^ help: consider removing the prefix: `"test"` + | -^^^^^^ + | | + | help: consider removing the prefix error[E0565]: item in `deprecated` must be a key/value pair --> $DIR/deprecation-sanity.rs:22:18 diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs index d66faa086..67a27729d 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs @@ -7,7 +7,6 @@ struct Error; enum Enum { A { x: Error //~ ERROR -//~^ ERROR } } diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr index f655600b7..9953154fd 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr @@ -18,26 +18,6 @@ help: consider annotating `Error` with `#[derive(PartialEq)]` LL | #[derive(PartialEq)] | -error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 - | -LL | #[derive(PartialEq)] - | --------- in this derive macro expansion -... -LL | x: Error - | ^^^^^^^^ - | -note: an implementation of `PartialEq<_>` might be missing for `Error` - --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:4:1 - | -LL | struct Error; - | ^^^^^^^^^^^^ must implement `PartialEq<_>` - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `Error` with `#[derive(PartialEq)]` - | -LL | #[derive(PartialEq)] - | - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.rs b/src/test/ui/derives/derives-span-PartialEq-enum.rs index 66edf460b..0becc7e0d 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.rs +++ b/src/test/ui/derives/derives-span-PartialEq-enum.rs @@ -7,8 +7,7 @@ struct Error; enum Enum { A( Error //~ ERROR -//~^ ERROR - ) + ) } fn main() {} diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.stderr b/src/test/ui/derives/derives-span-PartialEq-enum.stderr index ce4b00bfb..7c1304523 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum.stderr @@ -18,26 +18,6 @@ help: consider annotating `Error` with `#[derive(PartialEq)]` LL | #[derive(PartialEq)] | -error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum.rs:9:6 - | -LL | #[derive(PartialEq)] - | --------- in this derive macro expansion -... -LL | Error - | ^^^^^ - | -note: an implementation of `PartialEq<_>` might be missing for `Error` - --> $DIR/derives-span-PartialEq-enum.rs:4:1 - | -LL | struct Error; - | ^^^^^^^^^^^^ must implement `PartialEq<_>` - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `Error` with `#[derive(PartialEq)]` - | -LL | #[derive(PartialEq)] - | - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.rs b/src/test/ui/derives/derives-span-PartialEq-struct.rs index ce5c67af7..c92ef5fad 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.rs +++ b/src/test/ui/derives/derives-span-PartialEq-struct.rs @@ -6,7 +6,6 @@ struct Error; #[derive(PartialEq)] struct Struct { x: Error //~ ERROR -//~^ ERROR } fn main() {} diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-struct.stderr index c5c8f255f..ba3d6ced3 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-struct.stderr @@ -18,26 +18,6 @@ help: consider annotating `Error` with `#[derive(PartialEq)]` LL | #[derive(PartialEq)] | -error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-struct.rs:8:5 - | -LL | #[derive(PartialEq)] - | --------- in this derive macro expansion -LL | struct Struct { -LL | x: Error - | ^^^^^^^^ - | -note: an implementation of `PartialEq<_>` might be missing for `Error` - --> $DIR/derives-span-PartialEq-struct.rs:4:1 - | -LL | struct Error; - | ^^^^^^^^^^^^ must implement `PartialEq<_>` - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `Error` with `#[derive(PartialEq)]` - | -LL | #[derive(PartialEq)] - | - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs index eaa628311..10ac347aa 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs @@ -6,7 +6,6 @@ struct Error; #[derive(PartialEq)] struct Struct( Error //~ ERROR -//~^ ERROR ); fn main() {} diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr index f5d609cb3..ab0b56a9e 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr @@ -18,26 +18,6 @@ help: consider annotating `Error` with `#[derive(PartialEq)]` LL | #[derive(PartialEq)] | -error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 - | -LL | #[derive(PartialEq)] - | --------- in this derive macro expansion -LL | struct Struct( -LL | Error - | ^^^^^ - | -note: an implementation of `PartialEq<_>` might be missing for `Error` - --> $DIR/derives-span-PartialEq-tuple-struct.rs:4:1 - | -LL | struct Error; - | ^^^^^^^^^^^^ must implement `PartialEq<_>` - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `Error` with `#[derive(PartialEq)]` - | -LL | #[derive(PartialEq)] - | - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/derives/deriving-copyclone.stderr b/src/test/ui/derives/deriving-copyclone.stderr index 13097edf0..80e2dd7fe 100644 --- a/src/test/ui/derives/deriving-copyclone.stderr +++ b/src/test/ui/derives/deriving-copyclone.stderr @@ -2,11 +2,11 @@ error[E0277]: the trait bound `B: Copy` is not satisfied --> $DIR/deriving-copyclone.rs:31:13 | LL | is_copy(B { a: 1, b: C }); - | ------- ^^^^^^^^^^^^^^^^ expected an implementor of trait `Copy` + | ------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `B` | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Copy` for `B` +note: required for `B` to implement `Copy` --> $DIR/deriving-copyclone.rs:9:10 | LL | #[derive(Copy, Clone)] @@ -26,11 +26,11 @@ error[E0277]: the trait bound `B: Clone` is not satisfied --> $DIR/deriving-copyclone.rs:32:14 | LL | is_clone(B { a: 1, b: C }); - | -------- ^^^^^^^^^^^^^^^^ expected an implementor of trait `Clone` + | -------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B` | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Clone` for `B` +note: required for `B` to implement `Clone` --> $DIR/deriving-copyclone.rs:9:16 | LL | #[derive(Copy, Clone)] @@ -50,11 +50,11 @@ error[E0277]: the trait bound `B: Copy` is not satisfied --> $DIR/deriving-copyclone.rs:35:13 | LL | is_copy(B { a: 1, b: D }); - | ------- ^^^^^^^^^^^^^^^^ expected an implementor of trait `Copy` + | ------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `B` | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Copy` for `B` +note: required for `B` to implement `Copy` --> $DIR/deriving-copyclone.rs:9:10 | LL | #[derive(Copy, Clone)] diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.rs b/src/test/ui/derives/deriving-no-inner-impl-error-message.rs index 39e41a59e..b3ce31bf0 100644 --- a/src/test/ui/derives/deriving-no-inner-impl-error-message.rs +++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.rs @@ -3,7 +3,6 @@ struct NoCloneOrEq; #[derive(PartialEq)] struct E { x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq` - //~^ ERROR binary operation `!=` cannot be applied to type `NoCloneOrEq` } #[derive(Clone)] struct C { diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr index 7875f0723..ef8c44caa 100644 --- a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr +++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr @@ -18,28 +18,8 @@ help: consider annotating `NoCloneOrEq` with `#[derive(PartialEq)]` LL | #[derive(PartialEq)] | -error[E0369]: binary operation `!=` cannot be applied to type `NoCloneOrEq` - --> $DIR/deriving-no-inner-impl-error-message.rs:5:5 - | -LL | #[derive(PartialEq)] - | --------- in this derive macro expansion -LL | struct E { -LL | x: NoCloneOrEq - | ^^^^^^^^^^^^^^ - | -note: an implementation of `PartialEq<_>` might be missing for `NoCloneOrEq` - --> $DIR/deriving-no-inner-impl-error-message.rs:1:1 - | -LL | struct NoCloneOrEq; - | ^^^^^^^^^^^^^^^^^^ must implement `PartialEq<_>` - = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `NoCloneOrEq` with `#[derive(PartialEq)]` - | -LL | #[derive(PartialEq)] - | - error[E0277]: the trait bound `NoCloneOrEq: Clone` is not satisfied - --> $DIR/deriving-no-inner-impl-error-message.rs:10:5 + --> $DIR/deriving-no-inner-impl-error-message.rs:9:5 | LL | #[derive(Clone)] | ----- in this derive macro expansion @@ -53,7 +33,7 @@ help: consider annotating `NoCloneOrEq` with `#[derive(Clone)]` LL | #[derive(Clone)] | -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0369. For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/deriving/deriving-all-codegen.rs b/src/test/ui/deriving/deriving-all-codegen.rs index aef79ae8a..ba7809413 100644 --- a/src/test/ui/deriving/deriving-all-codegen.rs +++ b/src/test/ui/deriving/deriving-all-codegen.rs @@ -85,7 +85,7 @@ enum Mixed { P, Q, R(u32), - S { d1: u32, d2: u32 }, + S { d1: Option, d2: Option }, } // An enum with no fieldless variants. Note that `Default` cannot be derived diff --git a/src/test/ui/deriving/deriving-all-codegen.stdout b/src/test/ui/deriving/deriving-all-codegen.stdout index 21fe663f0..56efc2a59 100644 --- a/src/test/ui/deriving/deriving-all-codegen.stdout +++ b/src/test/ui/deriving/deriving-all-codegen.stdout @@ -122,10 +122,6 @@ impl ::core::cmp::PartialEq for Point { fn eq(&self, other: &Point) -> bool { self.x == other.x && self.y == other.y } - #[inline] - fn ne(&self, other: &Point) -> bool { - self.x != other.x || self.y != other.y - } } impl ::core::marker::StructuralEq for Point {} #[automatically_derived] @@ -239,13 +235,6 @@ impl ::core::cmp::PartialEq for Big { self.b6 == other.b6 && self.b7 == other.b7 && self.b8 == other.b8 } - #[inline] - fn ne(&self, other: &Big) -> bool { - self.b1 != other.b1 || self.b2 != other.b2 || self.b3 != other.b3 || - self.b4 != other.b4 || self.b5 != other.b5 || - self.b6 != other.b6 || self.b7 != other.b7 || - self.b8 != other.b8 - } } impl ::core::marker::StructuralEq for Big {} #[automatically_derived] @@ -361,8 +350,6 @@ impl ::core::marker::StructuralPartialEq for Unsized {} impl ::core::cmp::PartialEq for Unsized { #[inline] fn eq(&self, other: &Unsized) -> bool { self.0 == other.0 } - #[inline] - fn ne(&self, other: &Unsized) -> bool { self.0 != other.0 } } impl ::core::marker::StructuralEq for Unsized {} #[automatically_derived] @@ -428,8 +415,6 @@ impl ::core::marker::StructuralPartialEq for PackedCopy {} impl ::core::cmp::PartialEq for PackedCopy { #[inline] fn eq(&self, other: &PackedCopy) -> bool { { self.0 } == { other.0 } } - #[inline] - fn ne(&self, other: &PackedCopy) -> bool { { self.0 } != { other.0 } } } impl ::core::marker::StructuralEq for PackedCopy {} #[automatically_derived] @@ -503,12 +488,6 @@ impl ::core::cmp::PartialEq for PackedNonCopy { let Self(ref __self_1_0) = *other; *__self_0_0 == *__self_1_0 } - #[inline] - fn ne(&self, other: &PackedNonCopy) -> bool { - let Self(ref __self_0_0) = *self; - let Self(ref __self_1_0) = *other; - *__self_0_0 != *__self_1_0 - } } impl ::core::marker::StructuralEq for PackedNonCopy {} #[automatically_derived] @@ -638,13 +617,6 @@ impl ::core::cmp::PartialEq for Enum1 { *__self_0 == *__arg1_0, } } - #[inline] - fn ne(&self, other: &Enum1) -> bool { - match (self, other) { - (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) => - *__self_0 != *__arg1_0, - } - } } impl ::core::marker::StructuralEq for Enum1 {} #[automatically_derived] @@ -817,8 +789,8 @@ enum Mixed { Q, R(u32), S { - d1: u32, - d2: u32, + d1: Option, + d2: Option, }, } #[automatically_derived] @@ -826,6 +798,8 @@ impl ::core::clone::Clone for Mixed { #[inline] fn clone(&self) -> Mixed { let _: ::core::clone::AssertParamIsClone; + let _: ::core::clone::AssertParamIsClone>; + let _: ::core::clone::AssertParamIsClone>; *self } } @@ -883,20 +857,6 @@ impl ::core::cmp::PartialEq for Mixed { _ => true, } } - #[inline] - fn ne(&self, other: &Mixed) -> bool { - let __self_tag = ::core::intrinsics::discriminant_value(self); - let __arg1_tag = ::core::intrinsics::discriminant_value(other); - __self_tag != __arg1_tag || - match (self, other) { - (Mixed::R(__self_0), Mixed::R(__arg1_0)) => - *__self_0 != *__arg1_0, - (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S { - d1: __arg1_0, d2: __arg1_1 }) => - *__self_0 != *__arg1_0 || *__self_1 != *__arg1_1, - _ => false, - } - } } impl ::core::marker::StructuralEq for Mixed {} #[automatically_derived] @@ -906,6 +866,8 @@ impl ::core::cmp::Eq for Mixed { #[no_coverage] fn assert_receiver_is_total_eq(&self) -> () { let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; } } #[automatically_derived] @@ -1023,21 +985,6 @@ impl ::core::cmp::PartialEq for Fielded { _ => unsafe { ::core::intrinsics::unreachable() } } } - #[inline] - fn ne(&self, other: &Fielded) -> bool { - let __self_tag = ::core::intrinsics::discriminant_value(self); - let __arg1_tag = ::core::intrinsics::discriminant_value(other); - __self_tag != __arg1_tag || - match (self, other) { - (Fielded::X(__self_0), Fielded::X(__arg1_0)) => - *__self_0 != *__arg1_0, - (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) => - *__self_0 != *__arg1_0, - (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) => - *__self_0 != *__arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } } impl ::core::marker::StructuralEq for Fielded {} #[automatically_derived] diff --git a/src/test/ui/deriving/issue-103157.rs b/src/test/ui/deriving/issue-103157.rs new file mode 100644 index 000000000..52b4c7898 --- /dev/null +++ b/src/test/ui/deriving/issue-103157.rs @@ -0,0 +1,12 @@ +// check-fail + +#[derive(PartialEq, Eq)] +pub enum Value { + Boolean(Option), + Float(Option), //~ ERROR the trait bound `f64: Eq` is not satisfied +} + +fn main() { + let a = Value::Float(Some(f64::NAN)); + assert!(a == a); +} diff --git a/src/test/ui/deriving/issue-103157.stderr b/src/test/ui/deriving/issue-103157.stderr new file mode 100644 index 000000000..ee3528fe1 --- /dev/null +++ b/src/test/ui/deriving/issue-103157.stderr @@ -0,0 +1,30 @@ +error[E0277]: the trait bound `f64: Eq` is not satisfied + --> $DIR/issue-103157.rs:6:11 + | +LL | #[derive(PartialEq, Eq)] + | -- in this derive macro expansion +... +LL | Float(Option), + | ^^^^^^^^^^^ the trait `Eq` is not implemented for `f64` + | + = help: the following other types implement trait `Eq`: + i128 + i16 + i32 + i64 + i8 + isize + u128 + u16 + and 4 others + = note: required for `Option` to implement `Eq` +note: required by a bound in `AssertParamIsEq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + | +LL | pub struct AssertParamIsEq { + | ^^ required by this bound in `AssertParamIsEq` + = note: this error originates in the derive macro `Eq` (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 E0277`. diff --git a/src/test/ui/deriving/issue-89188-gat-hrtb.rs b/src/test/ui/deriving/issue-89188-gat-hrtb.rs index abd85a616..e8118f0c6 100644 --- a/src/test/ui/deriving/issue-89188-gat-hrtb.rs +++ b/src/test/ui/deriving/issue-89188-gat-hrtb.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - trait CallWithShim: Sized { type Shim<'s> where diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr index 26764bc0e..b69fcd5d3 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied - --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:24:8 + --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:24:12 | LL | f1.foo(1usize); - | ^^^ the trait `Foo` is not implemented for `Bar` + | --- ^^^^^^ the trait `Foo` is not implemented for `Bar` + | | + | required by a bound introduced by this call | = help: the following other types implement trait `Foo`: > diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr index bb175367e..5e0e4a011 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied - --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:28:8 + --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:28:12 | LL | f1.foo(1usize); - | ^^^ the trait `Foo` is not implemented for `Bar` + | --- ^^^^^^ the trait `Foo` is not implemented for `Bar` + | | + | required by a bound introduced by this call | = help: the following other types implement trait `Foo`: > diff --git a/src/test/ui/did_you_mean/use_instead_of_import.fixed b/src/test/ui/did_you_mean/use_instead_of_import.fixed index 87d453e15..a8aae76f4 100644 --- a/src/test/ui/did_you_mean/use_instead_of_import.fixed +++ b/src/test/ui/did_you_mean/use_instead_of_import.fixed @@ -6,10 +6,18 @@ use std::{ rc::Rc, }; +use std::time::Duration; +//~^ ERROR expected item, found `require` + +use std::time::Instant; +//~^ ERROR expected item, found `include` + pub use std::io; //~^ ERROR expected item, found `using` fn main() { let x = Rc::new(1); let _ = write!(io::stdout(), "{:?}", x); + let _ = Duration::new(5, 0); + let _ = Instant::now(); } diff --git a/src/test/ui/did_you_mean/use_instead_of_import.rs b/src/test/ui/did_you_mean/use_instead_of_import.rs index 59e837323..2db7c2407 100644 --- a/src/test/ui/did_you_mean/use_instead_of_import.rs +++ b/src/test/ui/did_you_mean/use_instead_of_import.rs @@ -6,10 +6,18 @@ import std::{ rc::Rc, }; +require std::time::Duration; +//~^ ERROR expected item, found `require` + +include std::time::Instant; +//~^ ERROR expected item, found `include` + pub using std::io; //~^ ERROR expected item, found `using` fn main() { let x = Rc::new(1); let _ = write!(io::stdout(), "{:?}", x); + let _ = Duration::new(5, 0); + let _ = Instant::now(); } diff --git a/src/test/ui/did_you_mean/use_instead_of_import.stderr b/src/test/ui/did_you_mean/use_instead_of_import.stderr index b22954af8..2aac8f68c 100644 --- a/src/test/ui/did_you_mean/use_instead_of_import.stderr +++ b/src/test/ui/did_you_mean/use_instead_of_import.stderr @@ -4,11 +4,23 @@ error: expected item, found `import` LL | import std::{ | ^^^^^^ help: items are imported using the `use` keyword +error: expected item, found `require` + --> $DIR/use_instead_of_import.rs:9:1 + | +LL | require std::time::Duration; + | ^^^^^^^ help: items are imported using the `use` keyword + +error: expected item, found `include` + --> $DIR/use_instead_of_import.rs:12:1 + | +LL | include std::time::Instant; + | ^^^^^^^ help: items are imported using the `use` keyword + error: expected item, found `using` - --> $DIR/use_instead_of_import.rs:9:5 + --> $DIR/use_instead_of_import.rs:15:5 | LL | pub using std::io; | ^^^^^ help: items are imported using the `use` keyword -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors diff --git a/src/test/ui/drop/drop-foreign-fundamental.rs b/src/test/ui/drop/drop-foreign-fundamental.rs new file mode 100644 index 000000000..c43df40d6 --- /dev/null +++ b/src/test/ui/drop/drop-foreign-fundamental.rs @@ -0,0 +1,23 @@ +use std::ops::Deref; +use std::pin::Pin; + +struct Whatever(T); + +impl Deref for Whatever { + type Target = T; + + fn deref(&self) -> &T { + &self.0 + } +} + +struct A; + +impl Drop for Pin> { + //~^ ERROR the `Drop` trait may only be implemented for local structs, enums, and unions + fn drop(&mut self) {} +} + +fn main() { + let x = Pin::new(Whatever(1.0f32)); +} diff --git a/src/test/ui/drop/drop-foreign-fundamental.stderr b/src/test/ui/drop/drop-foreign-fundamental.stderr new file mode 100644 index 000000000..fbd1ba085 --- /dev/null +++ b/src/test/ui/drop/drop-foreign-fundamental.stderr @@ -0,0 +1,9 @@ +error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions + --> $DIR/drop-foreign-fundamental.rs:16:15 + | +LL | impl Drop for Pin> { + | ^^^^^^^^^^^^^^^^ must be a struct, enum, or union in the current crate + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0120`. diff --git a/src/test/ui/drop/drop_order.rs b/src/test/ui/drop/drop_order.rs new file mode 100644 index 000000000..e42150dcc --- /dev/null +++ b/src/test/ui/drop/drop_order.rs @@ -0,0 +1,145 @@ +// run-pass + +use std::cell::RefCell; +use std::convert::TryInto; + +#[derive(Default)] +struct DropOrderCollector(RefCell>); + +struct LoudDrop<'a>(&'a DropOrderCollector, u32); + +impl Drop for LoudDrop<'_> { + fn drop(&mut self) { + println!("{}", self.1); + self.0.0.borrow_mut().push(self.1); + } +} + +impl DropOrderCollector { + fn option_loud_drop(&self, n: u32) -> Option { + Some(LoudDrop(self, n)) + } + + fn loud_drop(&self, n: u32) -> LoudDrop { + LoudDrop(self, n) + } + + fn print(&self, n: u32) { + println!("{}", n); + self.0.borrow_mut().push(n) + } + + fn if_(&self) { + if self.option_loud_drop(1).is_some() { + self.print(2); + } + + if self.option_loud_drop(3).is_none() { + unreachable!(); + } else if self.option_loud_drop(4).is_some() { + self.print(5); + } + + if { + if self.option_loud_drop(7).is_some() && self.option_loud_drop(6).is_some() { + self.loud_drop(8); + true + } else { + false + } + } { + self.print(9); + } + } + + fn if_let(&self) { + if let None = self.option_loud_drop(2) { + unreachable!(); + } else { + self.print(1); + } + + if let Some(_) = self.option_loud_drop(4) { + self.print(3); + } + + if let Some(_d) = self.option_loud_drop(6) { + self.print(5); + } + } + + fn match_(&self) { + match self.option_loud_drop(2) { + _any => self.print(1), + } + + match self.option_loud_drop(4) { + _ => self.print(3), + } + + match self.option_loud_drop(6) { + Some(_) => self.print(5), + _ => unreachable!(), + } + + match { + let _ = self.loud_drop(7); + let _d = self.loud_drop(9); + self.print(8); + () + } { + () => self.print(10), + } + + match { + match self.option_loud_drop(14) { + _ => { + self.print(11); + self.option_loud_drop(13) + } + } + } { + _ => self.print(12), + } + + match { + loop { + break match self.option_loud_drop(16) { + _ => { + self.print(15); + self.option_loud_drop(18) + } + }; + } + } { + _ => self.print(17), + } + } + + fn assert_sorted(self) { + assert!( + self.0 + .into_inner() + .into_iter() + .enumerate() + .all(|(idx, item)| idx + 1 == item.try_into().unwrap()) + ); + } +} + +fn main() { + println!("-- if --"); + let collector = DropOrderCollector::default(); + collector.if_(); + collector.assert_sorted(); + + println!("-- if let --"); + let collector = DropOrderCollector::default(); + collector.if_let(); + collector.assert_sorted(); + + println!("-- match --"); + let collector = DropOrderCollector::default(); + collector.match_(); + collector.assert_sorted(); +} diff --git a/src/test/ui/dropck/drop-on-non-struct.rs b/src/test/ui/dropck/drop-on-non-struct.rs index ef5e18126..145eab126 100644 --- a/src/test/ui/dropck/drop-on-non-struct.rs +++ b/src/test/ui/dropck/drop-on-non-struct.rs @@ -1,5 +1,5 @@ impl<'a> Drop for &'a mut isize { - //~^ ERROR the `Drop` trait may only be implemented for structs, enums, and unions + //~^ ERROR the `Drop` trait may only be implemented for local structs, enums, and unions //~^^ ERROR E0117 fn drop(&mut self) { println!("kaboom"); @@ -8,8 +8,7 @@ impl<'a> Drop for &'a mut isize { impl Drop for Nonexistent { //~^ ERROR cannot find type `Nonexistent` - fn drop(&mut self) { } + fn drop(&mut self) {} } -fn main() { -} +fn main() {} diff --git a/src/test/ui/dropck/drop-on-non-struct.stderr b/src/test/ui/dropck/drop-on-non-struct.stderr index e52728f37..e8fbe5e97 100644 --- a/src/test/ui/dropck/drop-on-non-struct.stderr +++ b/src/test/ui/dropck/drop-on-non-struct.stderr @@ -15,11 +15,11 @@ LL | impl<'a> Drop for &'a mut isize { | = note: define and implement a trait or new type instead -error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions +error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions --> $DIR/drop-on-non-struct.rs:1:19 | LL | impl<'a> Drop for &'a mut isize { - | ^^^^^^^^^^^^^ must be a struct, enum, or union + | ^^^^^^^^^^^^^ must be a struct, enum, or union in the current crate error: aborting due to 3 previous errors diff --git a/src/test/ui/dst/dst-bad-coercions.stderr b/src/test/ui/dst/dst-bad-coercions.stderr index 01f862ed5..0d6f4d020 100644 --- a/src/test/ui/dst/dst-bad-coercions.stderr +++ b/src/test/ui/dst/dst-bad-coercions.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:14:17 | LL | let y: &S = x; - | -- ^ expected `&S`, found *-ptr + | -- ^ expected `&S`, found `*const S` | | | expected due to this | @@ -13,7 +13,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:15:21 | LL | let y: &dyn T = x; - | ------ ^ expected `&dyn T`, found *-ptr + | ------ ^ expected `&dyn T`, found `*const S` | | | expected due to this | @@ -24,7 +24,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:19:17 | LL | let y: &S = x; - | -- ^ expected `&S`, found *-ptr + | -- ^ expected `&S`, found `*mut S` | | | expected due to this | @@ -35,7 +35,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:20:21 | LL | let y: &dyn T = x; - | ------ ^ expected `&dyn T`, found *-ptr + | ------ ^ expected `&dyn T`, found `*mut S` | | | expected due to this | diff --git a/src/test/ui/dst/dst-rvalue.rs b/src/test/ui/dst/dst-rvalue.rs index b52a95a70..fbb32cac1 100644 --- a/src/test/ui/dst/dst-rvalue.rs +++ b/src/test/ui/dst/dst-rvalue.rs @@ -1,12 +1,10 @@ // Check that dynamically sized rvalues are forbidden -#![feature(box_syntax)] - pub fn main() { - let _x: Box = box *"hello world"; + let _x: Box = Box::new(*"hello world"); //~^ ERROR E0277 let array: &[isize] = &[1, 2, 3]; - let _x: Box<[isize]> = box *array; + let _x: Box<[isize]> = Box::new(*array); //~^ ERROR E0277 } diff --git a/src/test/ui/dst/dst-rvalue.stderr b/src/test/ui/dst/dst-rvalue.stderr index 15830636b..727f4d843 100644 --- a/src/test/ui/dst/dst-rvalue.stderr +++ b/src/test/ui/dst/dst-rvalue.stderr @@ -1,20 +1,32 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/dst-rvalue.rs:6:28 + --> $DIR/dst-rvalue.rs:4:33 | -LL | let _x: Box = box *"hello world"; - | ^^^^^^^^^^^^^^ doesn't have a size known at compile-time +LL | let _x: Box = Box::new(*"hello world"); + | -------- ^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `str` - = note: the type of a box expression must have a statically known size +note: required by a bound in `Box::::new` + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + | +LL | impl Box { + | ^ required by this bound in `Box::::new` error[E0277]: the size for values of type `[isize]` cannot be known at compilation time - --> $DIR/dst-rvalue.rs:10:32 + --> $DIR/dst-rvalue.rs:8:37 | -LL | let _x: Box<[isize]> = box *array; - | ^^^^^^ doesn't have a size known at compile-time +LL | let _x: Box<[isize]> = Box::new(*array); + | -------- ^^^^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call | = help: the trait `Sized` is not implemented for `[isize]` - = note: the type of a box expression must have a statically known size +note: required by a bound in `Box::::new` + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + | +LL | impl Box { + | ^ required by this bound in `Box::::new` error: aborting due to 2 previous errors diff --git a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr index 34699bb26..e7db68693 100644 --- a/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr +++ b/src/test/ui/dyn-keyword/dyn-2018-edition-lint.stderr @@ -13,9 +13,8 @@ LL | #[deny(bare_trait_objects)] = note: for more information, see help: use `dyn` | -LL - fn function(x: &SomeTrait, y: Box) { -LL + fn function(x: &dyn SomeTrait, y: Box) { - | +LL | fn function(x: &dyn SomeTrait, y: Box) { + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:35 @@ -27,9 +26,8 @@ LL | fn function(x: &SomeTrait, y: Box) { = note: for more information, see help: use `dyn` | -LL - fn function(x: &SomeTrait, y: Box) { -LL + fn function(x: &SomeTrait, y: Box) { - | +LL | fn function(x: &SomeTrait, y: Box) { + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:17:14 @@ -41,9 +39,8 @@ LL | let _x: &SomeTrait = todo!(); = note: for more information, see help: use `dyn` | -LL - let _x: &SomeTrait = todo!(); -LL + let _x: &dyn SomeTrait = todo!(); - | +LL | let _x: &dyn SomeTrait = todo!(); + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:17 @@ -55,9 +52,8 @@ LL | fn function(x: &SomeTrait, y: Box) { = note: for more information, see help: use `dyn` | -LL - fn function(x: &SomeTrait, y: Box) { -LL + fn function(x: &dyn SomeTrait, y: Box) { - | +LL | fn function(x: &dyn SomeTrait, y: Box) { + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:17 @@ -69,9 +65,8 @@ LL | fn function(x: &SomeTrait, y: Box) { = note: for more information, see help: use `dyn` | -LL - fn function(x: &SomeTrait, y: Box) { -LL + fn function(x: &dyn SomeTrait, y: Box) { - | +LL | fn function(x: &dyn SomeTrait, y: Box) { + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:35 @@ -83,9 +78,8 @@ LL | fn function(x: &SomeTrait, y: Box) { = note: for more information, see help: use `dyn` | -LL - fn function(x: &SomeTrait, y: Box) { -LL + fn function(x: &SomeTrait, y: Box) { - | +LL | fn function(x: &SomeTrait, y: Box) { + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/dyn-2018-edition-lint.rs:4:35 @@ -97,9 +91,8 @@ LL | fn function(x: &SomeTrait, y: Box) { = note: for more information, see help: use `dyn` | -LL - fn function(x: &SomeTrait, y: Box) { -LL + fn function(x: &SomeTrait, y: Box) { - | +LL | fn function(x: &SomeTrait, y: Box) { + | +++ error: aborting due to 7 previous errors diff --git a/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr index 9e212c77d..08ee77116 100644 --- a/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr +++ b/src/test/ui/dyn-keyword/dyn-2021-edition-error.stderr @@ -6,9 +6,8 @@ LL | fn function(x: &SomeTrait, y: Box) { | help: add `dyn` keyword before this trait | -LL - fn function(x: &SomeTrait, y: Box) { -LL + fn function(x: &dyn SomeTrait, y: Box) { - | +LL | fn function(x: &dyn SomeTrait, y: Box) { + | +++ error[E0782]: trait objects must include the `dyn` keyword --> $DIR/dyn-2021-edition-error.rs:3:35 @@ -18,9 +17,8 @@ LL | fn function(x: &SomeTrait, y: Box) { | help: add `dyn` keyword before this trait | -LL - fn function(x: &SomeTrait, y: Box) { -LL + fn function(x: &SomeTrait, y: Box) { - | +LL | fn function(x: &SomeTrait, y: Box) { + | +++ error: aborting due to 2 previous errors diff --git a/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr b/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr index 9bc603fba..261c2d574 100644 --- a/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr +++ b/src/test/ui/dyn-keyword/dyn-angle-brackets.stderr @@ -13,9 +13,8 @@ LL | #![deny(bare_trait_objects)] = note: for more information, see help: use `dyn` | -LL - ::fmt(self, f) -LL + ::fmt(self, f) - | +LL | ::fmt(self, f) + | +++ error: aborting due to previous error diff --git a/src/test/ui/dyn-star/const.rs b/src/test/ui/dyn-star/const.rs new file mode 100644 index 000000000..e49caf649 --- /dev/null +++ b/src/test/ui/dyn-star/const.rs @@ -0,0 +1,14 @@ +// run-pass +#![feature(dyn_star)] +#![allow(unused, incomplete_features)] + +use std::fmt::Debug; + +fn make_dyn_star() { + let i = 42usize; + let dyn_i: dyn* Debug = i as dyn* Debug; +} + +fn main() { + make_dyn_star(); +} diff --git a/src/test/ui/dyn-star/drop.rs b/src/test/ui/dyn-star/drop.rs new file mode 100644 index 000000000..46b232f3d --- /dev/null +++ b/src/test/ui/dyn-star/drop.rs @@ -0,0 +1,23 @@ +// run-pass +// check-run-results +#![feature(dyn_star)] +#![allow(incomplete_features)] + +use std::fmt::Debug; + +#[derive(Debug)] +struct Foo(usize); + +impl Drop for Foo { + fn drop(&mut self) { + println!("destructor called"); + } +} + +fn make_dyn_star(i: Foo) { + let _dyn_i: dyn* Debug = i as dyn* Debug; +} + +fn main() { + make_dyn_star(Foo(42)); +} diff --git a/src/test/ui/dyn-star/drop.run.stdout b/src/test/ui/dyn-star/drop.run.stdout new file mode 100644 index 000000000..dadb33ccf --- /dev/null +++ b/src/test/ui/dyn-star/drop.run.stdout @@ -0,0 +1 @@ +destructor called diff --git a/src/test/ui/dyn-star/error.rs b/src/test/ui/dyn-star/error.rs new file mode 100644 index 000000000..33eff80a5 --- /dev/null +++ b/src/test/ui/dyn-star/error.rs @@ -0,0 +1,13 @@ +#![feature(dyn_star)] +#![allow(incomplete_features)] + +use std::fmt::Debug; + +trait Foo {} + +fn make_dyn_star() { + let i = 42; + let dyn_i: dyn* Foo = i as dyn* Foo; //~ ERROR trait bound `{integer}: Foo` is not satisfied +} + +fn main() {} diff --git a/src/test/ui/dyn-star/error.stderr b/src/test/ui/dyn-star/error.stderr new file mode 100644 index 000000000..d612ccc63 --- /dev/null +++ b/src/test/ui/dyn-star/error.stderr @@ -0,0 +1,9 @@ +error[E0277]: the trait bound `{integer}: Foo` is not satisfied + --> $DIR/error.rs:10:27 + | +LL | let dyn_i: dyn* Foo = i as dyn* Foo; + | ^ the trait `Foo` is not implemented for `{integer}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/dyn-star/feature-gate-dyn_star.rs b/src/test/ui/dyn-star/feature-gate-dyn_star.rs new file mode 100644 index 000000000..4756661cf --- /dev/null +++ b/src/test/ui/dyn-star/feature-gate-dyn_star.rs @@ -0,0 +1,9 @@ +// Feature gate test for dyn_star + +/// dyn* is not necessarily the final surface syntax (if we have one at all), +/// but for now we will support it to aid in writing tests independently. +pub fn dyn_star_parameter(_: &dyn* Send) { + //~^ dyn* trait objects are unstable +} + +fn main() {} diff --git a/src/test/ui/dyn-star/feature-gate-dyn_star.stderr b/src/test/ui/dyn-star/feature-gate-dyn_star.stderr new file mode 100644 index 000000000..2767e9478 --- /dev/null +++ b/src/test/ui/dyn-star/feature-gate-dyn_star.stderr @@ -0,0 +1,12 @@ +error[E0658]: dyn* trait objects are unstable + --> $DIR/feature-gate-dyn_star.rs:5:31 + | +LL | pub fn dyn_star_parameter(_: &dyn* Send) { + | ^^^^^^^^^ + | + = note: see issue #91611 for more information + = help: add `#![feature(dyn_star)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/dyn-star/make-dyn-star.rs b/src/test/ui/dyn-star/make-dyn-star.rs new file mode 100644 index 000000000..708ffa25d --- /dev/null +++ b/src/test/ui/dyn-star/make-dyn-star.rs @@ -0,0 +1,13 @@ +// run-pass +#![feature(dyn_star)] +#![allow(incomplete_features)] + +use std::fmt::Debug; + +fn make_dyn_star(i: usize) { + let _dyn_i: dyn* Debug = i as dyn* Debug; +} + +fn main() { + make_dyn_star(42); +} diff --git a/src/test/ui/dyn-star/method.rs b/src/test/ui/dyn-star/method.rs new file mode 100644 index 000000000..d04958ca2 --- /dev/null +++ b/src/test/ui/dyn-star/method.rs @@ -0,0 +1,26 @@ +// run-pass +#![feature(dyn_star)] +#![allow(incomplete_features)] + +trait Foo { + fn get(&self) -> usize; +} + +impl Foo for usize { + fn get(&self) -> usize { + *self + } +} + +fn invoke_dyn_star(i: dyn* Foo) -> usize { + i.get() +} + +fn make_and_invoke_dyn_star(i: usize) -> usize { + let dyn_i: dyn* Foo = i as dyn* Foo; + invoke_dyn_star(dyn_i) +} + +fn main() { + println!("{}", make_and_invoke_dyn_star(42)); +} diff --git a/src/test/ui/dyn-star/syntax.rs b/src/test/ui/dyn-star/syntax.rs new file mode 100644 index 000000000..618c72562 --- /dev/null +++ b/src/test/ui/dyn-star/syntax.rs @@ -0,0 +1,11 @@ +// Make sure we can parse the `dyn* Trait` syntax +// +// check-pass + +#![feature(dyn_star)] +#![allow(incomplete_features)] + +pub fn dyn_star_parameter(_: dyn* Send) { +} + +fn main() {} diff --git a/src/test/ui/dynamically-sized-types/dst-struct.rs b/src/test/ui/dynamically-sized-types/dst-struct.rs index 25ec07b88..5da9381f8 100644 --- a/src/test/ui/dynamically-sized-types/dst-struct.rs +++ b/src/test/ui/dynamically-sized-types/dst-struct.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] struct Fat { f1: isize, @@ -111,7 +110,7 @@ pub fn main() { assert_eq!((*f2)[1], 2); // Nested Box. - let f1 : Box> = box Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; + let f1 : Box> = Box::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }); foo(&*f1); let f2 : Box> = f1; foo(&*f2); diff --git a/src/test/ui/dynamically-sized-types/dst-trait.rs b/src/test/ui/dynamically-sized-types/dst-trait.rs index ec6bc7219..7ac6f0392 100644 --- a/src/test/ui/dynamically-sized-types/dst-trait.rs +++ b/src/test/ui/dynamically-sized-types/dst-trait.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] struct Fat { f1: isize, diff --git a/src/test/ui/empty/empty-never-array.rs b/src/test/ui/empty/empty-never-array.rs index 01b99134a..3de2b1a78 100644 --- a/src/test/ui/empty/empty-never-array.rs +++ b/src/test/ui/empty/empty-never-array.rs @@ -8,7 +8,7 @@ enum Helper { fn transmute(t: T) -> U { let Helper::U(u) = Helper::T(t, []); - //~^ ERROR refutable pattern in local binding: `T(_, _)` not covered + //~^ ERROR refutable pattern in local binding: `Helper::T(_, _)` not covered u } diff --git a/src/test/ui/empty/empty-never-array.stderr b/src/test/ui/empty/empty-never-array.stderr index 909aa73a7..adf782743 100644 --- a/src/test/ui/empty/empty-never-array.stderr +++ b/src/test/ui/empty/empty-never-array.stderr @@ -1,8 +1,8 @@ -error[E0005]: refutable pattern in local binding: `T(_, _)` not covered +error[E0005]: refutable pattern in local binding: `Helper::T(_, _)` not covered --> $DIR/empty-never-array.rs:10:9 | LL | let Helper::U(u) = Helper::T(t, []); - | ^^^^^^^^^^^^ pattern `T(_, _)` not covered + | ^^^^^^^^^^^^ pattern `Helper::T(_, _)` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html @@ -18,7 +18,7 @@ help: you might want to use `if let` to ignore the variant that isn't matched | LL | let u = if let Helper::U(u) = Helper::T(t, []) { u } else { todo!() }; | ++++++++++ ++++++++++++++++++++++ -help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched +help: alternatively, you might want to use let else to handle the variant that isn't matched | LL | let Helper::U(u) = Helper::T(t, []) else { todo!() }; | ++++++++++++++++ diff --git a/src/test/ui/enum/enum-discrim-autosizing.rs b/src/test/ui/enum/enum-discrim-autosizing.rs index 27fab1bb5..fc94d281c 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.rs +++ b/src/test/ui/enum/enum-discrim-autosizing.rs @@ -6,9 +6,9 @@ enum Eu64 { //~^ ERROR discriminant value `0` assigned more than once Au64 = 0, - //~^NOTE first assignment of `0` + //~^NOTE `0` assigned here Bu64 = 0x8000_0000_0000_0000 - //~^NOTE second assignment of `0` (overflowed from `9223372036854775808`) + //~^NOTE `0` (overflowed from `9223372036854775808`) assigned here } fn main() {} diff --git a/src/test/ui/enum/enum-discrim-autosizing.stderr b/src/test/ui/enum/enum-discrim-autosizing.stderr index eacea86d6..be3d7c64e 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.stderr +++ b/src/test/ui/enum/enum-discrim-autosizing.stderr @@ -5,10 +5,10 @@ LL | enum Eu64 { | ^^^^^^^^^ LL | LL | Au64 = 0, - | - first assignment of `0` + | - `0` assigned here LL | LL | Bu64 = 0x8000_0000_0000_0000 - | --------------------- second assignment of `0` (overflowed from `9223372036854775808`) + | --------------------- `0` (overflowed from `9223372036854775808`) assigned here error: aborting due to previous error diff --git a/src/test/ui/env-funky-keys.rs b/src/test/ui/env-funky-keys.rs index 4548d3339..46e20d8c6 100644 --- a/src/test/ui/env-funky-keys.rs +++ b/src/test/ui/env-funky-keys.rs @@ -6,6 +6,7 @@ // ignore-emscripten no execve // ignore-sgx no execve // ignore-vxworks no execve +// ignore-fuchsia no 'execve' // no-prefer-dynamic #![feature(rustc_private)] diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr index 8ba151d9e..4ac8c904f 100644 --- a/src/test/ui/error-codes/E0004.stderr +++ b/src/test/ui/error-codes/E0004.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered +error[E0004]: non-exhaustive patterns: `Terminator::HastaLaVistaBaby` not covered --> $DIR/E0004.rs:9:11 | LL | match x { - | ^ pattern `HastaLaVistaBaby` not covered + | ^ pattern `Terminator::HastaLaVistaBaby` not covered | note: `Terminator` defined here --> $DIR/E0004.rs:2:5 @@ -15,7 +15,7 @@ LL | HastaLaVistaBaby, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Terminator::TalkToMyHand => {} -LL + HastaLaVistaBaby => todo!() +LL + Terminator::HastaLaVistaBaby => todo!() | error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr index f01a77bd3..de8e6bac4 100644 --- a/src/test/ui/error-codes/E0005.stderr +++ b/src/test/ui/error-codes/E0005.stderr @@ -19,7 +19,7 @@ help: you might want to use `if let` to ignore the variant that isn't matched | LL | let y = if let Some(y) = x { y } else { todo!() }; | ++++++++++ ++++++++++++++++++++++ -help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched +help: alternatively, you might want to use let else to handle the variant that isn't matched | LL | let Some(y) = x else { todo!() }; | ++++++++++++++++ diff --git a/src/test/ui/error-codes/E0057.stderr b/src/test/ui/error-codes/E0057.stderr index 2307f52c9..bea226f09 100644 --- a/src/test/ui/error-codes/E0057.stderr +++ b/src/test/ui/error-codes/E0057.stderr @@ -12,7 +12,7 @@ LL | let f = |x| x * 3; help: provide the argument | LL | let a = f(/* value */); - | ~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~ error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/E0057.rs:5:13 @@ -28,7 +28,7 @@ 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/src/test/ui/error-codes/E0060.stderr b/src/test/ui/error-codes/E0060.stderr index 644fd5983..934a18d89 100644 --- a/src/test/ui/error-codes/E0060.stderr +++ b/src/test/ui/error-codes/E0060.stderr @@ -12,7 +12,7 @@ LL | fn printf(_: *const u8, ...) -> u32; help: provide the argument | LL | unsafe { printf(/* *const u8 */); } - | ~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0061.stderr b/src/test/ui/error-codes/E0061.stderr index fa55db092..fa4ccbe66 100644 --- a/src/test/ui/error-codes/E0061.stderr +++ b/src/test/ui/error-codes/E0061.stderr @@ -12,7 +12,7 @@ LL | fn f(a: u16, b: &str) {} help: provide the argument | LL | f(0, /* &str */); - | ~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~ error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/E0061.rs:9:5 @@ -28,7 +28,7 @@ LL | fn f2(a: u16) {} help: provide the argument | LL | f2(/* u16 */); - | ~~~~~~~~~~~~~ + | ~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0081.rs b/src/test/ui/error-codes/E0081.rs index 5aa6a7863..f53fda864 100644 --- a/src/test/ui/error-codes/E0081.rs +++ b/src/test/ui/error-codes/E0081.rs @@ -1,9 +1,9 @@ enum Enum { //~^ ERROR discriminant value `3` assigned more than once P = 3, - //~^ NOTE first assignment of `3` + //~^ NOTE `3` assigned here X = 3, - //~^ NOTE second assignment of `3` + //~^ NOTE `3` assigned here Y = 5 } @@ -11,20 +11,43 @@ enum Enum { enum EnumOverflowRepr { //~^ ERROR discriminant value `1` assigned more than once P = 257, - //~^ NOTE first assignment of `1` (overflowed from `257`) + //~^ NOTE `1` (overflowed from `257`) assigned here X = 513, - //~^ NOTE second assignment of `1` (overflowed from `513`) + //~^ NOTE `1` (overflowed from `513`) assigned here } #[repr(i8)] enum NegDisEnum { //~^ ERROR discriminant value `-1` assigned more than once First = -1, - //~^ NOTE first assignment of `-1` + //~^ NOTE `-1` assigned here Second = -2, - //~^ NOTE assigned discriminant for `Last` was incremented from this discriminant + //~^ NOTE discriminant for `Last` incremented from this startpoint (`Second` + 1 variant later => `Last` = -1) Last, - //~^ NOTE second assignment of `-1` + //~^ NOTE `-1` assigned here +} + +enum MultipleDuplicates { + //~^ ERROR discriminant value `0` assigned more than once + //~^^ ERROR discriminant value `-2` assigned more than once + V0, + //~^ NOTE `0` assigned here + V1 = 0, + //~^ NOTE `0` assigned here + V2, + V3, + V4 = 0, + //~^ NOTE `0` assigned here + V5 = -2, + //~^ NOTE discriminant for `V7` incremented from this startpoint (`V5` + 2 variants later => `V7` = 0) + //~^^ NOTE `-2` assigned here + V6, + V7, + //~^ NOTE `0` assigned here + V8 = -3, + //~^ NOTE discriminant for `V9` incremented from this startpoint (`V8` + 1 variant later => `V9` = -2) + V9, + //~^ NOTE `-2` assigned here } fn main() { diff --git a/src/test/ui/error-codes/E0081.stderr b/src/test/ui/error-codes/E0081.stderr index ff6113646..64562fefc 100644 --- a/src/test/ui/error-codes/E0081.stderr +++ b/src/test/ui/error-codes/E0081.stderr @@ -5,10 +5,10 @@ LL | enum Enum { | ^^^^^^^^^ LL | LL | P = 3, - | - first assignment of `3` + | - `3` assigned here LL | LL | X = 3, - | - second assignment of `3` + | - `3` assigned here error[E0081]: discriminant value `1` assigned more than once --> $DIR/E0081.rs:11:1 @@ -17,10 +17,10 @@ LL | enum EnumOverflowRepr { | ^^^^^^^^^^^^^^^^^^^^^ LL | LL | P = 257, - | --- first assignment of `1` (overflowed from `257`) + | --- `1` (overflowed from `257`) assigned here LL | LL | X = 513, - | --- second assignment of `1` (overflowed from `513`) + | --- `1` (overflowed from `513`) assigned here error[E0081]: discriminant value `-1` assigned more than once --> $DIR/E0081.rs:20:1 @@ -29,14 +29,50 @@ LL | enum NegDisEnum { | ^^^^^^^^^^^^^^^ LL | LL | First = -1, - | -- first assignment of `-1` + | -- `-1` assigned here LL | LL | Second = -2, - | ----------- assigned discriminant for `Last` was incremented from this discriminant + | ----------- discriminant for `Last` incremented from this startpoint (`Second` + 1 variant later => `Last` = -1) LL | LL | Last, - | ---- second assignment of `-1` + | ---- `-1` assigned here -error: aborting due to 3 previous errors +error[E0081]: discriminant value `0` assigned more than once + --> $DIR/E0081.rs:30:1 + | +LL | enum MultipleDuplicates { + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | V0, + | -- `0` assigned here +LL | +LL | V1 = 0, + | - `0` assigned here +... +LL | V4 = 0, + | - `0` assigned here +LL | +LL | V5 = -2, + | ------- discriminant for `V7` incremented from this startpoint (`V5` + 2 variants later => `V7` = 0) +... +LL | V7, + | -- `0` assigned here + +error[E0081]: discriminant value `-2` assigned more than once + --> $DIR/E0081.rs:30:1 + | +LL | enum MultipleDuplicates { + | ^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | V5 = -2, + | -- `-2` assigned here +... +LL | V8 = -3, + | ------- discriminant for `V9` incremented from this startpoint (`V8` + 1 variant later => `V9` = -2) +LL | +LL | V9, + | -- `-2` assigned here + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0081`. diff --git a/src/test/ui/error-codes/E0107.stderr b/src/test/ui/error-codes/E0107.stderr index 5ca03b45d..03430f8fa 100644 --- a/src/test/ui/error-codes/E0107.stderr +++ b/src/test/ui/error-codes/E0107.stderr @@ -142,7 +142,7 @@ LL | pub trait T { help: replace the generic bounds with the associated types | LL | fn trait_bound_generic>(_i: I) { - | ~~~~~~ ~~~~~~~ + | +++ +++ error: aborting due to 10 previous errors diff --git a/src/test/ui/error-codes/E0117.rs b/src/test/ui/error-codes/E0117.rs index 22b486573..406d24e36 100644 --- a/src/test/ui/error-codes/E0117.rs +++ b/src/test/ui/error-codes/E0117.rs @@ -1,4 +1,4 @@ impl Drop for u32 {} //~ ERROR E0117 -//~| ERROR the `Drop` trait may only be implemented for structs, enums, and unions +//~| ERROR the `Drop` trait may only be implemented for local structs, enums, and unions fn main() {} diff --git a/src/test/ui/error-codes/E0117.stderr b/src/test/ui/error-codes/E0117.stderr index 76d9f5cc0..f144aa9f7 100644 --- a/src/test/ui/error-codes/E0117.stderr +++ b/src/test/ui/error-codes/E0117.stderr @@ -9,11 +9,11 @@ LL | impl Drop for u32 {} | = note: define and implement a trait or new type instead -error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions +error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions --> $DIR/E0117.rs:1:15 | LL | impl Drop for u32 {} - | ^^^ must be a struct, enum, or union + | ^^^ must be a struct, enum, or union in the current crate error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0120.stderr b/src/test/ui/error-codes/E0120.stderr index 6c306455e..75778f1f9 100644 --- a/src/test/ui/error-codes/E0120.stderr +++ b/src/test/ui/error-codes/E0120.stderr @@ -1,8 +1,8 @@ -error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions +error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions --> $DIR/E0120.rs:3:15 | LL | impl Drop for dyn MyTrait { - | ^^^^^^^^^^^ must be a struct, enum, or union + | ^^^^^^^^^^^ must be a struct, enum, or union in the current crate error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0271.stderr b/src/test/ui/error-codes/E0271.stderr index 9c9c7237d..1e2f43834 100644 --- a/src/test/ui/error-codes/E0271.stderr +++ b/src/test/ui/error-codes/E0271.stderr @@ -1,8 +1,10 @@ error[E0271]: type mismatch resolving `::AssociatedType == u32` - --> $DIR/E0271.rs:10:5 + --> $DIR/E0271.rs:10:9 | LL | foo(3_i8); - | ^^^ type mismatch resolving `::AssociatedType == u32` + | --- ^^^^ type mismatch resolving `::AssociatedType == u32` + | | + | required by a bound introduced by this call | note: expected this to be `u32` --> $DIR/E0271.rs:7:43 diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index dfffbb182..87cfaa489 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -5,13 +5,13 @@ LL | impl Foo for T where Bar: Foo {} | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`) -note: required because of the requirements on the impl of `Foo` for `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` +note: required for `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Foo` --> $DIR/E0275.rs:5:9 | LL | impl Foo for T where Bar: Foo {} | ^^^ ^ = note: 127 redundant requirements hidden - = note: required because of the requirements on the impl of `Foo` for `Bar` + = note: required for `Bar` to implement `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0277-2.stderr b/src/test/ui/error-codes/E0277-2.stderr index ca2cb8842..a2abf3793 100644 --- a/src/test/ui/error-codes/E0277-2.stderr +++ b/src/test/ui/error-codes/E0277-2.stderr @@ -1,8 +1,8 @@ error[E0277]: `*const u8` cannot be sent between threads safely - --> $DIR/E0277-2.rs:16:5 + --> $DIR/E0277-2.rs:16:15 | LL | is_send::(); - | ^^^^^^^^^^^^^^ `*const u8` cannot be sent between threads safely + | ^^^ `*const u8` cannot be sent between threads safely | = help: within `Foo`, the trait `Send` is not implemented for `*const u8` note: required because it appears within the type `Baz` diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr index 81715621d..b0e2ef5b6 100644 --- a/src/test/ui/error-codes/E0401.stderr +++ b/src/test/ui/error-codes/E0401.stderr @@ -4,9 +4,9 @@ error[E0401]: can't use generic parameters from outer function LL | fn foo(x: T) { | - type parameter from outer function LL | fn bfnr, W: Fn()>(y: T) { - | --------------------------- ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `bfnr, W: Fn(), T>` + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `T,` error[E0401]: can't use generic parameters from outer function --> $DIR/E0401.rs:9:16 @@ -15,7 +15,7 @@ LL | fn foo(x: T) { | - type parameter from outer function ... LL | fn baz $DIR/E0565-2.rs:2:22 | LL | #[deprecated(since = b"1.29", note = "hi")] - | ^^^^^^^ help: consider removing the prefix: `"1.29"` + | -^^^^^^ + | | + | help: consider removing the prefix error: aborting due to previous error diff --git a/src/test/ui/explore-issue-38412.stderr b/src/test/ui/explore-issue-38412.stderr index e3f82137a..08dadb4db 100644 --- a/src/test/ui/explore-issue-38412.stderr +++ b/src/test/ui/explore-issue-38412.stderr @@ -43,19 +43,19 @@ LL | t.2; = note: see issue #38412 for more information = help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable -error[E0616]: field `3` of struct `Tuple` is private +error[E0616]: field `3` of struct `pub_and_stability::Tuple` is private --> $DIR/explore-issue-38412.rs:36:7 | LL | t.3; | ^ private field -error[E0616]: field `4` of struct `Tuple` is private +error[E0616]: field `4` of struct `pub_and_stability::Tuple` is private --> $DIR/explore-issue-38412.rs:37:7 | LL | t.4; | ^ private field -error[E0616]: field `5` of struct `Tuple` is private +error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private --> $DIR/explore-issue-38412.rs:38:7 | LL | t.5; diff --git a/src/test/ui/expr/if/if-branch-types.stderr b/src/test/ui/expr/if/if-branch-types.stderr index 14f02163a..d2bba8821 100644 --- a/src/test/ui/expr/if/if-branch-types.stderr +++ b/src/test/ui/expr/if/if-branch-types.stderr @@ -5,6 +5,11 @@ LL | let x = if true { 10i32 } else { 10u32 }; | ----- ^^^^^ expected `i32`, found `u32` | | | expected because of this + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | let x = if true { 10i32 } else { 10i32 }; + | ~~~ error: aborting due to previous error diff --git a/src/test/ui/expr/if/if-else-type-mismatch.stderr b/src/test/ui/expr/if/if-else-type-mismatch.stderr index 9fa190d6c..f1fffdb1e 100644 --- a/src/test/ui/expr/if/if-else-type-mismatch.stderr +++ b/src/test/ui/expr/if/if-else-type-mismatch.stderr @@ -10,6 +10,11 @@ LL | | 2u32 | | ^^^^ expected `i32`, found `u32` LL | | }; | |_____- `if` and `else` have incompatible types + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | 2i32 + | ~~~ error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:8:38 @@ -18,6 +23,11 @@ LL | let _ = if true { 42i32 } else { 42u32 }; | ----- ^^^^^ expected `i32`, found `u32` | | | expected because of this + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | let _ = if true { 42i32 } else { 42i32 }; + | ~~~ error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:13:9 diff --git a/src/test/ui/extern/extern-types-unsized.stderr b/src/test/ui/extern/extern-types-unsized.stderr index 8d6713261..a79caced1 100644 --- a/src/test/ui/extern/extern-types-unsized.stderr +++ b/src/test/ui/extern/extern-types-unsized.stderr @@ -16,10 +16,10 @@ LL | fn assert_sized() {} | ++++++++ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:25:5 + --> $DIR/extern-types-unsized.rs:25:20 | LL | assert_sized::(); - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^ doesn't have a size known at compile-time | = help: within `Foo`, the trait `Sized` is not implemented for `A` note: required because it appears within the type `Foo` @@ -38,10 +38,10 @@ LL | fn assert_sized() {} | ++++++++ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:28:5 + --> $DIR/extern-types-unsized.rs:28:20 | LL | assert_sized::>(); - | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^ doesn't have a size known at compile-time | = help: within `Bar`, the trait `Sized` is not implemented for `A` note: required because it appears within the type `Bar` @@ -60,10 +60,10 @@ LL | fn assert_sized() {} | ++++++++ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:31:5 + --> $DIR/extern-types-unsized.rs:31:20 | LL | assert_sized::>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Bar>`, the trait `Sized` is not implemented for `A` note: required because it appears within the type `Bar` diff --git a/src/test/ui/extern/extern-wrong-value-type.stderr b/src/test/ui/extern/extern-wrong-value-type.stderr index c6f0d5df9..ff2934a2b 100644 --- a/src/test/ui/extern/extern-wrong-value-type.stderr +++ b/src/test/ui/extern/extern-wrong-value-type.stderr @@ -6,7 +6,7 @@ LL | is_fn(f); | | | required by a bound introduced by this call | - = help: the trait `Fn<()>` is not implemented for `extern "C" fn() {f}` + = help: the trait `Fn<()>` is not implemented for fn item `extern "C" fn() {f}` = note: wrap the `extern "C" fn() {f}` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `is_fn` --> $DIR/extern-wrong-value-type.rs:4:28 diff --git a/src/test/ui/feature-gates/feature-gate-collapse_debuginfo.rs b/src/test/ui/feature-gates/feature-gate-collapse_debuginfo.rs new file mode 100644 index 000000000..f73bf579f --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-collapse_debuginfo.rs @@ -0,0 +1,7 @@ +#[collapse_debuginfo] +//~^ ERROR the `#[collapse_debuginfo]` attribute is an experimental feature +macro_rules! foo { + ($e:expr) => { $e } +} + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-collapse_debuginfo.stderr b/src/test/ui/feature-gates/feature-gate-collapse_debuginfo.stderr new file mode 100644 index 000000000..2cbde893a --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-collapse_debuginfo.stderr @@ -0,0 +1,12 @@ +error[E0658]: the `#[collapse_debuginfo]` attribute is an experimental feature + --> $DIR/feature-gate-collapse_debuginfo.rs:1:1 + | +LL | #[collapse_debuginfo] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #100758 for more information + = help: add `#![feature(collapse_debuginfo)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr index f8349391a..5ced344f1 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -19,7 +19,7 @@ help: you might want to use `if let` to ignore the variant that isn't matched | LL | let _x = if let Ok(_x) = foo() { _x } else { todo!() }; | +++++++++++ +++++++++++++++++++++++ -help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched +help: alternatively, you might want to use let else to handle the variant that isn't matched | LL | let Ok(_x) = foo() else { todo!() }; | ++++++++++++++++ diff --git a/src/test/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr b/src/test/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr index 49eede479..56123a983 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr +++ b/src/test/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr @@ -1,33 +1,24 @@ -error[E0658]: using `_` for array lengths is unstable +error: in expressions, `_` can only be used on the left-hand side of an assignment --> $DIR/feature-gate-generic_arg_infer.rs:11:27 | LL | let _x: [u8; 3] = [0; _]; - | ^ - | - = note: see issue #85077 for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + | ^ `_` not allowed here error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/feature-gate-generic_arg_infer.rs:11:27 + --> $DIR/feature-gate-generic_arg_infer.rs:14:18 | -LL | let _x: [u8; 3] = [0; _]; - | ^ `_` not allowed here +LL | let _y: [u8; _] = [0; 3]; + | ^ `_` not allowed here error[E0658]: using `_` for array lengths is unstable --> $DIR/feature-gate-generic_arg_infer.rs:14:18 | LL | let _y: [u8; _] = [0; 3]; - | ^ + | ^ help: consider specifying the array length: `3` | = note: see issue #85077 for more information = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/feature-gate-generic_arg_infer.rs:14:18 - | -LL | let _y: [u8; _] = [0; 3]; - | ^ `_` not allowed here - error[E0747]: type provided when a constant was expected --> $DIR/feature-gate-generic_arg_infer.rs:20:20 | @@ -37,6 +28,15 @@ LL | let _x = foo::<_>([1,2]); = help: const arguments cannot yet be inferred with `_` = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable +error[E0658]: using `_` for array lengths is unstable + --> $DIR/feature-gate-generic_arg_infer.rs:11:27 + | +LL | let _x: [u8; 3] = [0; _]; + | ^ + | + = note: see issue #85077 for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + error: aborting due to 5 previous errors Some errors have detailed explanations: E0658, E0747. diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs b/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs deleted file mode 100644 index c5c134514..000000000 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::ops::Deref; - -trait PointerFamily { - type Pointer: Deref; - //~^ ERROR generic associated types are unstable - type Pointer2: Deref where T: Clone, U: Clone; - //~^ ERROR generic associated types are unstable - //~| ERROR where clauses on associated types are unstable -} - -struct Foo; - -impl PointerFamily for Foo { - type Pointer = Box; - //~^ ERROR generic associated types are unstable - type Pointer2 = Box; - //~^ ERROR generic associated types are unstable - //~| ERROR the trait bound `U32: Clone` is not satisfied -} - -trait Bar { - type Assoc where Self: Sized; - //~^ ERROR where clauses on associated types are unstable -} - -impl Bar for Foo { - type Assoc = Foo where Self: Sized; - //~^ ERROR where clauses on associated types are unstable -} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr deleted file mode 100644 index 12a40ff0a..000000000 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr +++ /dev/null @@ -1,78 +0,0 @@ -error[E0658]: generic associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:4:5 - | -LL | type Pointer: Deref; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error[E0658]: generic associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:6:5 - | -LL | type Pointer2: Deref where T: Clone, U: Clone; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error[E0658]: where clauses on associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:6:5 - | -LL | type Pointer2: Deref where T: Clone, U: Clone; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error[E0658]: generic associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:14:5 - | -LL | type Pointer = Box; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error[E0658]: generic associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:16:5 - | -LL | type Pointer2 = Box; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error[E0658]: where clauses on associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:22:5 - | -LL | type Assoc where Self: Sized; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error[E0658]: where clauses on associated types are unstable - --> $DIR/feature-gate-generic_associated_types.rs:27:5 - | -LL | type Assoc = Foo where Self: Sized; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error[E0277]: the trait bound `U32: Clone` is not satisfied - --> $DIR/feature-gate-generic_associated_types.rs:16:26 - | -LL | type Pointer2 = Box; - | ^^^^^^^^ the trait `Clone` is not implemented for `U32` - | -help: consider restricting type parameter `U32` - | -LL | type Pointer2 = Box; - | +++++++++++++++++++ - -error: aborting due to 8 previous errors - -Some errors have detailed explanations: E0277, E0658. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types_extended.rs b/src/test/ui/feature-gates/feature-gate-generic_associated_types_extended.rs index 258b8cd35..7842d44ac 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types_extended.rs +++ b/src/test/ui/feature-gates/feature-gate-generic_associated_types_extended.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - // This feature doesn't *currently* fire on any specific code; it's just a // behavior change. Future changes might. #[rustc_error] //~ the diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types_extended.stderr b/src/test/ui/feature-gates/feature-gate-generic_associated_types_extended.stderr index 6a5eba38c..bb1622628 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types_extended.stderr +++ b/src/test/ui/feature-gates/feature-gate-generic_associated_types_extended.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable - --> $DIR/feature-gate-generic_associated_types_extended.rs:5:1 + --> $DIR/feature-gate-generic_associated_types_extended.rs:3:1 | LL | #[rustc_error] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-label_break_value.rs b/src/test/ui/feature-gates/feature-gate-label_break_value.rs deleted file mode 100644 index 6fc38f455..000000000 --- a/src/test/ui/feature-gates/feature-gate-label_break_value.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub fn main() { - 'a: { //~ ERROR labels on blocks are unstable - break 'a; - } -} diff --git a/src/test/ui/feature-gates/feature-gate-label_break_value.stderr b/src/test/ui/feature-gates/feature-gate-label_break_value.stderr deleted file mode 100644 index 4b43fdc59..000000000 --- a/src/test/ui/feature-gates/feature-gate-label_break_value.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: labels on blocks are unstable - --> $DIR/feature-gate-label_break_value.rs:2:5 - | -LL | 'a: { - | ^^ - | - = note: see issue #48594 for more information - = help: add `#![feature(label_break_value)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-let_else.rs b/src/test/ui/feature-gates/feature-gate-let_else.rs deleted file mode 100644 index 3f04a9dab..000000000 --- a/src/test/ui/feature-gates/feature-gate-let_else.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let Some(x) = Some(1) else { //~ ERROR `let...else` statements are unstable - return; - }; -} diff --git a/src/test/ui/feature-gates/feature-gate-let_else.stderr b/src/test/ui/feature-gates/feature-gate-let_else.stderr deleted file mode 100644 index 862526041..000000000 --- a/src/test/ui/feature-gates/feature-gate-let_else.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: `let...else` statements are unstable - --> $DIR/feature-gate-let_else.rs:2:5 - | -LL | / let Some(x) = Some(1) else { -LL | | return; -LL | | }; - | |______^ - | - = note: see issue #87335 for more information - = help: add `#![feature(let_else)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs index 29a6e1f8a..9b646060a 100644 --- a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs @@ -21,7 +21,7 @@ fn main() { Foo::A => {} Foo::B => {} } - //~^^^^ ERROR non-exhaustive patterns: `C` not covered + //~^^^^ ERROR non-exhaustive patterns: `Foo::C` not covered match Foo::A { Foo::A => {} diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr index dbeef6c2d..3de08e215 100644 --- a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr @@ -99,11 +99,11 @@ LL | #[warn(non_exhaustive_omitted_patterns)] = note: see issue #89554 for more information = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable -error[E0004]: non-exhaustive patterns: `C` not covered +error[E0004]: non-exhaustive patterns: `Foo::C` not covered --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:20:11 | LL | match Foo::A { - | ^^^^^^ pattern `C` not covered + | ^^^^^^ pattern `Foo::C` not covered | note: `Foo` defined here --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:12:15 @@ -116,7 +116,7 @@ LL | A, B, C, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Foo::B => {} -LL + C => todo!() +LL + Foo::C => todo!() | error: aborting due to previous error; 10 warnings emitted diff --git a/src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr b/src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr index 72cb4cc84..d76c697fe 100644 --- a/src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr +++ b/src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr @@ -13,10 +13,10 @@ LL | trait NonObjectSafe1: Sized {} | this trait cannot be made into an object... error[E0038]: the trait `NonObjectSafe2` cannot be made into an object - --> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36 + --> $DIR/feature-gate-object_safe_for_dispatch.rs:22:45 | LL | fn return_non_object_safe_ref() -> &'static dyn NonObjectSafe2 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe2` cannot be made into an object + | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe2` 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-object_safe_for_dispatch.rs:7:8 @@ -50,10 +50,10 @@ LL | fn foo(&self); = help: consider moving `foo` to another trait error[E0038]: the trait `NonObjectSafe4` cannot be made into an object - --> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35 + --> $DIR/feature-gate-object_safe_for_dispatch.rs:31:47 | LL | fn return_non_object_safe_rc() -> std::rc::Rc { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe4` cannot be made into an object + | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe4` 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-object_safe_for_dispatch.rs:15:22 diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-2.rs b/src/test/ui/feature-gates/feature-gate-raw-dylib-2.rs index 518aa20dd..fc47a9061 100644 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-2.rs +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib-2.rs @@ -1,8 +1,12 @@ +// only-x86 #[link(name = "foo")] extern "C" { #[link_ordinal(42)] - //~^ ERROR: the `#[link_ordinal]` attribute is an experimental feature + //~^ ERROR: `#[link_ordinal]` is unstable on x86 fn foo(); + #[link_ordinal(5)] + //~^ ERROR: `#[link_ordinal]` is unstable on x86 + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-2.stderr b/src/test/ui/feature-gates/feature-gate-raw-dylib-2.stderr index dbee5f316..0e900760d 100644 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-2.stderr +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib-2.stderr @@ -1,5 +1,5 @@ -error[E0658]: the `#[link_ordinal]` attribute is an experimental feature - --> $DIR/feature-gate-raw-dylib-2.rs:3:5 +error[E0658]: `#[link_ordinal]` is unstable on x86 + --> $DIR/feature-gate-raw-dylib-2.rs:4:5 | LL | #[link_ordinal(42)] | ^^^^^^^^^^^^^^^^^^^ @@ -7,6 +7,15 @@ LL | #[link_ordinal(42)] = note: see issue #58713 for more information = help: add `#![feature(raw_dylib)]` to the crate attributes to enable -error: aborting due to previous error +error[E0658]: `#[link_ordinal]` is unstable on x86 + --> $DIR/feature-gate-raw-dylib-2.rs:7:5 + | +LL | #[link_ordinal(5)] + | ^^^^^^^^^^^^^^^^^^ + | + = note: see issue #58713 for more information + = help: add `#![feature(raw_dylib)]` 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/src/test/ui/feature-gates/feature-gate-raw-dylib-import-name-type.rs b/src/test/ui/feature-gates/feature-gate-raw-dylib-import-name-type.rs new file mode 100644 index 000000000..295f502d6 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib-import-name-type.rs @@ -0,0 +1,8 @@ +// only-windows +// only-x86 +#[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] +//~^ ERROR link kind `raw-dylib` is unstable on x86 +//~| ERROR import name type is unstable +extern "C" {} + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-import-name-type.stderr b/src/test/ui/feature-gates/feature-gate-raw-dylib-import-name-type.stderr new file mode 100644 index 000000000..d6b165b76 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib-import-name-type.stderr @@ -0,0 +1,21 @@ +error[E0658]: link kind `raw-dylib` is unstable on x86 + --> $DIR/feature-gate-raw-dylib-import-name-type.rs:3:29 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] + | ^^^^^^^^^^^ + | + = note: see issue #58713 for more information + = help: add `#![feature(raw_dylib)]` to the crate attributes to enable + +error[E0658]: import name type is unstable + --> $DIR/feature-gate-raw-dylib-import-name-type.rs:3:61 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] + | ^^^^^^^^^^^ + | + = note: see issue #58713 for more information + = help: add `#![feature(raw_dylib)]` 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/src/test/ui/feature-gates/feature-gate-raw-dylib.rs b/src/test/ui/feature-gates/feature-gate-raw-dylib.rs index f894f517b..291cca8fd 100644 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib.rs +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib.rs @@ -1,6 +1,7 @@ // only-windows +// only-x86 #[link(name = "foo", kind = "raw-dylib")] -//~^ ERROR: link kind `raw-dylib` is unstable +//~^ ERROR: link kind `raw-dylib` is unstable on x86 extern "C" {} fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib.stderr b/src/test/ui/feature-gates/feature-gate-raw-dylib.stderr index ca7a61f64..f02241e49 100644 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib.stderr +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib.stderr @@ -1,5 +1,5 @@ -error[E0658]: link kind `raw-dylib` is unstable - --> $DIR/feature-gate-raw-dylib.rs:2:29 +error[E0658]: link kind `raw-dylib` is unstable on x86 + --> $DIR/feature-gate-raw-dylib.rs:3:29 | LL | #[link(name = "foo", kind = "raw-dylib")] | ^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-register_attr.rs b/src/test/ui/feature-gates/feature-gate-register_attr.rs deleted file mode 100644 index 36dce2aa7..000000000 --- a/src/test/ui/feature-gates/feature-gate-register_attr.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![register_attr(attr)] //~ ERROR the `#[register_attr]` attribute is an experimental feature - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-register_attr.stderr b/src/test/ui/feature-gates/feature-gate-register_attr.stderr deleted file mode 100644 index 8ca3845d2..000000000 --- a/src/test/ui/feature-gates/feature-gate-register_attr.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: the `#[register_attr]` attribute is an experimental feature - --> $DIR/feature-gate-register_attr.rs:1:1 - | -LL | #![register_attr(attr)] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #66080 for more information - = help: add `#![feature(register_attr)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs b/src/test/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs new file mode 100644 index 000000000..de7966c66 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs @@ -0,0 +1,5 @@ +trait Foo { + fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return +} + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr b/src/test/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr new file mode 100644 index 000000000..36177bbe1 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr @@ -0,0 +1,12 @@ +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return + --> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:2:17 + | +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: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/feature-gates/feature-gate-unix_sigpipe.rs b/src/test/ui/feature-gates/feature-gate-unix_sigpipe.rs new file mode 100644 index 000000000..46dc3f6cc --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-unix_sigpipe.rs @@ -0,0 +1,4 @@ +#![crate_type = "bin"] + +#[unix_sigpipe = "inherit"] //~ the `#[unix_sigpipe]` attribute is an experimental feature +fn main () {} diff --git a/src/test/ui/feature-gates/feature-gate-unix_sigpipe.stderr b/src/test/ui/feature-gates/feature-gate-unix_sigpipe.stderr new file mode 100644 index 000000000..cf3284467 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-unix_sigpipe.stderr @@ -0,0 +1,12 @@ +error[E0658]: the `#[unix_sigpipe]` attribute is an experimental feature + --> $DIR/feature-gate-unix_sigpipe.rs:3:1 + | +LL | #[unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #97889 for more information + = help: add `#![feature(unix_sigpipe)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/soft-syntax-gates-with-errors.rs b/src/test/ui/feature-gates/soft-syntax-gates-with-errors.rs new file mode 100644 index 000000000..49f1cba71 --- /dev/null +++ b/src/test/ui/feature-gates/soft-syntax-gates-with-errors.rs @@ -0,0 +1,30 @@ +// check-fail +// This file is used to test the behavior of the early-pass syntax warnings. +// If macro syntax is stabilized, replace with a different unstable syntax. + +macro a() {} +//~^ ERROR: `macro` is experimental + +#[cfg(FALSE)] +macro b() {} + +macro_rules! identity { + ($($x:tt)*) => ($($x)*); +} + +identity! { + macro c() {} + //~^ ERROR: `macro` is experimental +} + +#[cfg(FALSE)] +identity! { + macro d() {} // No error +} + +identity! { + #[cfg(FALSE)] + macro e() {} +} + +fn main() {} diff --git a/src/test/ui/feature-gates/soft-syntax-gates-with-errors.stderr b/src/test/ui/feature-gates/soft-syntax-gates-with-errors.stderr new file mode 100644 index 000000000..49550d811 --- /dev/null +++ b/src/test/ui/feature-gates/soft-syntax-gates-with-errors.stderr @@ -0,0 +1,21 @@ +error[E0658]: `macro` is experimental + --> $DIR/soft-syntax-gates-with-errors.rs:5:1 + | +LL | macro a() {} + | ^^^^^^^^^^^^ + | + = note: see issue #39412 for more information + = help: add `#![feature(decl_macro)]` to the crate attributes to enable + +error[E0658]: `macro` is experimental + --> $DIR/soft-syntax-gates-with-errors.rs:16:5 + | +LL | macro c() {} + | ^^^^^^^^^^^^ + | + = note: see issue #39412 for more information + = help: add `#![feature(decl_macro)]` 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/src/test/ui/feature-gates/soft-syntax-gates-without-errors.rs b/src/test/ui/feature-gates/soft-syntax-gates-without-errors.rs new file mode 100644 index 000000000..ca4ad2320 --- /dev/null +++ b/src/test/ui/feature-gates/soft-syntax-gates-without-errors.rs @@ -0,0 +1,26 @@ +// check-pass +// This file is used to test the behavior of the early-pass syntax warnings. +// If macro syntax is stabilized, replace with a different unstable syntax. + +#[cfg(FALSE)] +macro b() {} +//~^ WARN: `macro` is experimental +//~| WARN: unstable syntax + +macro_rules! identity { + ($($x:tt)*) => ($($x)*); +} + +#[cfg(FALSE)] +identity! { + macro d() {} // No error +} + +identity! { + #[cfg(FALSE)] + macro e() {} + //~^ WARN: `macro` is experimental + //~| WARN: unstable syntax +} + +fn main() {} diff --git a/src/test/ui/feature-gates/soft-syntax-gates-without-errors.stderr b/src/test/ui/feature-gates/soft-syntax-gates-without-errors.stderr new file mode 100644 index 000000000..3d9c22e54 --- /dev/null +++ b/src/test/ui/feature-gates/soft-syntax-gates-without-errors.stderr @@ -0,0 +1,24 @@ +warning: `macro` is experimental + --> $DIR/soft-syntax-gates-without-errors.rs:6:1 + | +LL | macro b() {} + | ^^^^^^^^^^^^ + | + = note: see issue #39412 for more information + = help: add `#![feature(decl_macro)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: `macro` is experimental + --> $DIR/soft-syntax-gates-without-errors.rs:21:5 + | +LL | macro e() {} + | ^^^^^^^^^^^^ + | + = note: see issue #39412 for more information + = help: add `#![feature(decl_macro)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: 2 warnings emitted + diff --git a/src/test/ui/fmt/ifmt-bad-arg.rs b/src/test/ui/fmt/ifmt-bad-arg.rs index 84f4cc7f4..f00cb05c9 100644 --- a/src/test/ui/fmt/ifmt-bad-arg.rs +++ b/src/test/ui/fmt/ifmt-bad-arg.rs @@ -94,4 +94,6 @@ tenth number: {}", // doesn't exist. println!("{:.*}"); //~^ ERROR 2 positional arguments in format string, but no arguments were given + println!("{:.0$}"); + //~^ ERROR 1 positional argument in format string, but no arguments were given } diff --git a/src/test/ui/fmt/ifmt-bad-arg.stderr b/src/test/ui/fmt/ifmt-bad-arg.stderr index 5439ee173..dbb4bc6d9 100644 --- a/src/test/ui/fmt/ifmt-bad-arg.stderr +++ b/src/test/ui/fmt/ifmt-bad-arg.stderr @@ -273,6 +273,17 @@ LL | println!("{:.*}"); = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html +error: 1 positional argument in format string, but no arguments were given + --> $DIR/ifmt-bad-arg.rs:97:15 + | +LL | println!("{:.0$}"); + | ^^---^ + | | + | this precision flag expects an `usize` argument at position 0, but no arguments were given + | + = note: positional arguments are zero-based + = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html + error[E0425]: cannot find value `foo` in this scope --> $DIR/ifmt-bad-arg.rs:27:18 | @@ -339,7 +350,7 @@ LL | pub fn from_usize(x: &usize) -> ArgumentV1<'_> { | ^^^^^^^^^^ = 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 37 previous errors +error: aborting due to 38 previous errors Some errors have detailed explanations: E0308, E0425. For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/fmt/ifmt-unimpl.stderr b/src/test/ui/fmt/ifmt-unimpl.stderr index dbcb2eb66..0e34f9135 100644 --- a/src/test/ui/fmt/ifmt-unimpl.stderr +++ b/src/test/ui/fmt/ifmt-unimpl.stderr @@ -14,7 +14,7 @@ LL | format!("{:X}", "3"); NonZeroI8 NonZeroIsize and 21 others - = note: required because of the requirements on the impl of `UpperHex` for `&str` + = note: required for `&str` to implement `UpperHex` note: required by a bound in `ArgumentV1::<'a>::new_upper_hex` --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | diff --git a/src/test/ui/fmt/send-sync.stderr b/src/test/ui/fmt/send-sync.stderr index 7c7a3c884..3ed040c3a 100644 --- a/src/test/ui/fmt/send-sync.stderr +++ b/src/test/ui/fmt/send-sync.stderr @@ -1,14 +1,16 @@ error[E0277]: `core::fmt::Opaque` cannot be shared between threads safely - --> $DIR/send-sync.rs:8:5 + --> $DIR/send-sync.rs:8:10 | LL | send(format_args!("{:?}", c)); - | ^^^^ `core::fmt::Opaque` cannot be shared between threads safely + | ---- ^^^^^^^^^^^^^^^^^^^^^^^ `core::fmt::Opaque` cannot be shared between threads safely + | | + | required by a bound introduced by this call | = help: within `[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 because of the requirements on the impl of `Send` for `&[ArgumentV1<'_>]` + = note: required for `&[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 @@ -17,10 +19,12 @@ LL | fn send(_: T) {} | ^^^^ required by this bound in `send` error[E0277]: `core::fmt::Opaque` cannot be shared between threads safely - --> $DIR/send-sync.rs:9:5 + --> $DIR/send-sync.rs:9:10 | LL | sync(format_args!("{:?}", c)); - | ^^^^ `core::fmt::Opaque` cannot be shared between threads safely + | ---- ^^^^^^^^^^^^^^^^^^^^^^^ `core::fmt::Opaque` cannot be shared between threads safely + | | + | required by a bound introduced by this call | = help: within `Arguments<'_>`, the trait `Sync` is not implemented for `core::fmt::Opaque` = note: required because it appears within the type `&core::fmt::Opaque` diff --git a/src/test/ui/fn/fn-compare-mismatch.stderr b/src/test/ui/fn/fn-compare-mismatch.stderr index 096440225..df838cb11 100644 --- a/src/test/ui/fn/fn-compare-mismatch.stderr +++ b/src/test/ui/fn/fn-compare-mismatch.stderr @@ -6,14 +6,10 @@ LL | let x = f == g; | | | fn() {f} | -help: you might have forgotten to call this function +help: use parentheses to call these | -LL | let x = f() == g; - | ++ -help: you might have forgotten to call this function - | -LL | let x = f == g(); - | ++ +LL | let x = f() == g(); + | ++ ++ error[E0308]: mismatched types --> $DIR/fn-compare-mismatch.rs:4:18 diff --git a/src/test/ui/fn/fn-item-type.stderr b/src/test/ui/fn/fn-item-type.stderr index ecc6485d6..f03a47d5c 100644 --- a/src/test/ui/fn/fn-item-type.stderr +++ b/src/test/ui/fn/fn-item-type.stderr @@ -15,7 +15,7 @@ note: function defined here --> $DIR/fn-item-type.rs:7:4 | LL | fn eq(x: T, y: T) { } - | ^^ ---- ---- + | ^^ ---- error[E0308]: mismatched types --> $DIR/fn-item-type.rs:22:19 @@ -34,7 +34,7 @@ note: function defined here --> $DIR/fn-item-type.rs:7:4 | LL | fn eq(x: T, y: T) { } - | ^^ ---- ---- + | ^^ ---- error[E0308]: mismatched types --> $DIR/fn-item-type.rs:29:23 @@ -53,7 +53,7 @@ note: function defined here --> $DIR/fn-item-type.rs:7:4 | LL | fn eq(x: T, y: T) { } - | ^^ ---- ---- + | ^^ ---- error[E0308]: mismatched types --> $DIR/fn-item-type.rs:38:26 @@ -72,7 +72,7 @@ note: function defined here --> $DIR/fn-item-type.rs:7:4 | LL | fn eq(x: T, y: T) { } - | ^^ ---- ---- + | ^^ ---- error[E0308]: mismatched types --> $DIR/fn-item-type.rs:45:19 @@ -90,7 +90,7 @@ note: function defined here --> $DIR/fn-item-type.rs:7:4 | LL | fn eq(x: T, y: T) { } - | ^^ ---- ---- + | ^^ ---- error: aborting due to 5 previous errors diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr index ea88e401b..2a674d3c1 100644 --- a/src/test/ui/fn/fn-trait-formatting.stderr +++ b/src/test/ui/fn/fn-trait-formatting.stderr @@ -8,6 +8,10 @@ LL | let _: () = Box::new(|_: isize| {}) as Box; | = note: expected unit type `()` found struct `Box` +help: use parentheses to call this trait object + | +LL | let _: () = (Box::new(|_: isize| {}) as Box)(/* isize */); + | + ++++++++++++++ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:10:17 @@ -19,6 +23,10 @@ LL | let _: () = Box::new(|_: isize, isize| {}) as Box | = note: expected unit type `()` found struct `Box` +help: use parentheses to call this trait object + | +LL | let _: () = (Box::new(|_: isize, isize| {}) as Box)(/* isize */, /* isize */); + | + +++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:14:17 diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs index 5a92bcd37..5d9245556 100644 --- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs @@ -1,4 +1,4 @@ -// check-pass +// check-fail trait Trait { type Type; @@ -17,6 +17,7 @@ where fn g<'a, 'b>() { f::<'a, 'b>(()); + //~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr new file mode 100644 index 000000000..0c3df04ea --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.stderr @@ -0,0 +1,17 @@ +error: lifetime may not live long enough + --> $DIR/implied-bounds-unnorm-associated-type-2.rs:19:5 + | +LL | fn g<'a, 'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | f::<'a, 'b>(()); + | ^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` + = note: requirement occurs because of a function pointer to `f` + = note: the function `f` is invariant over the parameter `'a` + = help: see for more information about variance + +error: aborting due to previous error + diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs index dc25ac086..888f74cf6 100644 --- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.rs @@ -1,6 +1,4 @@ -// check-fail -// See issue #91899. If we treat unnormalized args as WF, `Self` can also be a -// source of unsoundness. +// check-pass pub trait Yokeable<'a>: 'static { type Output: 'a; @@ -17,7 +15,6 @@ pub trait ZeroCopyFrom: for<'a> Yokeable<'a> { impl ZeroCopyFrom<[T]> for &'static [T] { fn zero_copy_from<'b>(cart: &'b [T]) -> &'b [T] { - //~^ the parameter cart } } diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.stderr deleted file mode 100644 index 95cf4fb16..000000000 --- a/src/test/ui/fn/implied-bounds-unnorm-associated-type-3.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/implied-bounds-unnorm-associated-type-3.rs:19:5 - | -LL | fn zero_copy_from<'b>(cart: &'b [T]) -> &'b [T] { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `[T]` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | impl ZeroCopyFrom<[T]> for &'static [T] { - | +++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs new file mode 100644 index 000000000..12859252c --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.rs @@ -0,0 +1,24 @@ +// A regression test for #98543 + +trait Trait { + type Type; +} + +impl Trait for T { + type Type = (); +} + +fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str +where + &'a &'b (): Trait, // <- adding this bound is the change from #91068 +{ + s +} + +fn main() { + let x = String::from("Hello World!"); + let y = f(&x, ()); + drop(x); + //~^ ERROR cannot move out of `x` because it is borrowed + println!("{}", y); +} diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr new file mode 100644 index 000000000..fcbaa91d1 --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type-4.stderr @@ -0,0 +1,14 @@ +error[E0505]: cannot move out of `x` because it is borrowed + --> $DIR/implied-bounds-unnorm-associated-type-4.rs:21:10 + | +LL | let y = f(&x, ()); + | -- borrow of `x` occurs here +LL | drop(x); + | ^ move out of `x` occurs here +LL | +LL | println!("{}", y); + | - borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0505`. diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs new file mode 100644 index 000000000..2a9a6a8cc --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.rs @@ -0,0 +1,23 @@ +trait Trait<'a>: 'a { + type Type; +} + +// if the `T: 'a` bound gets implied we would probably get ub here again +impl<'a, T> Trait<'a> for T { + //~^ ERROR the parameter type `T` may not live long enough + type Type = (); +} + +fn f<'a, 'b>(s: &'b str, _: <&'b () as Trait<'a>>::Type) -> &'a str +where + &'b (): Trait<'a>, +{ + s +} + +fn main() { + let x = String::from("Hello World!"); + let y = f(&x, ()); + drop(x); + println!("{}", y); +} diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr new file mode 100644 index 000000000..458756a3d --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type-5.stderr @@ -0,0 +1,19 @@ +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/implied-bounds-unnorm-associated-type-5.rs:6:13 + | +LL | impl<'a, T> Trait<'a> for T { + | ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/implied-bounds-unnorm-associated-type-5.rs:1:18 + | +LL | trait Trait<'a>: 'a { + | ^^ +help: consider adding an explicit lifetime bound... + | +LL | impl<'a, T: 'a> Trait<'a> for T { + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs index 04b6f4dd8..d58d25036 100644 --- a/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs @@ -1,6 +1,6 @@ // check-fail -// See issue #91068. Types in the substs of an associated type can't be implied -// to be WF, since they don't actually have to be constructed. +// See issue #91068. We check that the unnormalized associated types in +// function signatures are implied trait Trait { type Type; @@ -12,12 +12,12 @@ impl Trait for T { fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { s - //~^ ERROR lifetime may not live long enough } fn main() { let x = String::from("Hello World!"); let y = f(&x, ()); drop(x); + //~^ ERROR cannot move out of `x` because it is borrowed println!("{}", y); } diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr index 8096f0838..e35f46e44 100644 --- a/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr @@ -1,14 +1,14 @@ -error: lifetime may not live long enough - --> $DIR/implied-bounds-unnorm-associated-type.rs:14:5 +error[E0505]: cannot move out of `x` because it is borrowed + --> $DIR/implied-bounds-unnorm-associated-type.rs:20:10 | -LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | s - | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` - | - = help: consider adding the following bound: `'b: 'a` +LL | let y = f(&x, ()); + | -- borrow of `x` occurs here +LL | drop(x); + | ^ move out of `x` occurs here +LL | +LL | println!("{}", y); + | - borrow later used here error: aborting due to previous error +For more information about this error, try `rustc --explain E0505`. diff --git a/src/test/ui/for-loop-while/break-while-condition.stderr b/src/test/ui/for-loop-while/break-while-condition.stderr index 6960c4fd8..e79f6a75f 100644 --- a/src/test/ui/for-loop-while/break-while-condition.stderr +++ b/src/test/ui/for-loop-while/break-while-condition.stderr @@ -31,6 +31,14 @@ LL | | } | = note: expected type `!` found unit type `()` +note: the function expects a value to always be returned, but loops might run zero times + --> $DIR/break-while-condition.rs:24:13 + | +LL | while false { + | ^^^^^^^^^^^ this might have zero elements to iterate on +LL | return + | ------ if the loop doesn't execute, this value would never get returned + = help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility error: aborting due to 3 previous errors diff --git a/src/test/ui/for-loop-while/label_break_value.rs b/src/test/ui/for-loop-while/label_break_value.rs index ca9d71a7a..10992c505 100644 --- a/src/test/ui/for-loop-while/label_break_value.rs +++ b/src/test/ui/for-loop-while/label_break_value.rs @@ -1,7 +1,6 @@ // run-pass #![allow(dead_code)] #![allow(unused_assignments)] -#![feature(label_break_value)] // Test control flow to follow label_break_value semantics fn label_break(a: bool, b: bool) -> u32 { diff --git a/src/test/ui/for-loop-while/label_break_value_invalid.rs b/src/test/ui/for-loop-while/label_break_value_invalid.rs index 149bf17b8..fcf2e0f29 100644 --- a/src/test/ui/for-loop-while/label_break_value_invalid.rs +++ b/src/test/ui/for-loop-while/label_break_value_invalid.rs @@ -1,5 +1,4 @@ #![crate_type = "lib"] -#![feature(label_break_value)] fn lbv_macro_test_hygiene_respected() { macro_rules! mac2 { diff --git a/src/test/ui/for-loop-while/label_break_value_invalid.stderr b/src/test/ui/for-loop-while/label_break_value_invalid.stderr index 7182b8f59..f6999c4ab 100644 --- a/src/test/ui/for-loop-while/label_break_value_invalid.stderr +++ b/src/test/ui/for-loop-while/label_break_value_invalid.stderr @@ -1,5 +1,5 @@ error[E0426]: use of undeclared label `'a` - --> $DIR/label_break_value_invalid.rs:7:19 + --> $DIR/label_break_value_invalid.rs:6:19 | LL | break 'a $val; | ^^ undeclared label `'a` @@ -10,7 +10,7 @@ LL | mac2!(2); = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0426]: use of undeclared label `'a` - --> $DIR/label_break_value_invalid.rs:29:19 + --> $DIR/label_break_value_invalid.rs:28:19 | LL | let x: u8 = mac3!('b: { | -- a label with a similar name is reachable @@ -22,7 +22,7 @@ LL | break 'a 3; | help: try using similarly named label: `'b` error[E0426]: use of undeclared label `'a` - --> $DIR/label_break_value_invalid.rs:34:29 + --> $DIR/label_break_value_invalid.rs:33:29 | LL | let x: u8 = mac3!(break 'a 4); | ^^ undeclared label `'a` diff --git a/src/test/ui/for/for-c-in-str.rs b/src/test/ui/for/for-c-in-str.rs index 86a1c1a34..b086128d2 100644 --- a/src/test/ui/for/for-c-in-str.rs +++ b/src/test/ui/for/for-c-in-str.rs @@ -5,7 +5,7 @@ fn main() { //~^ ERROR `&str` is not an iterator //~| NOTE `&str` is not an iterator //~| HELP the trait `Iterator` is not implemented for `&str` - //~| NOTE required because of the requirements on the impl of `IntoIterator` for `&str` + //~| NOTE required for `&str` to implement `IntoIterator` //~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop diff --git a/src/test/ui/for/for-c-in-str.stderr b/src/test/ui/for/for-c-in-str.stderr index 07ddc8ea7..959a7c43f 100644 --- a/src/test/ui/for/for-c-in-str.stderr +++ b/src/test/ui/for/for-c-in-str.stderr @@ -5,7 +5,7 @@ LL | for c in "asdf" { | ^^^^^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()` | = help: the trait `Iterator` is not implemented for `&str` - = note: required because of the requirements on the impl of `IntoIterator` for `&str` + = note: required for `&str` to implement `IntoIterator` error: aborting due to previous error diff --git a/src/test/ui/for/for-loop-bogosity.stderr b/src/test/ui/for/for-loop-bogosity.stderr index 0bdd75b35..9bf8056e8 100644 --- a/src/test/ui/for/for-loop-bogosity.stderr +++ b/src/test/ui/for/for-loop-bogosity.stderr @@ -5,7 +5,7 @@ LL | for x in bogus { | ^^^^^ `MyStruct` is not an iterator | = help: the trait `Iterator` is not implemented for `MyStruct` - = note: required because of the requirements on the impl of `IntoIterator` for `MyStruct` + = note: required for `MyStruct` to implement `IntoIterator` error: aborting due to previous error diff --git a/src/test/ui/functions-closures/fn-help-with-err.rs b/src/test/ui/functions-closures/fn-help-with-err.rs index 3d2bcb8ad..49a514a8b 100644 --- a/src/test/ui/functions-closures/fn-help-with-err.rs +++ b/src/test/ui/functions-closures/fn-help-with-err.rs @@ -1,16 +1,28 @@ // This test case checks the behavior of typeck::check::method::suggest::is_fn on Ty::Error. + +struct Foo; + +trait Bar { + //~^ NOTE `Bar` defines an item `bar`, perhaps you need to implement it + //~| NOTE `Bar` defines an item `bar`, perhaps you need to implement it + fn bar(&self) {} +} + +impl Bar for Foo {} + fn main() { let arc = std::sync::Arc::new(oops); //~^ ERROR cannot find value `oops` in this scope //~| NOTE not found - // The error "note: this is a function, perhaps you wish to call it" MUST NOT appear. - arc.blablabla(); - //~^ ERROR no method named `blablabla` + arc.bar(); + //~^ ERROR no method named `bar` //~| NOTE method not found - let arc2 = std::sync::Arc::new(|| 1); - // The error "note: this is a function, perhaps you wish to call it" SHOULD appear - arc2.blablabla(); - //~^ ERROR no method named `blablabla` + //~| HELP items from traits can only be used if the trait is implemented and in scope + + let arc2 = std::sync::Arc::new(|| Foo); + arc2.bar(); + //~^ ERROR no method named `bar` //~| NOTE method not found - //~| NOTE this is a function, perhaps you wish to call it + //~| HELP items from traits can only be used if the trait is implemented and in scope + //~| HELP use parentheses to call this closure } diff --git a/src/test/ui/functions-closures/fn-help-with-err.stderr b/src/test/ui/functions-closures/fn-help-with-err.stderr index 06e29daef..229666621 100644 --- a/src/test/ui/functions-closures/fn-help-with-err.stderr +++ b/src/test/ui/functions-closures/fn-help-with-err.stderr @@ -1,22 +1,38 @@ error[E0425]: cannot find value `oops` in this scope - --> $DIR/fn-help-with-err.rs:3:35 + --> $DIR/fn-help-with-err.rs:14:35 | LL | let arc = std::sync::Arc::new(oops); | ^^^^ not found in this scope -error[E0599]: no method named `blablabla` found for struct `Arc<_>` in the current scope - --> $DIR/fn-help-with-err.rs:7:9 +error[E0599]: no method named `bar` found for struct `Arc<_>` in the current scope + --> $DIR/fn-help-with-err.rs:17:9 | -LL | arc.blablabla(); - | ^^^^^^^^^ method not found in `Arc<_>` +LL | arc.bar(); + | ^^^ method not found in `Arc<_>` + | + = help: items from traits can only be used if the trait is implemented and in scope +note: `Bar` defines an item `bar`, perhaps you need to implement it + --> $DIR/fn-help-with-err.rs:5:1 + | +LL | trait Bar { + | ^^^^^^^^^ -error[E0599]: no method named `blablabla` found for struct `Arc<[closure@$DIR/fn-help-with-err.rs:10:36: 10:38]>` in the current scope - --> $DIR/fn-help-with-err.rs:12:10 +error[E0599]: no method named `bar` found for struct `Arc<[closure@$DIR/fn-help-with-err.rs:22:36: 22:38]>` in the current scope + --> $DIR/fn-help-with-err.rs:23:10 + | +LL | arc2.bar(); + | ^^^ method not found in `Arc<[closure@$DIR/fn-help-with-err.rs:22:36: 22:38]>` + | + = help: items from traits can only be used if the trait is implemented and in scope +note: `Bar` defines an item `bar`, perhaps you need to implement it + --> $DIR/fn-help-with-err.rs:5:1 + | +LL | trait Bar { + | ^^^^^^^^^ +help: use parentheses to call this closure | -LL | arc2.blablabla(); - | ---- ^^^^^^^^^ method not found in `Arc<[closure@$DIR/fn-help-with-err.rs:10:36: 10:38]>` - | | - | this is a function, perhaps you wish to call it +LL | arc2().bar(); + | ++ error: aborting due to 3 previous errors diff --git a/src/test/ui/generator/clone-impl-async.rs b/src/test/ui/generator/clone-impl-async.rs new file mode 100644 index 000000000..83c51526b --- /dev/null +++ b/src/test/ui/generator/clone-impl-async.rs @@ -0,0 +1,71 @@ +// edition:2021 +// gate-test-generator_clone +// Verifies that feature(generator_clone) doesn't allow async blocks to be cloned/copied. + +#![feature(generators, generator_clone)] + +use std::future::ready; + +struct NonClone; + +fn main() { + let inner_non_clone = async { + let non_clone = NonClone; + let () = ready(()).await; + drop(non_clone); + }; + check_copy(&inner_non_clone); + //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + check_clone(&inner_non_clone); + //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + + let non_clone = NonClone; + let outer_non_clone = async move { + drop(non_clone); + }; + check_copy(&outer_non_clone); + //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + check_clone(&outer_non_clone); + //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + + let maybe_copy_clone = async move {}; + check_copy(&maybe_copy_clone); + //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + check_clone(&maybe_copy_clone); + //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + + let inner_non_clone_fn = the_inner_non_clone_fn(); + check_copy(&inner_non_clone_fn); + //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + check_clone(&inner_non_clone_fn); + //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + + let outer_non_clone_fn = the_outer_non_clone_fn(NonClone); + check_copy(&outer_non_clone_fn); + //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + check_clone(&outer_non_clone_fn); + //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + + let maybe_copy_clone_fn = the_maybe_copy_clone_fn(); + check_copy(&maybe_copy_clone_fn); + //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + check_clone(&maybe_copy_clone_fn); + //~^ ERROR the trait bound `impl Future: Clone` is not satisfied +} + +async fn the_inner_non_clone_fn() { + let non_clone = NonClone; + let () = ready(()).await; + drop(non_clone); +} + +async fn the_outer_non_clone_fn(non_clone: NonClone) { + let () = ready(()).await; + drop(non_clone); +} + +async fn the_maybe_copy_clone_fn() { +} + +fn check_copy(_x: &T) {} +fn check_clone(_x: &T) {} diff --git a/src/test/ui/generator/clone-impl-async.stderr b/src/test/ui/generator/clone-impl-async.stderr new file mode 100644 index 000000000..cbb58d2af --- /dev/null +++ b/src/test/ui/generator/clone-impl-async.stderr @@ -0,0 +1,171 @@ +error[E0277]: the trait bound `impl Future: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:17:16 + | +LL | check_copy(&inner_non_clone); + | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_copy` + --> $DIR/clone-impl-async.rs:70:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `impl Future: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:19:17 + | +LL | check_clone(&inner_non_clone); + | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_clone` + --> $DIR/clone-impl-async.rs:71:19 + | +LL | fn check_clone(_x: &T) {} + | ^^^^^ required by this bound in `check_clone` + +error[E0277]: the trait bound `impl Future: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:26:16 + | +LL | check_copy(&outer_non_clone); + | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_copy` + --> $DIR/clone-impl-async.rs:70:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `impl Future: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:28:17 + | +LL | check_clone(&outer_non_clone); + | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_clone` + --> $DIR/clone-impl-async.rs:71:19 + | +LL | fn check_clone(_x: &T) {} + | ^^^^^ required by this bound in `check_clone` + +error[E0277]: the trait bound `impl Future: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:32:16 + | +LL | check_copy(&maybe_copy_clone); + | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_copy` + --> $DIR/clone-impl-async.rs:70:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `impl Future: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:34:17 + | +LL | check_clone(&maybe_copy_clone); + | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_clone` + --> $DIR/clone-impl-async.rs:71:19 + | +LL | fn check_clone(_x: &T) {} + | ^^^^^ required by this bound in `check_clone` + +error[E0277]: the trait bound `impl Future: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:38:16 + | +LL | check_copy(&inner_non_clone_fn); + | ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_copy` + --> $DIR/clone-impl-async.rs:70:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `impl Future: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:40:17 + | +LL | check_clone(&inner_non_clone_fn); + | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_clone` + --> $DIR/clone-impl-async.rs:71:19 + | +LL | fn check_clone(_x: &T) {} + | ^^^^^ required by this bound in `check_clone` + +error[E0277]: the trait bound `impl Future: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:44:16 + | +LL | check_copy(&outer_non_clone_fn); + | ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_copy` + --> $DIR/clone-impl-async.rs:70:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `impl Future: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:46:17 + | +LL | check_clone(&outer_non_clone_fn); + | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_clone` + --> $DIR/clone-impl-async.rs:71:19 + | +LL | fn check_clone(_x: &T) {} + | ^^^^^ required by this bound in `check_clone` + +error[E0277]: the trait bound `impl Future: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:50:16 + | +LL | check_copy(&maybe_copy_clone_fn); + | ---------- ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_copy` + --> $DIR/clone-impl-async.rs:70:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `impl Future: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:52:17 + | +LL | check_clone(&maybe_copy_clone_fn); + | ----------- ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_clone` + --> $DIR/clone-impl-async.rs:71:19 + | +LL | fn check_clone(_x: &T) {} + | ^^^^^ required by this bound in `check_clone` + +error: aborting due to 12 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/generator/clone-impl-static.rs b/src/test/ui/generator/clone-impl-static.rs new file mode 100644 index 000000000..55ed0f281 --- /dev/null +++ b/src/test/ui/generator/clone-impl-static.rs @@ -0,0 +1,17 @@ +// gate-test-generator_clone +// Verifies that static generators cannot be cloned/copied. + +#![feature(generators, generator_clone)] + +fn main() { + let gen = static move || { + yield; + }; + check_copy(&gen); + //~^ ERROR Copy` is not satisfied + check_clone(&gen); + //~^ ERROR Clone` is not satisfied +} + +fn check_copy(_x: &T) {} +fn check_clone(_x: &T) {} diff --git a/src/test/ui/generator/clone-impl-static.stderr b/src/test/ui/generator/clone-impl-static.stderr new file mode 100644 index 000000000..cbadf6f15 --- /dev/null +++ b/src/test/ui/generator/clone-impl-static.stderr @@ -0,0 +1,31 @@ +error[E0277]: the trait bound `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]: Copy` is not satisfied + --> $DIR/clone-impl-static.rs:10:16 + | +LL | check_copy(&gen); + | ---------- ^^^^ the trait `Copy` is not implemented for `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_copy` + --> $DIR/clone-impl-static.rs:16:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]: Clone` is not satisfied + --> $DIR/clone-impl-static.rs:12:17 + | +LL | check_clone(&gen); + | ----------- ^^^^ the trait `Clone` is not implemented for `[static generator@$DIR/clone-impl-static.rs:7:15: 7:29]` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check_clone` + --> $DIR/clone-impl-static.rs:17:19 + | +LL | fn check_clone(_x: &T) {} + | ^^^^^ required by this bound in `check_clone` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/generator/clone-impl.rs b/src/test/ui/generator/clone-impl.rs new file mode 100644 index 000000000..cbfd65a53 --- /dev/null +++ b/src/test/ui/generator/clone-impl.rs @@ -0,0 +1,73 @@ +// gate-test-generator_clone +// Verifies that non-static generators can be cloned/copied if all their upvars and locals held +// across awaits can be cloned/copied. + +#![feature(generators, generator_clone)] + +struct NonClone; + +fn main() { + let copyable: u32 = 123; + let clonable_0: Vec = Vec::new(); + let clonable_1: Vec = Vec::new(); + let non_clonable: NonClone = NonClone; + + let gen_copy_0 = move || { + yield; + drop(copyable); + }; + check_copy(&gen_copy_0); + check_clone(&gen_copy_0); + let gen_copy_1 = move || { + /* + let v = vec!['a']; + let n = NonClone; + drop(v); + drop(n); + */ + yield; + let v = vec!['a']; + let n = NonClone; + drop(n); + drop(copyable); + }; + check_copy(&gen_copy_1); + check_clone(&gen_copy_1); + let gen_clone_0 = move || { + let v = vec!['a']; + yield; + drop(v); + drop(clonable_0); + }; + check_copy(&gen_clone_0); + //~^ ERROR the trait bound `Vec: Copy` is not satisfied + //~| ERROR the trait bound `Vec: Copy` is not satisfied + check_clone(&gen_clone_0); + let gen_clone_1 = move || { + let v = vec!['a']; + /* + let n = NonClone; + drop(n); + */ + yield; + let n = NonClone; + drop(n); + drop(v); + drop(clonable_1); + }; + check_copy(&gen_clone_1); + //~^ ERROR the trait bound `Vec: Copy` is not satisfied + //~| ERROR the trait bound `Vec: Copy` is not satisfied + check_clone(&gen_clone_1); + let gen_non_clone = move || { + yield; + drop(non_clonable); + }; + check_copy(&gen_non_clone); + //~^ ERROR the trait bound `NonClone: Copy` is not satisfied + check_clone(&gen_non_clone); + //~^ ERROR the trait bound `NonClone: Clone` is not satisfied +} + +fn check_copy(_x: &T) {} +fn check_clone(_x: &T) {} diff --git a/src/test/ui/generator/clone-impl.stderr b/src/test/ui/generator/clone-impl.stderr new file mode 100644 index 000000000..a92646b19 --- /dev/null +++ b/src/test/ui/generator/clone-impl.stderr @@ -0,0 +1,142 @@ +error[E0277]: the trait bound `Vec: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:36:23: 36:30]` + --> $DIR/clone-impl.rs:42:16 + | +LL | let gen_clone_0 = move || { + | ------- within this `[generator@$DIR/clone-impl.rs:36:23: 36:30]` +... +LL | check_copy(&gen_clone_0); + | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:36:23: 36:30]`, the trait `Copy` is not implemented for `Vec` + | +note: captured value does not implement `Copy` + --> $DIR/clone-impl.rs:40:14 + | +LL | drop(clonable_0); + | ^^^^^^^^^^ has type `Vec` which does not implement `Copy` +note: required by a bound in `check_copy` + --> $DIR/clone-impl.rs:72:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `Vec: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:36:23: 36:30]` + --> $DIR/clone-impl.rs:42:16 + | +LL | let gen_clone_0 = move || { + | ------- within this `[generator@$DIR/clone-impl.rs:36:23: 36:30]` +... +LL | check_copy(&gen_clone_0); + | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:36:23: 36:30]`, the trait `Copy` is not implemented for `Vec` + | +note: generator does not implement `Copy` as this value is used across a yield + --> $DIR/clone-impl.rs:38:9 + | +LL | let v = vec!['a']; + | - has type `Vec` which does not implement `Copy` +LL | yield; + | ^^^^^ yield occurs here, with `v` maybe used later +... +LL | }; + | - `v` is later dropped here +note: required by a bound in `check_copy` + --> $DIR/clone-impl.rs:72:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `Vec: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:46:23: 46:30]` + --> $DIR/clone-impl.rs:58:16 + | +LL | let gen_clone_1 = move || { + | ------- within this `[generator@$DIR/clone-impl.rs:46:23: 46:30]` +... +LL | check_copy(&gen_clone_1); + | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:46:23: 46:30]`, the trait `Copy` is not implemented for `Vec` + | +note: captured value does not implement `Copy` + --> $DIR/clone-impl.rs:56:14 + | +LL | drop(clonable_1); + | ^^^^^^^^^^ has type `Vec` which does not implement `Copy` +note: required by a bound in `check_copy` + --> $DIR/clone-impl.rs:72:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `Vec: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:46:23: 46:30]` + --> $DIR/clone-impl.rs:58:16 + | +LL | let gen_clone_1 = move || { + | ------- within this `[generator@$DIR/clone-impl.rs:46:23: 46:30]` +... +LL | check_copy(&gen_clone_1); + | ^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:46:23: 46:30]`, the trait `Copy` is not implemented for `Vec` + | +note: generator does not implement `Copy` as this value is used across a yield + --> $DIR/clone-impl.rs:52:9 + | +LL | let v = vec!['a']; + | - has type `Vec` which does not implement `Copy` +... +LL | yield; + | ^^^^^ yield occurs here, with `v` maybe used later +... +LL | }; + | - `v` is later dropped here +note: required by a bound in `check_copy` + --> $DIR/clone-impl.rs:72:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` + +error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `[generator@$DIR/clone-impl.rs:62:25: 62:32]` + --> $DIR/clone-impl.rs:66:16 + | +LL | let gen_non_clone = move || { + | ------- within this `[generator@$DIR/clone-impl.rs:62:25: 62:32]` +... +LL | check_copy(&gen_non_clone); + | ^^^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:62:25: 62:32]`, the trait `Copy` is not implemented for `NonClone` + | +note: captured value does not implement `Copy` + --> $DIR/clone-impl.rs:64:14 + | +LL | drop(non_clonable); + | ^^^^^^^^^^^^ has type `NonClone` which does not implement `Copy` +note: required by a bound in `check_copy` + --> $DIR/clone-impl.rs:72:18 + | +LL | fn check_copy(_x: &T) {} + | ^^^^ required by this bound in `check_copy` +help: consider annotating `NonClone` with `#[derive(Copy)]` + | +LL | #[derive(Copy)] + | + +error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `[generator@$DIR/clone-impl.rs:62:25: 62:32]` + --> $DIR/clone-impl.rs:68:17 + | +LL | let gen_non_clone = move || { + | ------- within this `[generator@$DIR/clone-impl.rs:62:25: 62:32]` +... +LL | check_clone(&gen_non_clone); + | ^^^^^^^^^^^^^^ within `[generator@$DIR/clone-impl.rs:62:25: 62:32]`, the trait `Clone` is not implemented for `NonClone` + | +note: captured value does not implement `Clone` + --> $DIR/clone-impl.rs:64:14 + | +LL | drop(non_clonable); + | ^^^^^^^^^^^^ has type `NonClone` which does not implement `Clone` +note: required by a bound in `check_clone` + --> $DIR/clone-impl.rs:73:19 + | +LL | fn check_clone(_x: &T) {} + | ^^^^^ required by this bound in `check_clone` +help: consider annotating `NonClone` with `#[derive(Clone)]` + | +LL | #[derive(Clone)] + | + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/generator/drop-tracking-parent-expression.stderr b/src/test/ui/generator/drop-tracking-parent-expression.stderr index 522a300b3..fbf5d6e07 100644 --- a/src/test/ui/generator/drop-tracking-parent-expression.stderr +++ b/src/test/ui/generator/drop-tracking-parent-expression.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:13 + --> $DIR/drop-tracking-parent-expression.rs:24:25 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -41,10 +41,10 @@ LL | fn assert_send(_thing: T) {} = 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:13 + --> $DIR/drop-tracking-parent-expression.rs:24:25 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -83,10 +83,10 @@ LL | fn assert_send(_thing: T) {} = 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:13 + --> $DIR/drop-tracking-parent-expression.rs:24:25 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK diff --git a/src/test/ui/generator/drop-yield-twice.stderr b/src/test/ui/generator/drop-yield-twice.stderr index 5bc6ea560..0808a2c85 100644 --- a/src/test/ui/generator/drop-yield-twice.stderr +++ b/src/test/ui/generator/drop-yield-twice.stderr @@ -1,8 +1,14 @@ error: generator cannot be sent between threads safely - --> $DIR/drop-yield-twice.rs:7:5 + --> $DIR/drop-yield-twice.rs:7:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` +LL | assert_send(|| { + | _________________^ +LL | | let guard = Foo(42); +LL | | yield; +LL | | drop(guard); +LL | | yield; +LL | | }) + | |_____^ generator is not `Send` | = help: within `[generator@$DIR/drop-yield-twice.rs:7:17: 7:19]`, the trait `Send` is not implemented for `Foo` note: generator is not `Send` as this value is used across a yield diff --git a/src/test/ui/generator/generator-yielding-or-returning-itself.stderr b/src/test/ui/generator/generator-yielding-or-returning-itself.stderr index 2a39a08ee..8f5d2429a 100644 --- a/src/test/ui/generator/generator-yielding-or-returning-itself.stderr +++ b/src/test/ui/generator/generator-yielding-or-returning-itself.stderr @@ -1,8 +1,15 @@ error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36] as Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36]` - --> $DIR/generator-yielding-or-returning-itself.rs:15:5 + --> $DIR/generator-yielding-or-returning-itself.rs:15:34 | -LL | want_cyclic_generator_return(|| { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size +LL | want_cyclic_generator_return(|| { + | _____----------------------------_^ + | | | + | | required by a bound introduced by this call +LL | | +LL | | if false { yield None.unwrap(); } +LL | | None.unwrap() +LL | | }) + | |_____^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, @@ -17,10 +24,17 @@ LL | where T: Generator | ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return` error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35] as Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35]` - --> $DIR/generator-yielding-or-returning-itself.rs:28:5 + --> $DIR/generator-yielding-or-returning-itself.rs:28:33 | -LL | want_cyclic_generator_yield(|| { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size +LL | want_cyclic_generator_yield(|| { + | _____---------------------------_^ + | | | + | | required by a bound introduced by this call +LL | | +LL | | if false { yield None.unwrap(); } +LL | | None.unwrap() +LL | | }) + | |_____^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, diff --git a/src/test/ui/generator/issue-68112.rs b/src/test/ui/generator/issue-68112.rs index 3fcef773b..21026f45c 100644 --- a/src/test/ui/generator/issue-68112.rs +++ b/src/test/ui/generator/issue-68112.rs @@ -63,7 +63,8 @@ fn test2() { require_send(send_gen); //~^ ERROR `RefCell` cannot be shared between threads safely //~| NOTE `RefCell` cannot be shared between threads safely - //~| NOTE requirements on the impl + //~| NOTE required for + //~| NOTE required by a bound introduced by this call //~| NOTE captures the following types } diff --git a/src/test/ui/generator/issue-68112.stderr b/src/test/ui/generator/issue-68112.stderr index 1d5b97e98..eb99d42c9 100644 --- a/src/test/ui/generator/issue-68112.stderr +++ b/src/test/ui/generator/issue-68112.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/issue-68112.rs:40:5 + --> $DIR/issue-68112.rs:40:18 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^ 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 @@ -23,13 +23,15 @@ 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:5 + --> $DIR/issue-68112.rs:63:18 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely + | ------------ ^^^^^^^^ `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 because of the requirements on the impl of `Send` for `Arc>` + = note: required for `Arc>` to implement `Send` note: required because it's used within this generator --> $DIR/issue-68112.rs:48:5 | diff --git a/src/test/ui/generator/not-send-sync.stderr b/src/test/ui/generator/not-send-sync.stderr index 0b31bb4fd..a821c57b9 100644 --- a/src/test/ui/generator/not-send-sync.stderr +++ b/src/test/ui/generator/not-send-sync.stderr @@ -1,11 +1,18 @@ error[E0277]: `Cell` cannot be shared between threads safely - --> $DIR/not-send-sync.rs:16:5 + --> $DIR/not-send-sync.rs:16:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ `Cell` cannot be shared between threads safely +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 because of the requirements on the impl of `Send` 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 | @@ -18,10 +25,15 @@ 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:5 - | -LL | assert_sync(|| { - | ^^^^^^^^^^^ generator is not `Sync` + --> $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 diff --git a/src/test/ui/generator/partial-drop.stderr b/src/test/ui/generator/partial-drop.stderr index 1004fc64d..9baafe54e 100644 --- a/src/test/ui/generator/partial-drop.stderr +++ b/src/test/ui/generator/partial-drop.stderr @@ -1,8 +1,15 @@ error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:14:5 + --> $DIR/partial-drop.rs:14:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` +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 @@ -22,10 +29,17 @@ 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:5 + --> $DIR/partial-drop.rs:22:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` +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 @@ -45,10 +59,17 @@ 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:5 + --> $DIR/partial-drop.rs:32:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` +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 diff --git a/src/test/ui/generator/print/generator-print-verbose-1.stderr b/src/test/ui/generator/print/generator-print-verbose-1.stderr index 5b61f1e8f..3a83021dd 100644 --- a/src/test/ui/generator/print/generator-print-verbose-1.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-1.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/generator-print-verbose-1.rs:37:5 + --> $DIR/generator-print-verbose-1.rs:37:18 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^ 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 @@ -21,13 +21,15 @@ 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:5 + --> $DIR/generator-print-verbose-1.rs:56:18 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely + | ------------ ^^^^^^^^ `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 because of the requirements on the impl of `Send` for `Arc>` + = note: required for `Arc>` to implement `Send` note: required because it's used within this generator --> $DIR/generator-print-verbose-1.rs:42:5 | diff --git a/src/test/ui/generator/print/generator-print-verbose-2.stderr b/src/test/ui/generator/print/generator-print-verbose-2.stderr index eb79d2e6e..909e49c38 100644 --- a/src/test/ui/generator/print/generator-print-verbose-2.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-2.stderr @@ -1,11 +1,18 @@ error[E0277]: `Cell` cannot be shared between threads safely - --> $DIR/generator-print-verbose-2.rs:19:5 + --> $DIR/generator-print-verbose-2.rs:19:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ `Cell` cannot be shared between threads safely +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 because of the requirements on the impl of `Send` for `&'_#4r 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 | @@ -18,10 +25,15 @@ 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:5 - | -LL | assert_sync(|| { - | ^^^^^^^^^^^ generator is not `Sync` + --> $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 diff --git a/src/test/ui/generator/type-mismatch-signature-deduction.stderr b/src/test/ui/generator/type-mismatch-signature-deduction.stderr index 7938fc809..b98da1ed8 100644 --- a/src/test/ui/generator/type-mismatch-signature-deduction.stderr +++ b/src/test/ui/generator/type-mismatch-signature-deduction.stderr @@ -11,6 +11,12 @@ note: return type inferred to be `Result<{integer}, _>` here | LL | return Ok(6); | ^^^^^ +help: try wrapping the expression in a variant of `Result` + | +LL | Ok(5) + | +++ + +LL | Err(5) + | ++++ + error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7] as Generator>::Return == i32` --> $DIR/type-mismatch-signature-deduction.rs:5:13 diff --git a/src/test/ui/generator/yield-outside-generator-issue-78653.stderr b/src/test/ui/generator/yield-outside-generator-issue-78653.stderr index ee1afbe5b..dcfb21174 100644 --- a/src/test/ui/generator/yield-outside-generator-issue-78653.stderr +++ b/src/test/ui/generator/yield-outside-generator-issue-78653.stderr @@ -12,7 +12,7 @@ LL | yield || for i in 0 { } | = help: the trait `Iterator` is not implemented for `{integer}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `{integer}` + = note: required for `{integer}` to implement `IntoIterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/generic-associated-types/anonymize-bound-vars.rs b/src/test/ui/generic-associated-types/anonymize-bound-vars.rs index 1ec9c6998..eb7a12412 100644 --- a/src/test/ui/generic-associated-types/anonymize-bound-vars.rs +++ b/src/test/ui/generic-associated-types/anonymize-bound-vars.rs @@ -1,7 +1,6 @@ // check-pass // // regression test for #98702 -#![feature(generic_associated_types)] trait Foo { type Assoc; diff --git a/src/test/ui/generic-associated-types/auxiliary/foo_defn.rs b/src/test/ui/generic-associated-types/auxiliary/foo_defn.rs index 0e8e14852..21a9b3b89 100644 --- a/src/test/ui/generic-associated-types/auxiliary/foo_defn.rs +++ b/src/test/ui/generic-associated-types/auxiliary/foo_defn.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - use std::{future::Future, pin::Pin}; pub trait Foo { diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.rs b/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.rs new file mode 100644 index 000000000..719d1bd5a --- /dev/null +++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.rs @@ -0,0 +1,35 @@ +// check-fail +// known-bug + +// This gives us problems because `for<'a> I::Item<'a>: Debug` should mean "for +// all 'a where I::Item<'a> is WF", but really means "for all 'a possible" + +use std::fmt::Debug; + +pub trait LendingIterator { + type Item<'this> + where + Self: 'this; +} + +pub struct WindowsMut<'x> { + slice: &'x (), +} + +impl<'y> LendingIterator for WindowsMut<'y> { + type Item<'this> = &'this mut () where 'y: 'this; +} + +fn print_items(_iter: I) +where + I: LendingIterator, + for<'a> I::Item<'a>: Debug, +{ +} + +fn main() { + let slice = &mut (); + //~^ temporary value dropped while borrowed + let windows = WindowsMut { slice }; + print_items::>(windows); +} diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr b/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr new file mode 100644 index 000000000..414999881 --- /dev/null +++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-1.stderr @@ -0,0 +1,20 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/hrtb-implied-1.rs:31:22 + | +LL | let slice = &mut (); + | ^^ creates a temporary which is freed while still in use +... +LL | print_items::>(windows); + | -------------------------------------- argument requires that borrow lasts for `'static` +LL | } + | - temporary value is freed at the end of this statement + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/hrtb-implied-1.rs:26:26 + | +LL | for<'a> I::Item<'a>: Debug, + | ^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.rs b/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.rs new file mode 100644 index 000000000..8e6c5348e --- /dev/null +++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.rs @@ -0,0 +1,40 @@ +// check-fail +// known-bug + +// This gives us problems because `for<'a> I::Item<'a>: Debug` should mean "for +// all 'a where I::Item<'a> is WF", but really means "for all 'a possible" + +trait LendingIterator: Sized { + type Item<'a> + where + Self: 'a; + fn next(&mut self) -> Self::Item<'_>; +} +fn fails(iter: &mut I, f: F) -> bool +where + F: FnMut(I::Item<'_>), +{ + let mut iter2 = Eat(iter, f); + let _next = iter2.next(); + //~^ borrowed data escapes + true +} +impl LendingIterator for &mut I { + type Item<'a> = I::Item<'a> where Self:'a; + fn next(&mut self) -> Self::Item<'_> { + (**self).next() + } +} + +struct Eat(I, F); +impl Iterator for Eat +where + F: FnMut(I::Item<'_>), +{ + type Item = (); + fn next(&mut self) -> Option { + None + } +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.stderr b/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.stderr new file mode 100644 index 000000000..1ee270398 --- /dev/null +++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-2.stderr @@ -0,0 +1,22 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/hrtb-implied-2.rs:18:17 + | +LL | fn fails(iter: &mut I, f: F) -> bool + | ---- - let's call the lifetime of this reference `'1` + | | + | `iter` is a reference that is only valid in the function body +... +LL | let _next = iter2.next(); + | ^^^^^^^^^^^^ + | | + | `iter` escapes the function body here + | argument requires that `'1` must outlive `'static` + | + = note: requirement occurs because of a mutable reference to `Eat<&mut I, F>` + = note: mutable references are invariant over their type parameter + = help: see for more information about variance + = note: due to current limitations in the borrow checker, this implies a `'static` lifetime + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.rs b/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.rs new file mode 100644 index 000000000..bc9e6c8ae --- /dev/null +++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.rs @@ -0,0 +1,23 @@ +trait LendingIterator { + type Item<'a> + where + Self: 'a; +} + +impl LendingIterator for &str { + type Item<'a> = () where Self:'a; +} + +fn trivial_bound(_: I) +where + I: LendingIterator, + for<'a> I::Item<'a>: Sized, +{ +} + +fn fails(iter: &str) { + trivial_bound(iter); + //~^ borrowed data escapes +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.stderr b/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.stderr new file mode 100644 index 000000000..c67e02437 --- /dev/null +++ b/src/test/ui/generic-associated-types/bugs/hrtb-implied-3.stderr @@ -0,0 +1,22 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/hrtb-implied-3.rs:19:5 + | +LL | fn fails(iter: &str) { + | ---- - let's call the lifetime of this reference `'1` + | | + | `iter` is a reference that is only valid in the function body +LL | trivial_bound(iter); + | ^^^^^^^^^^^^^^^^^^^ + | | + | `iter` escapes the function body here + | argument requires that `'1` must outlive `'static` + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/hrtb-implied-3.rs:14:26 + | +LL | for<'a> I::Item<'a>: Sized, + | ^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.rs b/src/test/ui/generic-associated-types/bugs/issue-80626.rs index 14f27aff1..f6aa6b36e 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-80626.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-80626.rs @@ -3,8 +3,6 @@ // This should pass, but it requires `Sized` to be coinductive. -#![feature(generic_associated_types)] - trait Allocator { type Allocated; } diff --git a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr index 487b83dfa..9a0f332ed 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-80626.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-80626.stderr @@ -1,11 +1,11 @@ error[E0275]: overflow evaluating the requirement `LinkedList: Sized` - --> $DIR/issue-80626.rs:14:10 + --> $DIR/issue-80626.rs:12:10 | LL | Next(A::Allocated) | ^^^^^^^^^^^^^^^^^^ | note: required by a bound in `Allocator::Allocated` - --> $DIR/issue-80626.rs:9:20 + --> $DIR/issue-80626.rs:7:20 | LL | type Allocated; | ^ required by this bound in `Allocator::Allocated` diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.rs b/src/test/ui/generic-associated-types/bugs/issue-86218.rs index fb62c10a9..3a2d758e7 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-86218.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-86218.rs @@ -3,7 +3,6 @@ // This should pass, but seems to run into a TAIT issue. -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] pub trait Stream { diff --git a/src/test/ui/generic-associated-types/bugs/issue-86218.stderr b/src/test/ui/generic-associated-types/bugs/issue-86218.stderr index fbf1c8f95..de1b464a4 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-86218.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-86218.stderr @@ -1,17 +1,17 @@ error[E0477]: the type `<() as Yay<&'a ()>>::InnerStream<'s>` does not fulfill the required lifetime - --> $DIR/issue-86218.rs:23:28 + --> $DIR/issue-86218.rs:22:28 | LL | type InnerStream<'s> = impl Stream + 's; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must outlive the lifetime `'s` as defined here as required by this binding - --> $DIR/issue-86218.rs:23:22 + --> $DIR/issue-86218.rs:22:22 | LL | type InnerStream<'s> = impl Stream + 's; | ^^ error: unconstrained opaque type - --> $DIR/issue-86218.rs:23:28 + --> $DIR/issue-86218.rs:22:28 | LL | type InnerStream<'s> = impl Stream + 's; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/bugs/issue-87735.rs b/src/test/ui/generic-associated-types/bugs/issue-87735.rs index 0844d84c3..80737a798 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87735.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87735.rs @@ -3,8 +3,6 @@ // This should pass, but we need an extension of implied bounds (probably). -#![feature(generic_associated_types)] - pub trait AsRef2 { type Output<'a> where Self: 'a; diff --git a/src/test/ui/generic-associated-types/bugs/issue-87735.stderr b/src/test/ui/generic-associated-types/bugs/issue-87735.stderr index 0a18b5f0c..ebe2054ce 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87735.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-87735.stderr @@ -1,5 +1,5 @@ error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-87735.rs:27:13 + --> $DIR/issue-87735.rs:25:13 | LL | impl<'b, T, U> AsRef2 for Foo | ^ unconstrained type parameter diff --git a/src/test/ui/generic-associated-types/bugs/issue-87748.rs b/src/test/ui/generic-associated-types/bugs/issue-87748.rs deleted file mode 100644 index a3d00ee03..000000000 --- a/src/test/ui/generic-associated-types/bugs/issue-87748.rs +++ /dev/null @@ -1,23 +0,0 @@ -// check-fail -// known-bug: #87748 - -// This should pass, but unnormalized input args aren't treated as implied. - -#![feature(generic_associated_types)] - -trait MyTrait { - type Assoc<'a, 'b> where 'b: 'a; - fn do_sth(arg: Self::Assoc<'_, '_>); -} - -struct Foo; - -impl MyTrait for Foo { - type Assoc<'a, 'b> = u32 where 'b: 'a; - - fn do_sth(_: u32) {} - // fn do_sth(_: Self::Assoc<'static, 'static>) {} - // fn do_sth(_: Self::Assoc<'_, '_>) {} -} - -fn main() {} diff --git a/src/test/ui/generic-associated-types/bugs/issue-87748.stderr b/src/test/ui/generic-associated-types/bugs/issue-87748.stderr deleted file mode 100644 index ac197dfe6..000000000 --- a/src/test/ui/generic-associated-types/bugs/issue-87748.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0478]: lifetime bound not satisfied - --> $DIR/issue-87748.rs:18:5 - | -LL | fn do_sth(_: u32) {} - | ^^^^^^^^^^^^^^^^^ - | -note: lifetime parameter instantiated with the anonymous lifetime as defined here - --> $DIR/issue-87748.rs:18:5 - | -LL | fn do_sth(_: u32) {} - | ^^^^^^^^^^^^^^^^^ -note: but lifetime parameter must outlive the anonymous lifetime as defined here - --> $DIR/issue-87748.rs:18:5 - | -LL | fn do_sth(_: u32) {} - | ^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0478`. diff --git a/src/test/ui/generic-associated-types/bugs/issue-87755.rs b/src/test/ui/generic-associated-types/bugs/issue-87755.rs index efa487d62..cda722d2f 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87755.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87755.rs @@ -3,8 +3,6 @@ // This should pass. -#![feature(generic_associated_types)] - use std::fmt::Debug; trait Foo { diff --git a/src/test/ui/generic-associated-types/bugs/issue-87755.stderr b/src/test/ui/generic-associated-types/bugs/issue-87755.stderr index 5d1aff011..5e94db9b0 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87755.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-87755.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow evaluating the requirement `::Ass == _` - --> $DIR/issue-87755.rs:18:16 + --> $DIR/issue-87755.rs:16:16 | LL | type Ass = Bar; | ^^^ diff --git a/src/test/ui/generic-associated-types/bugs/issue-87803.rs b/src/test/ui/generic-associated-types/bugs/issue-87803.rs index a8a111c99..56237e387 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87803.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-87803.rs @@ -4,8 +4,6 @@ // This should pass, but using a type alias vs a reference directly // changes late-bound -> early-bound. -#![feature(generic_associated_types)] - trait Scanner { type Input<'a>; type Token<'a>; diff --git a/src/test/ui/generic-associated-types/bugs/issue-87803.stderr b/src/test/ui/generic-associated-types/bugs/issue-87803.stderr index c81c051d3..fe2abdedb 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-87803.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-87803.stderr @@ -1,5 +1,5 @@ error[E0195]: lifetime parameters or bounds on method `scan` do not match the trait declaration - --> $DIR/issue-87803.rs:22:12 + --> $DIR/issue-87803.rs:20:12 | LL | fn scan<'a>(&mut self, i : Self::Input<'a>) -> Self::Token<'a>; | ---- lifetimes in impl do not match this method in trait diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.rs b/src/test/ui/generic-associated-types/bugs/issue-88382.rs index 5493b9b93..8f8cc4523 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88382.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-88382.rs @@ -3,8 +3,6 @@ // This should pass, but has a missed normalization due to HRTB. -#![feature(generic_associated_types)] - trait Iterable { type Iterator<'a> where Self: 'a; fn iter(&self) -> Self::Iterator<'_>; diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.stderr b/src/test/ui/generic-associated-types/bugs/issue-88382.stderr index 7210895b7..c5fd58096 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88382.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-88382.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in function arguments - --> $DIR/issue-88382.rs:28:40 + --> $DIR/issue-88382.rs:26:40 | LL | do_something(SomeImplementation(), test); | ------------ ^^^^ expected due to this @@ -12,7 +12,7 @@ LL | fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {} = note: expected function signature `for<'r> fn(&'r mut std::iter::Empty) -> _` found function signature `for<'a, 'r> fn(&'r mut <_ as Iterable>::Iterator<'a>) -> _` note: required by a bound in `do_something` - --> $DIR/issue-88382.rs:22:48 + --> $DIR/issue-88382.rs:20:48 | LL | fn do_something(i: I, mut f: impl for<'a> Fn(&mut I::Iterator<'a>)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `do_something` diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.rs b/src/test/ui/generic-associated-types/bugs/issue-88460.rs index f1c3b2269..224e696ad 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88460.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-88460.rs @@ -3,8 +3,6 @@ // This should pass, but has a missed normalization due to HRTB. -#![feature(generic_associated_types)] - pub trait Marker {} pub trait Trait { diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr index 98c304cc9..6612c4b49 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr @@ -1,12 +1,14 @@ error[E0277]: the trait bound `for<'a> <_ as Trait>::Assoc<'a>: Marker` is not satisfied - --> $DIR/issue-88460.rs:30:5 + --> $DIR/issue-88460.rs:28:10 | LL | test(Foo); - | ^^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>` + | ---- ^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>` + | | + | required by a bound introduced by this call | = help: the trait `Marker` is implemented for `()` note: required by a bound in `test` - --> $DIR/issue-88460.rs:17:27 + --> $DIR/issue-88460.rs:15:27 | LL | fn test(value: T) | ---- required by a bound in this diff --git a/src/test/ui/generic-associated-types/bugs/issue-88526.rs b/src/test/ui/generic-associated-types/bugs/issue-88526.rs index 15363ad04..99397744f 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88526.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-88526.rs @@ -3,8 +3,6 @@ // This should pass, but requires more logic. -#![feature(generic_associated_types)] - trait A { type I<'a>; } diff --git a/src/test/ui/generic-associated-types/bugs/issue-88526.stderr b/src/test/ui/generic-associated-types/bugs/issue-88526.stderr index 127c889bf..56857c655 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88526.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-88526.stderr @@ -1,5 +1,5 @@ error[E0207]: the type parameter `I` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-88526.rs:27:13 + --> $DIR/issue-88526.rs:25:13 | LL | impl<'q, Q, I, F> A for TestB | ^ unconstrained type parameter diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.rs b/src/test/ui/generic-associated-types/bugs/issue-89008.rs index 79c28b0d2..012aa8df2 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-89008.rs +++ b/src/test/ui/generic-associated-types/bugs/issue-89008.rs @@ -5,7 +5,6 @@ // This should pass, but seems to run into a TAIT bug. #![feature(type_alias_impl_trait)] -#![feature(generic_associated_types)] use std::future::Future; diff --git a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr b/src/test/ui/generic-associated-types/bugs/issue-89008.stderr index 50844fdc1..3f72734ef 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-89008.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-89008.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving ` as Stream>::Item == Repr` - --> $DIR/issue-89008.rs:39:43 + --> $DIR/issue-89008.rs:38:43 | LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving ` as Stream>::Item == Repr` @@ -7,7 +7,7 @@ LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> { | this type parameter | note: expected this to be `()` - --> $DIR/issue-89008.rs:18:17 + --> $DIR/issue-89008.rs:17:17 | LL | type Item = (); | ^^ diff --git a/src/test/ui/generic-associated-types/bugs/issue-91762.rs b/src/test/ui/generic-associated-types/bugs/issue-91762.rs new file mode 100644 index 000000000..796935cc0 --- /dev/null +++ b/src/test/ui/generic-associated-types/bugs/issue-91762.rs @@ -0,0 +1,29 @@ +// check-fail +// known-bug + +// We almost certaintly want this to pass, but +// it's particularly difficult currently, because we need a way of specifying +// that `::With = Self` without using that when we have +// a `U`. See `https://github.com/rust-lang/rust/pull/92728` for a (hacky) +// solution. This might be better to just wait for Chalk. + +pub trait Functor { + type With; + + fn fmap(this: Self::With) -> Self::With; +} + +pub trait FunctorExt: Sized { + type Base: Functor = Self>; + + fn fmap(self) { + let arg: ::With; + let ret: ::With; + + arg = self; + ret = ::fmap(arg); + //~^ type annotations needed + } +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/bugs/issue-91762.stderr b/src/test/ui/generic-associated-types/bugs/issue-91762.stderr new file mode 100644 index 000000000..1272c8b8a --- /dev/null +++ b/src/test/ui/generic-associated-types/bugs/issue-91762.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/issue-91762.rs:24:15 + | +LL | ret = ::fmap(arg); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the associated function `fmap` + | +help: consider specifying the generic arguments + | +LL | ret = ::fmap::(arg); + | ++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/generic-associated-types/collections-project-default.rs b/src/test/ui/generic-associated-types/collections-project-default.rs index 157e1b1d2..e08aa18cf 100644 --- a/src/test/ui/generic-associated-types/collections-project-default.rs +++ b/src/test/ui/generic-associated-types/collections-project-default.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] #![feature(associated_type_defaults)] // A Collection trait and collection families. Based on diff --git a/src/test/ui/generic-associated-types/collections-project-default.stderr b/src/test/ui/generic-associated-types/collections-project-default.stderr index 22fbc0271..5701017dc 100644 --- a/src/test/ui/generic-associated-types/collections-project-default.stderr +++ b/src/test/ui/generic-associated-types/collections-project-default.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/collections-project-default.rs:59:5 + --> $DIR/collections-project-default.rs:58:5 | LL | fn floatify_sibling(ints: &C) -> >::Sibling | ------------------------------------ expected `>::Sibling` because of return type diff --git a/src/test/ui/generic-associated-types/collections.rs b/src/test/ui/generic-associated-types/collections.rs index 1c00aa73f..15f429afb 100644 --- a/src/test/ui/generic-associated-types/collections.rs +++ b/src/test/ui/generic-associated-types/collections.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] #![feature(associated_type_defaults)] // A Collection trait and collection families. Based on diff --git a/src/test/ui/generic-associated-types/collectivity-regression.rs b/src/test/ui/generic-associated-types/collectivity-regression.rs index fb7368439..54154f9d1 100644 --- a/src/test/ui/generic-associated-types/collectivity-regression.rs +++ b/src/test/ui/generic-associated-types/collectivity-regression.rs @@ -1,7 +1,5 @@ // Regression test from https://github.com/rust-lang/rust/pull/98109 -#![feature(generic_associated_types)] - pub trait Get { type Value<'a> where diff --git a/src/test/ui/generic-associated-types/collectivity-regression.stderr b/src/test/ui/generic-associated-types/collectivity-regression.stderr index a858dd7fd..1dbe1e2cb 100644 --- a/src/test/ui/generic-associated-types/collectivity-regression.stderr +++ b/src/test/ui/generic-associated-types/collectivity-regression.stderr @@ -1,5 +1,5 @@ error: `T` does not live long enough - --> $DIR/collectivity-regression.rs:15:5 + --> $DIR/collectivity-regression.rs:13:5 | LL | / || { LL | | diff --git a/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-1.rs b/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-1.rs index afde5f376..c5f9a25a6 100644 --- a/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-1.rs +++ b/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-1.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(generic_associated_types)] // This test unsures that with_opt_const_param returns the // def_id of the N param in the Foo::Assoc GAT. diff --git a/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-2.rs b/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-2.rs index 51046be79..cd7941ed9 100644 --- a/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-2.rs +++ b/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-2.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(generic_associated_types)] // This test unsures that with_opt_const_param returns the // def_id of the N param in the Foo::Assoc GAT. diff --git a/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-3.rs b/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-3.rs index 457fe27b3..db61fc080 100644 --- a/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-3.rs +++ b/src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-3.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(generic_associated_types)] // This test unsures that with_opt_const_param returns the // def_id of the N param in the Bar::Assoc GAT. diff --git a/src/test/ui/generic-associated-types/const_params_have_right_type.rs b/src/test/ui/generic-associated-types/const_params_have_right_type.rs index 6bed8e3af..d2cb12697 100644 --- a/src/test/ui/generic-associated-types/const_params_have_right_type.rs +++ b/src/test/ui/generic-associated-types/const_params_have_right_type.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Trait { type Foo; } diff --git a/src/test/ui/generic-associated-types/const_params_have_right_type.stderr b/src/test/ui/generic-associated-types/const_params_have_right_type.stderr index 89c993dee..fdedd3bf5 100644 --- a/src/test/ui/generic-associated-types/const_params_have_right_type.stderr +++ b/src/test/ui/generic-associated-types/const_params_have_right_type.stderr @@ -1,5 +1,5 @@ error[E0053]: type `Foo` has an incompatible generic parameter for trait `Trait` - --> $DIR/const_params_have_right_type.rs:8:14 + --> $DIR/const_params_have_right_type.rs:6:14 | LL | trait Trait { | ----- diff --git a/src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.rs b/src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.rs index e315ee842..c78a54997 100644 --- a/src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.rs +++ b/src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.rs @@ -1,7 +1,5 @@ // Test that correct syntax is used in suggestion to constrain associated type -#![feature(generic_associated_types)] - trait X { type Y; } diff --git a/src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr b/src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr index 957ae5d29..96c4330fe 100644 --- a/src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr +++ b/src/test/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/constraint-assoc-type-suggestion.rs:12:23 + --> $DIR/constraint-assoc-type-suggestion.rs:10:23 | LL | let b: Vec = a; | -------- ^ expected struct `Vec`, found associated type diff --git a/src/test/ui/generic-associated-types/construct_with_other_type.rs b/src/test/ui/generic-associated-types/construct_with_other_type.rs index 060804269..5cb07f558 100644 --- a/src/test/ui/generic-associated-types/construct_with_other_type.rs +++ b/src/test/ui/generic-associated-types/construct_with_other_type.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - // check-pass use std::ops::Deref; diff --git a/src/test/ui/generic-associated-types/cross-crate-bounds.stderr b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr index c4009dd96..c81cd7e77 100644 --- a/src/test/ui/generic-associated-types/cross-crate-bounds.stderr +++ b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr @@ -5,7 +5,7 @@ LL | type Bar = (); | ^^ the trait `AsRef<()>` is not implemented for `()` | note: required by a bound in `foo_defn::Foo::Bar` - --> $DIR/auxiliary/foo_defn.rs:6:15 + --> $DIR/auxiliary/foo_defn.rs:4:15 | LL | type Bar: AsRef<()>; | ^^^^^^^^^ required by this bound in `foo_defn::Foo::Bar` diff --git a/src/test/ui/generic-associated-types/elided-in-expr-position.rs b/src/test/ui/generic-associated-types/elided-in-expr-position.rs index 482d0d5c0..e40093305 100644 --- a/src/test/ui/generic-associated-types/elided-in-expr-position.rs +++ b/src/test/ui/generic-associated-types/elided-in-expr-position.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] #![allow(unused)] pub trait Trait { diff --git a/src/test/ui/generic-associated-types/elided-in-expr-position.stderr b/src/test/ui/generic-associated-types/elided-in-expr-position.stderr index b395a1cfd..20f35c3c1 100644 --- a/src/test/ui/generic-associated-types/elided-in-expr-position.stderr +++ b/src/test/ui/generic-associated-types/elided-in-expr-position.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `Trait::Assoc` - --> $DIR/elided-in-expr-position.rs:10:26 + --> $DIR/elided-in-expr-position.rs:9:26 | LL | fn g(&self) -> Self::Assoc; | ^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/elided-in-expr-position.rs:5:10 + --> $DIR/elided-in-expr-position.rs:4:10 | LL | type Assoc<'a> where Self: 'a; | ^^^^^ -- @@ -15,13 +15,13 @@ LL | fn g(&self) -> Self::Assoc<'a>; | ~~~~~~~~~ error[E0107]: missing generics for associated type `Trait::Assoc` - --> $DIR/elided-in-expr-position.rs:32:26 + --> $DIR/elided-in-expr-position.rs:31:26 | LL | fn g(&self) -> Self::Assoc { | ^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/elided-in-expr-position.rs:5:10 + --> $DIR/elided-in-expr-position.rs:4:10 | LL | type Assoc<'a> where Self: 'a; | ^^^^^ -- diff --git a/src/test/ui/generic-associated-types/empty_generics.rs b/src/test/ui/generic-associated-types/empty_generics.rs index 772b7f2b4..964c2972d 100644 --- a/src/test/ui/generic-associated-types/empty_generics.rs +++ b/src/test/ui/generic-associated-types/empty_generics.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Foo { type Bar<,>; //~^ ERROR expected one of `#`, `>`, `const`, identifier, or lifetime, found `,` diff --git a/src/test/ui/generic-associated-types/empty_generics.stderr b/src/test/ui/generic-associated-types/empty_generics.stderr index ac22bfc08..b753181cf 100644 --- a/src/test/ui/generic-associated-types/empty_generics.stderr +++ b/src/test/ui/generic-associated-types/empty_generics.stderr @@ -1,5 +1,5 @@ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,` - --> $DIR/empty_generics.rs:4:14 + --> $DIR/empty_generics.rs:2:14 | LL | trait Foo { | - while parsing this item list starting here diff --git a/src/test/ui/generic-associated-types/extended/lending_iterator.base.stderr b/src/test/ui/generic-associated-types/extended/lending_iterator.base.stderr index 3da7794b3..614c4a34c 100644 --- a/src/test/ui/generic-associated-types/extended/lending_iterator.base.stderr +++ b/src/test/ui/generic-associated-types/extended/lending_iterator.base.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/lending_iterator.rs:14:45 + --> $DIR/lending_iterator.rs:13:45 | LL | fn from_iter LendingIterator = A>>(iter: T) -> Self; | ------------------------------------------------------------------------ definition of `from_iter` from trait diff --git a/src/test/ui/generic-associated-types/extended/lending_iterator.rs b/src/test/ui/generic-associated-types/extended/lending_iterator.rs index ede164766..247761dd0 100644 --- a/src/test/ui/generic-associated-types/extended/lending_iterator.rs +++ b/src/test/ui/generic-associated-types/extended/lending_iterator.rs @@ -2,7 +2,6 @@ //[base] check-fail //[extended] check-pass -#![feature(generic_associated_types)] #![cfg_attr(extended, feature(generic_associated_types_extended))] #![cfg_attr(extended, allow(incomplete_features))] diff --git a/src/test/ui/generic-associated-types/extended/lending_iterator_2.base.stderr b/src/test/ui/generic-associated-types/extended/lending_iterator_2.base.stderr index 6c2a624ca..f6b0b644e 100644 --- a/src/test/ui/generic-associated-types/extended/lending_iterator_2.base.stderr +++ b/src/test/ui/generic-associated-types/extended/lending_iterator_2.base.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/lending_iterator_2.rs:14:45 + --> $DIR/lending_iterator_2.rs:13:45 | LL | fn from_iter LendingIterator = A>>(iter: T) -> Self; | ------------------------------------------------------------------------ definition of `from_iter` from trait diff --git a/src/test/ui/generic-associated-types/extended/lending_iterator_2.rs b/src/test/ui/generic-associated-types/extended/lending_iterator_2.rs index 3c4a2184d..eb9c0456a 100644 --- a/src/test/ui/generic-associated-types/extended/lending_iterator_2.rs +++ b/src/test/ui/generic-associated-types/extended/lending_iterator_2.rs @@ -2,7 +2,6 @@ //[base] check-fail //[extended] check-pass -#![feature(generic_associated_types)] #![cfg_attr(extended, feature(generic_associated_types_extended))] #![cfg_attr(extended, allow(incomplete_features))] diff --git a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.rs b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.rs deleted file mode 100644 index c1d68812e..000000000 --- a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// rust-lang/rust#60654: Do not ICE on an attempt to use GATs that is -// missing the feature gate. - -struct Foo; - -trait MyTrait { - type Item; - //~^ ERROR generic associated types are unstable [E0658] -} - -impl MyTrait for Foo { - type Item = T; - //~^ ERROR generic associated types are unstable [E0658] -} - -fn main() { } diff --git a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.stderr b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.stderr deleted file mode 100644 index 34f536dbe..000000000 --- a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature-2.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: generic associated types are unstable - --> $DIR/gat-dont-ice-on-absent-feature-2.rs:7:5 - | -LL | type Item; - | ^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error[E0658]: generic associated types are unstable - --> $DIR/gat-dont-ice-on-absent-feature-2.rs:12:5 - | -LL | type Item = T; - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` 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/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.rs b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.rs deleted file mode 100644 index e8fc47d2a..000000000 --- a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.rs +++ /dev/null @@ -1,16 +0,0 @@ -// rust-lang/rust#60654: Do not ICE on an attempt to use GATs that is -// missing the feature gate. - -struct Foo; - -impl Iterator for Foo { - type Item<'b> = &'b Foo; - //~^ ERROR generic associated types are unstable [E0658] - //~| ERROR lifetime parameters or bounds on type `Item` do not match the trait declaration - - fn next(&mut self) -> Option { - None - } -} - -fn main() { } diff --git a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.stderr b/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.stderr deleted file mode 100644 index ec36886f7..000000000 --- a/src/test/ui/generic-associated-types/gat-dont-ice-on-absent-feature.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0658]: generic associated types are unstable - --> $DIR/gat-dont-ice-on-absent-feature.rs:7:5 - | -LL | type Item<'b> = &'b Foo; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error[E0195]: lifetime parameters or bounds on type `Item` do not match the trait declaration - --> $DIR/gat-dont-ice-on-absent-feature.rs:7:14 - | -LL | type Item<'b> = &'b Foo; - | ^^^^ lifetimes do not match type in trait - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0195, E0658. -For more information about an error, try `rustc --explain E0195`. diff --git a/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.rs b/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.rs index f542a7f54..86b164ba7 100644 --- a/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.rs +++ b/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait X { type Y<'x>; } diff --git a/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr b/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr index 1792d8db2..b77f10084 100644 --- a/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr +++ b/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr @@ -1,5 +1,5 @@ error[E0261]: use of undeclared lifetime name `'x` - --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:35 + --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:6:35 | LL | fn _f(arg : Box X = &'a [u32]>>) {} | ^^ undeclared lifetime @@ -15,7 +15,7 @@ LL | fn _f<'x>(arg : Box X = &'a [u32]>>) {} | ++++ error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:33 + --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:6:33 | LL | fn _f(arg : Box X = &'a [u32]>>) {} | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/gat-in-trait-path.base.stderr b/src/test/ui/generic-associated-types/gat-in-trait-path.base.stderr index c2054f64e..fd54faaf3 100644 --- a/src/test/ui/generic-associated-types/gat-in-trait-path.base.stderr +++ b/src/test/ui/generic-associated-types/gat-in-trait-path.base.stderr @@ -1,11 +1,11 @@ error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/gat-in-trait-path.rs:27:17 + --> $DIR/gat-in-trait-path.rs:26:17 | LL | fn f(_arg : Box Foo = &'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/gat-in-trait-path.rs:11:10 + --> $DIR/gat-in-trait-path.rs:10:10 | LL | trait Foo { | --- this trait cannot be made into an object... diff --git a/src/test/ui/generic-associated-types/gat-in-trait-path.rs b/src/test/ui/generic-associated-types/gat-in-trait-path.rs index c82450ccf..c55f5a726 100644 --- a/src/test/ui/generic-associated-types/gat-in-trait-path.rs +++ b/src/test/ui/generic-associated-types/gat-in-trait-path.rs @@ -2,7 +2,6 @@ //[base] check-fail //[extended] check-pass -#![feature(generic_associated_types)] #![feature(associated_type_defaults)] #![cfg_attr(extended, feature(generic_associated_types_extended))] #![cfg_attr(extended, allow(incomplete_features))] diff --git a/src/test/ui/generic-associated-types/gat-incomplete-warning.rs b/src/test/ui/generic-associated-types/gat-incomplete-warning.rs deleted file mode 100644 index 607ea1759..000000000 --- a/src/test/ui/generic-associated-types/gat-incomplete-warning.rs +++ /dev/null @@ -1,5 +0,0 @@ -// run-pass - -#![feature(generic_associated_types)] - -fn main() {} diff --git a/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs b/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs index dbf7e02ae..d00c036fb 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs +++ b/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Foo { type F<'a>; diff --git a/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr b/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr index dad0dae6a..cb2b9f32b 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr +++ b/src/test/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr @@ -1,5 +1,5 @@ error[E0403]: the name `T1` is already used for a generic parameter in this item's generic parameters - --> $DIR/gat-trait-path-generic-type-arg.rs:11:12 + --> $DIR/gat-trait-path-generic-type-arg.rs:9:12 | LL | impl Foo for T { | -- first use of `T1` @@ -8,13 +8,13 @@ LL | type F = &[u8]; | ^^ already used error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/gat-trait-path-generic-type-arg.rs:11:18 + --> $DIR/gat-trait-path-generic-type-arg.rs:9:18 | LL | type F = &[u8]; | ^ explicit lifetime name needed here error[E0207]: the type parameter `T1` is not constrained by the impl trait, self type, or predicates - --> $DIR/gat-trait-path-generic-type-arg.rs:9:10 + --> $DIR/gat-trait-path-generic-type-arg.rs:7:10 | LL | impl Foo for T { | ^^ unconstrained type parameter diff --git a/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs b/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs index 9864787f0..83b86f04a 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs +++ b/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait X { type Y<'a>; diff --git a/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr b/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr index aeb9238de..452dfefd1 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr +++ b/src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `X::Y` - --> $DIR/gat-trait-path-missing-lifetime.rs:10:20 + --> $DIR/gat-trait-path-missing-lifetime.rs:8:20 | LL | fn foo<'a, T1: X>(t : T1) -> T1::Y<'a> { | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/gat-trait-path-missing-lifetime.rs:4:8 + --> $DIR/gat-trait-path-missing-lifetime.rs:2:8 | LL | type Y<'a>; | ^ -- @@ -15,13 +15,13 @@ LL | fn foo<'a, T1: X = T1>>(t : T1) -> T1::Y<'a> { | ~~~~~ error[E0107]: missing generics for associated type `X::Y` - --> $DIR/gat-trait-path-missing-lifetime.rs:10:20 + --> $DIR/gat-trait-path-missing-lifetime.rs:8:20 | LL | fn foo<'a, T1: X>(t : T1) -> T1::Y<'a> { | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/gat-trait-path-missing-lifetime.rs:4:8 + --> $DIR/gat-trait-path-missing-lifetime.rs:2:8 | LL | type Y<'a>; | ^ -- diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs index c55b0530c..9eb069637 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs +++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait X { type Y<'a>; } diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index 162214063..e55a21e19 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -1,11 +1,11 @@ error: lifetime in trait object type must be followed by `+` - --> $DIR/gat-trait-path-parenthesised-args.rs:7:29 + --> $DIR/gat-trait-path-parenthesised-args.rs:5:29 | LL | fn foo<'a>(arg: Box>) {} | ^^ error: parenthesized generic arguments cannot be used in associated type constraints - --> $DIR/gat-trait-path-parenthesised-args.rs:7:27 + --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} | ^^^^^ @@ -16,7 +16,7 @@ LL | fn foo<'a>(arg: Box = &'a ()>>) {} | ~ ~ error: parenthesized generic arguments cannot be used in associated type constraints - --> $DIR/gat-trait-path-parenthesised-args.rs:14:27 + --> $DIR/gat-trait-path-parenthesised-args.rs:12:27 | LL | fn bar<'a>(arg: Box>) {} | ^-- @@ -24,13 +24,13 @@ 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 - --> $DIR/gat-trait-path-parenthesised-args.rs:7:27 + --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/gat-trait-path-parenthesised-args.rs:4:8 + --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 | LL | type Y<'a>; | ^ -- @@ -40,7 +40,7 @@ LL | fn foo<'a>(arg: Box>) {} | +++ error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:7:27 + --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} | ^---- help: remove these generics @@ -48,19 +48,19 @@ LL | fn foo<'a>(arg: Box>) {} | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters - --> $DIR/gat-trait-path-parenthesised-args.rs:4:8 + --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 | LL | type Y<'a>; | ^ error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:14:27 + --> $DIR/gat-trait-path-parenthesised-args.rs:12:27 | LL | fn bar<'a>(arg: Box>) {} | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/gat-trait-path-parenthesised-args.rs:4:8 + --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 | LL | type Y<'a>; | ^ -- diff --git a/src/test/ui/generic-associated-types/generic-associated-type-bounds.rs b/src/test/ui/generic-associated-types/generic-associated-type-bounds.rs index d7c4dbda2..fdc5a7267 100644 --- a/src/test/ui/generic-associated-types/generic-associated-type-bounds.rs +++ b/src/test/ui/generic-associated-types/generic-associated-type-bounds.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(generic_associated_types)] - pub trait X { type Y<'a> where Self: 'a; fn m(&self) -> Self::Y<'_>; diff --git a/src/test/ui/generic-associated-types/generic-associated-types-where.rs b/src/test/ui/generic-associated-types/generic-associated-types-where.rs index 2ecbc8c59..bbdfffafe 100644 --- a/src/test/ui/generic-associated-types/generic-associated-types-where.rs +++ b/src/test/ui/generic-associated-types/generic-associated-types-where.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - // Checking the interaction with this other feature #![feature(associated_type_defaults)] diff --git a/src/test/ui/generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/generic-associated-types/generic-associated-types-where.stderr index e866b3bab..9a745c099 100644 --- a/src/test/ui/generic-associated-types/generic-associated-types-where.stderr +++ b/src/test/ui/generic-associated-types/generic-associated-types-where.stderr @@ -1,5 +1,5 @@ error[E0277]: `T` doesn't implement `std::fmt::Display` - --> $DIR/generic-associated-types-where.rs:20:22 + --> $DIR/generic-associated-types-where.rs:18:22 | LL | type Assoc2 = Vec; | ^^^^^^ `T` cannot be formatted with the default formatter @@ -11,7 +11,7 @@ LL | type Assoc2 = Vec; | +++++++++++++++++++ error[E0276]: impl has stricter requirements than trait - --> $DIR/generic-associated-types-where.rs:22:38 + --> $DIR/generic-associated-types-where.rs:20:38 | LL | type Assoc3; | -------------- definition of `Assoc3` from trait diff --git a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.rs b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.rs index 43058f7eb..2cb218bf8 100644 --- a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.rs +++ b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - use std::ops::Deref; trait Iterable { diff --git a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr index a4bb36190..396ff15ab 100644 --- a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr +++ b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr @@ -1,5 +1,5 @@ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:8:37 + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:6:37 | LL | + Deref>; | ^^ undeclared lifetime @@ -19,7 +19,7 @@ LL | trait Iterable<'b> { | ++++ error[E0261]: use of undeclared lifetime name `'undeclared` - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:41 + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:9:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; | ^^^^^^^^^^^ undeclared lifetime diff --git a/src/test/ui/generic-associated-types/impl_bounds.rs b/src/test/ui/generic-associated-types/impl_bounds.rs index ec1d171c0..01165fceb 100644 --- a/src/test/ui/generic-associated-types/impl_bounds.rs +++ b/src/test/ui/generic-associated-types/impl_bounds.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] #![feature(associated_type_defaults)] trait Foo { diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr index ce79c635a..442d4f336 100644 --- a/src/test/ui/generic-associated-types/impl_bounds.stderr +++ b/src/test/ui/generic-associated-types/impl_bounds.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/impl_bounds.rs:15:39 + --> $DIR/impl_bounds.rs:14:39 | LL | type A<'a> where Self: 'a; | ---------- definition of `A` from trait @@ -8,7 +8,7 @@ LL | type A<'a> = (&'a ()) where Self: 'static; | ^^^^^^^ impl has extra requirement `T: 'static` error[E0276]: impl has stricter requirements than trait - --> $DIR/impl_bounds.rs:17:48 + --> $DIR/impl_bounds.rs:16:48 | LL | type B<'a, 'b> where 'a: 'b; | -------------- definition of `B` from trait @@ -17,7 +17,7 @@ LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; | ^^ impl has extra requirement `'b: 'a` error[E0478]: lifetime bound not satisfied - --> $DIR/impl_bounds.rs:17:22 + --> $DIR/impl_bounds.rs:16:22 | LL | type B<'a, 'b> where 'a: 'b; | -------------- definition of `B` from trait @@ -26,29 +26,29 @@ LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; | ^^^^^^^^^^^^^^^ - help: try copying this clause from the trait: `, 'a: 'b` | note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/impl_bounds.rs:17:12 + --> $DIR/impl_bounds.rs:16:12 | LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; | ^^ note: but lifetime parameter must outlive the lifetime `'b` as defined here - --> $DIR/impl_bounds.rs:17:16 + --> $DIR/impl_bounds.rs:16:16 | LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; | ^^ error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/impl_bounds.rs:20:33 + --> $DIR/impl_bounds.rs:19:33 | LL | type C = String where Self: Copy; | ^^^^ the trait `Copy` is not implemented for `T` | -note: required because of the requirements on the impl of `Copy` for `Fooy` - --> $DIR/impl_bounds.rs:11:10 +note: required for `Fooy` to implement `Copy` + --> $DIR/impl_bounds.rs:10:10 | LL | #[derive(Copy, Clone)] | ^^^^ note: the requirement `Fooy: Copy` appears on the `impl`'s associated type `C` but not on the corresponding trait's associated type - --> $DIR/impl_bounds.rs:7:10 + --> $DIR/impl_bounds.rs:6:10 | LL | trait Foo { | --- in this trait @@ -62,18 +62,18 @@ LL | impl Foo for Fooy { | +++++++++++++++++++ error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/impl_bounds.rs:22:24 + --> $DIR/impl_bounds.rs:21:24 | LL | fn d() where Self: Copy {} | ^^^^ the trait `Copy` is not implemented for `T` | -note: required because of the requirements on the impl of `Copy` for `Fooy` - --> $DIR/impl_bounds.rs:11:10 +note: required for `Fooy` to implement `Copy` + --> $DIR/impl_bounds.rs:10:10 | LL | #[derive(Copy, Clone)] | ^^^^ note: the requirement `Fooy: Copy` appears on the `impl`'s method `d` but not on the corresponding trait's method - --> $DIR/impl_bounds.rs:8:8 + --> $DIR/impl_bounds.rs:7:8 | LL | trait Foo { | --- in this trait diff --git a/src/test/ui/generic-associated-types/impl_bounds_ok.rs b/src/test/ui/generic-associated-types/impl_bounds_ok.rs index 4df8235d9..88f829ea2 100644 --- a/src/test/ui/generic-associated-types/impl_bounds_ok.rs +++ b/src/test/ui/generic-associated-types/impl_bounds_ok.rs @@ -1,6 +1,5 @@ // check-pass -#![feature(generic_associated_types)] #![feature(associated_type_defaults)] trait Foo { diff --git a/src/test/ui/generic-associated-types/issue-101020.rs b/src/test/ui/generic-associated-types/issue-101020.rs new file mode 100644 index 000000000..80d0fa5ad --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-101020.rs @@ -0,0 +1,35 @@ +pub trait LendingIterator { + type Item<'a> + where + Self: 'a; + + fn consume(self, _f: F) + where + Self: Sized, + for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>, + { + } +} + +impl LendingIterator for &mut I { + type Item<'a> = I::Item<'a> where Self: 'a; +} +struct EmptyIter; +impl LendingIterator for EmptyIter { + type Item<'a> = &'a mut () where Self:'a; +} +pub trait FuncInput<'a, F> +where + F: Foo, + Self: Sized, +{ +} +impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo {} +trait Foo {} + +fn map_test() { + (&mut EmptyIter).consume(()); + //~^ ERROR the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-101020.stderr b/src/test/ui/generic-associated-types/issue-101020.stderr new file mode 100644 index 000000000..b4e94cb83 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-101020.stderr @@ -0,0 +1,25 @@ +error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied + --> $DIR/issue-101020.rs:31:5 + | +LL | (&mut EmptyIter).consume(()); + | ^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()` + | +note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>` + --> $DIR/issue-101020.rs:27:20 + | +LL | impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo {} + | ^^^^^^^^^^^^^^^^ ^ +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 +... +LL | for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `LendingIterator::consume` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/generic-associated-types/issue-102333.rs b/src/test/ui/generic-associated-types/issue-102333.rs new file mode 100644 index 000000000..6c7256332 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-102333.rs @@ -0,0 +1,15 @@ +// check-pass + +trait A { + type T: B = ()>; +} + +trait B { + type U; +} + +fn f() { + let _: <::T as B>::U<1i32> = (); +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-102335-gat.rs b/src/test/ui/generic-associated-types/issue-102335-gat.rs new file mode 100644 index 000000000..a7255fdcb --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-102335-gat.rs @@ -0,0 +1,12 @@ +trait T { + type A: S = ()>; + //~^ ERROR associated type bindings are not allowed here +} + +trait Q {} + +trait S { + type C: Q; +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-102335-gat.stderr b/src/test/ui/generic-associated-types/issue-102335-gat.stderr new file mode 100644 index 000000000..7a7900a1e --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-102335-gat.stderr @@ -0,0 +1,9 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-102335-gat.rs:2:21 + | +LL | type A: S = ()>; + | ^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. diff --git a/src/test/ui/generic-associated-types/issue-47206-where-clause.rs b/src/test/ui/generic-associated-types/issue-47206-where-clause.rs index d352c1948..3d1b88ddf 100644 --- a/src/test/ui/generic-associated-types/issue-47206-where-clause.rs +++ b/src/test/ui/generic-associated-types/issue-47206-where-clause.rs @@ -1,7 +1,5 @@ // Check that this program doesn't cause the compiler to error without output. -#![feature(generic_associated_types)] - trait Foo { type Assoc3; } diff --git a/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr b/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr index 31948a878..7006744df 100644 --- a/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr +++ b/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/issue-47206-where-clause.rs:12:38 + --> $DIR/issue-47206-where-clause.rs:10:38 | LL | type Assoc3; | -------------- definition of `Assoc3` from trait diff --git a/src/test/ui/generic-associated-types/issue-58694-parameter-out-of-range.rs b/src/test/ui/generic-associated-types/issue-58694-parameter-out-of-range.rs index e87a76825..625ccfe89 100644 --- a/src/test/ui/generic-associated-types/issue-58694-parameter-out-of-range.rs +++ b/src/test/ui/generic-associated-types/issue-58694-parameter-out-of-range.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - trait Cert { type PublicKey<'a>: From<&'a [u8]>; } diff --git a/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs index d74d6d056..c1140bff8 100644 --- a/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs +++ b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - // check-pass trait Iterator { diff --git a/src/test/ui/generic-associated-types/issue-67424.rs b/src/test/ui/generic-associated-types/issue-67424.rs index fa35a3e8b..b6c7c70cd 100644 --- a/src/test/ui/generic-associated-types/issue-67424.rs +++ b/src/test/ui/generic-associated-types/issue-67424.rs @@ -1,3 +1,4 @@ +// check-pass // Fixed by #67160 trait Trait1 { @@ -6,7 +7,6 @@ trait Trait1 { trait Trait2 { type Type1: Trait1; - //~^ ERROR: generic associated types are unstable } fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-67424.stderr b/src/test/ui/generic-associated-types/issue-67424.stderr deleted file mode 100644 index bbb7d56f5..000000000 --- a/src/test/ui/generic-associated-types/issue-67424.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: generic associated types are unstable - --> $DIR/issue-67424.rs:8:5 - | -LL | type Type1: Trait1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #44265 for more information - = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/generic-associated-types/issue-67510-pass.base.stderr b/src/test/ui/generic-associated-types/issue-67510-pass.base.stderr index 74a616aaa..4cc68530e 100644 --- a/src/test/ui/generic-associated-types/issue-67510-pass.base.stderr +++ b/src/test/ui/generic-associated-types/issue-67510-pass.base.stderr @@ -1,11 +1,11 @@ error[E0038]: the trait `X` cannot be made into an object - --> $DIR/issue-67510-pass.rs:13:23 + --> $DIR/issue-67510-pass.rs:12:23 | LL | fn _func1<'a>(_x: Box=&'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^ `X` 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/issue-67510-pass.rs:10:10 + --> $DIR/issue-67510-pass.rs:9:10 | LL | trait X { | - this trait cannot be made into an object... diff --git a/src/test/ui/generic-associated-types/issue-67510-pass.rs b/src/test/ui/generic-associated-types/issue-67510-pass.rs index c5b02ff9a..66ce3e807 100644 --- a/src/test/ui/generic-associated-types/issue-67510-pass.rs +++ b/src/test/ui/generic-associated-types/issue-67510-pass.rs @@ -2,7 +2,6 @@ //[base] check-fail //[extended] check-pass -#![feature(generic_associated_types)] #![cfg_attr(extended, feature(generic_associated_types_extended))] #![cfg_attr(extended, allow(incomplete_features))] diff --git a/src/test/ui/generic-associated-types/issue-67510.rs b/src/test/ui/generic-associated-types/issue-67510.rs index 5725b660a..ab5c25d74 100644 --- a/src/test/ui/generic-associated-types/issue-67510.rs +++ b/src/test/ui/generic-associated-types/issue-67510.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait X { type Y<'a>; } diff --git a/src/test/ui/generic-associated-types/issue-67510.stderr b/src/test/ui/generic-associated-types/issue-67510.stderr index 8aeda22ba..d25c5b0f3 100644 --- a/src/test/ui/generic-associated-types/issue-67510.stderr +++ b/src/test/ui/generic-associated-types/issue-67510.stderr @@ -1,5 +1,5 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/issue-67510.rs:7:21 + --> $DIR/issue-67510.rs:5:21 | LL | fn f(x: Box = &'a ()>>) {} | ^^ undeclared lifetime @@ -15,7 +15,7 @@ LL | fn f<'a>(x: Box = &'a ()>>) {} | ++++ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/issue-67510.rs:7:28 + --> $DIR/issue-67510.rs:5:28 | LL | fn f(x: Box = &'a ()>>) {} | ^^ undeclared lifetime @@ -30,13 +30,13 @@ LL | fn f<'a>(x: Box = &'a ()>>) {} | ++++ error[E0038]: the trait `X` cannot be made into an object - --> $DIR/issue-67510.rs:7:13 + --> $DIR/issue-67510.rs:5:13 | LL | fn f(x: Box = &'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^^^ `X` 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/issue-67510.rs:4:10 + --> $DIR/issue-67510.rs:2:10 | LL | trait X { | - this trait cannot be made into an object... diff --git a/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.rs b/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.rs index 617d985dc..f1e779fcb 100644 --- a/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.rs +++ b/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.rs @@ -1,7 +1,5 @@ // Regression test for #68641 -#![feature(generic_associated_types)] - trait UnsafeCopy { type Item<'a>: Copy; diff --git a/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr b/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr index 2e21b38cb..6bb7492af 100644 --- a/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr +++ b/src/test/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/issue-68641-check-gat-bounds.rs:14:21 + --> $DIR/issue-68641-check-gat-bounds.rs:12:21 | LL | type Item<'a> = T; | ^ the trait `Copy` is not implemented for `T` | note: required by a bound in `UnsafeCopy::Item` - --> $DIR/issue-68641-check-gat-bounds.rs:6:20 + --> $DIR/issue-68641-check-gat-bounds.rs:4:20 | LL | type Item<'a>: Copy; | ^^^^ required by this bound in `UnsafeCopy::Item` diff --git a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs index def0ad18f..f5502adee 100644 --- a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs +++ b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs @@ -1,7 +1,5 @@ // Regression test for #68642 -#![feature(generic_associated_types)] - trait Fun { type F<'a>: Fn() -> u32; diff --git a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr index 713cc744f..07452137b 100644 --- a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr +++ b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr @@ -1,12 +1,12 @@ error[E0277]: expected a `Fn<()>` closure, found `T` - --> $DIR/issue-68642-broken-llvm-ir.rs:14:18 + --> $DIR/issue-68642-broken-llvm-ir.rs:12:18 | LL | type F<'a> = Self; | ^^^^ expected an `Fn<()>` closure, found `T` | = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Fun::F` - --> $DIR/issue-68642-broken-llvm-ir.rs:6:17 + --> $DIR/issue-68642-broken-llvm-ir.rs:4:17 | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` diff --git a/src/test/ui/generic-associated-types/issue-68643-broken-mir.rs b/src/test/ui/generic-associated-types/issue-68643-broken-mir.rs index 9af065b5d..6050a8bf5 100644 --- a/src/test/ui/generic-associated-types/issue-68643-broken-mir.rs +++ b/src/test/ui/generic-associated-types/issue-68643-broken-mir.rs @@ -1,7 +1,5 @@ // Regression test for #68643 -#![feature(generic_associated_types)] - trait Fun { type F<'a>: Fn() -> u32; diff --git a/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr b/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr index a7b7f64cd..31ded5dab 100644 --- a/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr +++ b/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr @@ -1,12 +1,12 @@ error[E0277]: expected a `Fn<()>` closure, found `T` - --> $DIR/issue-68643-broken-mir.rs:14:18 + --> $DIR/issue-68643-broken-mir.rs:12:18 | LL | type F<'a> = Self; | ^^^^ expected an `Fn<()>` closure, found `T` | = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Fun::F` - --> $DIR/issue-68643-broken-mir.rs:6:17 + --> $DIR/issue-68643-broken-mir.rs:4:17 | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` diff --git a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.rs b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.rs index 1d2636c26..898cfa1e7 100644 --- a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.rs +++ b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.rs @@ -1,7 +1,5 @@ // Regression test for #68644 -#![feature(generic_associated_types)] - trait Fun { type F<'a>: Fn() -> u32; diff --git a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr index 5e921e053..e2f9930cc 100644 --- a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr +++ b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr @@ -1,12 +1,12 @@ error[E0277]: expected a `Fn<()>` closure, found `T` - --> $DIR/issue-68644-codegen-selection.rs:14:18 + --> $DIR/issue-68644-codegen-selection.rs:12:18 | LL | type F<'a> = Self; | ^^^^ expected an `Fn<()>` closure, found `T` | = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Fun::F` - --> $DIR/issue-68644-codegen-selection.rs:6:17 + --> $DIR/issue-68644-codegen-selection.rs:4:17 | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` diff --git a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs index aa505064f..60b065bfc 100644 --- a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs +++ b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs @@ -1,7 +1,5 @@ // Regression test for #68645 -#![feature(generic_associated_types)] - trait Fun { type F<'a>: Fn() -> u32; diff --git a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr index 7edcdce62..0065368ad 100644 --- a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr +++ b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr @@ -1,12 +1,12 @@ error[E0277]: expected a `Fn<()>` closure, found `T` - --> $DIR/issue-68645-codegen-fulfillment.rs:14:18 + --> $DIR/issue-68645-codegen-fulfillment.rs:12:18 | LL | type F<'a> = Self; | ^^^^ expected an `Fn<()>` closure, found `T` | = note: wrap the `T` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Fun::F` - --> $DIR/issue-68645-codegen-fulfillment.rs:6:17 + --> $DIR/issue-68645-codegen-fulfillment.rs:4:17 | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` diff --git a/src/test/ui/generic-associated-types/issue-68648-1.rs b/src/test/ui/generic-associated-types/issue-68648-1.rs index 17bc034b3..0df41bab3 100644 --- a/src/test/ui/generic-associated-types/issue-68648-1.rs +++ b/src/test/ui/generic-associated-types/issue-68648-1.rs @@ -1,8 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - - trait Fun { type F<'a>; diff --git a/src/test/ui/generic-associated-types/issue-68648-2.rs b/src/test/ui/generic-associated-types/issue-68648-2.rs index 6c9a0d126..0f963d58f 100644 --- a/src/test/ui/generic-associated-types/issue-68648-2.rs +++ b/src/test/ui/generic-associated-types/issue-68648-2.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Fun { type F<'a>; diff --git a/src/test/ui/generic-associated-types/issue-68648-2.stderr b/src/test/ui/generic-associated-types/issue-68648-2.stderr index 06c1efcd8..b2bef19eb 100644 --- a/src/test/ui/generic-associated-types/issue-68648-2.stderr +++ b/src/test/ui/generic-associated-types/issue-68648-2.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-68648-2.rs:14:17 + --> $DIR/issue-68648-2.rs:12:17 | LL | fn bug<'a, T: Fun = T>>(t: T) -> T::F<'a> { | - this type parameter @@ -11,7 +11,7 @@ LL | T::identity(()) = note: expected type parameter `T` found unit type `()` note: associated function defined here - --> $DIR/issue-68648-2.rs:6:8 + --> $DIR/issue-68648-2.rs:4:8 | LL | fn identity<'a>(t: Self::F<'a>) -> Self::F<'a> { t } | ^^^^^^^^ -------------- diff --git a/src/test/ui/generic-associated-types/issue-68649-pass.rs b/src/test/ui/generic-associated-types/issue-68649-pass.rs index 33f08faff..772743877 100644 --- a/src/test/ui/generic-associated-types/issue-68649-pass.rs +++ b/src/test/ui/generic-associated-types/issue-68649-pass.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - trait Fun { type F<'a>; diff --git a/src/test/ui/generic-associated-types/issue-68653.rs b/src/test/ui/generic-associated-types/issue-68653.rs index 1e84717e9..170b87cf2 100644 --- a/src/test/ui/generic-associated-types/issue-68653.rs +++ b/src/test/ui/generic-associated-types/issue-68653.rs @@ -2,8 +2,6 @@ // check-pass -#![feature(generic_associated_types)] - trait Fun { type F<'a: 'a>; } diff --git a/src/test/ui/generic-associated-types/issue-68656-unsized-values.rs b/src/test/ui/generic-associated-types/issue-68656-unsized-values.rs index c0d933362..607cfed0b 100644 --- a/src/test/ui/generic-associated-types/issue-68656-unsized-values.rs +++ b/src/test/ui/generic-associated-types/issue-68656-unsized-values.rs @@ -1,7 +1,5 @@ // Regression test for #68656 -#![feature(generic_associated_types)] - trait UnsafeCopy { type Item<'a>: std::ops::Deref; diff --git a/src/test/ui/generic-associated-types/issue-68656-unsized-values.stderr b/src/test/ui/generic-associated-types/issue-68656-unsized-values.stderr index 8e0f23716..e8770aedf 100644 --- a/src/test/ui/generic-associated-types/issue-68656-unsized-values.stderr +++ b/src/test/ui/generic-associated-types/issue-68656-unsized-values.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `::Target == T` - --> $DIR/issue-68656-unsized-values.rs:15:21 + --> $DIR/issue-68656-unsized-values.rs:13:21 | LL | impl UnsafeCopy for T { | - this type parameter @@ -9,7 +9,7 @@ LL | type Item<'a> = T; = note: expected type parameter `T` found associated type `::Target` note: required by a bound in `UnsafeCopy::Item` - --> $DIR/issue-68656-unsized-values.rs:6:36 + --> $DIR/issue-68656-unsized-values.rs:4:36 | LL | type Item<'a>: std::ops::Deref; | ^^^^^^^^^^ required by this bound in `UnsafeCopy::Item` diff --git a/src/test/ui/generic-associated-types/issue-70303.rs b/src/test/ui/generic-associated-types/issue-70303.rs index 568996e1a..0edff5e4e 100644 --- a/src/test/ui/generic-associated-types/issue-70303.rs +++ b/src/test/ui/generic-associated-types/issue-70303.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - trait Document { type Cursor<'a>: DocCursor<'a> where Self: 'a; diff --git a/src/test/ui/generic-associated-types/issue-70304.rs b/src/test/ui/generic-associated-types/issue-70304.rs index f778f985c..8898d4c7d 100644 --- a/src/test/ui/generic-associated-types/issue-70304.rs +++ b/src/test/ui/generic-associated-types/issue-70304.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Document { type Cursor<'a>: DocCursor<'a>; //~^ ERROR: missing required bound on `Cursor` diff --git a/src/test/ui/generic-associated-types/issue-70304.stderr b/src/test/ui/generic-associated-types/issue-70304.stderr index bba7cab70..99339e968 100644 --- a/src/test/ui/generic-associated-types/issue-70304.stderr +++ b/src/test/ui/generic-associated-types/issue-70304.stderr @@ -1,11 +1,11 @@ error[E0637]: `'_` cannot be used here - --> $DIR/issue-70304.rs:48:41 + --> $DIR/issue-70304.rs:46:41 | LL | fn create_doc() -> impl Document = DocCursorImpl<'_>> { | ^^ `'_` is a reserved lifetime name error[E0106]: missing lifetime specifier - --> $DIR/issue-70304.rs:48:61 + --> $DIR/issue-70304.rs:46:61 | LL | fn create_doc() -> impl Document = DocCursorImpl<'_>> { | ^^ expected named lifetime parameter @@ -17,7 +17,7 @@ LL | fn create_doc() -> impl Document = DocCursorImpl<'static>> { | ~~~~~~~ error: missing required bound on `Cursor` - --> $DIR/issue-70304.rs:4:5 + --> $DIR/issue-70304.rs:2:5 | LL | type Cursor<'a>: DocCursor<'a>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- diff --git a/src/test/ui/generic-associated-types/issue-71176.rs b/src/test/ui/generic-associated-types/issue-71176.rs index c2f0d59f4..f0e162d82 100644 --- a/src/test/ui/generic-associated-types/issue-71176.rs +++ b/src/test/ui/generic-associated-types/issue-71176.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Provider { type A<'a>; } diff --git a/src/test/ui/generic-associated-types/issue-71176.stderr b/src/test/ui/generic-associated-types/issue-71176.stderr index 08c8d4162..386c97161 100644 --- a/src/test/ui/generic-associated-types/issue-71176.stderr +++ b/src/test/ui/generic-associated-types/issue-71176.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `Provider::A` - --> $DIR/issue-71176.rs:12:27 + --> $DIR/issue-71176.rs:10:27 | LL | inner: Box>, | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-71176.rs:4:10 + --> $DIR/issue-71176.rs:2:10 | LL | type A<'a>; | ^ -- diff --git a/src/test/ui/generic-associated-types/issue-74684-1.rs b/src/test/ui/generic-associated-types/issue-74684-1.rs index 0e3899a88..e9ec80074 100644 --- a/src/test/ui/generic-associated-types/issue-74684-1.rs +++ b/src/test/ui/generic-associated-types/issue-74684-1.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Fun { type F<'a>: ?Sized; diff --git a/src/test/ui/generic-associated-types/issue-74684-1.stderr b/src/test/ui/generic-associated-types/issue-74684-1.stderr index 2cd050ed8..cacc97307 100644 --- a/src/test/ui/generic-associated-types/issue-74684-1.stderr +++ b/src/test/ui/generic-associated-types/issue-74684-1.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/issue-74684-1.rs:15:26 + --> $DIR/issue-74684-1.rs:13:26 | LL | fn bug<'a, T: ?Sized + Fun = [u8]>>(_ : Box) -> &'static T::F<'a> { | -- lifetime `'a` defined here diff --git a/src/test/ui/generic-associated-types/issue-74684-2.rs b/src/test/ui/generic-associated-types/issue-74684-2.rs index fca55070b..ff243af2c 100644 --- a/src/test/ui/generic-associated-types/issue-74684-2.rs +++ b/src/test/ui/generic-associated-types/issue-74684-2.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Fun { type F<'a>: ?Sized; diff --git a/src/test/ui/generic-associated-types/issue-74684-2.stderr b/src/test/ui/generic-associated-types/issue-74684-2.stderr index f0e03e73f..59b85abf5 100644 --- a/src/test/ui/generic-associated-types/issue-74684-2.stderr +++ b/src/test/ui/generic-associated-types/issue-74684-2.stderr @@ -1,16 +1,18 @@ error[E0271]: type mismatch resolving `<{integer} as Fun>::F<'_> == [u8]` - --> $DIR/issue-74684-2.rs:23:5 + --> $DIR/issue-74684-2.rs:21:9 | LL | bug(Box::new(x)); - | ^^^ type mismatch resolving `<{integer} as Fun>::F<'_> == [u8]` + | --- ^^^^^^^^^^^ type mismatch resolving `<{integer} as Fun>::F<'_> == [u8]` + | | + | required by a bound introduced by this call | note: expected this to be `[u8]` - --> $DIR/issue-74684-2.rs:10:18 + --> $DIR/issue-74684-2.rs:8:18 | LL | type F<'a> = i32; | ^^^ note: required by a bound in `bug` - --> $DIR/issue-74684-2.rs:13:28 + --> $DIR/issue-74684-2.rs:11:28 | LL | fn bug<'a, T: ?Sized + Fun = [u8]>>(t: Box) -> &'static T::F<'a> { | ^^^^^^^^^^^^ required by this bound in `bug` diff --git a/src/test/ui/generic-associated-types/issue-74816.rs b/src/test/ui/generic-associated-types/issue-74816.rs index c932025d1..344afb87f 100644 --- a/src/test/ui/generic-associated-types/issue-74816.rs +++ b/src/test/ui/generic-associated-types/issue-74816.rs @@ -1,5 +1,4 @@ #![feature(associated_type_defaults)] -#![feature(generic_associated_types)] trait Trait1 { fn foo(); diff --git a/src/test/ui/generic-associated-types/issue-74816.stderr b/src/test/ui/generic-associated-types/issue-74816.stderr index 9eaa74e34..45018e697 100644 --- a/src/test/ui/generic-associated-types/issue-74816.stderr +++ b/src/test/ui/generic-associated-types/issue-74816.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `Self: Trait1` is not satisfied - --> $DIR/issue-74816.rs:9:31 + --> $DIR/issue-74816.rs:8:31 | LL | type Associated: Trait1 = Self; | ^^^^ the trait `Trait1` is not implemented for `Self` | note: required by a bound in `Trait2::Associated` - --> $DIR/issue-74816.rs:9:22 + --> $DIR/issue-74816.rs:8:22 | LL | type Associated: Trait1 = Self; | ^^^^^^ required by this bound in `Trait2::Associated` @@ -15,13 +15,13 @@ LL | trait Trait2: Trait1 { | ++++++++ error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/issue-74816.rs:9:31 + --> $DIR/issue-74816.rs:8:31 | LL | type Associated: Trait1 = Self; | ^^^^ doesn't have a size known at compile-time | note: required by a bound in `Trait2::Associated` - --> $DIR/issue-74816.rs:9:5 + --> $DIR/issue-74816.rs:8:5 | LL | type Associated: Trait1 = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait2::Associated` diff --git a/src/test/ui/generic-associated-types/issue-74824.rs b/src/test/ui/generic-associated-types/issue-74824.rs index 1bbf7aac5..10c45d133 100644 --- a/src/test/ui/generic-associated-types/issue-74824.rs +++ b/src/test/ui/generic-associated-types/issue-74824.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] #![feature(associated_type_defaults)] use std::ops::Deref; diff --git a/src/test/ui/generic-associated-types/issue-74824.stderr b/src/test/ui/generic-associated-types/issue-74824.stderr index 8517eb9fa..623adb1c2 100644 --- a/src/test/ui/generic-associated-types/issue-74824.stderr +++ b/src/test/ui/generic-associated-types/issue-74824.stderr @@ -1,24 +1,24 @@ error[E0277]: the trait bound `Box: Copy` is not satisfied - --> $DIR/issue-74824.rs:7:26 + --> $DIR/issue-74824.rs:6:26 | LL | type Copy: Copy = Box; | ^^^^^^ the trait `Copy` is not implemented for `Box` | note: required by a bound in `UnsafeCopy::Copy` - --> $DIR/issue-74824.rs:7:19 + --> $DIR/issue-74824.rs:6:19 | LL | type Copy: Copy = Box; | ^^^^ required by this bound in `UnsafeCopy::Copy` error[E0277]: the trait bound `T: Clone` is not satisfied - --> $DIR/issue-74824.rs:7:26 + --> $DIR/issue-74824.rs:6:26 | LL | type Copy: Copy = Box; | ^^^^^^ the trait `Clone` is not implemented for `T` | - = note: required because of the requirements on the impl of `Clone` for `Box` + = note: required for `Box` to implement `Clone` note: required by a bound in `UnsafeCopy::Copy` - --> $DIR/issue-74824.rs:7:19 + --> $DIR/issue-74824.rs:6:19 | LL | type Copy: Copy = Box; | ^^^^ required by this bound in `UnsafeCopy::Copy` diff --git a/src/test/ui/generic-associated-types/issue-76407.rs b/src/test/ui/generic-associated-types/issue-76407.rs index a8141829b..9556ec6da 100644 --- a/src/test/ui/generic-associated-types/issue-76407.rs +++ b/src/test/ui/generic-associated-types/issue-76407.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - trait Marker {} impl Marker for u32 {} diff --git a/src/test/ui/generic-associated-types/issue-76535.base.stderr b/src/test/ui/generic-associated-types/issue-76535.base.stderr index 5decd58bb..088f69b09 100644 --- a/src/test/ui/generic-associated-types/issue-76535.base.stderr +++ b/src/test/ui/generic-associated-types/issue-76535.base.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `SuperTrait::SubType` - --> $DIR/issue-76535.rs:40:33 + --> $DIR/issue-76535.rs:39:33 | LL | let sub: Box> = Box::new(SuperStruct::new(0)); | ^^^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-76535.rs:10:10 + --> $DIR/issue-76535.rs:9:10 | LL | type SubType<'a>: SubTrait where Self: 'a; | ^^^^^^^ -- @@ -15,13 +15,13 @@ LL | let sub: Box = SubStruct>> = Box::new(SuperS | ~~~~~~~~~~~ error[E0038]: the trait `SuperTrait` cannot be made into an object - --> $DIR/issue-76535.rs:40:14 + --> $DIR/issue-76535.rs:39:14 | LL | let sub: Box> = Box::new(SuperStruct::new(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` 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/issue-76535.rs:10:10 + --> $DIR/issue-76535.rs:9:10 | LL | pub trait SuperTrait { | ---------- this trait cannot be made into an object... @@ -30,20 +30,20 @@ LL | type SubType<'a>: SubTrait where Self: 'a; = help: consider moving `SubType` to another trait error[E0038]: the trait `SuperTrait` cannot be made into an object - --> $DIR/issue-76535.rs:40:57 + --> $DIR/issue-76535.rs:39:57 | LL | let sub: Box> = Box::new(SuperStruct::new(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` 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/issue-76535.rs:10:10 + --> $DIR/issue-76535.rs:9:10 | LL | pub trait SuperTrait { | ---------- this trait cannot be made into an object... LL | type SubType<'a>: SubTrait where Self: 'a; | ^^^^^^^ ...because it contains the generic associated type `SubType` = help: consider moving `SubType` to another trait - = note: required because of the requirements on the impl of `CoerceUnsized>>>` for `Box` + = note: required for `Box` to implement `CoerceUnsized>>>` = note: required by cast to type `Box>>` error: aborting due to 3 previous errors diff --git a/src/test/ui/generic-associated-types/issue-76535.extended.stderr b/src/test/ui/generic-associated-types/issue-76535.extended.stderr index 067d0489b..e79f0a73f 100644 --- a/src/test/ui/generic-associated-types/issue-76535.extended.stderr +++ b/src/test/ui/generic-associated-types/issue-76535.extended.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `SuperTrait::SubType` - --> $DIR/issue-76535.rs:40:33 + --> $DIR/issue-76535.rs:39:33 | LL | let sub: Box> = Box::new(SuperStruct::new(0)); | ^^^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-76535.rs:10:10 + --> $DIR/issue-76535.rs:9:10 | LL | type SubType<'a>: SubTrait where Self: 'a; | ^^^^^^^ -- diff --git a/src/test/ui/generic-associated-types/issue-76535.rs b/src/test/ui/generic-associated-types/issue-76535.rs index 46f217ba0..2457a05a0 100644 --- a/src/test/ui/generic-associated-types/issue-76535.rs +++ b/src/test/ui/generic-associated-types/issue-76535.rs @@ -1,6 +1,5 @@ // revisions: base extended -#![feature(generic_associated_types)] #![cfg_attr(extended, feature(generic_associated_types_extended))] #![cfg_attr(extended, allow(incomplete_features))] diff --git a/src/test/ui/generic-associated-types/issue-76826.rs b/src/test/ui/generic-associated-types/issue-76826.rs index 28eb3b0e7..ead78453e 100644 --- a/src/test/ui/generic-associated-types/issue-76826.rs +++ b/src/test/ui/generic-associated-types/issue-76826.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(generic_associated_types)] - pub trait Iter { type Item<'a> where Self: 'a; diff --git a/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.rs b/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.rs index 850d83be6..fd3b967d9 100644 --- a/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.rs +++ b/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.rs @@ -1,9 +1,7 @@ -// Test for diagnostics when we have mismatched lifetime due to implict 'static lifetime in GATs +// Test for diagnostics when we have mismatched lifetime due to implicit 'static lifetime in GATs // check-fail -#![feature(generic_associated_types)] - pub trait A {} impl A for &dyn A {} impl A for Box {} diff --git a/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr b/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr index d487f19ba..86e0f5745 100644 --- a/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr +++ b/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr @@ -1,22 +1,22 @@ error: incompatible lifetime on type - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:17:18 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:15:18 | LL | type T<'a> = Box; | ^^^^^^^^^^^^^^^ | note: because this has an unmet lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:12:17 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:10:17 | LL | type T<'a>: A; | ^ introduces a `'static` lifetime requirement note: the lifetime `'a` as defined here... - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:17:12 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:15:12 | LL | type T<'a> = Box; | ^^ = note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` note: this has an implicit `'static` lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:9:20 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:7:20 | LL | impl A for Box {} | ^ @@ -26,51 +26,51 @@ LL | impl A for Box {} | ++++ error: incompatible lifetime on type - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:27:18 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:25:18 | LL | type T<'a> = Box; | ^^^^^^^^^^^^^^^ | note: because this has an unmet lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:23:17 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:21:17 | LL | type T<'a>: C; | ^ introduces a `'static` lifetime requirement note: the lifetime `'a` as defined here... - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:27:12 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:25:12 | LL | type T<'a> = Box; | ^^ note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:21:1 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:19:1 | LL | impl C for Box {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: incompatible lifetime on type - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:37:18 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:35:18 | LL | type T<'a> = (Box, Box); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: because this has an unmet lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:33:17 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:31:17 | LL | type T<'a>: E; | ^ introduces a `'static` lifetime requirement note: the lifetime `'a` as defined here... - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:37:12 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:35:12 | LL | type T<'a> = (Box, Box); | ^^ = note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` note: this has an implicit `'static` lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:31:21 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:29:21 | LL | impl E for (Box, Box) {} | ^ note: this has an implicit `'static` lifetime requirement - --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:31:33 + --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:29:33 | LL | impl E for (Box, Box) {} | ^ diff --git a/src/test/ui/generic-associated-types/issue-78671.base.stderr b/src/test/ui/generic-associated-types/issue-78671.base.stderr index 6bcd004b1..514f8d45a 100644 --- a/src/test/ui/generic-associated-types/issue-78671.base.stderr +++ b/src/test/ui/generic-associated-types/issue-78671.base.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `CollectionFamily::Member` - --> $DIR/issue-78671.rs:11:47 + --> $DIR/issue-78671.rs:10:47 | LL | Box::new(Family) as &dyn CollectionFamily | ^^^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-78671.rs:8:10 + --> $DIR/issue-78671.rs:7:10 | LL | type Member; | ^^^^^^ - @@ -15,13 +15,13 @@ LL | Box::new(Family) as &dyn CollectionFamily=usize> | ~~~~~~~~~ error[E0038]: the trait `CollectionFamily` cannot be made into an object - --> $DIR/issue-78671.rs:11:25 + --> $DIR/issue-78671.rs:10:25 | LL | Box::new(Family) as &dyn CollectionFamily | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` 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/issue-78671.rs:8:10 + --> $DIR/issue-78671.rs:7:10 | LL | trait CollectionFamily { | ---------------- this trait cannot be made into an object... diff --git a/src/test/ui/generic-associated-types/issue-78671.extended.stderr b/src/test/ui/generic-associated-types/issue-78671.extended.stderr index f1b489335..6fa09a4c7 100644 --- a/src/test/ui/generic-associated-types/issue-78671.extended.stderr +++ b/src/test/ui/generic-associated-types/issue-78671.extended.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `CollectionFamily::Member` - --> $DIR/issue-78671.rs:11:47 + --> $DIR/issue-78671.rs:10:47 | LL | Box::new(Family) as &dyn CollectionFamily | ^^^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-78671.rs:8:10 + --> $DIR/issue-78671.rs:7:10 | LL | type Member; | ^^^^^^ - diff --git a/src/test/ui/generic-associated-types/issue-78671.rs b/src/test/ui/generic-associated-types/issue-78671.rs index c09dac28b..327b0c14a 100644 --- a/src/test/ui/generic-associated-types/issue-78671.rs +++ b/src/test/ui/generic-associated-types/issue-78671.rs @@ -1,6 +1,5 @@ // revisions: base extended -#![feature(generic_associated_types)] #![cfg_attr(extended, feature(generic_associated_types_extended))] #![cfg_attr(extended, allow(incomplete_features))] diff --git a/src/test/ui/generic-associated-types/issue-79422.base.stderr b/src/test/ui/generic-associated-types/issue-79422.base.stderr index 404c975d6..3c1a29d48 100644 --- a/src/test/ui/generic-associated-types/issue-79422.base.stderr +++ b/src/test/ui/generic-associated-types/issue-79422.base.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `MapLike::VRefCont` - --> $DIR/issue-79422.rs:48:36 + --> $DIR/issue-79422.rs:47:36 | LL | as Box>>; | ^^^^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-79422.rs:24:10 + --> $DIR/issue-79422.rs:23:10 | LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a; | ^^^^^^^^ -- @@ -15,13 +15,13 @@ LL | as Box = dyn RefCont<'_, u8>>>; | ~~~~~~~~~~~~ error[E0038]: the trait `MapLike` cannot be made into an object - --> $DIR/issue-79422.rs:48:12 + --> $DIR/issue-79422.rs:47:12 | LL | as Box>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` 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/issue-79422.rs:24:10 + --> $DIR/issue-79422.rs:23:10 | LL | trait MapLike { | ------- this trait cannot be made into an object... @@ -30,20 +30,20 @@ LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a; = help: consider moving `VRefCont` to another trait error[E0038]: the trait `MapLike` cannot be made into an object - --> $DIR/issue-79422.rs:45:13 + --> $DIR/issue-79422.rs:44:13 | LL | let m = Box::new(std::collections::BTreeMap::::new()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` 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/issue-79422.rs:24:10 + --> $DIR/issue-79422.rs:23:10 | LL | trait MapLike { | ------- this trait cannot be made into an object... LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a; | ^^^^^^^^ ...because it contains the generic associated type `VRefCont` = help: consider moving `VRefCont` to another trait - = note: required because of the requirements on the impl of `CoerceUnsized + 'static)>>>` for `Box>` + = note: required for `Box>` to implement `CoerceUnsized + 'static)>>>` = note: required by cast to type `Box + 'static)>>` error: aborting due to 3 previous errors diff --git a/src/test/ui/generic-associated-types/issue-79422.extended.stderr b/src/test/ui/generic-associated-types/issue-79422.extended.stderr index 9bcbd7471..58c921bf0 100644 --- a/src/test/ui/generic-associated-types/issue-79422.extended.stderr +++ b/src/test/ui/generic-associated-types/issue-79422.extended.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `MapLike::VRefCont` - --> $DIR/issue-79422.rs:48:36 + --> $DIR/issue-79422.rs:47:36 | LL | as Box>>; | ^^^^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-79422.rs:24:10 + --> $DIR/issue-79422.rs:23:10 | LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a; | ^^^^^^^^ -- @@ -15,13 +15,13 @@ LL | as Box = dyn RefCont<'_, u8>>>; | ~~~~~~~~~~~~ error[E0271]: type mismatch resolving ` as MapLike>::VRefCont<'_> == (dyn RefCont<'_, u8> + 'static)` - --> $DIR/issue-79422.rs:45:13 + --> $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)` | note: expected this to be `(dyn RefCont<'_, u8> + 'static)` - --> $DIR/issue-79422.rs:29:25 + --> $DIR/issue-79422.rs:28:25 | LL | type VRefCont<'a> = &'a V where Self: 'a; | ^^^^^ diff --git a/src/test/ui/generic-associated-types/issue-79422.rs b/src/test/ui/generic-associated-types/issue-79422.rs index 7749975e6..a52dd792d 100644 --- a/src/test/ui/generic-associated-types/issue-79422.rs +++ b/src/test/ui/generic-associated-types/issue-79422.rs @@ -1,6 +1,5 @@ // revisions: base extended -#![feature(generic_associated_types)] #![cfg_attr(extended, feature(generic_associated_types_extended))] #![cfg_attr(extended, allow(incomplete_features))] diff --git a/src/test/ui/generic-associated-types/issue-79636-1.rs b/src/test/ui/generic-associated-types/issue-79636-1.rs index 6d73fd68d..a89039b5c 100644 --- a/src/test/ui/generic-associated-types/issue-79636-1.rs +++ b/src/test/ui/generic-associated-types/issue-79636-1.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Monad { type Unwrapped; type Wrapped; diff --git a/src/test/ui/generic-associated-types/issue-79636-1.stderr b/src/test/ui/generic-associated-types/issue-79636-1.stderr index 1ecb86282..155477048 100644 --- a/src/test/ui/generic-associated-types/issue-79636-1.stderr +++ b/src/test/ui/generic-associated-types/issue-79636-1.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `Monad::Wrapped` - --> $DIR/issue-79636-1.rs:15:34 + --> $DIR/issue-79636-1.rs:13:34 | LL | MInner: Monad>, | ^^^^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `B` - --> $DIR/issue-79636-1.rs:5:10 + --> $DIR/issue-79636-1.rs:3:10 | LL | type Wrapped; | ^^^^^^^ - diff --git a/src/test/ui/generic-associated-types/issue-79636-2.rs b/src/test/ui/generic-associated-types/issue-79636-2.rs index cdaf2e483..ff5ff38c9 100644 --- a/src/test/ui/generic-associated-types/issue-79636-2.rs +++ b/src/test/ui/generic-associated-types/issue-79636-2.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait SomeTrait { type Wrapped: SomeTrait; diff --git a/src/test/ui/generic-associated-types/issue-79636-2.stderr b/src/test/ui/generic-associated-types/issue-79636-2.stderr index ae61b7b10..6a36bfc37 100644 --- a/src/test/ui/generic-associated-types/issue-79636-2.stderr +++ b/src/test/ui/generic-associated-types/issue-79636-2.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `SomeTrait::Wrapped` - --> $DIR/issue-79636-2.rs:11:18 + --> $DIR/issue-79636-2.rs:9:18 | LL | W: SomeTrait, | ^^^^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `A` - --> $DIR/issue-79636-2.rs:4:10 + --> $DIR/issue-79636-2.rs:2:10 | LL | type Wrapped: SomeTrait; | ^^^^^^^ - diff --git a/src/test/ui/generic-associated-types/issue-80433-reduced.rs b/src/test/ui/generic-associated-types/issue-80433-reduced.rs index f15d4d8b1..44831a995 100644 --- a/src/test/ui/generic-associated-types/issue-80433-reduced.rs +++ b/src/test/ui/generic-associated-types/issue-80433-reduced.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - struct E {} trait TestMut { diff --git a/src/test/ui/generic-associated-types/issue-80433.rs b/src/test/ui/generic-associated-types/issue-80433.rs index 6a1fe7519..05ff82fa7 100644 --- a/src/test/ui/generic-associated-types/issue-80433.rs +++ b/src/test/ui/generic-associated-types/issue-80433.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - #[derive(Default)] struct E { data: T, diff --git a/src/test/ui/generic-associated-types/issue-80433.stderr b/src/test/ui/generic-associated-types/issue-80433.stderr index d8c210dcf..20a407dd4 100644 --- a/src/test/ui/generic-associated-types/issue-80433.stderr +++ b/src/test/ui/generic-associated-types/issue-80433.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `TestMut::Output` - --> $DIR/issue-80433.rs:23:47 + --> $DIR/issue-80433.rs:21:47 | LL | fn test_simpler<'a>(dst: &'a mut impl TestMut) | ^^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-80433.rs:9:10 + --> $DIR/issue-80433.rs:7:10 | LL | type Output<'a>; | ^^^^^^ -- diff --git a/src/test/ui/generic-associated-types/issue-81487.rs b/src/test/ui/generic-associated-types/issue-81487.rs index 7f399c4f9..0d19a75bb 100644 --- a/src/test/ui/generic-associated-types/issue-81487.rs +++ b/src/test/ui/generic-associated-types/issue-81487.rs @@ -1,7 +1,5 @@ // build-pass -#![feature(generic_associated_types)] - trait Trait { type Ref<'a>; } diff --git a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs index fa2f86242..a7cc9a605 100644 --- a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs +++ b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs @@ -1,7 +1,5 @@ // Regression test for #81712. -#![feature(generic_associated_types)] - trait A { type BType: B; } diff --git a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr index 86c99c32f..c8961e28e 100644 --- a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr +++ b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `C::DType` - --> $DIR/issue-81712-cyclic-traits.rs:16:19 + --> $DIR/issue-81712-cyclic-traits.rs:14:19 | LL | type CType: C; | ^^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-81712-cyclic-traits.rs:13:10 + --> $DIR/issue-81712-cyclic-traits.rs:11:10 | LL | type DType: D; | ^^^^^ - diff --git a/src/test/ui/generic-associated-types/issue-81862.rs b/src/test/ui/generic-associated-types/issue-81862.rs index e457bca0c..bde828b77 100644 --- a/src/test/ui/generic-associated-types/issue-81862.rs +++ b/src/test/ui/generic-associated-types/issue-81862.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait StreamingIterator { type Item<'a>; fn next(&mut self) -> Option; diff --git a/src/test/ui/generic-associated-types/issue-81862.stderr b/src/test/ui/generic-associated-types/issue-81862.stderr index c664b3ee6..ba7980846 100644 --- a/src/test/ui/generic-associated-types/issue-81862.stderr +++ b/src/test/ui/generic-associated-types/issue-81862.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `StreamingIterator::Item` - --> $DIR/issue-81862.rs:5:40 + --> $DIR/issue-81862.rs:3:40 | LL | fn next(&mut self) -> Option; | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-81862.rs:4:10 + --> $DIR/issue-81862.rs:2:10 | LL | type Item<'a>; | ^^^^ -- diff --git a/src/test/ui/generic-associated-types/issue-84931.rs b/src/test/ui/generic-associated-types/issue-84931.rs index 9e247de16..4123ce9d4 100644 --- a/src/test/ui/generic-associated-types/issue-84931.rs +++ b/src/test/ui/generic-associated-types/issue-84931.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] // check-fail trait StreamingIter { diff --git a/src/test/ui/generic-associated-types/issue-84931.stderr b/src/test/ui/generic-associated-types/issue-84931.stderr index 11c3dffde..fffea98a4 100644 --- a/src/test/ui/generic-associated-types/issue-84931.stderr +++ b/src/test/ui/generic-associated-types/issue-84931.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/issue-84931.rs:15:21 + --> $DIR/issue-84931.rs:14:21 | LL | type Item<'a> = &'a mut T; | ^^^^^^^^^- help: consider adding a where clause: `where T: 'a` diff --git a/src/test/ui/generic-associated-types/issue-85921.rs b/src/test/ui/generic-associated-types/issue-85921.rs index df59f497d..d281ed9ee 100644 --- a/src/test/ui/generic-associated-types/issue-85921.rs +++ b/src/test/ui/generic-associated-types/issue-85921.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - trait Trait { type Assoc<'a>; diff --git a/src/test/ui/generic-associated-types/issue-86483.rs b/src/test/ui/generic-associated-types/issue-86483.rs index 07dd0bffd..70267637a 100644 --- a/src/test/ui/generic-associated-types/issue-86483.rs +++ b/src/test/ui/generic-associated-types/issue-86483.rs @@ -4,8 +4,6 @@ // // check-pass -#![feature(generic_associated_types)] - pub trait IceIce where for<'a> T: 'a, diff --git a/src/test/ui/generic-associated-types/issue-86787.rs b/src/test/ui/generic-associated-types/issue-86787.rs index 0f8096c8a..96075ca50 100644 --- a/src/test/ui/generic-associated-types/issue-86787.rs +++ b/src/test/ui/generic-associated-types/issue-86787.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] // check-fail enum Either { diff --git a/src/test/ui/generic-associated-types/issue-86787.stderr b/src/test/ui/generic-associated-types/issue-86787.stderr index d4b2267d3..f34c63cf7 100644 --- a/src/test/ui/generic-associated-types/issue-86787.stderr +++ b/src/test/ui/generic-associated-types/issue-86787.stderr @@ -1,5 +1,5 @@ error: missing required bound on `TRef` - --> $DIR/issue-86787.rs:11:5 + --> $DIR/issue-86787.rs:10:5 | LL | type TRef<'a>; | ^^^^^^^^^^^^^- diff --git a/src/test/ui/generic-associated-types/issue-87258_a.rs b/src/test/ui/generic-associated-types/issue-87258_a.rs index c65f3fb2a..9ab683d3d 100644 --- a/src/test/ui/generic-associated-types/issue-87258_a.rs +++ b/src/test/ui/generic-associated-types/issue-87258_a.rs @@ -1,5 +1,4 @@ #![feature(type_alias_impl_trait)] -#![feature(generic_associated_types)] // See https://github.com/rust-lang/rust/issues/87258#issuecomment-883293367 diff --git a/src/test/ui/generic-associated-types/issue-87258_a.stderr b/src/test/ui/generic-associated-types/issue-87258_a.stderr index db3a5c819..fa0748a28 100644 --- a/src/test/ui/generic-associated-types/issue-87258_a.stderr +++ b/src/test/ui/generic-associated-types/issue-87258_a.stderr @@ -1,5 +1,5 @@ error: unconstrained opaque type - --> $DIR/issue-87258_a.rs:18:26 + --> $DIR/issue-87258_a.rs:17:26 | LL | type FooFuture<'a> = impl Trait1; | ^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/issue-87258_b.rs b/src/test/ui/generic-associated-types/issue-87258_b.rs index f59e0d766..7b7610b21 100644 --- a/src/test/ui/generic-associated-types/issue-87258_b.rs +++ b/src/test/ui/generic-associated-types/issue-87258_b.rs @@ -1,5 +1,4 @@ #![feature(type_alias_impl_trait)] -#![feature(generic_associated_types)] // See https://github.com/rust-lang/rust/issues/87258#issuecomment-883293367 diff --git a/src/test/ui/generic-associated-types/issue-87258_b.stderr b/src/test/ui/generic-associated-types/issue-87258_b.stderr index 9faccc961..0ee665f38 100644 --- a/src/test/ui/generic-associated-types/issue-87258_b.stderr +++ b/src/test/ui/generic-associated-types/issue-87258_b.stderr @@ -1,5 +1,5 @@ error: unconstrained opaque type - --> $DIR/issue-87258_b.rs:17:49 + --> $DIR/issue-87258_b.rs:16:49 | LL | type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1; | ^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/issue-87429-2.rs b/src/test/ui/generic-associated-types/issue-87429-2.rs index d35bb098a..feb43ee5a 100644 --- a/src/test/ui/generic-associated-types/issue-87429-2.rs +++ b/src/test/ui/generic-associated-types/issue-87429-2.rs @@ -4,8 +4,6 @@ // check-pass -#![feature(generic_associated_types)] - trait Family { type Member<'a, C: Eq>: for<'b> MyBound<'b, C>; } diff --git a/src/test/ui/generic-associated-types/issue-87429-associated-type-default.rs b/src/test/ui/generic-associated-types/issue-87429-associated-type-default.rs index 9ee07c2f1..2006f9bc7 100644 --- a/src/test/ui/generic-associated-types/issue-87429-associated-type-default.rs +++ b/src/test/ui/generic-associated-types/issue-87429-associated-type-default.rs @@ -1,7 +1,6 @@ // check-fail #![feature(associated_type_defaults)] -#![feature(generic_associated_types)] trait Family { // Fine, i32: PartialEq diff --git a/src/test/ui/generic-associated-types/issue-87429-associated-type-default.stderr b/src/test/ui/generic-associated-types/issue-87429-associated-type-default.stderr index c6fa02cb9..b1abe012b 100644 --- a/src/test/ui/generic-associated-types/issue-87429-associated-type-default.stderr +++ b/src/test/ui/generic-associated-types/issue-87429-associated-type-default.stderr @@ -1,12 +1,12 @@ error[E0277]: can't compare `Foo` with `Foo` - --> $DIR/issue-87429-associated-type-default.rs:14:60 + --> $DIR/issue-87429-associated-type-default.rs:13:60 | LL | type Member<'a>: for<'b> PartialEq> = Foo; | ^^^ no implementation for `Foo == Foo` | = help: the trait `PartialEq` is not implemented for `Foo` note: required by a bound in `Family2::Member` - --> $DIR/issue-87429-associated-type-default.rs:14:22 + --> $DIR/issue-87429-associated-type-default.rs:13:22 | LL | type Member<'a>: for<'b> PartialEq> = Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family2::Member` diff --git a/src/test/ui/generic-associated-types/issue-87429-specialization.rs b/src/test/ui/generic-associated-types/issue-87429-specialization.rs index b365e07fe..6e31f1b21 100644 --- a/src/test/ui/generic-associated-types/issue-87429-specialization.rs +++ b/src/test/ui/generic-associated-types/issue-87429-specialization.rs @@ -2,7 +2,6 @@ #![feature(specialization)] //~^ WARN incomplete -#![feature(generic_associated_types)] trait Family { type Member<'a>: for<'b> PartialEq>; diff --git a/src/test/ui/generic-associated-types/issue-87429-specialization.stderr b/src/test/ui/generic-associated-types/issue-87429-specialization.stderr index 015e0c779..d8e889aec 100644 --- a/src/test/ui/generic-associated-types/issue-87429-specialization.stderr +++ b/src/test/ui/generic-associated-types/issue-87429-specialization.stderr @@ -9,14 +9,14 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete error[E0277]: can't compare `Foo` with `Foo` - --> $DIR/issue-87429-specialization.rs:21:31 + --> $DIR/issue-87429-specialization.rs:20:31 | LL | default type Member<'a> = Foo; | ^^^ no implementation for `Foo == Foo` | = help: the trait `PartialEq` is not implemented for `Foo` note: required by a bound in `Family::Member` - --> $DIR/issue-87429-specialization.rs:8:22 + --> $DIR/issue-87429-specialization.rs:7:22 | LL | type Member<'a>: for<'b> PartialEq>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family::Member` diff --git a/src/test/ui/generic-associated-types/issue-87429.rs b/src/test/ui/generic-associated-types/issue-87429.rs index f905348ae..56394823c 100644 --- a/src/test/ui/generic-associated-types/issue-87429.rs +++ b/src/test/ui/generic-associated-types/issue-87429.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - trait Family { type Member<'a>: for<'b> PartialEq>; } diff --git a/src/test/ui/generic-associated-types/issue-87748.rs b/src/test/ui/generic-associated-types/issue-87748.rs new file mode 100644 index 000000000..6cbe3d902 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-87748.rs @@ -0,0 +1,21 @@ +// Checks that we properly add implied bounds from unnormalized projections in +// inputs when typechecking functions. + +// check-pass + +trait MyTrait { + type Assoc<'a, 'b> where 'b: 'a; + fn do_sth(arg: Self::Assoc<'_, '_>); + fn do_sth2(arg: Self::Assoc<'_, '_>) {} +} + +struct Foo; + +impl MyTrait for Foo { + type Assoc<'a, 'b> = u32 where 'b: 'a; + + fn do_sth(_: u32) {} + fn do_sth2(_: Self::Assoc<'static, 'static>) {} +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-87750.rs b/src/test/ui/generic-associated-types/issue-87750.rs index 89bd79ac2..0a11a0f3a 100644 --- a/src/test/ui/generic-associated-types/issue-87750.rs +++ b/src/test/ui/generic-associated-types/issue-87750.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait PointerFamily { type Pointer; } diff --git a/src/test/ui/generic-associated-types/issue-87750.stderr b/src/test/ui/generic-associated-types/issue-87750.stderr index 854541f3d..b358ca273 100644 --- a/src/test/ui/generic-associated-types/issue-87750.stderr +++ b/src/test/ui/generic-associated-types/issue-87750.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow evaluating the requirement `Node: Sized` - --> $DIR/issue-87750.rs:20:16 + --> $DIR/issue-87750.rs:18:16 | LL | let _list: ::Pointer>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/issue-88287.rs b/src/test/ui/generic-associated-types/issue-88287.rs index 4952a0825..82188493d 100644 --- a/src/test/ui/generic-associated-types/issue-88287.rs +++ b/src/test/ui/generic-associated-types/issue-88287.rs @@ -1,6 +1,5 @@ // edition:2018 -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] use std::future::Future; diff --git a/src/test/ui/generic-associated-types/issue-88287.stderr b/src/test/ui/generic-associated-types/issue-88287.stderr index 5241d85a5..1b84cce62 100644 --- a/src/test/ui/generic-associated-types/issue-88287.stderr +++ b/src/test/ui/generic-associated-types/issue-88287.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/issue-88287.rs:35:9 + --> $DIR/issue-88287.rs:34:9 | LL | type SearchFutureTy<'f, A, B: 'f> | - this type parameter needs to be `std::marker::Sized` @@ -8,7 +8,7 @@ LL | async move { todo!() } | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | note: required by a bound in `>` - --> $DIR/issue-88287.rs:25:6 + --> $DIR/issue-88287.rs:24:6 | LL | impl SearchableResourceExt for T | ^ required by this bound in `>` diff --git a/src/test/ui/generic-associated-types/issue-88360.rs b/src/test/ui/generic-associated-types/issue-88360.rs index 8ee98201a..c02690618 100644 --- a/src/test/ui/generic-associated-types/issue-88360.rs +++ b/src/test/ui/generic-associated-types/issue-88360.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait GatTrait { type Gat<'a> where Self: 'a; diff --git a/src/test/ui/generic-associated-types/issue-88360.stderr b/src/test/ui/generic-associated-types/issue-88360.stderr index 5f769d799..cd3750344 100644 --- a/src/test/ui/generic-associated-types/issue-88360.stderr +++ b/src/test/ui/generic-associated-types/issue-88360.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-88360.rs:15:9 + --> $DIR/issue-88360.rs:13:9 | LL | trait SuperTrait | - this type parameter diff --git a/src/test/ui/generic-associated-types/issue-88405.rs b/src/test/ui/generic-associated-types/issue-88405.rs index 4a405bd36..8dad6a89f 100644 --- a/src/test/ui/generic-associated-types/issue-88405.rs +++ b/src/test/ui/generic-associated-types/issue-88405.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - trait SomeTrait {} trait OtherTrait { type Item; diff --git a/src/test/ui/generic-associated-types/issue-88459.rs b/src/test/ui/generic-associated-types/issue-88459.rs index 3b26a1801..07d7bc06d 100644 --- a/src/test/ui/generic-associated-types/issue-88459.rs +++ b/src/test/ui/generic-associated-types/issue-88459.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - trait Trait { type Assoc<'a>; } diff --git a/src/test/ui/generic-associated-types/issue-88595.rs b/src/test/ui/generic-associated-types/issue-88595.rs index e0796dfec..24641ee1f 100644 --- a/src/test/ui/generic-associated-types/issue-88595.rs +++ b/src/test/ui/generic-associated-types/issue-88595.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-88595.stderr b/src/test/ui/generic-associated-types/issue-88595.stderr index 79d3479af..bcefc8066 100644 --- a/src/test/ui/generic-associated-types/issue-88595.stderr +++ b/src/test/ui/generic-associated-types/issue-88595.stderr @@ -1,11 +1,11 @@ error: non-defining opaque type use in defining scope - --> $DIR/issue-88595.rs:21:35 + --> $DIR/issue-88595.rs:20:35 | LL | fn a(&'a self) -> Self::B<'a> {} | ^^ | note: lifetime used multiple times - --> $DIR/issue-88595.rs:18:6 + --> $DIR/issue-88595.rs:17:6 | LL | impl<'a> A<'a> for C { | ^^ diff --git a/src/test/ui/generic-associated-types/issue-89352.rs b/src/test/ui/generic-associated-types/issue-89352.rs index d9c656d5f..1896d0c87 100644 --- a/src/test/ui/generic-associated-types/issue-89352.rs +++ b/src/test/ui/generic-associated-types/issue-89352.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - use std::marker::PhantomData; pub trait GenAssoc { diff --git a/src/test/ui/generic-associated-types/issue-90014.rs b/src/test/ui/generic-associated-types/issue-90014.rs index f110b0693..55db95a6d 100644 --- a/src/test/ui/generic-associated-types/issue-90014.rs +++ b/src/test/ui/generic-associated-types/issue-90014.rs @@ -1,6 +1,5 @@ // edition:2018 -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] use std::future::Future; diff --git a/src/test/ui/generic-associated-types/issue-90014.stderr b/src/test/ui/generic-associated-types/issue-90014.stderr index 457c582e8..2d3f4a6af 100644 --- a/src/test/ui/generic-associated-types/issue-90014.stderr +++ b/src/test/ui/generic-associated-types/issue-90014.stderr @@ -1,5 +1,5 @@ error[E0477]: the type `&mut ()` does not fulfill the required lifetime - --> $DIR/issue-90014.rs:14:20 + --> $DIR/issue-90014.rs:13:20 | LL | type Fut<'a> where Self: 'a; | ------------ definition of `Fut` from trait @@ -8,7 +8,7 @@ LL | type Fut<'a> = impl Future; | ^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a` | note: type must outlive the lifetime `'a` as defined here - --> $DIR/issue-90014.rs:14:14 + --> $DIR/issue-90014.rs:13:14 | LL | type Fut<'a> = impl Future; | ^^ diff --git a/src/test/ui/generic-associated-types/issue-90729.rs b/src/test/ui/generic-associated-types/issue-90729.rs index 98295cce8..bcec2e321 100644 --- a/src/test/ui/generic-associated-types/issue-90729.rs +++ b/src/test/ui/generic-associated-types/issue-90729.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - use std::marker::PhantomData; pub trait Type { diff --git a/src/test/ui/generic-associated-types/issue-91139.migrate.stderr b/src/test/ui/generic-associated-types/issue-91139.migrate.stderr index b424d9a2f..690160577 100644 --- a/src/test/ui/generic-associated-types/issue-91139.migrate.stderr +++ b/src/test/ui/generic-associated-types/issue-91139.migrate.stderr @@ -1,13 +1,8 @@ -error[E0311]: the parameter type `T` may not live long enough - --> $DIR/issue-91139.rs:27:12 +error: expected identifier, found `<<` + --> $DIR/issue-91139.rs:1:1 | -LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | fn foo() { - | ++++ +LL | <<<<<<< HEAD + | ^^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-91139.rs b/src/test/ui/generic-associated-types/issue-91139.rs index 40eef11f0..5fc6071c9 100644 --- a/src/test/ui/generic-associated-types/issue-91139.rs +++ b/src/test/ui/generic-associated-types/issue-91139.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Foo { type Type<'a> where diff --git a/src/test/ui/generic-associated-types/issue-91139.stderr b/src/test/ui/generic-associated-types/issue-91139.stderr index b789b3a42..8bbe98fa1 100644 --- a/src/test/ui/generic-associated-types/issue-91139.stderr +++ b/src/test/ui/generic-associated-types/issue-91139.stderr @@ -1,41 +1,41 @@ error: `T` does not live long enough - --> $DIR/issue-91139.rs:16:12 + --> $DIR/issue-91139.rs:14:12 | LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `T` does not live long enough - --> $DIR/issue-91139.rs:16:12 + --> $DIR/issue-91139.rs:14:12 | LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `T` does not live long enough - --> $DIR/issue-91139.rs:16:12 + --> $DIR/issue-91139.rs:14:12 | LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `T` does not live long enough - --> $DIR/issue-91139.rs:16:12 + --> $DIR/issue-91139.rs:14:12 | LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `T` does not live long enough - --> $DIR/issue-91139.rs:16:58 + --> $DIR/issue-91139.rs:14:58 | LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); | ^^^^^^^^^ error: `T` does not live long enough - --> $DIR/issue-91139.rs:16:58 + --> $DIR/issue-91139.rs:14:58 | LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); | ^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/issue-91139.rs:16:58 + --> $DIR/issue-91139.rs:14:58 | LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); | ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds @@ -46,13 +46,13 @@ LL | fn foo() { | +++++++++ error: `T` does not live long enough - --> $DIR/issue-91139.rs:16:58 + --> $DIR/issue-91139.rs:14:58 | LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); | ^^^^^^^^^ error: `T` does not live long enough - --> $DIR/issue-91139.rs:16:58 + --> $DIR/issue-91139.rs:14:58 | LL | let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); | ^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/issue-91762.rs b/src/test/ui/generic-associated-types/issue-91762.rs deleted file mode 100644 index b259a3c6e..000000000 --- a/src/test/ui/generic-associated-types/issue-91762.rs +++ /dev/null @@ -1,30 +0,0 @@ -// check-fail - -// FIXME(generic_associated_types): We almost certaintly want this to pass, but -// it's particularly difficult currently, because we need a way of specifying -// that `::With = Self` without using that when we have -// a `U`. See `https://github.com/rust-lang/rust/pull/92728` for a (hacky) -// solution. This might be better to just wait for Chalk. - -#![feature(generic_associated_types)] - -pub trait Functor { - type With; - - fn fmap(this: Self::With) -> Self::With; -} - -pub trait FunctorExt: Sized { - type Base: Functor = Self>; - - fn fmap(self) { - let arg: ::With; - let ret: ::With; - - arg = self; - ret = ::fmap(arg); - //~^ type annotations needed - } -} - -fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-91762.stderr b/src/test/ui/generic-associated-types/issue-91762.stderr deleted file mode 100644 index c2785fee3..000000000 --- a/src/test/ui/generic-associated-types/issue-91762.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/issue-91762.rs:25:15 - | -LL | ret = ::fmap(arg); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the associated function `fmap` - | -help: consider specifying the generic arguments - | -LL | ret = ::fmap::(arg); - | ++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/generic-associated-types/issue-91883.rs b/src/test/ui/generic-associated-types/issue-91883.rs index 3d4585a44..e870e08a3 100644 --- a/src/test/ui/generic-associated-types/issue-91883.rs +++ b/src/test/ui/generic-associated-types/issue-91883.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - use std::fmt::Debug; use std::marker::PhantomData; diff --git a/src/test/ui/generic-associated-types/issue-91883.stderr b/src/test/ui/generic-associated-types/issue-91883.stderr index baf4889cc..1cfc2aaf1 100644 --- a/src/test/ui/generic-associated-types/issue-91883.stderr +++ b/src/test/ui/generic-associated-types/issue-91883.stderr @@ -1,5 +1,5 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/issue-91883.rs:32:24 + --> $DIR/issue-91883.rs:30:24 | LL | type Cursor<'tx>: Cursor<'tx> | ----------------------------- definition of `Cursor` from trait @@ -8,12 +8,12 @@ LL | type Cursor<'tx> = CursorImpl<'tx>; | ^^^^^^^^^^^^^^^- help: try copying these clauses from the trait: `where 'db: 'tx, Self: 'tx` | note: lifetime parameter instantiated with the lifetime `'db` as defined here - --> $DIR/issue-91883.rs:31:6 + --> $DIR/issue-91883.rs:29:6 | LL | impl<'db> Transaction<'db> for TransactionImpl<'db> { | ^^^ note: but lifetime parameter must outlive the lifetime `'tx` as defined here - --> $DIR/issue-91883.rs:32:17 + --> $DIR/issue-91883.rs:30:17 | LL | type Cursor<'tx> = CursorImpl<'tx>; | ^^^ diff --git a/src/test/ui/generic-associated-types/issue-92033.rs b/src/test/ui/generic-associated-types/issue-92033.rs index 1d5f7d5c0..d111580b8 100644 --- a/src/test/ui/generic-associated-types/issue-92033.rs +++ b/src/test/ui/generic-associated-types/issue-92033.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - struct Texture; trait Surface { diff --git a/src/test/ui/generic-associated-types/issue-92033.stderr b/src/test/ui/generic-associated-types/issue-92033.stderr index 6dd901027..cd7eed254 100644 --- a/src/test/ui/generic-associated-types/issue-92033.stderr +++ b/src/test/ui/generic-associated-types/issue-92033.stderr @@ -1,5 +1,5 @@ error[E0477]: the type `&'s Texture` does not fulfill the required lifetime - --> $DIR/issue-92033.rs:22:28 + --> $DIR/issue-92033.rs:20:28 | LL | type TextureIter<'a>: Iterator | -------------------------------------------------- definition of `TextureIter` from trait @@ -8,7 +8,7 @@ LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a` | note: type must outlive the lifetime `'a` as defined here - --> $DIR/issue-92033.rs:22:22 + --> $DIR/issue-92033.rs:20:22 | LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>; | ^^ diff --git a/src/test/ui/generic-associated-types/issue-92096.migrate.stderr b/src/test/ui/generic-associated-types/issue-92096.migrate.stderr index c74161cd3..ce1fd6dd9 100644 --- a/src/test/ui/generic-associated-types/issue-92096.migrate.stderr +++ b/src/test/ui/generic-associated-types/issue-92096.migrate.stderr @@ -1,5 +1,5 @@ error[E0311]: the parameter type `C` may not live long enough - --> $DIR/issue-92096.rs:20:33 + --> $DIR/issue-92096.rs:19:33 | LL | fn call_connect(c: &'_ C) -> impl '_ + Future + Send | ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds @@ -10,7 +10,7 @@ LL | C: Client + Send + Sync + 'a, | ++++ error[E0311]: the parameter type `C` may not live long enough - --> $DIR/issue-92096.rs:20:33 + --> $DIR/issue-92096.rs:19:33 | LL | fn call_connect(c: &'_ C) -> impl '_ + Future + Send | ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds diff --git a/src/test/ui/generic-associated-types/issue-92096.rs b/src/test/ui/generic-associated-types/issue-92096.rs index 377b8164a..e285af666 100644 --- a/src/test/ui/generic-associated-types/issue-92096.rs +++ b/src/test/ui/generic-associated-types/issue-92096.rs @@ -1,7 +1,5 @@ // edition:2018 -#![feature(generic_associated_types)] - use std::future::Future; trait Client { diff --git a/src/test/ui/generic-associated-types/issue-92096.stderr b/src/test/ui/generic-associated-types/issue-92096.stderr index ca61a0f43..91a06d5ac 100644 --- a/src/test/ui/generic-associated-types/issue-92096.stderr +++ b/src/test/ui/generic-associated-types/issue-92096.stderr @@ -1,5 +1,5 @@ error: `C` does not live long enough - --> $DIR/issue-92096.rs:19:5 + --> $DIR/issue-92096.rs:17:5 | LL | async move { c.connect().await } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/issue-92280.rs b/src/test/ui/generic-associated-types/issue-92280.rs index 81d000f10..9284beea3 100644 --- a/src/test/ui/generic-associated-types/issue-92280.rs +++ b/src/test/ui/generic-associated-types/issue-92280.rs @@ -1,6 +1,5 @@ // check-pass -#![feature(generic_associated_types)] #![allow(non_camel_case_types)] trait HasAssoc { diff --git a/src/test/ui/generic-associated-types/issue-92954.rs b/src/test/ui/generic-associated-types/issue-92954.rs index 95c090ff4..22ce8f9fe 100644 --- a/src/test/ui/generic-associated-types/issue-92954.rs +++ b/src/test/ui/generic-associated-types/issue-92954.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - pub trait Foo { type Assoc<'c>; fn function() -> for<'x> fn(Self::Assoc<'x>); diff --git a/src/test/ui/generic-associated-types/issue-93141.rs b/src/test/ui/generic-associated-types/issue-93141.rs index 39ca77d13..48c78b9c0 100644 --- a/src/test/ui/generic-associated-types/issue-93141.rs +++ b/src/test/ui/generic-associated-types/issue-93141.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - pub trait Fooey: Sized { type Context<'c> where Self: 'c; } diff --git a/src/test/ui/generic-associated-types/issue-93262.rs b/src/test/ui/generic-associated-types/issue-93262.rs index adc6aa8fa..a7bcd111d 100644 --- a/src/test/ui/generic-associated-types/issue-93262.rs +++ b/src/test/ui/generic-associated-types/issue-93262.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - pub trait Trait { type Assoc<'a> where Self: 'a; } diff --git a/src/test/ui/generic-associated-types/issue-93340.rs b/src/test/ui/generic-associated-types/issue-93340.rs index d065bde88..4662fda53 100644 --- a/src/test/ui/generic-associated-types/issue-93340.rs +++ b/src/test/ui/generic-associated-types/issue-93340.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - pub trait Scalar: 'static { type RefType<'a>: ScalarRef<'a>; } diff --git a/src/test/ui/generic-associated-types/issue-93341.rs b/src/test/ui/generic-associated-types/issue-93341.rs index e96a768ec..737b2bbdb 100644 --- a/src/test/ui/generic-associated-types/issue-93341.rs +++ b/src/test/ui/generic-associated-types/issue-93341.rs @@ -1,6 +1,5 @@ // check-pass -#![feature(generic_associated_types)] use std::marker::PhantomData; pub struct Id<'id>(PhantomData &'id ()>); diff --git a/src/test/ui/generic-associated-types/issue-93342.rs b/src/test/ui/generic-associated-types/issue-93342.rs index d8d7adac9..d4422d5d1 100644 --- a/src/test/ui/generic-associated-types/issue-93342.rs +++ b/src/test/ui/generic-associated-types/issue-93342.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - use std::marker::PhantomData; pub trait Scalar: 'static { diff --git a/src/test/ui/generic-associated-types/issue-93874.rs b/src/test/ui/generic-associated-types/issue-93874.rs index f403d7516..30956655a 100644 --- a/src/test/ui/generic-associated-types/issue-93874.rs +++ b/src/test/ui/generic-associated-types/issue-93874.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - pub trait Build { type Output; fn build(self, input: O) -> Self::Output; diff --git a/src/test/ui/generic-associated-types/issue-95305.rs b/src/test/ui/generic-associated-types/issue-95305.rs index e2f1710fa..6c3ec20e7 100644 --- a/src/test/ui/generic-associated-types/issue-95305.rs +++ b/src/test/ui/generic-associated-types/issue-95305.rs @@ -2,7 +2,6 @@ // Forbid it for now but proper support might be added // at some point in the future. -#![feature(generic_associated_types)] #![feature(anonymous_lifetime_in_impl_trait)] trait Foo { type Item<'a>; diff --git a/src/test/ui/generic-associated-types/issue-95305.stderr b/src/test/ui/generic-associated-types/issue-95305.stderr index d8557525f..eb15cbc62 100644 --- a/src/test/ui/generic-associated-types/issue-95305.stderr +++ b/src/test/ui/generic-associated-types/issue-95305.stderr @@ -1,5 +1,5 @@ error[E0637]: `'_` cannot be used here - --> $DIR/issue-95305.rs:11:26 + --> $DIR/issue-95305.rs:10:26 | LL | fn foo(x: &impl Foo = u32>) { } | ^^ `'_` is a reserved lifetime name diff --git a/src/test/ui/generic-associated-types/iterable.rs b/src/test/ui/generic-associated-types/iterable.rs index af0049891..8ad351bd3 100644 --- a/src/test/ui/generic-associated-types/iterable.rs +++ b/src/test/ui/generic-associated-types/iterable.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - // run-pass trait Iterable { diff --git a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs index 655abd18d..36974b3df 100644 --- a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs +++ b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs @@ -1,8 +1,6 @@ // Test that the predicate printed in an unresolved method error prints the // generics for a generic associated type. -#![feature(generic_associated_types)] - trait X { type Y; } diff --git a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr index d9dc77ac8..baef38f6b 100644 --- a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr +++ b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr @@ -1,5 +1,5 @@ error[E0599]: the method `f` exists for struct `S`, but its trait bounds were not satisfied - --> $DIR/method-unsatified-assoc-type-predicate.rs:30:7 + --> $DIR/method-unsatified-assoc-type-predicate.rs:28:7 | LL | struct S; | -------- @@ -12,7 +12,7 @@ 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:14:11 + --> $DIR/method-unsatified-assoc-type-predicate.rs:12:11 | LL | impl = i32>> M for T {} | ^^^^^^^^^^^^ - - diff --git a/src/test/ui/generic-associated-types/missing-bounds.fixed b/src/test/ui/generic-associated-types/missing-bounds.fixed index 2315810a4..ee758f19e 100644 --- a/src/test/ui/generic-associated-types/missing-bounds.fixed +++ b/src/test/ui/generic-associated-types/missing-bounds.fixed @@ -24,7 +24,7 @@ impl> Add for C { struct D(B); -impl> Add for D { +impl> Add for D { type Output = Self; fn add(self, rhs: Self) -> Self { diff --git a/src/test/ui/generic-associated-types/missing-bounds.stderr b/src/test/ui/generic-associated-types/missing-bounds.stderr index 138c642dd..c913483a8 100644 --- a/src/test/ui/generic-associated-types/missing-bounds.stderr +++ b/src/test/ui/generic-associated-types/missing-bounds.stderr @@ -66,8 +66,8 @@ LL | Self(self.0 + rhs.0) | help: consider restricting type parameter `B` | -LL | impl> Add for D { - | +++++++++++++++++++++++++ +LL | impl> Add for D { + | +++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/missing-bounds.rs:42:14 diff --git a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs index 8171dc0ae..de9cad308 100644 --- a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs +++ b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs @@ -1,7 +1,5 @@ // check-fail -#![feature(generic_associated_types)] - trait Foo { type Assoc<'a, 'b>; } diff --git a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr index edd1f9367..ffdba6676 100644 --- a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr +++ b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/missing-where-clause-on-trait.rs:9:39 + --> $DIR/missing-where-clause-on-trait.rs:7:39 | LL | type Assoc<'a, 'b>; | ------------------ definition of `Assoc` from trait diff --git a/src/test/ui/generic-associated-types/missing_lifetime_args.rs b/src/test/ui/generic-associated-types/missing_lifetime_args.rs index cd918157f..78def8092 100644 --- a/src/test/ui/generic-associated-types/missing_lifetime_args.rs +++ b/src/test/ui/generic-associated-types/missing_lifetime_args.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait X { type Y<'a, 'b>; } diff --git a/src/test/ui/generic-associated-types/missing_lifetime_args.stderr b/src/test/ui/generic-associated-types/missing_lifetime_args.stderr index 7cf3f4b73..0ad1f1f8c 100644 --- a/src/test/ui/generic-associated-types/missing_lifetime_args.stderr +++ b/src/test/ui/generic-associated-types/missing_lifetime_args.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `X::Y` - --> $DIR/missing_lifetime_args.rs:13:32 + --> $DIR/missing_lifetime_args.rs:11:32 | LL | fn foo<'c, 'd>(_arg: Box>) {} | ^ expected 2 lifetime arguments | note: associated type defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/missing_lifetime_args.rs:4:10 + --> $DIR/missing_lifetime_args.rs:2:10 | LL | type Y<'a, 'b>; | ^ -- -- @@ -15,7 +15,7 @@ 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 - --> $DIR/missing_lifetime_args.rs:16:26 + --> $DIR/missing_lifetime_args.rs:14:26 | LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} | ^^^ -- -- supplied 2 lifetime arguments @@ -23,7 +23,7 @@ LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} | expected 3 lifetime arguments | note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c` - --> $DIR/missing_lifetime_args.rs:7:8 + --> $DIR/missing_lifetime_args.rs:5:8 | LL | struct Foo<'a, 'b, 'c> { | ^^^ -- -- -- @@ -33,7 +33,7 @@ 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 - --> $DIR/missing_lifetime_args.rs:19:16 + --> $DIR/missing_lifetime_args.rs:17:16 | LL | fn f<'a>(_arg: Foo<'a>) {} | ^^^ -- supplied 1 lifetime argument @@ -41,7 +41,7 @@ LL | fn f<'a>(_arg: Foo<'a>) {} | expected 3 lifetime arguments | note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c` - --> $DIR/missing_lifetime_args.rs:7:8 + --> $DIR/missing_lifetime_args.rs:5:8 | LL | struct Foo<'a, 'b, 'c> { | ^^^ -- -- -- diff --git a/src/test/ui/generic-associated-types/missing_lifetime_const.rs b/src/test/ui/generic-associated-types/missing_lifetime_const.rs index e3e78dd96..8b174b9e9 100644 --- a/src/test/ui/generic-associated-types/missing_lifetime_const.rs +++ b/src/test/ui/generic-associated-types/missing_lifetime_const.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Foo { type Assoc<'a, const N: usize>; } diff --git a/src/test/ui/generic-associated-types/missing_lifetime_const.stderr b/src/test/ui/generic-associated-types/missing_lifetime_const.stderr index 5d50637bd..62d2e9f49 100644 --- a/src/test/ui/generic-associated-types/missing_lifetime_const.stderr +++ b/src/test/ui/generic-associated-types/missing_lifetime_const.stderr @@ -1,11 +1,11 @@ error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/missing_lifetime_const.rs:8:24 + --> $DIR/missing_lifetime_const.rs:6:24 | LL | let _: ::Assoc<3>; | ^^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/missing_lifetime_const.rs:4:10 + --> $DIR/missing_lifetime_const.rs:2:10 | LL | type Assoc<'a, const N: usize>; | ^^^^^ -- diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind.rs b/src/test/ui/generic-associated-types/parameter_number_and_kind.rs index 0508cc2da..8428e7763 100644 --- a/src/test/ui/generic-associated-types/parameter_number_and_kind.rs +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] #![feature(associated_type_defaults)] trait Foo { diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr b/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr index 53d76fd22..c20b9669e 100644 --- a/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -1,5 +1,5 @@ error[E0107]: this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied - --> $DIR/parameter_number_and_kind.rs:12:24 + --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; | ^ ------- help: remove this lifetime argument @@ -7,19 +7,19 @@ LL | type FErr1 = Self::E<'static, 'static>; | expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/parameter_number_and_kind.rs:9:10 + --> $DIR/parameter_number_and_kind.rs:8:10 | LL | type E<'a, T>; | ^ -- error[E0107]: this associated type takes 1 generic argument but 0 generic arguments were supplied - --> $DIR/parameter_number_and_kind.rs:12:24 + --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; | ^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/parameter_number_and_kind.rs:9:10 + --> $DIR/parameter_number_and_kind.rs:8:10 | LL | type E<'a, T>; | ^ - @@ -29,7 +29,7 @@ LL | type FErr1 = Self::E<'static, 'static, T>; | +++ error[E0107]: this associated type takes 1 generic argument but 2 generic arguments were supplied - --> $DIR/parameter_number_and_kind.rs:15:27 + --> $DIR/parameter_number_and_kind.rs:14:27 | LL | type FErr2 = Self::E<'static, T, u32>; | ^ --- help: remove this generic argument @@ -37,7 +37,7 @@ LL | type FErr2 = Self::E<'static, T, u32>; | expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/parameter_number_and_kind.rs:9:10 + --> $DIR/parameter_number_and_kind.rs:8:10 | LL | type E<'a, T>; | ^ - diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.rs b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.rs index 6ca0bc6dd..c1381025a 100644 --- a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.rs +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.rs @@ -1,4 +1,3 @@ -#![feature(generic_associated_types)] #![feature(associated_type_defaults)] // FIXME(#44265) add tests for type-generic and const-genertic associated types. diff --git a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr index 1458bf0c4..fdd6d305a 100644 --- a/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr +++ b/src/test/ui/generic-associated-types/parameter_number_and_kind_impl.stderr @@ -1,5 +1,5 @@ error[E0195]: lifetime parameters or bounds on type `A` do not match the trait declaration - --> $DIR/parameter_number_and_kind_impl.rs:15:11 + --> $DIR/parameter_number_and_kind_impl.rs:14:11 | LL | type A<'a>; | ---- lifetimes in impl do not match this type in trait @@ -8,7 +8,7 @@ LL | type A = u32; | ^ lifetimes do not match type in trait error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/parameter_number_and_kind_impl.rs:17:12 + --> $DIR/parameter_number_and_kind_impl.rs:16:12 | LL | type B<'a, 'b>; | -- -- @@ -21,7 +21,7 @@ LL | type B<'a, T> = Vec; | found 1 type parameter error[E0195]: lifetime parameters or bounds on type `C` do not match the trait declaration - --> $DIR/parameter_number_and_kind_impl.rs:19:11 + --> $DIR/parameter_number_and_kind_impl.rs:18:11 | LL | type C; | - lifetimes in impl do not match this type in trait @@ -30,7 +30,7 @@ LL | type C<'a> = u32; | ^^^^ lifetimes do not match type in trait error[E0049]: type `A` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/parameter_number_and_kind_impl.rs:26:12 + --> $DIR/parameter_number_and_kind_impl.rs:25:12 | LL | type A<'a>; | -- expected 0 type parameters @@ -39,7 +39,7 @@ LL | type A = u32; | ^ found 1 type parameter error[E0195]: lifetime parameters or bounds on type `B` do not match the trait declaration - --> $DIR/parameter_number_and_kind_impl.rs:28:11 + --> $DIR/parameter_number_and_kind_impl.rs:27:11 | LL | type B<'a, 'b>; | -------- lifetimes in impl do not match this type in trait @@ -48,7 +48,7 @@ LL | type B<'a> = u32; | ^^^^ lifetimes do not match type in trait error[E0049]: type `C` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/parameter_number_and_kind_impl.rs:30:12 + --> $DIR/parameter_number_and_kind_impl.rs:29:12 | LL | type C; | - expected 0 type parameters diff --git a/src/test/ui/generic-associated-types/parse/in-trait-impl.rs b/src/test/ui/generic-associated-types/parse/in-trait-impl.rs index 7f4775ddb..767098835 100644 --- a/src/test/ui/generic-associated-types/parse/in-trait-impl.rs +++ b/src/test/ui/generic-associated-types/parse/in-trait-impl.rs @@ -1,8 +1,6 @@ // check-pass // compile-flags: -Z parse-only -#![feature(generic_associated_types)] - impl Baz for T where T: Foo { type Quux<'a> = ::Bar<'a, 'static>; } diff --git a/src/test/ui/generic-associated-types/parse/in-trait.rs b/src/test/ui/generic-associated-types/parse/in-trait.rs index d438795eb..6628aac37 100644 --- a/src/test/ui/generic-associated-types/parse/in-trait.rs +++ b/src/test/ui/generic-associated-types/parse/in-trait.rs @@ -1,8 +1,6 @@ // check-pass // compile-flags: -Z parse-only -#![feature(generic_associated_types)] - use std::ops::Deref; use std::fmt::Debug; diff --git a/src/test/ui/generic-associated-types/parse/trait-path-expected-token.rs b/src/test/ui/generic-associated-types/parse/trait-path-expected-token.rs index be85598b7..cbb051892 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-expected-token.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-expected-token.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait X { type Y<'a>; } diff --git a/src/test/ui/generic-associated-types/parse/trait-path-expected-token.stderr b/src/test/ui/generic-associated-types/parse/trait-path-expected-token.stderr index 2b265e921..53d5f9de6 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-expected-token.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-expected-token.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=` - --> $DIR/trait-path-expected-token.rs:7:33 + --> $DIR/trait-path-expected-token.rs:5:33 | LL | fn f1<'a>(arg : Box>) {} | - ^ expected one of 7 possible tokens diff --git a/src/test/ui/generic-associated-types/parse/trait-path-expressions.rs b/src/test/ui/generic-associated-types/parse/trait-path-expressions.rs index d57c2813b..9183ec497 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-expressions.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-expressions.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - mod error1 { trait X { type Y<'a>; diff --git a/src/test/ui/generic-associated-types/parse/trait-path-expressions.stderr b/src/test/ui/generic-associated-types/parse/trait-path-expressions.stderr index 272afc10b..cf2b1763f 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-expressions.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-expressions.stderr @@ -1,5 +1,5 @@ error: expected expression, found `)` - --> $DIR/trait-path-expressions.rs:8:39 + --> $DIR/trait-path-expressions.rs:6:39 | LL | fn f1<'a>(arg : Box>) {} | - ^ expected expression @@ -7,7 +7,7 @@ LL | fn f1<'a>(arg : Box>) {} | while parsing a const generic argument starting here error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/trait-path-expressions.rs:18:36 + --> $DIR/trait-path-expressions.rs:16:36 | LL | fn f2<'a>(arg : Box>) {} | - ^ expected one of `,`, `:`, or `>` diff --git a/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.rs b/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.rs index 791486480..ecabf8943 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait X { type Y<'a>; } diff --git a/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr b/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr index 3ace774a0..10ceccedc 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, a const expression, lifetime, or type, found `:` - --> $DIR/trait-path-missing-gen_arg.rs:8:30 + --> $DIR/trait-path-missing-gen_arg.rs:6:30 | LL | fn f1<'a>(arg : Box>) {} | ^ expected one of `>`, a const expression, lifetime, or type @@ -10,13 +10,13 @@ LL | fn f1<'a>(arg : Box<{ dyn X< : 32 } >>) {} | + + error: expected parameter name, found `>` - --> $DIR/trait-path-missing-gen_arg.rs:8:36 + --> $DIR/trait-path-missing-gen_arg.rs:6:36 | LL | fn f1<'a>(arg : Box>) {} | ^ expected parameter name error: expected one of `!`, `)`, `+`, `,`, or `::`, found `>` - --> $DIR/trait-path-missing-gen_arg.rs:8:36 + --> $DIR/trait-path-missing-gen_arg.rs:6:36 | LL | fn f1<'a>(arg : Box>) {} | ^ @@ -25,7 +25,7 @@ LL | fn f1<'a>(arg : Box>) {} | help: missing `,` error: expected one of `>`, a const expression, lifetime, or type, found `=` - --> $DIR/trait-path-missing-gen_arg.rs:16:30 + --> $DIR/trait-path-missing-gen_arg.rs:14:30 | LL | fn f1<'a>(arg : Box>) {} | - ^ expected one of `>`, a const expression, lifetime, or type @@ -33,7 +33,7 @@ LL | fn f1<'a>(arg : Box>) {} | maybe try to close unmatched angle bracket error[E0747]: constant provided when a type was expected - --> $DIR/trait-path-missing-gen_arg.rs:8:23 + --> $DIR/trait-path-missing-gen_arg.rs:6:23 | LL | fn f1<'a>(arg : Box>) {} | ^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/parse/trait-path-segments.rs b/src/test/ui/generic-associated-types/parse/trait-path-segments.rs index e943f075f..458e203eb 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-segments.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-segments.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - const _: () = { trait X { type Y<'a>; diff --git a/src/test/ui/generic-associated-types/parse/trait-path-segments.stderr b/src/test/ui/generic-associated-types/parse/trait-path-segments.stderr index 7394393c0..8bc737d67 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-segments.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-segments.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `+`, `,`, `::`, `:`, `<`, or `>`, found `=` - --> $DIR/trait-path-segments.rs:8:36 + --> $DIR/trait-path-segments.rs:6:36 | LL | fn f1<'a>(arg : Box>) {} | - ^ expected one of 8 possible tokens @@ -12,7 +12,7 @@ LL | fn f1<'a>(arg : Box = u32>>) {} | + error: expected one of `,`, `::`, `:`, or `>`, found `=` - --> $DIR/trait-path-segments.rs:19:35 + --> $DIR/trait-path-segments.rs:17:35 | LL | impl::Y<'a> = &'a u32>> Z for T {} | - ^ expected one of `,`, `::`, `:`, or `>` @@ -25,7 +25,7 @@ LL | impl::Y<'a>> = &'a u32>> Z for T {} | + error: expected one of `!`, `+`, `,`, `::`, `:`, or `>`, found `=` - --> $DIR/trait-path-segments.rs:30:25 + --> $DIR/trait-path-segments.rs:28:25 | LL | impl = &'a u32>> Z for T {} | - ^ expected one of `!`, `+`, `,`, `::`, `:`, or `>` diff --git a/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs b/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs index 4846af96d..1622b92aa 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait X { type Y<'a>; } diff --git a/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 46ddcb635..e00a414ef 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -1,11 +1,11 @@ error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/trait-path-type-error-once-implemented.rs:8:29 + --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/trait-path-type-error-once-implemented.rs:4:10 + --> $DIR/trait-path-type-error-once-implemented.rs:2:10 | LL | type Y<'a>; | ^ -- @@ -15,7 +15,7 @@ LL | fn f2<'a>(arg : Box = &'a ()>>) {} | +++ error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/trait-path-type-error-once-implemented.rs:8:29 + --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} | ^--- help: remove these generics @@ -23,7 +23,7 @@ LL | fn f2<'a>(arg : Box = &'a ()>>) {} | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters - --> $DIR/trait-path-type-error-once-implemented.rs:4:10 + --> $DIR/trait-path-type-error-once-implemented.rs:2:10 | LL | type Y<'a>; | ^ diff --git a/src/test/ui/generic-associated-types/parse/trait-path-types.rs b/src/test/ui/generic-associated-types/parse/trait-path-types.rs index 856253cc7..74a00342f 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-types.rs +++ b/src/test/ui/generic-associated-types/parse/trait-path-types.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait X { type Y<'a>; } diff --git a/src/test/ui/generic-associated-types/parse/trait-path-types.stderr b/src/test/ui/generic-associated-types/parse/trait-path-types.stderr index fe9ed579e..8f7a73c95 100644 --- a/src/test/ui/generic-associated-types/parse/trait-path-types.stderr +++ b/src/test/ui/generic-associated-types/parse/trait-path-types.stderr @@ -1,5 +1,5 @@ error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/trait-path-types.rs:8:37 + --> $DIR/trait-path-types.rs:6:37 | LL | fn f<'a>(arg : Box>) {} | - ^ expected one of `,`, `:`, or `>` @@ -12,7 +12,7 @@ LL | fn f<'a>(arg : Box = u32>>) {} | + error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/trait-path-types.rs:13:37 + --> $DIR/trait-path-types.rs:11:37 | LL | fn f1<'a>(arg : Box) = &'a ()>>) {} | - ^ expected one of `,`, `:`, or `>` @@ -25,7 +25,7 @@ LL | fn f1<'a>(arg : Box)> = &'a ()>>) {} | + error: expected one of `,`, `:`, or `>`, found `=` - --> $DIR/trait-path-types.rs:18:33 + --> $DIR/trait-path-types.rs:16:33 | LL | fn f1<'a>(arg : Box>) {} | -- ^ expected one of `,`, `:`, or `>` diff --git a/src/test/ui/generic-associated-types/pointer_family.rs b/src/test/ui/generic-associated-types/pointer_family.rs index da86e7f27..80827cd56 100644 --- a/src/test/ui/generic-associated-types/pointer_family.rs +++ b/src/test/ui/generic-associated-types/pointer_family.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - // check-pass use std::rc::Rc; diff --git a/src/test/ui/generic-associated-types/projection-bound-cycle-generic.rs b/src/test/ui/generic-associated-types/projection-bound-cycle-generic.rs index 794d677c8..58d57df63 100644 --- a/src/test/ui/generic-associated-types/projection-bound-cycle-generic.rs +++ b/src/test/ui/generic-associated-types/projection-bound-cycle-generic.rs @@ -1,8 +1,6 @@ // Like `projection-bound-cycle.rs` but this avoids using // `feature(trivial_bounds)`. -#![feature(generic_associated_types)] - trait Print { fn print(); } diff --git a/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr b/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr index 2b57c439f..27c1a8299 100644 --- a/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr +++ b/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr @@ -1,11 +1,11 @@ error[E0275]: overflow evaluating the requirement `::Item: Sized` - --> $DIR/projection-bound-cycle-generic.rs:44:18 + --> $DIR/projection-bound-cycle-generic.rs:42:18 | LL | type Assoc = OnlySized<::Item>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `OnlySized` - --> $DIR/projection-bound-cycle-generic.rs:28:18 + --> $DIR/projection-bound-cycle-generic.rs:26:18 | LL | struct OnlySized where T: Sized { f: T } | ^ required by this bound in `OnlySized` diff --git a/src/test/ui/generic-associated-types/projection-bound-cycle.rs b/src/test/ui/generic-associated-types/projection-bound-cycle.rs index 6564a3608..4cad1f613 100644 --- a/src/test/ui/generic-associated-types/projection-bound-cycle.rs +++ b/src/test/ui/generic-associated-types/projection-bound-cycle.rs @@ -2,7 +2,6 @@ // Make sure that we make sure that we don't allow arbitrary bounds to be // proven when a bound and a where clause of an associated type are the same. -#![feature(generic_associated_types)] #![feature(trivial_bounds)] trait Print { diff --git a/src/test/ui/generic-associated-types/projection-bound-cycle.stderr b/src/test/ui/generic-associated-types/projection-bound-cycle.stderr index d9d0bf427..a46518c80 100644 --- a/src/test/ui/generic-associated-types/projection-bound-cycle.stderr +++ b/src/test/ui/generic-associated-types/projection-bound-cycle.stderr @@ -1,11 +1,11 @@ error[E0275]: overflow evaluating the requirement `::Item: Sized` - --> $DIR/projection-bound-cycle.rs:46:18 + --> $DIR/projection-bound-cycle.rs:45:18 | LL | type Assoc = OnlySized<::Item>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `OnlySized` - --> $DIR/projection-bound-cycle.rs:30:18 + --> $DIR/projection-bound-cycle.rs:29:18 | LL | struct OnlySized where T: Sized { f: T } | ^ required by this bound in `OnlySized` diff --git a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.rs b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.rs index a40c0c2c4..8e4d5ca5e 100644 --- a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.rs +++ b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - pub trait X { type Y<'a> where Self: 'a; fn m(&self) -> Self::Y<'_>; diff --git a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.stderr b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.stderr index 4620aa34e..753ead48b 100644 --- a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.stderr +++ b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/projection-type-lifetime-mismatch.rs:17:5 + --> $DIR/projection-type-lifetime-mismatch.rs:15:5 | LL | fn f(x: &impl for<'a> X = &'a ()>) -> &'static () { | - let's call the lifetime of this reference `'1` @@ -7,7 +7,7 @@ LL | x.m() | ^^^^^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/projection-type-lifetime-mismatch.rs:22:5 + --> $DIR/projection-type-lifetime-mismatch.rs:20:5 | LL | fn g X = &'a ()>>(x: &T) -> &'static () { | - let's call the lifetime of this reference `'1` @@ -15,7 +15,7 @@ LL | x.m() | ^^^^^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/projection-type-lifetime-mismatch.rs:27:5 + --> $DIR/projection-type-lifetime-mismatch.rs:25:5 | LL | fn h(x: &()) -> &'static () { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/generic-associated-types/self-outlives-lint.rs b/src/test/ui/generic-associated-types/self-outlives-lint.rs index 300907adb..673891fc3 100644 --- a/src/test/ui/generic-associated-types/self-outlives-lint.rs +++ b/src/test/ui/generic-associated-types/self-outlives-lint.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - // check-fail use std::fmt::Debug; @@ -210,4 +208,17 @@ trait StaticReturnAndTakes<'a> { fn bar<'b>(&self, arg: Self::Y<'b>); } +// We require bounds when the GAT appears in the inputs +trait Input { + type Item<'a>; + //~^ missing required + fn takes_item<'a>(&'a self, item: Self::Item<'a>); +} + +// We don't require bounds when the GAT appears in the where clauses +trait WhereClause { + type Item<'a>; + fn takes_item<'a>(&'a self) where Self::Item<'a>: ; +} + fn main() {} diff --git a/src/test/ui/generic-associated-types/self-outlives-lint.stderr b/src/test/ui/generic-associated-types/self-outlives-lint.stderr index fdb1f50a7..58172bf06 100644 --- a/src/test/ui/generic-associated-types/self-outlives-lint.stderr +++ b/src/test/ui/generic-associated-types/self-outlives-lint.stderr @@ -1,5 +1,5 @@ error: missing required bound on `Item` - --> $DIR/self-outlives-lint.rs:9:5 + --> $DIR/self-outlives-lint.rs:7:5 | LL | type Item<'x>; | ^^^^^^^^^^^^^- @@ -10,7 +10,7 @@ LL | type Item<'x>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Out` - --> $DIR/self-outlives-lint.rs:25:5 + --> $DIR/self-outlives-lint.rs:23:5 | LL | type Out<'x>; | ^^^^^^^^^^^^- @@ -21,7 +21,7 @@ LL | type Out<'x>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Out` - --> $DIR/self-outlives-lint.rs:39:5 + --> $DIR/self-outlives-lint.rs:37:5 | LL | type Out<'x>; | ^^^^^^^^^^^^- @@ -32,7 +32,7 @@ LL | type Out<'x>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bounds on `Out` - --> $DIR/self-outlives-lint.rs:46:5 + --> $DIR/self-outlives-lint.rs:44:5 | LL | type Out<'x, 'y>; | ^^^^^^^^^^^^^^^^- @@ -43,7 +43,7 @@ LL | type Out<'x, 'y>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Out` - --> $DIR/self-outlives-lint.rs:61:5 + --> $DIR/self-outlives-lint.rs:59:5 | LL | type Out<'x, D>; | ^^^^^^^^^^^^^^^- @@ -54,7 +54,7 @@ LL | type Out<'x, D>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Out` - --> $DIR/self-outlives-lint.rs:77:5 + --> $DIR/self-outlives-lint.rs:75:5 | LL | type Out<'x, D>; | ^^^^^^^^^^^^^^^- @@ -65,7 +65,7 @@ LL | type Out<'x, D>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Out` - --> $DIR/self-outlives-lint.rs:92:5 + --> $DIR/self-outlives-lint.rs:90:5 | LL | type Out<'x, D>; | ^^^^^^^^^^^^^^^- @@ -76,7 +76,7 @@ LL | type Out<'x, D>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bounds on `Bar` - --> $DIR/self-outlives-lint.rs:114:5 + --> $DIR/self-outlives-lint.rs:112:5 | LL | type Bar<'b>; | ^^^^^^^^^^^^- @@ -87,7 +87,7 @@ LL | type Bar<'b>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Bar` - --> $DIR/self-outlives-lint.rs:122:5 + --> $DIR/self-outlives-lint.rs:120:5 | LL | type Bar<'b>; | ^^^^^^^^^^^^- @@ -98,7 +98,7 @@ LL | type Bar<'b>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Bar` - --> $DIR/self-outlives-lint.rs:129:5 + --> $DIR/self-outlives-lint.rs:127:5 | LL | type Bar<'b>; | ^^^^^^^^^^^^- @@ -109,7 +109,7 @@ LL | type Bar<'b>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Item` - --> $DIR/self-outlives-lint.rs:142:5 + --> $DIR/self-outlives-lint.rs:140:5 | LL | type Item<'a>; | ^^^^^^^^^^^^^- @@ -120,7 +120,7 @@ LL | type Item<'a>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Iterator` - --> $DIR/self-outlives-lint.rs:144:5 + --> $DIR/self-outlives-lint.rs:142:5 | LL | type Iterator<'a>: Iterator>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- @@ -131,7 +131,7 @@ LL | type Iterator<'a>: Iterator>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Item` - --> $DIR/self-outlives-lint.rs:150:5 + --> $DIR/self-outlives-lint.rs:148:5 | LL | type Item<'a>; | ^^^^^^^^^^^^^- @@ -142,7 +142,7 @@ LL | type Item<'a>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Bar` - --> $DIR/self-outlives-lint.rs:159:5 + --> $DIR/self-outlives-lint.rs:157:5 | LL | type Bar<'a, 'b>; | ^^^^^^^^^^^^^^^^- @@ -153,7 +153,7 @@ LL | type Bar<'a, 'b>; = note: we are soliciting feedback, see issue #87479 for more information error: missing required bound on `Fut` - --> $DIR/self-outlives-lint.rs:175:5 + --> $DIR/self-outlives-lint.rs:173:5 | LL | type Fut<'out>; | ^^^^^^^^^^^^^^- @@ -163,5 +163,16 @@ LL | type Fut<'out>; = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information -error: aborting due to 15 previous errors +error: missing required bound on `Item` + --> $DIR/self-outlives-lint.rs:213:5 + | +LL | type Item<'a>; + | ^^^^^^^^^^^^^- + | | + | help: add the required where clause: `where Self: 'a` + | + = note: this bound is currently required to ensure that impls have maximum flexibility + = note: we are soliciting feedback, see issue #87479 for more information + +error: aborting due to 16 previous errors diff --git a/src/test/ui/generic-associated-types/shadowing.rs b/src/test/ui/generic-associated-types/shadowing.rs index 2a9763457..a05d6e143 100644 --- a/src/test/ui/generic-associated-types/shadowing.rs +++ b/src/test/ui/generic-associated-types/shadowing.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Shadow<'a> { type Bar<'a>; //~^ ERROR lifetime name `'a` shadows a lifetime name that is already in scope diff --git a/src/test/ui/generic-associated-types/shadowing.stderr b/src/test/ui/generic-associated-types/shadowing.stderr index be7659209..bb32684bc 100644 --- a/src/test/ui/generic-associated-types/shadowing.stderr +++ b/src/test/ui/generic-associated-types/shadowing.stderr @@ -1,5 +1,5 @@ error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope - --> $DIR/shadowing.rs:4:14 + --> $DIR/shadowing.rs:2:14 | LL | trait Shadow<'a> { | -- first declared here @@ -7,7 +7,7 @@ LL | type Bar<'a>; | ^^ lifetime `'a` already in scope error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope - --> $DIR/shadowing.rs:13:14 + --> $DIR/shadowing.rs:11:14 | LL | impl<'a> NoShadow<'a> for &'a u32 { | -- first declared here @@ -15,7 +15,7 @@ LL | type Bar<'a> = i32; | ^^ lifetime `'a` already in scope error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/shadowing.rs:18:14 + --> $DIR/shadowing.rs:16:14 | LL | trait ShadowT { | - first use of `T` @@ -23,7 +23,7 @@ LL | type Bar; | ^ already used error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/shadowing.rs:27:14 + --> $DIR/shadowing.rs:25:14 | LL | impl NoShadowT for Option { | - first use of `T` diff --git a/src/test/ui/generic-associated-types/streaming_iterator.rs b/src/test/ui/generic-associated-types/streaming_iterator.rs index e71b6805a..408b8dc99 100644 --- a/src/test/ui/generic-associated-types/streaming_iterator.rs +++ b/src/test/ui/generic-associated-types/streaming_iterator.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(generic_associated_types)] - use std::fmt::Display; trait StreamingIterator { diff --git a/src/test/ui/generic-associated-types/trait-objects.base.stderr b/src/test/ui/generic-associated-types/trait-objects.base.stderr index 1df76a21b..556422c27 100644 --- a/src/test/ui/generic-associated-types/trait-objects.base.stderr +++ b/src/test/ui/generic-associated-types/trait-objects.base.stderr @@ -1,11 +1,11 @@ error[E0038]: the trait `StreamingIterator` cannot be made into an object - --> $DIR/trait-objects.rs:14:21 + --> $DIR/trait-objects.rs:13:21 | LL | fn min_size(x: &mut dyn for<'a> StreamingIterator = &'a i32>) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `StreamingIterator` 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/trait-objects.rs:8:10 + --> $DIR/trait-objects.rs:7:10 | LL | trait StreamingIterator { | ----------------- this trait cannot be made into an object... diff --git a/src/test/ui/generic-associated-types/trait-objects.extended.stderr b/src/test/ui/generic-associated-types/trait-objects.extended.stderr index 52d48d578..45b64d2b0 100644 --- a/src/test/ui/generic-associated-types/trait-objects.extended.stderr +++ b/src/test/ui/generic-associated-types/trait-objects.extended.stderr @@ -1,5 +1,5 @@ error[E0521]: borrowed data escapes outside of function - --> $DIR/trait-objects.rs:16:5 + --> $DIR/trait-objects.rs:15:5 | LL | fn min_size(x: &mut dyn for<'a> StreamingIterator = &'a i32>) -> usize { | - - let's call the lifetime of this reference `'1` @@ -11,6 +11,8 @@ LL | x.size_hint().0 | | | `x` escapes the function body here | argument requires that `'1` must outlive `'static` + | + = note: due to current limitations in the borrow checker, this implies a `'static` lifetime error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/trait-objects.rs b/src/test/ui/generic-associated-types/trait-objects.rs index c1da1e0a3..17fed11ba 100644 --- a/src/test/ui/generic-associated-types/trait-objects.rs +++ b/src/test/ui/generic-associated-types/trait-objects.rs @@ -1,6 +1,5 @@ // revisions: base extended -#![feature(generic_associated_types)] #![cfg_attr(extended, feature(generic_associated_types_extended))] #![cfg_attr(extended, allow(incomplete_features))] diff --git a/src/test/ui/generic-associated-types/type-param-defaults.rs b/src/test/ui/generic-associated-types/type-param-defaults.rs new file mode 100644 index 000000000..f034076b0 --- /dev/null +++ b/src/test/ui/generic-associated-types/type-param-defaults.rs @@ -0,0 +1,34 @@ +// Check that we disallow GAT param defaults, even with `invalid_type_param_default` allowed + +#![allow(invalid_type_param_default)] + +trait Trait { + type Assoc; + //~^ defaults for type parameters are only allowed +} + +impl Trait for () { + type Assoc = u64; + //~^ defaults for type parameters are only allowed +} + +impl Trait for u32 { + type Assoc = T; + //~^ defaults for type parameters are only allowed +} + +trait Other {} +impl Other for u32 {} + +fn foo() +where + T: Trait, + T::Assoc: Other { + } + +fn main() { + // errors + foo::<()>(); + // works + foo::(); +} diff --git a/src/test/ui/generic-associated-types/type-param-defaults.stderr b/src/test/ui/generic-associated-types/type-param-defaults.stderr new file mode 100644 index 000000000..85ccaba0e --- /dev/null +++ b/src/test/ui/generic-associated-types/type-param-defaults.stderr @@ -0,0 +1,20 @@ +error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/type-param-defaults.rs:6:16 + | +LL | type Assoc; + | ^^^^^^^ + +error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/type-param-defaults.rs:11:16 + | +LL | type Assoc = u64; + | ^^^^^^^ + +error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/type-param-defaults.rs:16:16 + | +LL | type Assoc = T; + | ^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.rs b/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.rs index 8b40dac57..1cc09aa6d 100644 --- a/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.rs +++ b/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - pub trait X { type Y<'a: 'static>; //~^ WARNING unnecessary lifetime parameter diff --git a/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr b/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr index ae52010cc..fbd79879d 100644 --- a/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr +++ b/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr @@ -1,5 +1,5 @@ warning: unnecessary lifetime parameter `'a` - --> $DIR/unsatified-item-lifetime-bound.rs:4:12 + --> $DIR/unsatified-item-lifetime-bound.rs:2:12 | LL | type Y<'a: 'static>; | ^^ @@ -7,39 +7,39 @@ 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:13:8 + --> $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:12:10 + --> $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:18:8 + --> $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:17:10 + --> $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:23:8 + --> $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:22:10 + --> $DIR/unsatified-item-lifetime-bound.rs:20:10 | LL | struct D<'a> { | ^^ diff --git a/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.rs b/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.rs index 6466bf98d..7137d9237 100644 --- a/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.rs +++ b/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait ATy { type Item<'a>: 'a; } diff --git a/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr b/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr index 7ec9386ca..1c9ac01ec 100644 --- a/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr +++ b/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr @@ -1,23 +1,23 @@ error[E0477]: the type `&'b ()` does not fulfill the required lifetime - --> $DIR/unsatisfied-outlives-bound.rs:8:21 + --> $DIR/unsatisfied-outlives-bound.rs:6:21 | LL | type Item<'a> = &'b (); | ^^^^^^ | note: type must outlive the lifetime `'a` as defined here as required by this binding - --> $DIR/unsatisfied-outlives-bound.rs:8:15 + --> $DIR/unsatisfied-outlives-bound.rs:6:15 | LL | type Item<'a> = &'b (); | ^^ error[E0477]: the type `&'a ()` does not fulfill the required lifetime - --> $DIR/unsatisfied-outlives-bound.rs:17:21 + --> $DIR/unsatisfied-outlives-bound.rs:15:21 | LL | type Item<'a> = &'a (); | ^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/unsatisfied-outlives-bound.rs:13:20 + --> $DIR/unsatisfied-outlives-bound.rs:11:20 | LL | type Item<'a>: 'static; | ^^^^^^^ diff --git a/src/test/ui/generic-associated-types/variance_constraints.rs b/src/test/ui/generic-associated-types/variance_constraints.rs index 7d0f7638a..0e9dbb8b1 100644 --- a/src/test/ui/generic-associated-types/variance_constraints.rs +++ b/src/test/ui/generic-associated-types/variance_constraints.rs @@ -1,6 +1,5 @@ // check-pass // issue #69184 -#![feature(generic_associated_types)] trait A { type B<'a> where Self: 'a; diff --git a/src/test/ui/generics/issue-59508-1.rs b/src/test/ui/generics/issue-59508-1.rs index 7e1dd7707..8e27749e8 100644 --- a/src/test/ui/generics/issue-59508-1.rs +++ b/src/test/ui/generics/issue-59508-1.rs @@ -8,7 +8,7 @@ struct A; impl A { pub fn do_things() { - //~^ ERROR lifetime parameters must be declared prior to type parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters println!("panic"); } } diff --git a/src/test/ui/generics/issue-59508-1.stderr b/src/test/ui/generics/issue-59508-1.stderr index d162365ea..1c510044f 100644 --- a/src/test/ui/generics/issue-59508-1.stderr +++ b/src/test/ui/generics/issue-59508-1.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-59508-1.rs:10:25 | LL | pub fn do_things() { diff --git a/src/test/ui/generics/issue-59508.fixed b/src/test/ui/generics/issue-59508.fixed index b5c60a162..de8f47d4c 100644 --- a/src/test/ui/generics/issue-59508.fixed +++ b/src/test/ui/generics/issue-59508.fixed @@ -8,7 +8,7 @@ struct A; impl A { pub fn do_things<'a, 'b: 'a, T>() { - //~^ ERROR lifetime parameters must be declared prior to type parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters println!("panic"); } } diff --git a/src/test/ui/generics/issue-59508.rs b/src/test/ui/generics/issue-59508.rs index 0b39c5d8f..a4c7d4ff2 100644 --- a/src/test/ui/generics/issue-59508.rs +++ b/src/test/ui/generics/issue-59508.rs @@ -8,7 +8,7 @@ struct A; impl A { pub fn do_things() { - //~^ ERROR lifetime parameters must be declared prior to type parameters + //~^ ERROR lifetime parameters must be declared prior to type and const parameters println!("panic"); } } diff --git a/src/test/ui/generics/issue-59508.stderr b/src/test/ui/generics/issue-59508.stderr index c52ae4182..fd23b6276 100644 --- a/src/test/ui/generics/issue-59508.stderr +++ b/src/test/ui/generics/issue-59508.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-59508.rs:10:25 | LL | pub fn do_things() { diff --git a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs index fe3e4fbc7..0e208818e 100644 --- a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs +++ b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.rs @@ -1,4 +1,4 @@ #![crate_type = "lib"] struct S(&'a T); -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters diff --git a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr index 119b1a0d2..70793a9c9 100644 --- a/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr +++ b/src/test/ui/generics/issue-80512-param-reordering-with-defaults.stderr @@ -1,4 +1,4 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/issue-80512-param-reordering-with-defaults.rs:3:18 | LL | struct S(&'a T); diff --git a/src/test/ui/generics/issue-98432.stderr b/src/test/ui/generics/issue-98432.stderr index afa67b63b..c7b5c3361 100644 --- a/src/test/ui/generics/issue-98432.stderr +++ b/src/test/ui/generics/issue-98432.stderr @@ -5,9 +5,9 @@ LL | impl Struct { | - type parameter from outer function LL | const CONST: fn() = || { LL | struct _Obligation where T:; - | ^ use of generic parameter from outer function - | - = help: try using a local generic parameter instead + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `` error: aborting due to previous error diff --git a/src/test/ui/generics/lifetime-before-type-params.rs b/src/test/ui/generics/lifetime-before-type-params.rs index 5a71d6efe..d64b1b0b4 100644 --- a/src/test/ui/generics/lifetime-before-type-params.rs +++ b/src/test/ui/generics/lifetime-before-type-params.rs @@ -1,11 +1,11 @@ #![allow(unused)] fn first() {} -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn second<'a, T, 'b>() {} -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn third() {} -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn fourth<'a, T, 'b, U, 'c, V>() {} -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime parameters must be declared prior to type and const parameters fn main() {} diff --git a/src/test/ui/generics/lifetime-before-type-params.stderr b/src/test/ui/generics/lifetime-before-type-params.stderr index 62d95e453..84825eb4c 100644 --- a/src/test/ui/generics/lifetime-before-type-params.stderr +++ b/src/test/ui/generics/lifetime-before-type-params.stderr @@ -1,22 +1,22 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:2:13 | LL | fn first() {} | ----^^--^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:4:18 | LL | fn second<'a, T, 'b>() {} | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:6:16 | LL | fn third() {} | -------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/lifetime-before-type-params.rs:8:18 | LL | fn fourth<'a, T, 'b, U, 'c, V>() {} diff --git a/src/test/ui/hashmap/hashmap-index-mut.rs b/src/test/ui/hashmap/hashmap-index-mut.rs new file mode 100644 index 000000000..98448e9d5 --- /dev/null +++ b/src/test/ui/hashmap/hashmap-index-mut.rs @@ -0,0 +1,6 @@ +use std::collections::HashMap; + +fn main() { + let mut map = HashMap::::new(); + map[&0] = 1; //~ ERROR cannot assign +} diff --git a/src/test/ui/hashmap/hashmap-index-mut.stderr b/src/test/ui/hashmap/hashmap-index-mut.stderr new file mode 100644 index 000000000..c1948ab62 --- /dev/null +++ b/src/test/ui/hashmap/hashmap-index-mut.stderr @@ -0,0 +1,19 @@ +error[E0594]: cannot assign to data in an index of `HashMap` + --> $DIR/hashmap-index-mut.rs:5:5 + | +LL | map[&0] = 1; + | ^^^^^^^^^^^ cannot assign + | + = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap` +help: to modify a `HashMap`, use `.get_mut()`, `.insert()` or the entry API + | +LL | map.insert(&0, 1); + | ~~~~~~~~ ~ + +LL | map.get_mut(&0).map(|val| { *val = 1; }); + | ~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ++++ +LL | let val = map.entry(&0).or_insert(1); + | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/higher-rank-trait-bounds/complex.rs b/src/test/ui/higher-rank-trait-bounds/complex.rs new file mode 100644 index 000000000..8cdfe247e --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/complex.rs @@ -0,0 +1,28 @@ +// check-pass + +trait A<'a> {} +trait B<'b> {} +fn foo() where for<'a> T: A<'a> + 'a {} +trait C<'c>: for<'a> A<'a> + for<'b> B<'b> { + type As; +} +struct D where T: for<'c> C<'c, As=&'c ()> { + t: std::marker::PhantomData, +} +trait E<'e, 'g> { + type As; +} +trait F<'f>: for<'a> A<'a> + for<'e> E<'e, 'f> {} +struct G where T: for<'f> F<'f, As=&'f ()> { + t: std::marker::PhantomData, +} +trait H<'a, 'b> { + type As; +} +trait I<'a>: for<'b> H<'a, 'b> {} + +struct J where T: for<'i> I<'i, As=&'i ()> { + t: std::marker::PhantomData, +} + +fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/due-to-where-clause.rs b/src/test/ui/higher-rank-trait-bounds/due-to-where-clause.rs new file mode 100644 index 000000000..1afd15613 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/due-to-where-clause.rs @@ -0,0 +1,13 @@ +fn main() { + test::(&mut 42); //~ ERROR implementation of `Foo` is not general enough +} + +trait Foo<'a> {} + +struct FooS<'a> { + data: &'a mut u32, +} + +impl<'a, 'b: 'a> Foo<'b> for FooS<'a> {} + +fn test<'a, F>(data: &'a mut u32) where F: for<'b> Foo<'b> {} diff --git a/src/test/ui/higher-rank-trait-bounds/due-to-where-clause.stderr b/src/test/ui/higher-rank-trait-bounds/due-to-where-clause.stderr new file mode 100644 index 000000000..520938a63 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/due-to-where-clause.stderr @@ -0,0 +1,11 @@ +error: implementation of `Foo` is not general enough + --> $DIR/due-to-where-clause.rs:2:5 + | +LL | test::(&mut 42); + | ^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `FooS<'_>` must implement `Foo<'0>`, for any lifetime `'0`... + = note: ...but `FooS<'_>` actually implements `Foo<'1>`, for some specific lifetime `'1` + +error: aborting due to previous error + diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.rs new file mode 100644 index 000000000..a20d03c77 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.rs @@ -0,0 +1,24 @@ +// Regression test for #54302. +// +// We were incorrectly using the "evaluation cache" (which ignored +// region results) to conclude that `&'static str: Deserialize`, even +// though it would require that `for<'de> 'de: 'static`, which is +// clearly false. + +trait Deserialize<'de> {} + +trait DeserializeOwned: for<'de> Deserialize<'de> {} +impl DeserializeOwned for T where T: for<'de> Deserialize<'de> {} + +// Based on this impl, `&'static str` only implements Deserialize<'static>. +// It does not implement for<'de> Deserialize<'de>. +impl<'de: 'a, 'a> Deserialize<'de> for &'a str {} + +fn main() { + fn assert_deserialize_owned() {} + assert_deserialize_owned::<&'static str>(); //~ ERROR + + // It correctly does not implement for<'de> Deserialize<'de>. + // fn assert_hrtb Deserialize<'de>>() {} + // assert_hrtb::<&'static str>(); +} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.stderr new file mode 100644 index 000000000..f014eab86 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-cache-issue-54302.stderr @@ -0,0 +1,11 @@ +error: implementation of `Deserialize` is not general enough + --> $DIR/hrtb-cache-issue-54302.rs:19:5 + | +LL | assert_deserialize_owned::<&'static str>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Deserialize` is not general enough + | + = note: `&'static str` must implement `Deserialize<'0>`, for any lifetime `'0`... + = note: ...but `&str` actually implements `Deserialize<'1>`, for some specific lifetime `'1` + +error: aborting due to previous error + diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.rs new file mode 100644 index 000000000..e83686404 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.rs @@ -0,0 +1,31 @@ +// Test that an impl with only one bound region `'a` cannot be used to +// satisfy a constraint where there are two bound regions. + +trait Foo { + fn foo(&self, x: X) { } +} + +fn want_foo2() + where T : for<'a,'b> Foo<(&'a isize, &'b isize)> +{ +} + +fn want_foo1() + where T : for<'z> Foo<(&'z isize, &'z isize)> +{ +} + +// Expressed as a where clause + +struct SomeStruct; + +impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct +{ +} + +fn a() { want_foo1::(); } // OK -- foo wants just one region +fn b() { want_foo2::(); } +//~^ ERROR implementation of +//~| ERROR implementation of + +fn main() { } diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.stderr new file mode 100644 index 000000000..46f5308dd --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-conflate-regions.stderr @@ -0,0 +1,20 @@ +error: implementation of `Foo` is not general enough + --> $DIR/hrtb-conflate-regions.rs:27:10 + | +LL | fn b() { want_foo2::(); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + = note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + +error: implementation of `Foo` is not general enough + --> $DIR/hrtb-conflate-regions.rs:27:10 + | +LL | fn b() { want_foo2::(); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + = note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.rs new file mode 100644 index 000000000..05d3e1a43 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.rs @@ -0,0 +1,18 @@ +// Test the case where the `Self` type has a bound lifetime that must +// be adjusted in the fn signature. Issue #19537. + +use std::collections::HashMap; + +struct Foo<'a> { + map: HashMap +} + +impl<'a> Foo<'a> { + fn new() -> Foo<'a> { panic!() } + fn insert(&'a mut self) { } +} +fn main() { + let mut foo = Foo::new(); + foo.insert(); + foo.insert(); //~ ERROR cannot borrow +} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.stderr new file mode 100644 index 000000000..fa391ecba --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-debruijn-in-receiver.stderr @@ -0,0 +1,14 @@ +error[E0499]: cannot borrow `foo` as mutable more than once at a time + --> $DIR/hrtb-debruijn-in-receiver.rs:17:5 + | +LL | foo.insert(); + | ------------ first mutable borrow occurs here +LL | foo.insert(); + | ^^^^^^^^^^^^ + | | + | second mutable borrow occurs here + | first borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0499`. diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.rs new file mode 100644 index 000000000..567802376 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.rs @@ -0,0 +1,18 @@ +// Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! +// +// In particular, we test this pattern in trait solving, where it is not connected +// to any part of the source code. + +fn foo<'a>() -> fn(&'a u32) { + panic!() +} + +fn main() { + // Here, proving that `fn(&'a u32) <: for<'b> fn(&'b u32)`: + // + // - instantiates `'b` with a placeholder `!b`, + // - requires that `&!b u32 <: &'a u32` and hence that `!b: 'a`, + // - but we can never know this. + + let _: for<'b> fn(&'b u32) = foo(); //~ ERROR mismatched types +} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.stderr new file mode 100644 index 000000000..9914783d9 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-fn.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/hrtb-exists-forall-fn.rs:17:34 + | +LL | let _: for<'b> fn(&'b u32) = foo(); + | ^^^^^ one type is more general than the other + | + = note: expected fn pointer `for<'b> fn(&'b u32)` + found fn pointer `fn(&u32)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.rs new file mode 100644 index 000000000..921061916 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.rs @@ -0,0 +1,36 @@ +// Test a case where variance and higher-ranked types interact in surprising ways. +// +// In particular, we test this pattern in trait solving, where it is not connected +// to any part of the source code. + +trait Trait {} + +fn foo() +where + T: Trait fn(&'b u32)>, +{ +} + +impl<'a> Trait for () {} + +fn main() { + // Here, proving that `(): Trait fn(&'b u32)>` uses the impl: + // + // - The impl provides the clause `forall<'a> { (): Trait }` + // - We instantiate `'a` existentially to get `(): Trait` + // - We unify `fn(&?a u32)` with `for<'b> fn(&'b u32)` -- this does a + // "bidirectional" subtyping check, so we wind up with: + // - `fn(&?a u32) <: for<'b> fn(&'b u32)` :- + // - `&'!b u32 <: &?a u32` + // - `!'b: ?a` -- solveable if `?a` is inferred to `'empty` + // - `for<'b> fn(&'b u32) <: fn(&?a u32)` :- + // - `&?a u32 u32 <: &?b u32` + // - `?a: ?b` -- solveable if `?b` is also inferred to `'empty` + // - So the subtyping check succeeds, somewhat surprisingly. + // This is because we can use `'empty`. + // + // NB. *However*, the reinstated leak-check gives an error here. + + foo::<()>(); + //~^ ERROR implementation of `Trait` is not general enough +} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.stderr new file mode 100644 index 000000000..364b613fc --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-contravariant.stderr @@ -0,0 +1,11 @@ +error: implementation of `Trait` is not general enough + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5 + | +LL | foo::<()>(); + | ^^^^^^^^^^^ implementation of `Trait` is not general enough + | + = note: `()` must implement `Trait fn(&'b u32)>` + = note: ...but it actually implements `Trait`, for some specific lifetime `'0` + +error: aborting due to previous error + diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-covariant.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-covariant.rs new file mode 100644 index 000000000..f95496a6c --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-covariant.rs @@ -0,0 +1,37 @@ +// Test a case where variance and higher-ranked types interact in surprising ways. +// +// In particular, we test this pattern in trait solving, where it is not connected +// to any part of the source code. +// +// check-pass + +trait Trait {} + +fn foo() +where + T: Trait fn(fn(&'b u32))>, +{ +} + +impl<'a> Trait for () {} + +fn main() { + // Here, proving that `(): Trait fn(&'b u32)>` uses the impl: + // + // - The impl provides the clause `forall<'a> { (): Trait }` + // - We instantiate `'a` existentially to get `(): Trait` + // - We unify `fn(fn(&?a u32))` with `for<'b> fn(fn(&'b u32))` -- this does a + // "bidirectional" subtyping check, so we wind up with: + // - `fn(fn(&?a u32)) <: for<'b> fn(fn(&'b u32))` :- + // - `fn(&!b u32) <: fn(&?a u32)` + // - `&?a u32 <: &!b u32` + // - `?a: !'b` -- solveable if `?a` is inferred to `'static` + // - `for<'b> fn(fn(&'b u32)) <: fn(fn(&?a u32))` :- + // - `fn(&?a u32) <: fn(&?b u32)` + // - `&?b u32 <: &?a u32` + // - `?b: ?a` -- solveable if `?b` is inferred to `'static` + // - So the subtyping check succeeds, somewhat surprisingly. + // This is because we can use `'static`. + + foo::<()>(); +} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.rs new file mode 100644 index 000000000..9b9e4496a --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.rs @@ -0,0 +1,29 @@ +// Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! +// +// In particular, we test this pattern in trait solving, where it is not connected +// to any part of the source code. + +use std::cell::Cell; + +trait Trait {} + +fn foo() +where + T: Trait fn(Cell<&'b u32>)>, +{ +} + +impl<'a> Trait)> for () {} + +fn main() { + // Here, proving that `(): Trait fn(&'b u32)>` uses the impl: + // + // - The impl provides the clause `forall<'a> { (): Trait }` + // - We instantiate `'a` existentially to get `(): Trait` + // - We unify `fn(&?a u32)` with `for<'b> fn(&'b u32)` + // - This requires (among other things) instantiating `'b` universally, + // yielding `fn(&!b u32)`, in a fresh universe U1 + // - So we get `?a = !b` but the universe U0 assigned to `?a` cannot name `!b`. + + foo::<()>(); //~ ERROR implementation of `Trait` is not general enough +} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.stderr new file mode 100644 index 000000000..cb2ce8a41 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-exists-forall-trait-invariant.stderr @@ -0,0 +1,11 @@ +error: implementation of `Trait` is not general enough + --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 + | +LL | foo::<()>(); + | ^^^^^^^^^^^ implementation of `Trait` is not general enough + | + = note: `()` must implement `Trait fn(Cell<&'b u32>)>` + = note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` + +error: aborting due to previous error + diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.rs new file mode 100644 index 000000000..f9ae1429e --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.rs @@ -0,0 +1,50 @@ +// Test HRTB supertraits with several levels of expansion required. + +trait Foo<'tcx> +{ + fn foo(&'tcx self) -> &'tcx isize; +} + +trait Bar<'ccx> + : for<'tcx> Foo<'tcx> +{ + fn bar(&'ccx self) -> &'ccx isize; +} + +trait Baz + : for<'ccx> Bar<'ccx> +{ + fn dummy(&self); +} + +trait Qux + : Bar<'static> +{ + fn dummy(&self); +} + +fn want_foo_for_any_tcx(f: &F) + where F : for<'tcx> Foo<'tcx> +{ +} + +fn want_bar_for_any_ccx(b: &B) + where B : for<'ccx> Bar<'ccx> +{ +} + +fn want_baz(b: &B) + where B : Baz +{ + want_foo_for_any_tcx(b); + want_bar_for_any_ccx(b); +} + +fn want_qux(b: &B) + where B : Qux +{ + want_foo_for_any_tcx(b); + want_bar_for_any_ccx(b); //~ ERROR +} + +fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr new file mode 100644 index 000000000..8cda76b94 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr @@ -0,0 +1,23 @@ +error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied + --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:26 + | +LL | want_bar_for_any_ccx(b); + | -------------------- ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` + | | + | required by a bound introduced by this call + | +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 +LL | where B : for<'ccx> Bar<'ccx> + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` +help: consider further restricting this bound + | +LL | where B : Qux + for<'ccx> Bar<'ccx> + | +++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.rs new file mode 100644 index 000000000..48ebe5017 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.rs @@ -0,0 +1,48 @@ +// Test a trait (`Bar`) with a higher-ranked supertrait. + +trait Foo<'tcx> +{ + fn foo(&'tcx self) -> &'tcx isize; +} + +trait Bar<'ccx> + : for<'tcx> Foo<'tcx> +{ + fn bar(&'ccx self) -> &'ccx isize; +} + +fn want_foo_for_some_tcx<'x,F>(f: &'x F) + where F : Foo<'x> +{ + want_foo_for_some_tcx(f); + want_foo_for_any_tcx(f); //~ ERROR not satisfied +} + +fn want_foo_for_any_tcx(f: &F) + where F : for<'tcx> Foo<'tcx> +{ + want_foo_for_some_tcx(f); + want_foo_for_any_tcx(f); +} + +fn want_bar_for_some_ccx<'x,B>(b: &B) + where B : Bar<'x> +{ + want_foo_for_some_tcx(b); + want_foo_for_any_tcx(b); + + want_bar_for_some_ccx(b); + want_bar_for_any_ccx(b); //~ ERROR not satisfied +} + +fn want_bar_for_any_ccx(b: &B) + where B : for<'ccx> Bar<'ccx> +{ + want_foo_for_some_tcx(b); + want_foo_for_any_tcx(b); + + want_bar_for_some_ccx(b); + want_bar_for_any_ccx(b); +} + +fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr new file mode 100644 index 000000000..88793a152 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr @@ -0,0 +1,43 @@ +error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied + --> $DIR/hrtb-higher-ranker-supertraits.rs:18:26 + | +LL | want_foo_for_any_tcx(f); + | -------------------- ^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F` + | | + | required by a bound introduced by this call + | +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 +LL | where F : for<'tcx> Foo<'tcx> + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo_for_any_tcx` +help: consider further restricting this bound + | +LL | where F : Foo<'x> + for<'tcx> Foo<'tcx> + | +++++++++++++++++++++ + +error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied + --> $DIR/hrtb-higher-ranker-supertraits.rs:35:26 + | +LL | want_bar_for_any_ccx(b); + | -------------------- ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` + | | + | required by a bound introduced by this call + | +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 +LL | where B : for<'ccx> Bar<'ccx> + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` +help: consider further restricting this bound + | +LL | where B : Bar<'x> + for<'ccx> Bar<'ccx> + | +++++++++++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.rs new file mode 100644 index 000000000..89fc4705a --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.rs @@ -0,0 +1,26 @@ +// Test that the `'a` in the where clause correctly links the region +// of the output to the region of the input. + +trait FnLike { + fn call(&self, arg: A) -> R; +} + +fn call_repeatedly(f: F) + where F : for<'a> FnLike<&'a isize, &'a isize> +{ + // Result is stored: cannot re-assign `x` + let mut x = 3; + let y = f.call(&x); + x = 5; //~ ERROR cannot assign to `x` because it is borrowed + + // Result is not stored: can re-assign `x` + let mut x = 3; + f.call(&x); + f.call(&x); + f.call(&x); + x = 5; + drop(y); +} + +fn main() { +} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr new file mode 100644 index 000000000..4886a3c8b --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr @@ -0,0 +1,14 @@ +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 +LL | x = 5; + | ^^^^^ assignment to borrowed `x` occurs here +... +LL | drop(y); + | - borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0506`. diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.rs new file mode 100644 index 000000000..8fb4218f8 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.rs @@ -0,0 +1,35 @@ +// Test a case where you have an impl of `Foo` for all `X` that +// is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730. + +trait Foo { + fn foo(&self, x: X) { } +} + +fn want_hrtb() + where T : for<'a> Foo<&'a isize> +{ +} + +// AnyInt implements Foo<&'a isize> for any 'a, so it is a match. +struct AnyInt; +impl<'a> Foo<&'a isize> for AnyInt { } +fn give_any() { + want_hrtb::() +} + +// StaticInt only implements Foo<&'static isize>, so it is an error. +struct StaticInt; +impl Foo<&'static isize> for StaticInt { } +fn give_static() { + want_hrtb::() //~ ERROR +} + +// &'a u32 only implements Foo<&'a isize> for specific 'a, so it is an error. +impl<'a> Foo<&'a isize> for &'a u32 { } +fn give_some<'a>() { + want_hrtb::<&'a u32>() + //~^ ERROR lifetime may not live long enough + //~| ERROR implementation of `Foo` is not general enough +} + +fn main() { } diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.stderr new file mode 100644 index 000000000..31e11e128 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-just-for-static.stderr @@ -0,0 +1,34 @@ +error: implementation of `Foo` is not general enough + --> $DIR/hrtb-just-for-static.rs:24:5 + | +LL | want_hrtb::() + | ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... + = note: ...but it actually implements `Foo<&'static isize>` + +error: lifetime may not live long enough + --> $DIR/hrtb-just-for-static.rs:30:5 + | +LL | fn give_some<'a>() { + | -- lifetime `'a` defined here +LL | want_hrtb::<&'a u32>() + | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/hrtb-just-for-static.rs:9:15 + | +LL | where T : for<'a> Foo<&'a isize> + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: implementation of `Foo` is not general enough + --> $DIR/hrtb-just-for-static.rs:30:5 + | +LL | want_hrtb::<&'a u32>() + | ^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo<&'0 isize>` would have to be implemented for the type `&u32`, for any lifetime `'0`... + = note: ...but `Foo<&'1 isize>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.polonius.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.polonius.stderr new file mode 100644 index 000000000..a94c80eb3 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.polonius.stderr @@ -0,0 +1,71 @@ +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:16:1 + | +LL | / fn no_hrtb<'b, T>(mut t: T) +LL | | where +LL | | T: Bar<&'b isize>, +LL | | { +... | +LL | | no_hrtb(&mut t); + | | --------------- recursive call site +LL | | } + | |_^ cannot return without recursing + | + = note: `#[warn(unconditional_recursion)]` on by default + = help: a `loop` may express intention better if this is on purpose + +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:25:1 + | +LL | / fn bar_hrtb(mut t: T) +LL | | where +LL | | T: for<'b> Bar<&'b isize>, +LL | | { +... | +LL | | bar_hrtb(&mut t); + | | ---------------- recursive call site +LL | | } + | |_^ cannot return without recursing + | + = help: a `loop` may express intention better if this is on purpose + +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:35:1 + | +LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T) +LL | | where +LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, +LL | | { +... | +LL | | foo_hrtb_bar_not(&mut t); + | | ------------------------ recursive call site +LL | | +LL | | +LL | | } + | |_^ cannot return without recursing + | + = help: a `loop` may express intention better if this is on purpose + +error: higher-ranked subtype error + --> $DIR/hrtb-perfect-forwarding.rs:43:5 + | +LL | foo_hrtb_bar_not(&mut t); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:48:1 + | +LL | / fn foo_hrtb_bar_hrtb(mut t: T) +LL | | where +LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>, +LL | | { +LL | | // OK -- now we have `T : for<'b> Bar<&'b isize>`. +LL | | foo_hrtb_bar_hrtb(&mut t); + | | ------------------------- recursive call site +LL | | } + | |_^ cannot return without recursing + | + = help: a `loop` may express intention better if this is on purpose + +error: aborting due to previous error; 4 warnings emitted + diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.rs new file mode 100644 index 000000000..d45fa183c --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.rs @@ -0,0 +1,56 @@ +// Test a case where you have an impl of `Foo` for all `X` that +// is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730. + +trait Foo { + fn foo(&mut self, x: X) {} +} + +trait Bar { + fn bar(&mut self, x: X) {} +} + +impl<'a, X, F> Foo for &'a mut F where F: Foo + Bar {} + +impl<'a, X, F> Bar for &'a mut F where F: Bar {} + +fn no_hrtb<'b, T>(mut t: T) //~ WARN function cannot return +where + T: Bar<&'b isize>, +{ + // OK -- `T : Bar<&'b isize>`, and thus the impl above ensures that + // `&mut T : Bar<&'b isize>`. + no_hrtb(&mut t); +} + +fn bar_hrtb(mut t: T) //~ WARN function cannot return +where + T: for<'b> Bar<&'b isize>, +{ + // OK -- `T : for<'b> Bar<&'b isize>`, and thus the impl above + // ensures that `&mut T : for<'b> Bar<&'b isize>`. This is an + // example of a "perfect forwarding" impl. + bar_hrtb(&mut t); +} + +fn foo_hrtb_bar_not<'b, T>(mut t: T) //~ WARN function cannot return +where + T: for<'a> Foo<&'a isize> + Bar<&'b isize>, +{ + // Not OK -- The forwarding impl for `Foo` requires that `Bar` also + // be implemented. Thus to satisfy `&mut T : for<'a> Foo<&'a + // isize>`, we require `T : for<'a> Bar<&'a isize>`, but the where + // clause only specifies `T : Bar<&'b isize>`. + foo_hrtb_bar_not(&mut t); + //~^ ERROR implementation of `Bar` is not general enough + //~^^ ERROR lifetime may not live long enough +} + +fn foo_hrtb_bar_hrtb(mut t: T) //~ WARN function cannot return +where + T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>, +{ + // OK -- now we have `T : for<'b> Bar<&'b isize>`. + foo_hrtb_bar_hrtb(&mut t); +} + +fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.stderr new file mode 100644 index 000000000..5e75a4cc8 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-perfect-forwarding.stderr @@ -0,0 +1,79 @@ +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:16:1 + | +LL | / fn no_hrtb<'b, T>(mut t: T) +LL | | where +LL | | T: Bar<&'b isize>, + | |______________________^ cannot return without recursing +... +LL | no_hrtb(&mut t); + | --------------- recursive call site + | + = note: `#[warn(unconditional_recursion)]` on by default + = help: a `loop` may express intention better if this is on purpose + +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:25:1 + | +LL | / fn bar_hrtb(mut t: T) +LL | | where +LL | | T: for<'b> Bar<&'b isize>, + | |______________________________^ cannot return without recursing +... +LL | bar_hrtb(&mut t); + | ---------------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:35:1 + | +LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T) +LL | | where +LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, + | |_______________________________________________^ cannot return without recursing +... +LL | foo_hrtb_bar_not(&mut t); + | ------------------------ recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: lifetime may not live long enough + --> $DIR/hrtb-perfect-forwarding.rs:43:5 + | +LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) + | -- lifetime `'b` defined here +... +LL | foo_hrtb_bar_not(&mut t); + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/hrtb-perfect-forwarding.rs:37:8 + | +LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: implementation of `Bar` is not general enough + --> $DIR/hrtb-perfect-forwarding.rs:43:5 + | +LL | foo_hrtb_bar_not(&mut t); + | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Bar` is not general enough + | + = note: `T` must implement `Bar<&'0 isize>`, for any lifetime `'0`... + = note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1` + +warning: function cannot return without recursing + --> $DIR/hrtb-perfect-forwarding.rs:48:1 + | +LL | / fn foo_hrtb_bar_hrtb(mut t: T) +LL | | where +LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>, + | |_______________________________________________________^ cannot return without recursing +... +LL | foo_hrtb_bar_hrtb(&mut t); + | ------------------------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error: aborting due to 2 previous errors; 4 warnings emitted + diff --git a/src/test/ui/higher-rank-trait-bounds/issue-30786.rs b/src/test/ui/higher-rank-trait-bounds/issue-30786.rs new file mode 100644 index 000000000..e5f46f711 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-30786.rs @@ -0,0 +1,134 @@ +// rust-lang/rust#30786: the use of `for<'b> &'b mut A: Stream Option; +} + +// Example stream +pub struct Repeat(u64); + +impl<'a> Stream for &'a mut Repeat { + type Item = &'a u64; + fn next(self) -> Option { + Some(&self.0) + } +} + +pub struct Map { + stream: S, + func: F, +} + +impl<'a, A, F, T> Stream for &'a mut Map +where + &'a mut A: Stream, + F: FnMut(<&'a mut A as Stream>::Item) -> T, +{ + type Item = T; + fn next(self) -> Option { + match self.stream.next() { + Some(item) => Some((self.func)(item)), + None => None, + } + } +} + +pub struct Filter { + stream: S, + func: F, +} + +impl<'a, A, F, T> Stream for &'a mut Filter +where + for<'b> &'b mut A: Stream, // <---- BAD + F: FnMut(&T) -> bool, +{ + type Item = <&'a mut A as Stream>::Item; + fn next(self) -> Option { + while let Some(item) = self.stream.next() { + if (self.func)(&item) { + return Some(item); + } + } + None + } +} + +pub trait StreamExt +where + for<'b> &'b mut Self: Stream, +{ + fn mapx(self, func: F) -> Map + where + Self: Sized, + for<'a> &'a mut Map: Stream, + { + Map { func: func, stream: self } + } + + fn filterx(self, func: F) -> Filter + where + Self: Sized, + for<'a> &'a mut Filter: Stream, + { + Filter { func: func, stream: self } + } + + fn countx(mut self) -> usize + where + Self: Sized, + { + let mut count = 0; + while let Some(_) = self.next() { + count += 1; + } + count + } +} + +impl StreamExt for T where for<'a> &'a mut T: Stream {} + +fn identity(x: &T) -> &T { + x +} + +fn variant1() { + let source = Repeat(10); + + // Here, the call to `mapx` returns a type `T` to which `StreamExt` + // is not applicable, because `for<'b> &'b mut T: Stream`) doesn't hold. + // + // More concretely, the type `T` is `Map`, and + // the where clause doesn't hold because the signature of the + // closure gets inferred to a signature like `|&'_ Stream| -> &'_` + // for some specific `'_`, rather than a more generic + // signature. + // + // Why *exactly* we opt for this signature is a bit unclear to me, + // we deduce it somehow from a reuqirement that `Map: Stream` I + // guess. + let map = source.mapx(|x: &_| x); + let filter = map.filterx(|x: &_| true); + //~^ ERROR the method +} + +fn variant2() { + let source = Repeat(10); + + // Here, we use a function, which is not subject to the vagaries + // of closure signature inference. In this case, we get the error + // on `countx` as, I think, the test originally expected. + let map = source.mapx(identity); + let filter = map.filterx(|x: &_| true); + let count = filter.countx(); + //~^ ERROR the method +} + +fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/issue-30786.stderr b/src/test/ui/higher-rank-trait-bounds/issue-30786.stderr new file mode 100644 index 000000000..ffe3d7b81 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-30786.stderr @@ -0,0 +1,45 @@ +error[E0599]: the method `filterx` exists for struct `Map`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:118:22 + | +LL | pub struct Map { + | -------------------- + | | + | method `filterx` not found for this struct + | doesn't satisfy `_: StreamExt` +... +LL | let filter = map.filterx(|x: &_| true); + | ^^^^^^^ 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 + | +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(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:130:24 + | +LL | pub struct Filter { + | ----------------------- + | | + | method `countx` not found for this struct + | doesn't satisfy `_: StreamExt` +... +LL | let count = filter.countx(); + | ^^^^^^ method cannot be called on `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `&'a mut &Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` + `&'a mut &mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` + `&'a mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` + --> $DIR/issue-30786.rs:96:50 + | +LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} + | --------- - ^^^^^^ unsatisfied trait bound introduced here + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/higher-rank-trait-bounds/issue-46989.rs b/src/test/ui/higher-rank-trait-bounds/issue-46989.rs new file mode 100644 index 000000000..4a09f4be1 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-46989.rs @@ -0,0 +1,40 @@ +// Regression test for #46989: +// +// In the move to universes, this test started passing. +// It is not necessarily WRONG to do so, but it was a bit +// surprising. The reason that it passed is that when we were +// asked to prove that +// +// for<'a> fn(&'a i32): Foo +// +// we were able to use the impl below to prove +// +// fn(&'empty i32): Foo +// +// and then we were able to prove that +// +// fn(&'empty i32) = for<'a> fn(&'a i32) +// +// This last fact is somewhat surprising, but essentially "falls out" +// from handling variance correctly. In particular, consider the subtyping +// relations. First: +// +// fn(&'empty i32) <: for<'a> fn(&'a i32) +// +// This holds because -- intuitively -- a fn that takes a reference but doesn't use +// it can be given a reference with any lifetime. Similarly, the opposite direction: +// +// for<'a> fn(&'a i32) <: fn(&'empty i32) +// +// holds because 'a can be instantiated to 'empty. + +trait Foo {} + +impl Foo for fn(A) {} + +fn assert_foo() {} + +fn main() { + assert_foo::(); + //~^ ERROR implementation of `Foo` is not general enough +} diff --git a/src/test/ui/higher-rank-trait-bounds/issue-46989.stderr b/src/test/ui/higher-rank-trait-bounds/issue-46989.stderr new file mode 100644 index 000000000..309e1a676 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-46989.stderr @@ -0,0 +1,11 @@ +error: implementation of `Foo` is not general enough + --> $DIR/issue-46989.rs:38:5 + | +LL | assert_foo::(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough + | + = note: `Foo` would have to be implemented for the type `for<'r> fn(&'r i32)` + = note: ...but `Foo` is actually implemented for the type `fn(&'0 i32)`, for some specific lifetime `'0` + +error: aborting due to previous error + diff --git a/src/test/ui/higher-rank-trait-bounds/issue-57639.rs b/src/test/ui/higher-rank-trait-bounds/issue-57639.rs new file mode 100644 index 000000000..392e7233b --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-57639.rs @@ -0,0 +1,29 @@ +// Regression test for #57639: +// +// In the move to universes, this test stopped working. The problem +// was that when the trait solver was asked to prove `for<'a> T::Item: +// Foo<'a>` as part of WF checking, it wound up "eagerly committing" +// to the where clause, which says that `T::Item: Foo<'a>`, but it +// should instead have been using the bound found in the trait +// declaration. Pre-universe, this used to work out ok because we got +// "eager errors" due to the leak check. +// +// See [this comment on GitHub][c] for more details. +// +// check-pass +// +// [c]: https://github.com/rust-lang/rust/issues/57639#issuecomment-455685861 + +trait Foo<'a> {} + +trait Bar { + type Item: for<'a> Foo<'a>; +} + +fn foo<'a, T>(_: T) +where + T: Bar, + T::Item: Foo<'a>, +{} + +fn main() { } diff --git a/src/test/ui/higher-rank-trait-bounds/issue-58451.rs b/src/test/ui/higher-rank-trait-bounds/issue-58451.rs new file mode 100644 index 000000000..f36d549e4 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-58451.rs @@ -0,0 +1,13 @@ +// Regression test for #58451: +// +// Error reporting here encountered an ICE in the shift to universes. + +fn f(i: I) +where + I: IntoIterator, + I::Item: for<'a> Into<&'a ()>, +{} + +fn main() { + f(&[f()]); //~ ERROR this function takes 1 argument +} diff --git a/src/test/ui/higher-rank-trait-bounds/issue-58451.stderr b/src/test/ui/higher-rank-trait-bounds/issue-58451.stderr new file mode 100644 index 000000000..09e25f4dc --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-58451.stderr @@ -0,0 +1,19 @@ +error[E0061]: this function takes 1 argument but 0 arguments were supplied + --> $DIR/issue-58451.rs:12:9 + | +LL | f(&[f()]); + | ^-- an argument is missing + | +note: function defined here + --> $DIR/issue-58451.rs:5:4 + | +LL | fn f(i: I) + | ^ ---- +help: provide the argument + | +LL | f(&[f(/* value */)]); + | ~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0061`. diff --git a/src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.rs b/src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.rs new file mode 100644 index 000000000..e70f6fc34 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.rs @@ -0,0 +1,54 @@ +trait T0<'a, A> { + type O; +} + +struct L { + f: T, +} + +// explicitly named variants of what one would normally denote by the +// unit type `()`. Why do this? So that we can differentiate them in +// the diagnostic output. +struct Unit1; +struct Unit2; +struct Unit3; +struct Unit4; + +impl<'a, A, T> T0<'a, A> for L +where + T: FnMut(A) -> Unit3, +{ + type O = T::Output; +} + +trait T1: for<'r> Ty<'r> { + fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 + where + F: for<'r> T0<'r, (>::V,), O = >::V>, + { + unimplemented!(); + } +} + +trait Ty<'a> { + type V; +} + +fn main() { + let v = Unit2.m( + L { + //~^ ERROR to be a closure that returns `Unit3`, but it returns `Unit4` + //~| ERROR type mismatch + f: |x| { + drop(x); + Unit4 + }, + }, + ); +} + +impl<'a> Ty<'a> for Unit2 { + type V = &'a u8; +} + +impl T1 for Unit2 {} diff --git a/src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr b/src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr new file mode 100644 index 000000000..ab5598e36 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr @@ -0,0 +1,63 @@ +error[E0271]: type mismatch resolving `for<'r> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V` + --> $DIR/issue-62203-hrtb-ice.rs:39:9 + | +LL | let v = Unit2.m( + | - required by a bound introduced by this call +LL | / L { +LL | | +LL | | +LL | | f: |x| { +... | +LL | | }, +LL | | }, + | |_________^ type mismatch resolving `for<'r> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V` + | +note: expected this to be `<_ as Ty<'_>>::V` + --> $DIR/issue-62203-hrtb-ice.rs:21:14 + | +LL | type O = T::Output; + | ^^^^^^^^^ + = note: expected associated type `<_ as Ty<'_>>::V` + found struct `Unit4` + = help: consider constraining the associated type `<_ as Ty<'_>>::V` to `Unit4` or calling a method that returns `<_ as Ty<'_>>::V` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +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 +LL | where +LL | F: for<'r> T0<'r, (>::V,), O = >::V>, + | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` + +error[E0271]: expected `[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]` to be a closure that returns `Unit3`, but it returns `Unit4` + --> $DIR/issue-62203-hrtb-ice.rs:39:9 + | +LL | let v = Unit2.m( + | - required by a bound introduced by this call +LL | / L { +LL | | +LL | | +LL | | f: |x| { +... | +LL | | }, +LL | | }, + | |_________^ expected struct `Unit3`, found struct `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 + | +LL | impl<'a, A, T> T0<'a, A> for L + | ^^^^^^^^^ ^^^^ +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 +LL | where +LL | F: for<'r> T0<'r, (>::V,), O = >::V>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/higher-rank-trait-bounds/issue-88446.rs b/src/test/ui/higher-rank-trait-bounds/issue-88446.rs new file mode 100644 index 000000000..571b85317 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-88446.rs @@ -0,0 +1,35 @@ +// check-pass + +trait Yokeable<'a> { + type Output: 'a; +} +impl<'a> Yokeable<'a> for () { + type Output = (); +} + +trait DataMarker<'data> { + type Yokeable: for<'a> Yokeable<'a>; +} +impl<'data> DataMarker<'data> for () { + type Yokeable = (); +} + +struct DataPayload<'data, M>(&'data M); + +impl DataPayload<'static, ()> { + pub fn map_project_with_capture( + _: for<'a> fn( + capture: T, + std::marker::PhantomData<&'a ()>, + ) -> >::Output, + ) -> DataPayload<'static, M2> + where + M2: DataMarker<'static>, + { + todo!() + } +} + +fn main() { + let _: DataPayload<()> = DataPayload::<()>::map_project_with_capture::<_, &()>(|_, _| todo!()); +} diff --git a/src/test/ui/higher-rank-trait-bounds/issue-90177.rs b/src/test/ui/higher-rank-trait-bounds/issue-90177.rs new file mode 100644 index 000000000..b151a9d3a --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-90177.rs @@ -0,0 +1,32 @@ +// check-pass + +trait Base<'f> { + type Assoc; + + fn do_something(&self); +} + +trait ForAnyLifetime: for<'f> Base<'f> {} + +impl ForAnyLifetime for T where T: for<'f> Base<'f> {} + +trait CanBeDynamic: ForAnyLifetime + for<'f> Base<'f, Assoc = ()> {} + +fn foo(a: &dyn CanBeDynamic) { + a.do_something(); +} + +struct S; + +impl<'a> Base<'a> for S { + type Assoc = (); + + fn do_something(&self) {} +} + +impl CanBeDynamic for S {} + +fn main() { + let s = S; + foo(&s); +} diff --git a/src/test/ui/higher-rank-trait-bounds/issue-95034.rs b/src/test/ui/higher-rank-trait-bounds/issue-95034.rs new file mode 100644 index 000000000..d8edbe7e5 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-95034.rs @@ -0,0 +1,98 @@ +// known-bug: #95034 +// failure-status: 101 +// compile-flags: --edition=2021 --crate-type=lib +// rustc-env:RUST_BACKTRACE=0 + +// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" +// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" +// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" +// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" +// normalize-stderr-test "note: compiler flags.*\n\n" -> "" +// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" +// normalize-stderr-test "query stack during panic:\n" -> "" +// normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> "" +// normalize-stderr-test "end of query stack\n" -> "" +// normalize-stderr-test "#.*\n" -> "" + +// This should not ICE. + +// Refer to the issue for more minimized versions. + +use std::{ + future::Future, + marker::PhantomData, + pin::Pin, + task::{Context, Poll}, +}; + +mod object { + use super::*; + + pub trait Object<'a> { + type Error; + type Future: Future; + fn create() -> Self::Future; + } + + impl<'a> Object<'a> for u8 { + type Error = (); + type Future = Pin>>; + fn create() -> Self::Future { + unimplemented!() + } + } + + impl<'a, E, A: Object<'a, Error = E>> Object<'a> for (A,) { + type Error = (); + type Future = CustomFut<'a, E, A>; + fn create() -> Self::Future { + unimplemented!() + } + } + + pub struct CustomFut<'f, E, A: Object<'f, Error = E>> { + ph: PhantomData<(A::Future,)>, + } + + impl<'f, E, A: Object<'f, Error = E>> Future for CustomFut<'f, E, A> { + type Output = (A,); + fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { + unimplemented!() + } + } +} + +mod async_fn { + use super::*; + + pub trait AsyncFn { + type Future: Future; + fn call(&self) -> Self::Future; + } + + impl AsyncFn for F + where + F: Fn() -> Fut, + Fut: Future, + { + type Future = Fut; + fn call(&self) -> Self::Future { + (self)() + } + } +} + +pub async fn test() { + use self::{async_fn::AsyncFn, object::Object}; + + async fn create>() { + T::create().await; + } + + async fn call_async_fn(inner: impl AsyncFn) { + inner.call().await; + } + + call_async_fn(create::<(u8,)>).await; +} diff --git a/src/test/ui/higher-rank-trait-bounds/issue-95034.stderr b/src/test/ui/higher-rank-trait-bounds/issue-95034.stderr new file mode 100644 index 000000000..1d8329142 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-95034.stderr @@ -0,0 +1 @@ +thread 'rustc' panicked diff --git a/src/test/ui/higher-rank-trait-bounds/issue-95230.rs b/src/test/ui/higher-rank-trait-bounds/issue-95230.rs new file mode 100644 index 000000000..92c506eab --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/issue-95230.rs @@ -0,0 +1,7 @@ +// check-pass + +pub struct Bar +where + for<'a> &'a mut Self:; + +fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr index 066bf431a..b30dd36d2 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr @@ -1,8 +1,10 @@ error[E0277]: expected a `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F` - --> $DIR/issue-62529-3.rs:25:9 + --> $DIR/issue-62529-3.rs:25:14 | LL | call(f, ()); - | ^^^^ expected an `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F` + | ---- ^ expected an `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F` + | | + | required by a bound introduced by this call | = note: expected a closure with arguments `((),)` found a closure with arguments `(<_ as ATC<'a>>::Type,)` diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs index 172bf218c..de9348f53 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.rs @@ -7,7 +7,6 @@ trait SomeTrait<'a> { fn give_me_ice() { callee:: >::Associated>(); //~^ ERROR the trait bound `for<'r> T: SomeTrait<'r>` is not satisfied [E0277] - //~| ERROR the trait bound `for<'r> T: SomeTrait<'r>` is not satisfied [E0277] } fn callee>() { diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr index ecca4b999..6a948a116 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-85455.stderr @@ -9,17 +9,6 @@ help: consider restricting type parameter `T` LL | fn give_me_ice SomeTrait<'r>>() { | +++++++++++++++++++++++ -error[E0277]: the trait bound `for<'r> T: SomeTrait<'r>` is not satisfied - --> $DIR/issue-85455.rs:8:14 - | -LL | callee:: >::Associated>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'r> SomeTrait<'r>` is not implemented for `T` - | -help: consider restricting type parameter `T` - | -LL | fn give_me_ice SomeTrait<'r>>() { - | +++++++++++++++++++++++ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr index a6858154d..14fe1803b 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied LL | C: StackContext, | ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` | -note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>` +note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>` --> $DIR/issue-89118.rs:5:23 | LL | impl BufferUdpStateContext for C {} @@ -24,7 +24,7 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied LL | impl EthernetWorker {} | ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` | -note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>` +note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>` --> $DIR/issue-89118.rs:5:23 | LL | impl BufferUdpStateContext for C {} @@ -44,7 +44,7 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied LL | type Handler = Ctx; | ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` | -note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>` +note: required for `Ctx<()>` to implement `for<'a> BufferUdpStateContext<&'a ()>` --> $DIR/issue-89118.rs:5:23 | LL | impl BufferUdpStateContext for C {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90612.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90612.rs index e150ecfe9..effc32945 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90612.rs +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90612.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(generic_associated_types)] - use std::marker::PhantomData; trait Family: Sized { diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90638.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90638.rs index 18b7f3834..628b5cba1 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90638.rs +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90638.rs @@ -1,7 +1,5 @@ //check-pass -#![feature(generic_associated_types)] - trait Yokeable<'a>: 'static { type Output: 'a; } diff --git a/src/test/ui/hrtb/complex.rs b/src/test/ui/hrtb/complex.rs deleted file mode 100644 index 8cdfe247e..000000000 --- a/src/test/ui/hrtb/complex.rs +++ /dev/null @@ -1,28 +0,0 @@ -// check-pass - -trait A<'a> {} -trait B<'b> {} -fn foo() where for<'a> T: A<'a> + 'a {} -trait C<'c>: for<'a> A<'a> + for<'b> B<'b> { - type As; -} -struct D where T: for<'c> C<'c, As=&'c ()> { - t: std::marker::PhantomData, -} -trait E<'e, 'g> { - type As; -} -trait F<'f>: for<'a> A<'a> + for<'e> E<'e, 'f> {} -struct G where T: for<'f> F<'f, As=&'f ()> { - t: std::marker::PhantomData, -} -trait H<'a, 'b> { - type As; -} -trait I<'a>: for<'b> H<'a, 'b> {} - -struct J where T: for<'i> I<'i, As=&'i ()> { - t: std::marker::PhantomData, -} - -fn main() {} diff --git a/src/test/ui/hrtb/due-to-where-clause.rs b/src/test/ui/hrtb/due-to-where-clause.rs deleted file mode 100644 index 1afd15613..000000000 --- a/src/test/ui/hrtb/due-to-where-clause.rs +++ /dev/null @@ -1,13 +0,0 @@ -fn main() { - test::(&mut 42); //~ ERROR implementation of `Foo` is not general enough -} - -trait Foo<'a> {} - -struct FooS<'a> { - data: &'a mut u32, -} - -impl<'a, 'b: 'a> Foo<'b> for FooS<'a> {} - -fn test<'a, F>(data: &'a mut u32) where F: for<'b> Foo<'b> {} diff --git a/src/test/ui/hrtb/due-to-where-clause.stderr b/src/test/ui/hrtb/due-to-where-clause.stderr deleted file mode 100644 index 520938a63..000000000 --- a/src/test/ui/hrtb/due-to-where-clause.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Foo` is not general enough - --> $DIR/due-to-where-clause.rs:2:5 - | -LL | test::(&mut 42); - | ^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `FooS<'_>` must implement `Foo<'0>`, for any lifetime `'0`... - = note: ...but `FooS<'_>` actually implements `Foo<'1>`, for some specific lifetime `'1` - -error: aborting due to previous error - diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.rs b/src/test/ui/hrtb/hrtb-cache-issue-54302.rs deleted file mode 100644 index a20d03c77..000000000 --- a/src/test/ui/hrtb/hrtb-cache-issue-54302.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Regression test for #54302. -// -// We were incorrectly using the "evaluation cache" (which ignored -// region results) to conclude that `&'static str: Deserialize`, even -// though it would require that `for<'de> 'de: 'static`, which is -// clearly false. - -trait Deserialize<'de> {} - -trait DeserializeOwned: for<'de> Deserialize<'de> {} -impl DeserializeOwned for T where T: for<'de> Deserialize<'de> {} - -// Based on this impl, `&'static str` only implements Deserialize<'static>. -// It does not implement for<'de> Deserialize<'de>. -impl<'de: 'a, 'a> Deserialize<'de> for &'a str {} - -fn main() { - fn assert_deserialize_owned() {} - assert_deserialize_owned::<&'static str>(); //~ ERROR - - // It correctly does not implement for<'de> Deserialize<'de>. - // fn assert_hrtb Deserialize<'de>>() {} - // assert_hrtb::<&'static str>(); -} diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr b/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr deleted file mode 100644 index f014eab86..000000000 --- a/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Deserialize` is not general enough - --> $DIR/hrtb-cache-issue-54302.rs:19:5 - | -LL | assert_deserialize_owned::<&'static str>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Deserialize` is not general enough - | - = note: `&'static str` must implement `Deserialize<'0>`, for any lifetime `'0`... - = note: ...but `&str` actually implements `Deserialize<'1>`, for some specific lifetime `'1` - -error: aborting due to previous error - diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.rs b/src/test/ui/hrtb/hrtb-conflate-regions.rs deleted file mode 100644 index e83686404..000000000 --- a/src/test/ui/hrtb/hrtb-conflate-regions.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Test that an impl with only one bound region `'a` cannot be used to -// satisfy a constraint where there are two bound regions. - -trait Foo { - fn foo(&self, x: X) { } -} - -fn want_foo2() - where T : for<'a,'b> Foo<(&'a isize, &'b isize)> -{ -} - -fn want_foo1() - where T : for<'z> Foo<(&'z isize, &'z isize)> -{ -} - -// Expressed as a where clause - -struct SomeStruct; - -impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct -{ -} - -fn a() { want_foo1::(); } // OK -- foo wants just one region -fn b() { want_foo2::(); } -//~^ ERROR implementation of -//~| ERROR implementation of - -fn main() { } diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.stderr b/src/test/ui/hrtb/hrtb-conflate-regions.stderr deleted file mode 100644 index 46f5308dd..000000000 --- a/src/test/ui/hrtb/hrtb-conflate-regions.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: implementation of `Foo` is not general enough - --> $DIR/hrtb-conflate-regions.rs:27:10 - | -LL | fn b() { want_foo2::(); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` - -error: implementation of `Foo` is not general enough - --> $DIR/hrtb-conflate-regions.rs:27:10 - | -LL | fn b() { want_foo2::(); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs deleted file mode 100644 index 05d3e1a43..000000000 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Test the case where the `Self` type has a bound lifetime that must -// be adjusted in the fn signature. Issue #19537. - -use std::collections::HashMap; - -struct Foo<'a> { - map: HashMap -} - -impl<'a> Foo<'a> { - fn new() -> Foo<'a> { panic!() } - fn insert(&'a mut self) { } -} -fn main() { - let mut foo = Foo::new(); - foo.insert(); - foo.insert(); //~ ERROR cannot borrow -} diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr deleted file mode 100644 index fa391ecba..000000000 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/hrtb-debruijn-in-receiver.rs:17:5 - | -LL | foo.insert(); - | ------------ first mutable borrow occurs here -LL | foo.insert(); - | ^^^^^^^^^^^^ - | | - | second mutable borrow occurs here - | first borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0499`. diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.rs b/src/test/ui/hrtb/hrtb-exists-forall-fn.rs deleted file mode 100644 index 567802376..000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-fn.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! -// -// In particular, we test this pattern in trait solving, where it is not connected -// to any part of the source code. - -fn foo<'a>() -> fn(&'a u32) { - panic!() -} - -fn main() { - // Here, proving that `fn(&'a u32) <: for<'b> fn(&'b u32)`: - // - // - instantiates `'b` with a placeholder `!b`, - // - requires that `&!b u32 <: &'a u32` and hence that `!b: 'a`, - // - but we can never know this. - - let _: for<'b> fn(&'b u32) = foo(); //~ ERROR mismatched types -} diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr deleted file mode 100644 index 9914783d9..000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/hrtb-exists-forall-fn.rs:17:34 - | -LL | let _: for<'b> fn(&'b u32) = foo(); - | ^^^^^ one type is more general than the other - | - = note: expected fn pointer `for<'b> fn(&'b u32)` - found fn pointer `fn(&u32)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs deleted file mode 100644 index 921061916..000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Test a case where variance and higher-ranked types interact in surprising ways. -// -// In particular, we test this pattern in trait solving, where it is not connected -// to any part of the source code. - -trait Trait {} - -fn foo() -where - T: Trait fn(&'b u32)>, -{ -} - -impl<'a> Trait for () {} - -fn main() { - // Here, proving that `(): Trait fn(&'b u32)>` uses the impl: - // - // - The impl provides the clause `forall<'a> { (): Trait }` - // - We instantiate `'a` existentially to get `(): Trait` - // - We unify `fn(&?a u32)` with `for<'b> fn(&'b u32)` -- this does a - // "bidirectional" subtyping check, so we wind up with: - // - `fn(&?a u32) <: for<'b> fn(&'b u32)` :- - // - `&'!b u32 <: &?a u32` - // - `!'b: ?a` -- solveable if `?a` is inferred to `'empty` - // - `for<'b> fn(&'b u32) <: fn(&?a u32)` :- - // - `&?a u32 u32 <: &?b u32` - // - `?a: ?b` -- solveable if `?b` is also inferred to `'empty` - // - So the subtyping check succeeds, somewhat surprisingly. - // This is because we can use `'empty`. - // - // NB. *However*, the reinstated leak-check gives an error here. - - foo::<()>(); - //~^ ERROR implementation of `Trait` is not general enough -} diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr deleted file mode 100644 index 364b613fc..000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5 - | -LL | foo::<()>(); - | ^^^^^^^^^^^ implementation of `Trait` is not general enough - | - = note: `()` must implement `Trait fn(&'b u32)>` - = note: ...but it actually implements `Trait`, for some specific lifetime `'0` - -error: aborting due to previous error - diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs deleted file mode 100644 index f95496a6c..000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Test a case where variance and higher-ranked types interact in surprising ways. -// -// In particular, we test this pattern in trait solving, where it is not connected -// to any part of the source code. -// -// check-pass - -trait Trait {} - -fn foo() -where - T: Trait fn(fn(&'b u32))>, -{ -} - -impl<'a> Trait for () {} - -fn main() { - // Here, proving that `(): Trait fn(&'b u32)>` uses the impl: - // - // - The impl provides the clause `forall<'a> { (): Trait }` - // - We instantiate `'a` existentially to get `(): Trait` - // - We unify `fn(fn(&?a u32))` with `for<'b> fn(fn(&'b u32))` -- this does a - // "bidirectional" subtyping check, so we wind up with: - // - `fn(fn(&?a u32)) <: for<'b> fn(fn(&'b u32))` :- - // - `fn(&!b u32) <: fn(&?a u32)` - // - `&?a u32 <: &!b u32` - // - `?a: !'b` -- solveable if `?a` is inferred to `'static` - // - `for<'b> fn(fn(&'b u32)) <: fn(fn(&?a u32))` :- - // - `fn(&?a u32) <: fn(&?b u32)` - // - `&?b u32 <: &?a u32` - // - `?b: ?a` -- solveable if `?b` is inferred to `'static` - // - So the subtyping check succeeds, somewhat surprisingly. - // This is because we can use `'static`. - - foo::<()>(); -} diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs deleted file mode 100644 index 9b9e4496a..000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! -// -// In particular, we test this pattern in trait solving, where it is not connected -// to any part of the source code. - -use std::cell::Cell; - -trait Trait {} - -fn foo() -where - T: Trait fn(Cell<&'b u32>)>, -{ -} - -impl<'a> Trait)> for () {} - -fn main() { - // Here, proving that `(): Trait fn(&'b u32)>` uses the impl: - // - // - The impl provides the clause `forall<'a> { (): Trait }` - // - We instantiate `'a` existentially to get `(): Trait` - // - We unify `fn(&?a u32)` with `for<'b> fn(&'b u32)` - // - This requires (among other things) instantiating `'b` universally, - // yielding `fn(&!b u32)`, in a fresh universe U1 - // - So we get `?a = !b` but the universe U0 assigned to `?a` cannot name `!b`. - - foo::<()>(); //~ ERROR implementation of `Trait` is not general enough -} diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr deleted file mode 100644 index cb2ce8a41..000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 - | -LL | foo::<()>(); - | ^^^^^^^^^^^ implementation of `Trait` is not general enough - | - = note: `()` must implement `Trait fn(Cell<&'b u32>)>` - = note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` - -error: aborting due to previous error - diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs deleted file mode 100644 index f9ae1429e..000000000 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Test HRTB supertraits with several levels of expansion required. - -trait Foo<'tcx> -{ - fn foo(&'tcx self) -> &'tcx isize; -} - -trait Bar<'ccx> - : for<'tcx> Foo<'tcx> -{ - fn bar(&'ccx self) -> &'ccx isize; -} - -trait Baz - : for<'ccx> Bar<'ccx> -{ - fn dummy(&self); -} - -trait Qux - : Bar<'static> -{ - fn dummy(&self); -} - -fn want_foo_for_any_tcx(f: &F) - where F : for<'tcx> Foo<'tcx> -{ -} - -fn want_bar_for_any_ccx(b: &B) - where B : for<'ccx> Bar<'ccx> -{ -} - -fn want_baz(b: &B) - where B : Baz -{ - want_foo_for_any_tcx(b); - want_bar_for_any_ccx(b); -} - -fn want_qux(b: &B) - where B : Qux -{ - want_foo_for_any_tcx(b); - want_bar_for_any_ccx(b); //~ ERROR -} - -fn main() {} diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr deleted file mode 100644 index 8cda76b94..000000000 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied - --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:26 - | -LL | want_bar_for_any_ccx(b); - | -------------------- ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` - | | - | required by a bound introduced by this call - | -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 -LL | where B : for<'ccx> Bar<'ccx> - | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` -help: consider further restricting this bound - | -LL | where B : Qux + for<'ccx> Bar<'ccx> - | +++++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs deleted file mode 100644 index 48ebe5017..000000000 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Test a trait (`Bar`) with a higher-ranked supertrait. - -trait Foo<'tcx> -{ - fn foo(&'tcx self) -> &'tcx isize; -} - -trait Bar<'ccx> - : for<'tcx> Foo<'tcx> -{ - fn bar(&'ccx self) -> &'ccx isize; -} - -fn want_foo_for_some_tcx<'x,F>(f: &'x F) - where F : Foo<'x> -{ - want_foo_for_some_tcx(f); - want_foo_for_any_tcx(f); //~ ERROR not satisfied -} - -fn want_foo_for_any_tcx(f: &F) - where F : for<'tcx> Foo<'tcx> -{ - want_foo_for_some_tcx(f); - want_foo_for_any_tcx(f); -} - -fn want_bar_for_some_ccx<'x,B>(b: &B) - where B : Bar<'x> -{ - want_foo_for_some_tcx(b); - want_foo_for_any_tcx(b); - - want_bar_for_some_ccx(b); - want_bar_for_any_ccx(b); //~ ERROR not satisfied -} - -fn want_bar_for_any_ccx(b: &B) - where B : for<'ccx> Bar<'ccx> -{ - want_foo_for_some_tcx(b); - want_foo_for_any_tcx(b); - - want_bar_for_some_ccx(b); - want_bar_for_any_ccx(b); -} - -fn main() {} diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr deleted file mode 100644 index 88793a152..000000000 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied - --> $DIR/hrtb-higher-ranker-supertraits.rs:18:26 - | -LL | want_foo_for_any_tcx(f); - | -------------------- ^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F` - | | - | required by a bound introduced by this call - | -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 -LL | where F : for<'tcx> Foo<'tcx> - | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo_for_any_tcx` -help: consider further restricting this bound - | -LL | where F : Foo<'x> + for<'tcx> Foo<'tcx> - | +++++++++++++++++++++ - -error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied - --> $DIR/hrtb-higher-ranker-supertraits.rs:35:26 - | -LL | want_bar_for_any_ccx(b); - | -------------------- ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` - | | - | required by a bound introduced by this call - | -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 -LL | where B : for<'ccx> Bar<'ccx> - | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` -help: consider further restricting this bound - | -LL | where B : Bar<'x> + for<'ccx> Bar<'ccx> - | +++++++++++++++++++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs b/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs deleted file mode 100644 index 89fc4705a..000000000 --- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Test that the `'a` in the where clause correctly links the region -// of the output to the region of the input. - -trait FnLike { - fn call(&self, arg: A) -> R; -} - -fn call_repeatedly(f: F) - where F : for<'a> FnLike<&'a isize, &'a isize> -{ - // Result is stored: cannot re-assign `x` - let mut x = 3; - let y = f.call(&x); - x = 5; //~ ERROR cannot assign to `x` because it is borrowed - - // Result is not stored: can re-assign `x` - let mut x = 3; - f.call(&x); - f.call(&x); - f.call(&x); - x = 5; - drop(y); -} - -fn main() { -} diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr deleted file mode 100644 index 4886a3c8b..000000000 --- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.stderr +++ /dev/null @@ -1,14 +0,0 @@ -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 -LL | x = 5; - | ^^^^^ assignment to borrowed `x` occurs here -... -LL | drop(y); - | - borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0506`. diff --git a/src/test/ui/hrtb/hrtb-just-for-static.rs b/src/test/ui/hrtb/hrtb-just-for-static.rs deleted file mode 100644 index 8fb4218f8..000000000 --- a/src/test/ui/hrtb/hrtb-just-for-static.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Test a case where you have an impl of `Foo` for all `X` that -// is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730. - -trait Foo { - fn foo(&self, x: X) { } -} - -fn want_hrtb() - where T : for<'a> Foo<&'a isize> -{ -} - -// AnyInt implements Foo<&'a isize> for any 'a, so it is a match. -struct AnyInt; -impl<'a> Foo<&'a isize> for AnyInt { } -fn give_any() { - want_hrtb::() -} - -// StaticInt only implements Foo<&'static isize>, so it is an error. -struct StaticInt; -impl Foo<&'static isize> for StaticInt { } -fn give_static() { - want_hrtb::() //~ ERROR -} - -// &'a u32 only implements Foo<&'a isize> for specific 'a, so it is an error. -impl<'a> Foo<&'a isize> for &'a u32 { } -fn give_some<'a>() { - want_hrtb::<&'a u32>() - //~^ ERROR lifetime may not live long enough - //~| ERROR implementation of `Foo` is not general enough -} - -fn main() { } diff --git a/src/test/ui/hrtb/hrtb-just-for-static.stderr b/src/test/ui/hrtb/hrtb-just-for-static.stderr deleted file mode 100644 index b4312091e..000000000 --- a/src/test/ui/hrtb/hrtb-just-for-static.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error: implementation of `Foo` is not general enough - --> $DIR/hrtb-just-for-static.rs:24:5 - | -LL | want_hrtb::() - | ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... - = note: ...but it actually implements `Foo<&'static isize>` - -error: lifetime may not live long enough - --> $DIR/hrtb-just-for-static.rs:30:5 - | -LL | fn give_some<'a>() { - | -- lifetime `'a` defined here -LL | want_hrtb::<&'a u32>() - | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - -error: implementation of `Foo` is not general enough - --> $DIR/hrtb-just-for-static.rs:30:5 - | -LL | want_hrtb::<&'a u32>() - | ^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo<&'0 isize>` would have to be implemented for the type `&u32`, for any lifetime `'0`... - = note: ...but `Foo<&'1 isize>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr deleted file mode 100644 index a94c80eb3..000000000 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.polonius.stderr +++ /dev/null @@ -1,71 +0,0 @@ -warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:16:1 - | -LL | / fn no_hrtb<'b, T>(mut t: T) -LL | | where -LL | | T: Bar<&'b isize>, -LL | | { -... | -LL | | no_hrtb(&mut t); - | | --------------- recursive call site -LL | | } - | |_^ cannot return without recursing - | - = note: `#[warn(unconditional_recursion)]` on by default - = help: a `loop` may express intention better if this is on purpose - -warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:25:1 - | -LL | / fn bar_hrtb(mut t: T) -LL | | where -LL | | T: for<'b> Bar<&'b isize>, -LL | | { -... | -LL | | bar_hrtb(&mut t); - | | ---------------- recursive call site -LL | | } - | |_^ cannot return without recursing - | - = help: a `loop` may express intention better if this is on purpose - -warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:35:1 - | -LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T) -LL | | where -LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, -LL | | { -... | -LL | | foo_hrtb_bar_not(&mut t); - | | ------------------------ recursive call site -LL | | -LL | | -LL | | } - | |_^ cannot return without recursing - | - = help: a `loop` may express intention better if this is on purpose - -error: higher-ranked subtype error - --> $DIR/hrtb-perfect-forwarding.rs:43:5 - | -LL | foo_hrtb_bar_not(&mut t); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:48:1 - | -LL | / fn foo_hrtb_bar_hrtb(mut t: T) -LL | | where -LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>, -LL | | { -LL | | // OK -- now we have `T : for<'b> Bar<&'b isize>`. -LL | | foo_hrtb_bar_hrtb(&mut t); - | | ------------------------- recursive call site -LL | | } - | |_^ cannot return without recursing - | - = help: a `loop` may express intention better if this is on purpose - -error: aborting due to previous error; 4 warnings emitted - diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs deleted file mode 100644 index d45fa183c..000000000 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Test a case where you have an impl of `Foo` for all `X` that -// is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730. - -trait Foo { - fn foo(&mut self, x: X) {} -} - -trait Bar { - fn bar(&mut self, x: X) {} -} - -impl<'a, X, F> Foo for &'a mut F where F: Foo + Bar {} - -impl<'a, X, F> Bar for &'a mut F where F: Bar {} - -fn no_hrtb<'b, T>(mut t: T) //~ WARN function cannot return -where - T: Bar<&'b isize>, -{ - // OK -- `T : Bar<&'b isize>`, and thus the impl above ensures that - // `&mut T : Bar<&'b isize>`. - no_hrtb(&mut t); -} - -fn bar_hrtb(mut t: T) //~ WARN function cannot return -where - T: for<'b> Bar<&'b isize>, -{ - // OK -- `T : for<'b> Bar<&'b isize>`, and thus the impl above - // ensures that `&mut T : for<'b> Bar<&'b isize>`. This is an - // example of a "perfect forwarding" impl. - bar_hrtb(&mut t); -} - -fn foo_hrtb_bar_not<'b, T>(mut t: T) //~ WARN function cannot return -where - T: for<'a> Foo<&'a isize> + Bar<&'b isize>, -{ - // Not OK -- The forwarding impl for `Foo` requires that `Bar` also - // be implemented. Thus to satisfy `&mut T : for<'a> Foo<&'a - // isize>`, we require `T : for<'a> Bar<&'a isize>`, but the where - // clause only specifies `T : Bar<&'b isize>`. - foo_hrtb_bar_not(&mut t); - //~^ ERROR implementation of `Bar` is not general enough - //~^^ ERROR lifetime may not live long enough -} - -fn foo_hrtb_bar_hrtb(mut t: T) //~ WARN function cannot return -where - T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>, -{ - // OK -- now we have `T : for<'b> Bar<&'b isize>`. - foo_hrtb_bar_hrtb(&mut t); -} - -fn main() {} diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr deleted file mode 100644 index 1461e7fd2..000000000 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr +++ /dev/null @@ -1,73 +0,0 @@ -warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:16:1 - | -LL | / fn no_hrtb<'b, T>(mut t: T) -LL | | where -LL | | T: Bar<&'b isize>, - | |______________________^ cannot return without recursing -... -LL | no_hrtb(&mut t); - | --------------- recursive call site - | - = note: `#[warn(unconditional_recursion)]` on by default - = help: a `loop` may express intention better if this is on purpose - -warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:25:1 - | -LL | / fn bar_hrtb(mut t: T) -LL | | where -LL | | T: for<'b> Bar<&'b isize>, - | |______________________________^ cannot return without recursing -... -LL | bar_hrtb(&mut t); - | ---------------- recursive call site - | - = help: a `loop` may express intention better if this is on purpose - -warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:35:1 - | -LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T) -LL | | where -LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, - | |_______________________________________________^ cannot return without recursing -... -LL | foo_hrtb_bar_not(&mut t); - | ------------------------ recursive call site - | - = help: a `loop` may express intention better if this is on purpose - -error: lifetime may not live long enough - --> $DIR/hrtb-perfect-forwarding.rs:43:5 - | -LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) - | -- lifetime `'b` defined here -... -LL | foo_hrtb_bar_not(&mut t); - | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` - -error: implementation of `Bar` is not general enough - --> $DIR/hrtb-perfect-forwarding.rs:43:5 - | -LL | foo_hrtb_bar_not(&mut t); - | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Bar` is not general enough - | - = note: `T` must implement `Bar<&'0 isize>`, for any lifetime `'0`... - = note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1` - -warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:48:1 - | -LL | / fn foo_hrtb_bar_hrtb(mut t: T) -LL | | where -LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>, - | |_______________________________________________________^ cannot return without recursing -... -LL | foo_hrtb_bar_hrtb(&mut t); - | ------------------------- recursive call site - | - = help: a `loop` may express intention better if this is on purpose - -error: aborting due to 2 previous errors; 4 warnings emitted - diff --git a/src/test/ui/hrtb/issue-30786.rs b/src/test/ui/hrtb/issue-30786.rs deleted file mode 100644 index e5f46f711..000000000 --- a/src/test/ui/hrtb/issue-30786.rs +++ /dev/null @@ -1,134 +0,0 @@ -// rust-lang/rust#30786: the use of `for<'b> &'b mut A: Stream Option; -} - -// Example stream -pub struct Repeat(u64); - -impl<'a> Stream for &'a mut Repeat { - type Item = &'a u64; - fn next(self) -> Option { - Some(&self.0) - } -} - -pub struct Map { - stream: S, - func: F, -} - -impl<'a, A, F, T> Stream for &'a mut Map -where - &'a mut A: Stream, - F: FnMut(<&'a mut A as Stream>::Item) -> T, -{ - type Item = T; - fn next(self) -> Option { - match self.stream.next() { - Some(item) => Some((self.func)(item)), - None => None, - } - } -} - -pub struct Filter { - stream: S, - func: F, -} - -impl<'a, A, F, T> Stream for &'a mut Filter -where - for<'b> &'b mut A: Stream, // <---- BAD - F: FnMut(&T) -> bool, -{ - type Item = <&'a mut A as Stream>::Item; - fn next(self) -> Option { - while let Some(item) = self.stream.next() { - if (self.func)(&item) { - return Some(item); - } - } - None - } -} - -pub trait StreamExt -where - for<'b> &'b mut Self: Stream, -{ - fn mapx(self, func: F) -> Map - where - Self: Sized, - for<'a> &'a mut Map: Stream, - { - Map { func: func, stream: self } - } - - fn filterx(self, func: F) -> Filter - where - Self: Sized, - for<'a> &'a mut Filter: Stream, - { - Filter { func: func, stream: self } - } - - fn countx(mut self) -> usize - where - Self: Sized, - { - let mut count = 0; - while let Some(_) = self.next() { - count += 1; - } - count - } -} - -impl StreamExt for T where for<'a> &'a mut T: Stream {} - -fn identity(x: &T) -> &T { - x -} - -fn variant1() { - let source = Repeat(10); - - // Here, the call to `mapx` returns a type `T` to which `StreamExt` - // is not applicable, because `for<'b> &'b mut T: Stream`) doesn't hold. - // - // More concretely, the type `T` is `Map`, and - // the where clause doesn't hold because the signature of the - // closure gets inferred to a signature like `|&'_ Stream| -> &'_` - // for some specific `'_`, rather than a more generic - // signature. - // - // Why *exactly* we opt for this signature is a bit unclear to me, - // we deduce it somehow from a reuqirement that `Map: Stream` I - // guess. - let map = source.mapx(|x: &_| x); - let filter = map.filterx(|x: &_| true); - //~^ ERROR the method -} - -fn variant2() { - let source = Repeat(10); - - // Here, we use a function, which is not subject to the vagaries - // of closure signature inference. In this case, we get the error - // on `countx` as, I think, the test originally expected. - let map = source.mapx(identity); - let filter = map.filterx(|x: &_| true); - let count = filter.countx(); - //~^ ERROR the method -} - -fn main() {} diff --git a/src/test/ui/hrtb/issue-30786.stderr b/src/test/ui/hrtb/issue-30786.stderr deleted file mode 100644 index bc7b5e914..000000000 --- a/src/test/ui/hrtb/issue-30786.stderr +++ /dev/null @@ -1,53 +0,0 @@ -error[E0599]: the method `filterx` exists for struct `Map`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:118:22 - | -LL | pub struct Map { - | -------------------- - | | - | method `filterx` not found for this struct - | doesn't satisfy `_: StreamExt` -... -LL | let filter = map.filterx(|x: &_| true); - | ^^^^^^^ 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 - | -LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} - | --------- - ^^^^^^ unsatisfied trait bound introduced here -help: one of the expressions' fields has a method of the same name - | -LL | let filter = map.stream.filterx(|x: &_| true); - | +++++++ - -error[E0599]: the method `countx` exists for struct `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:130:24 - | -LL | pub struct Filter { - | ----------------------- - | | - | method `countx` not found for this struct - | doesn't satisfy `_: StreamExt` -... -LL | let count = filter.countx(); - | ^^^^^^ method cannot be called on `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>` due to unsatisfied trait bounds - | -note: the following trait bounds were not satisfied: - `&'a mut &Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` - `&'a mut &mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` - `&'a mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` - --> $DIR/issue-30786.rs:96:50 - | -LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} - | --------- - ^^^^^^ unsatisfied trait bound introduced here -help: one of the expressions' fields has a method of the same name - | -LL | let count = filter.stream.countx(); - | +++++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/hrtb/issue-46989.rs b/src/test/ui/hrtb/issue-46989.rs deleted file mode 100644 index 4a09f4be1..000000000 --- a/src/test/ui/hrtb/issue-46989.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Regression test for #46989: -// -// In the move to universes, this test started passing. -// It is not necessarily WRONG to do so, but it was a bit -// surprising. The reason that it passed is that when we were -// asked to prove that -// -// for<'a> fn(&'a i32): Foo -// -// we were able to use the impl below to prove -// -// fn(&'empty i32): Foo -// -// and then we were able to prove that -// -// fn(&'empty i32) = for<'a> fn(&'a i32) -// -// This last fact is somewhat surprising, but essentially "falls out" -// from handling variance correctly. In particular, consider the subtyping -// relations. First: -// -// fn(&'empty i32) <: for<'a> fn(&'a i32) -// -// This holds because -- intuitively -- a fn that takes a reference but doesn't use -// it can be given a reference with any lifetime. Similarly, the opposite direction: -// -// for<'a> fn(&'a i32) <: fn(&'empty i32) -// -// holds because 'a can be instantiated to 'empty. - -trait Foo {} - -impl Foo for fn(A) {} - -fn assert_foo() {} - -fn main() { - assert_foo::(); - //~^ ERROR implementation of `Foo` is not general enough -} diff --git a/src/test/ui/hrtb/issue-46989.stderr b/src/test/ui/hrtb/issue-46989.stderr deleted file mode 100644 index 309e1a676..000000000 --- a/src/test/ui/hrtb/issue-46989.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Foo` is not general enough - --> $DIR/issue-46989.rs:38:5 - | -LL | assert_foo::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo` would have to be implemented for the type `for<'r> fn(&'r i32)` - = note: ...but `Foo` is actually implemented for the type `fn(&'0 i32)`, for some specific lifetime `'0` - -error: aborting due to previous error - diff --git a/src/test/ui/hrtb/issue-57639.rs b/src/test/ui/hrtb/issue-57639.rs deleted file mode 100644 index 392e7233b..000000000 --- a/src/test/ui/hrtb/issue-57639.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Regression test for #57639: -// -// In the move to universes, this test stopped working. The problem -// was that when the trait solver was asked to prove `for<'a> T::Item: -// Foo<'a>` as part of WF checking, it wound up "eagerly committing" -// to the where clause, which says that `T::Item: Foo<'a>`, but it -// should instead have been using the bound found in the trait -// declaration. Pre-universe, this used to work out ok because we got -// "eager errors" due to the leak check. -// -// See [this comment on GitHub][c] for more details. -// -// check-pass -// -// [c]: https://github.com/rust-lang/rust/issues/57639#issuecomment-455685861 - -trait Foo<'a> {} - -trait Bar { - type Item: for<'a> Foo<'a>; -} - -fn foo<'a, T>(_: T) -where - T: Bar, - T::Item: Foo<'a>, -{} - -fn main() { } diff --git a/src/test/ui/hrtb/issue-58451.rs b/src/test/ui/hrtb/issue-58451.rs deleted file mode 100644 index f36d549e4..000000000 --- a/src/test/ui/hrtb/issue-58451.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Regression test for #58451: -// -// Error reporting here encountered an ICE in the shift to universes. - -fn f(i: I) -where - I: IntoIterator, - I::Item: for<'a> Into<&'a ()>, -{} - -fn main() { - f(&[f()]); //~ ERROR this function takes 1 argument -} diff --git a/src/test/ui/hrtb/issue-58451.stderr b/src/test/ui/hrtb/issue-58451.stderr deleted file mode 100644 index 22ba63c3e..000000000 --- a/src/test/ui/hrtb/issue-58451.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0061]: this function takes 1 argument but 0 arguments were supplied - --> $DIR/issue-58451.rs:12:9 - | -LL | f(&[f()]); - | ^-- an argument is missing - | -note: function defined here - --> $DIR/issue-58451.rs:5:4 - | -LL | fn f(i: I) - | ^ ---- -help: provide the argument - | -LL | f(&[f(/* value */)]); - | ~~~~~~~~~~~~~~ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0061`. diff --git a/src/test/ui/hrtb/issue-62203-hrtb-ice.rs b/src/test/ui/hrtb/issue-62203-hrtb-ice.rs deleted file mode 100644 index 80f099ce3..000000000 --- a/src/test/ui/hrtb/issue-62203-hrtb-ice.rs +++ /dev/null @@ -1,50 +0,0 @@ -trait T0<'a, A> { - type O; -} - -struct L { - f: T, -} - -// explicitly named variants of what one would normally denote by the -// unit type `()`. Why do this? So that we can differentiate them in -// the diagnostic output. -struct Unit1; -struct Unit2; -struct Unit3; -struct Unit4; - -impl<'a, A, T> T0<'a, A> for L -where - T: FnMut(A) -> Unit3, -{ - type O = T::Output; -} - -trait T1: for<'r> Ty<'r> { - fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 - where - F: for<'r> T0<'r, (>::V,), O = >::V>, - { - unimplemented!(); - } -} - -trait Ty<'a> { - type V; -} - -fn main() { - let v = Unit2.m( - //~^ ERROR type mismatch - L { - //~^ ERROR type mismatch - f : |x| { drop(x); Unit4 } - }); -} - -impl<'a> Ty<'a> for Unit2 { - type V = &'a u8; -} - -impl T1 for Unit2 {} diff --git a/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr b/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr deleted file mode 100644 index 79ef56b9f..000000000 --- a/src/test/ui/hrtb/issue-62203-hrtb-ice.stderr +++ /dev/null @@ -1,53 +0,0 @@ -error[E0271]: type mismatch resolving `for<'r> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V` - --> $DIR/issue-62203-hrtb-ice.rs:38:19 - | -LL | let v = Unit2.m( - | ^ type mismatch resolving `for<'r> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V` - | -note: expected this to be `<_ as Ty<'_>>::V` - --> $DIR/issue-62203-hrtb-ice.rs:21:14 - | -LL | type O = T::Output; - | ^^^^^^^^^ - = note: expected associated type `<_ as Ty<'_>>::V` - found struct `Unit4` - = help: consider constraining the associated type `<_ as Ty<'_>>::V` to `Unit4` or calling a method that returns `<_ as Ty<'_>>::V` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html -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 -LL | where -LL | F: for<'r> T0<'r, (>::V,), O = >::V>, - | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` - -error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20] as FnOnce<((&'r u8,),)>>::Output == Unit3` - --> $DIR/issue-62203-hrtb-ice.rs:40:9 - | -LL | let v = Unit2.m( - | - required by a bound introduced by this call -LL | -LL | / L { -LL | | -LL | | f : |x| { drop(x); Unit4 } -LL | | }); - | |_________^ expected struct `Unit3`, found struct `Unit4` - | -note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20]>` - --> $DIR/issue-62203-hrtb-ice.rs:17:16 - | -LL | impl<'a, A, T> T0<'a, A> for L - | ^^^^^^^^^ ^^^^ -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 -LL | where -LL | F: for<'r> T0<'r, (>::V,), O = >::V>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/hrtb/issue-88446.rs b/src/test/ui/hrtb/issue-88446.rs deleted file mode 100644 index 571b85317..000000000 --- a/src/test/ui/hrtb/issue-88446.rs +++ /dev/null @@ -1,35 +0,0 @@ -// check-pass - -trait Yokeable<'a> { - type Output: 'a; -} -impl<'a> Yokeable<'a> for () { - type Output = (); -} - -trait DataMarker<'data> { - type Yokeable: for<'a> Yokeable<'a>; -} -impl<'data> DataMarker<'data> for () { - type Yokeable = (); -} - -struct DataPayload<'data, M>(&'data M); - -impl DataPayload<'static, ()> { - pub fn map_project_with_capture( - _: for<'a> fn( - capture: T, - std::marker::PhantomData<&'a ()>, - ) -> >::Output, - ) -> DataPayload<'static, M2> - where - M2: DataMarker<'static>, - { - todo!() - } -} - -fn main() { - let _: DataPayload<()> = DataPayload::<()>::map_project_with_capture::<_, &()>(|_, _| todo!()); -} diff --git a/src/test/ui/hrtb/issue-90177.rs b/src/test/ui/hrtb/issue-90177.rs deleted file mode 100644 index b151a9d3a..000000000 --- a/src/test/ui/hrtb/issue-90177.rs +++ /dev/null @@ -1,32 +0,0 @@ -// check-pass - -trait Base<'f> { - type Assoc; - - fn do_something(&self); -} - -trait ForAnyLifetime: for<'f> Base<'f> {} - -impl ForAnyLifetime for T where T: for<'f> Base<'f> {} - -trait CanBeDynamic: ForAnyLifetime + for<'f> Base<'f, Assoc = ()> {} - -fn foo(a: &dyn CanBeDynamic) { - a.do_something(); -} - -struct S; - -impl<'a> Base<'a> for S { - type Assoc = (); - - fn do_something(&self) {} -} - -impl CanBeDynamic for S {} - -fn main() { - let s = S; - foo(&s); -} diff --git a/src/test/ui/hrtb/issue-95034.rs b/src/test/ui/hrtb/issue-95034.rs deleted file mode 100644 index d8edbe7e5..000000000 --- a/src/test/ui/hrtb/issue-95034.rs +++ /dev/null @@ -1,98 +0,0 @@ -// known-bug: #95034 -// failure-status: 101 -// compile-flags: --edition=2021 --crate-type=lib -// rustc-env:RUST_BACKTRACE=0 - -// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" -// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" -// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" -// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" -// normalize-stderr-test "note: compiler flags.*\n\n" -> "" -// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" -// normalize-stderr-test "query stack during panic:\n" -> "" -// normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> "" -// normalize-stderr-test "end of query stack\n" -> "" -// normalize-stderr-test "#.*\n" -> "" - -// This should not ICE. - -// Refer to the issue for more minimized versions. - -use std::{ - future::Future, - marker::PhantomData, - pin::Pin, - task::{Context, Poll}, -}; - -mod object { - use super::*; - - pub trait Object<'a> { - type Error; - type Future: Future; - fn create() -> Self::Future; - } - - impl<'a> Object<'a> for u8 { - type Error = (); - type Future = Pin>>; - fn create() -> Self::Future { - unimplemented!() - } - } - - impl<'a, E, A: Object<'a, Error = E>> Object<'a> for (A,) { - type Error = (); - type Future = CustomFut<'a, E, A>; - fn create() -> Self::Future { - unimplemented!() - } - } - - pub struct CustomFut<'f, E, A: Object<'f, Error = E>> { - ph: PhantomData<(A::Future,)>, - } - - impl<'f, E, A: Object<'f, Error = E>> Future for CustomFut<'f, E, A> { - type Output = (A,); - fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { - unimplemented!() - } - } -} - -mod async_fn { - use super::*; - - pub trait AsyncFn { - type Future: Future; - fn call(&self) -> Self::Future; - } - - impl AsyncFn for F - where - F: Fn() -> Fut, - Fut: Future, - { - type Future = Fut; - fn call(&self) -> Self::Future { - (self)() - } - } -} - -pub async fn test() { - use self::{async_fn::AsyncFn, object::Object}; - - async fn create>() { - T::create().await; - } - - async fn call_async_fn(inner: impl AsyncFn) { - inner.call().await; - } - - call_async_fn(create::<(u8,)>).await; -} diff --git a/src/test/ui/hrtb/issue-95034.stderr b/src/test/ui/hrtb/issue-95034.stderr deleted file mode 100644 index 1d8329142..000000000 --- a/src/test/ui/hrtb/issue-95034.stderr +++ /dev/null @@ -1 +0,0 @@ -thread 'rustc' panicked diff --git a/src/test/ui/hrtb/issue-95230.rs b/src/test/ui/hrtb/issue-95230.rs deleted file mode 100644 index 92c506eab..000000000 --- a/src/test/ui/hrtb/issue-95230.rs +++ /dev/null @@ -1,7 +0,0 @@ -// check-pass - -pub struct Bar -where - for<'a> &'a mut Self:; - -fn main() {} diff --git a/src/test/ui/impl-trait/auto-trait-leak.stderr b/src/test/ui/impl-trait/auto-trait-leak.stderr index 634ff1486..b6e283647 100644 --- a/src/test/ui/impl-trait/auto-trait-leak.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak.stderr @@ -29,6 +29,11 @@ note: ...which requires building MIR for `cycle1`... | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires building THIR for `cycle1`... + --> $DIR/auto-trait-leak.rs:12:1 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires type-checking `cycle1`... --> $DIR/auto-trait-leak.rs:14:5 | @@ -65,6 +70,11 @@ note: ...which requires building MIR for `cycle2`... | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires building THIR for `cycle2`... + --> $DIR/auto-trait-leak.rs:19:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires type-checking `cycle2`... --> $DIR/auto-trait-leak.rs:20:5 | diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr index f14b447b0..d4a349551 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -12,10 +12,15 @@ error[E0308]: mismatched types --> $DIR/equality.rs:15:5 | LL | fn two(x: bool) -> impl Foo { - | -------- expected `_` because of return type + | -------- expected `i32` because of return type ... LL | 0_u32 | ^^^^^ expected `i32`, found `u32` + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | 0_i32 + | ~~~ error[E0277]: cannot add `impl Foo` to `u32` --> $DIR/equality.rs:24:11 diff --git a/src/test/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.edition2021.stderr b/src/test/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.edition2021.stderr index c01c33a89..8f4092273 100644 --- a/src/test/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.edition2021.stderr +++ b/src/test/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.edition2021.stderr @@ -6,9 +6,8 @@ LL | fn ice() -> impl AsRef { | help: add `dyn` keyword before this trait | -LL - fn ice() -> impl AsRef { -LL + fn ice() -> impl AsRef { - | +LL | fn ice() -> impl AsRef { + | +++ error[E0277]: the trait bound `(): AsRef<(dyn for<'r> Fn(&'r ()) + 'static)>` is not satisfied --> $DIR/generic-with-implicit-hrtb-without-dyn.rs:6:13 diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.rs b/src/test/ui/impl-trait/impl-generic-mismatch.rs index ba678bb03..fb8bde0d0 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.rs +++ b/src/test/ui/impl-trait/impl-generic-mismatch.rs @@ -18,6 +18,15 @@ impl Bar for () { //~^ Error method `bar` has incompatible signature for trait } +trait Baz { + fn baz(&self, _: &U, _: &T); +} + +impl Baz for () { + fn baz(&self, _: &impl Debug, _: &T) { } + //~^ Error method `baz` has incompatible signature for trait +} + // With non-local trait (#49841): use std::hash::{Hash, Hasher}; diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.stderr b/src/test/ui/impl-trait/impl-generic-mismatch.stderr index 489afd761..542f02d7e 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch.stderr @@ -27,8 +27,22 @@ help: try changing the `impl Trait` argument to a generic parameter LL | fn bar(&self, _: &U) { } | ++++++++++ ~ +error[E0643]: method `baz` has incompatible signature for trait + --> $DIR/impl-generic-mismatch.rs:26:33 + | +LL | fn baz(&self, _: &U, _: &T); + | - declaration in trait here +... +LL | fn baz(&self, _: &impl Debug, _: &T) { } + | ^^^^^^^^^^ expected generic parameter, found `impl Trait` + | +help: try changing the `impl Trait` argument to a generic parameter + | +LL | fn baz(&self, _: &T, _: &T) { } + | ~~~~~~~~~~~~~~~~~~~~ ~ + error[E0643]: method `hash` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:28:33 + --> $DIR/impl-generic-mismatch.rs:37:33 | LL | fn hash(&self, hasher: &mut impl Hasher) {} | ^^^^^^^^^^^ expected generic parameter, found `impl Trait` @@ -38,6 +52,6 @@ LL | fn hash(&self, hasher: &mut impl Hasher) {} LL | fn hash(&self, state: &mut H); | - declaration in trait here -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0643`. diff --git a/src/test/ui/impl-trait/in-trait/deep-match-works.rs b/src/test/ui/impl-trait/in-trait/deep-match-works.rs new file mode 100644 index 000000000..772da845e --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/deep-match-works.rs @@ -0,0 +1,16 @@ +// check-pass + +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +struct Wrapper(T); + +trait Foo { + fn bar() -> Wrapper; +} + +impl Foo for () { + fn bar() -> Wrapper { Wrapper(0) } +} + +fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/deep-match.rs b/src/test/ui/impl-trait/in-trait/deep-match.rs new file mode 100644 index 000000000..a6385147c --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/deep-match.rs @@ -0,0 +1,15 @@ +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +struct Wrapper(T); + +trait Foo { + fn bar() -> Wrapper; +} + +impl Foo for () { + fn bar() -> i32 { 0 } + //~^ ERROR method `bar` has an incompatible return type for trait +} + +fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/deep-match.stderr b/src/test/ui/impl-trait/in-trait/deep-match.stderr new file mode 100644 index 000000000..034ee5ea4 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/deep-match.stderr @@ -0,0 +1,15 @@ +error[E0053]: method `bar` has an incompatible return type for trait + --> $DIR/deep-match.rs:11:17 + | +LL | fn bar() -> i32 { 0 } + | ^^^ + | | + | expected struct `Wrapper`, found `i32` + | return type in trait + | + = note: expected struct `Wrapper<_>` + found type `i32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs b/src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs new file mode 100644 index 000000000..bb4e0d44f --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/doesnt-satisfy.rs @@ -0,0 +1,13 @@ +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +trait Foo { + fn bar() -> impl std::fmt::Display; +} + +impl Foo for () { + fn bar() -> () {} + //~^ ERROR `()` doesn't implement `std::fmt::Display` +} + +fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/doesnt-satisfy.stderr b/src/test/ui/impl-trait/in-trait/doesnt-satisfy.stderr new file mode 100644 index 000000000..aa5492d28 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/doesnt-satisfy.stderr @@ -0,0 +1,17 @@ +error[E0277]: `()` doesn't implement `std::fmt::Display` + --> $DIR/doesnt-satisfy.rs:9:17 + | +LL | fn bar() -> () {} + | ^^ `()` cannot be formatted with the default formatter + | + = help: the trait `std::fmt::Display` is not implemented for `()` + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `Foo::bar::{opaque#0}` + --> $DIR/doesnt-satisfy.rs:5:22 + | +LL | fn bar() -> impl std::fmt::Display; + | ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::bar::{opaque#0}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/impl-trait/in-trait/encode.rs b/src/test/ui/impl-trait/in-trait/encode.rs new file mode 100644 index 000000000..efb9f6498 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/encode.rs @@ -0,0 +1,9 @@ +// build-pass +// compile-flags: --crate-type=lib + +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +trait Foo { + fn bar() -> impl Sized; +} diff --git a/src/test/ui/impl-trait/in-trait/nested-rpitit.rs b/src/test/ui/impl-trait/in-trait/nested-rpitit.rs new file mode 100644 index 000000000..65285e3a3 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/nested-rpitit.rs @@ -0,0 +1,32 @@ +// check-pass + +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +use std::fmt::Display; +use std::ops::Deref; + +trait Foo { + fn bar(self) -> impl Deref; +} + +struct A; + +impl Foo for A { + fn bar(self) -> &'static str { + "Hello, world" + } +} + +struct B; + +impl Foo for B { + fn bar(self) -> Box { + Box::new(42) + } +} + +fn main() { + println!("Message for you: {:?}", &*A.bar()); + println!("Another for you: {:?}", &*B.bar()); +} diff --git a/src/test/ui/impl-trait/in-trait/object-safety.rs b/src/test/ui/impl-trait/in-trait/object-safety.rs new file mode 100644 index 000000000..dd35b9a2d --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/object-safety.rs @@ -0,0 +1,22 @@ +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +use std::fmt::Debug; + +trait Foo { + fn baz(&self) -> impl Debug; +} + +impl Foo for u32 { + fn baz(&self) -> u32 { + 32 + } +} + +fn main() { + let i = Box::new(42_u32) as Box; + //~^ ERROR the trait `Foo` cannot be made into an object + //~| ERROR the trait `Foo` cannot be made into an object + let s = i.baz(); + //~^ ERROR the trait `Foo` cannot be made into an object +} diff --git a/src/test/ui/impl-trait/in-trait/object-safety.stderr b/src/test/ui/impl-trait/in-trait/object-safety.stderr new file mode 100644 index 000000000..9a1554b5e --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/object-safety.stderr @@ -0,0 +1,50 @@ +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:17:33 + | +LL | let i = Box::new(42_u32) as Box; + | ^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:7:8 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:20:13 + | +LL | let s = i.baz(); + | ^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:7:8 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety.rs:17:13 + | +LL | let i = Box::new(42_u32) as Box; + | ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/object-safety.rs:7:8 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> impl Debug; + | ^^^ ...because method `baz` references an `impl Trait` type in its return type + = help: consider moving `baz` to another trait + = note: required for `Box` to implement `CoerceUnsized>` + = note: required by cast to type `Box` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs b/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs new file mode 100644 index 000000000..3ac264e8e --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs @@ -0,0 +1,19 @@ +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +use std::fmt::Display; + +trait Foo { + fn bar(&self) -> impl Display; +} + +impl Foo for () { + fn bar(&self) -> impl Display { + "Hello, world" + } +} + +fn main() { + let x: &str = ().bar(); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr b/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr new file mode 100644 index 000000000..15edda483 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/opaque-in-impl-is-opaque.rs:17:19 + | +LL | fn bar(&self) -> impl Display { + | ------------ the found opaque type +... +LL | let x: &str = ().bar(); + | ---- ^^^^^^^^ expected `&str`, found opaque type + | | + | expected due to this + | + = note: expected reference `&str` + found opaque type `impl std::fmt::Display` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/impl-trait/in-trait/opaque-in-impl.rs b/src/test/ui/impl-trait/in-trait/opaque-in-impl.rs new file mode 100644 index 000000000..2e0662969 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/opaque-in-impl.rs @@ -0,0 +1,48 @@ +// check-pass + +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +use std::fmt::Debug; + +trait Foo { + fn foo(&self) -> impl Debug; +} + +impl Foo for () { + fn foo(&self) -> impl Debug { + "Hello, world" + } +} + +impl Foo for std::marker::PhantomData { + fn foo(&self) -> impl Debug { + T::default() + } +} + +trait Bar { + fn bar(&self) -> impl Debug; +} + +impl Bar for () { + fn bar(&self) -> impl Debug { + format!("Hello with generic {}", std::any::type_name::()) + } +} + +trait Baz { + fn baz(&self) -> impl Debug + '_; +} + +impl Baz for String { + fn baz(&self) -> impl Debug + '_ { + (self,) + } +} + +fn main() { + println!("{:?}", ().foo()); + println!("{:?}", ().bar::()); + println!("{:?}", "hi".to_string().baz()); +} diff --git a/src/test/ui/impl-trait/in-trait/reveal.rs b/src/test/ui/impl-trait/in-trait/reveal.rs new file mode 100644 index 000000000..d6ede1cc4 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/reveal.rs @@ -0,0 +1,18 @@ +// check-pass + +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +trait Foo { + fn f() -> Box; +} + +impl Foo for () { + fn f() -> Box { + Box::new(String::new()) + } +} + +fn main() { + let x: Box = <() as Foo>::f(); +} diff --git a/src/test/ui/impl-trait/in-trait/success.rs b/src/test/ui/impl-trait/in-trait/success.rs new file mode 100644 index 000000000..4cbe682b4 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/success.rs @@ -0,0 +1,40 @@ +// check-pass + +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +use std::fmt::Display; + +trait Foo { + fn bar(&self) -> impl Display; +} + +impl Foo for i32 { + fn bar(&self) -> i32 { + *self + } +} + +impl Foo for &'static str { + fn bar(&self) -> &'static str { + *self + } +} + +struct Yay; + +impl Foo for Yay { + fn bar(&self) -> String { + String::from(":^)") + } +} + +fn foo_generically(t: T) { + println!("{}", t.bar()); +} + +fn main() { + println!("{}", "Hello, world.".bar()); + println!("The answer is {}!", 42.bar()); + foo_generically(Yay); +} diff --git a/src/test/ui/impl-trait/in-trait/wf-bounds.rs b/src/test/ui/impl-trait/in-trait/wf-bounds.rs new file mode 100644 index 000000000..2c71583b3 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/wf-bounds.rs @@ -0,0 +1,16 @@ +// issue #101663 + +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +trait Wf {} + +trait Uwu { + fn nya() -> impl Wf>; + //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time + + fn nya2() -> impl Wf<[u8]>; + //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time +} + +fn main() {} diff --git a/src/test/ui/impl-trait/in-trait/wf-bounds.stderr b/src/test/ui/impl-trait/in-trait/wf-bounds.stderr new file mode 100644 index 000000000..92e36841b --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/wf-bounds.stderr @@ -0,0 +1,33 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/wf-bounds.rs:9:22 + | +LL | fn nya() -> impl Wf>; + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + | +LL | pub struct Vec { + | ^ required by this bound in `Vec` + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/wf-bounds.rs:12:23 + | +LL | fn nya2() -> impl Wf<[u8]>; + | ^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` +note: required by a bound in `Wf` + --> $DIR/wf-bounds.rs:6:10 + | +LL | trait Wf {} + | ^ required by this bound in `Wf` +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Wf {} + | ++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/impl-trait/issue-100075-2.rs b/src/test/ui/impl-trait/issue-100075-2.rs new file mode 100644 index 000000000..cf059af19 --- /dev/null +++ b/src/test/ui/impl-trait/issue-100075-2.rs @@ -0,0 +1,8 @@ +fn opaque(t: T) -> impl Sized { + //~^ ERROR cannot resolve opaque type + //~| WARNING function cannot return without recursing + opaque(Some(t)) +} + +#[allow(dead_code)] +fn main() {} diff --git a/src/test/ui/impl-trait/issue-100075-2.stderr b/src/test/ui/impl-trait/issue-100075-2.stderr new file mode 100644 index 000000000..5a1f1a97d --- /dev/null +++ b/src/test/ui/impl-trait/issue-100075-2.stderr @@ -0,0 +1,24 @@ +warning: function cannot return without recursing + --> $DIR/issue-100075-2.rs:1:1 + | +LL | fn opaque(t: T) -> impl Sized { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +... +LL | opaque(Some(t)) + | --------------- recursive call site + | + = note: `#[warn(unconditional_recursion)]` on by default + = help: a `loop` may express intention better if this is on purpose + +error[E0720]: cannot resolve opaque type + --> $DIR/issue-100075-2.rs:1:23 + | +LL | fn opaque(t: T) -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | opaque(Some(t)) + | --------------- returning here with type `impl Sized` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0720`. diff --git a/src/test/ui/impl-trait/issue-100075.rs b/src/test/ui/impl-trait/issue-100075.rs new file mode 100644 index 000000000..ea30abb48 --- /dev/null +++ b/src/test/ui/impl-trait/issue-100075.rs @@ -0,0 +1,21 @@ +trait Marker {} +impl Marker for T {} + +fn maybe( + _t: T, +) -> Option< + //removing the line below makes it compile + &'static T, +> { + None +} + +fn _g(t: &'static T) -> &'static impl Marker { + //~^ ERROR cannot resolve opaque type + if let Some(t) = maybe(t) { + return _g(t); + } + todo!() +} + +fn main() {} diff --git a/src/test/ui/impl-trait/issue-100075.stderr b/src/test/ui/impl-trait/issue-100075.stderr new file mode 100644 index 000000000..267ecfdae --- /dev/null +++ b/src/test/ui/impl-trait/issue-100075.stderr @@ -0,0 +1,12 @@ +error[E0720]: cannot resolve opaque type + --> $DIR/issue-100075.rs:13:37 + | +LL | fn _g(t: &'static T) -> &'static impl Marker { + | ^^^^^^^^^^^ recursive opaque type +... +LL | return _g(t); + | ----- returning here with type `&impl Marker` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0720`. diff --git a/src/test/ui/impl-trait/issue-103599.rs b/src/test/ui/impl-trait/issue-103599.rs new file mode 100644 index 000000000..043ae67f2 --- /dev/null +++ b/src/test/ui/impl-trait/issue-103599.rs @@ -0,0 +1,10 @@ +// check-pass + +trait T {} + +fn wrap(x: impl T) -> impl T { + //~^ WARN function cannot return without recursing + wrap(wrap(x)) +} + +fn main() {} diff --git a/src/test/ui/impl-trait/issue-103599.stderr b/src/test/ui/impl-trait/issue-103599.stderr new file mode 100644 index 000000000..79fb355dd --- /dev/null +++ b/src/test/ui/impl-trait/issue-103599.stderr @@ -0,0 +1,14 @@ +warning: function cannot return without recursing + --> $DIR/issue-103599.rs:5:1 + | +LL | fn wrap(x: impl T) -> impl T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | +LL | wrap(wrap(x)) + | ------- recursive call site + | + = note: `#[warn(unconditional_recursion)]` on by default + = help: a `loop` may express intention better if this is on purpose + +warning: 1 warning emitted + diff --git a/src/test/ui/impl-trait/issue-99914.rs b/src/test/ui/impl-trait/issue-99914.rs new file mode 100644 index 000000000..4324a0229 --- /dev/null +++ b/src/test/ui/impl-trait/issue-99914.rs @@ -0,0 +1,13 @@ +// edition:2021 + +fn main() {} + +struct Error; +struct Okay; + +fn foo(t: Result) { + t.and_then(|t| -> _ { bar(t) }); + //~^ ERROR mismatched types +} + +async fn bar(t: Okay) {} diff --git a/src/test/ui/impl-trait/issue-99914.stderr b/src/test/ui/impl-trait/issue-99914.stderr new file mode 100644 index 000000000..074d5d58d --- /dev/null +++ b/src/test/ui/impl-trait/issue-99914.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/issue-99914.rs:9:27 + | +LL | t.and_then(|t| -> _ { bar(t) }); + | ^^^^^^ expected enum `Result`, found opaque type + | +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)) }); + | +++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/impl-trait/issues/issue-78722.rs b/src/test/ui/impl-trait/issues/issue-78722.rs index 002e4cde4..90d1cd379 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.rs +++ b/src/test/ui/impl-trait/issues/issue-78722.rs @@ -7,7 +7,7 @@ type F = impl core::future::Future; struct Bug { V1: [(); { fn concrete_use() -> F { - //~^ ERROR type mismatch + //~^ ERROR expected `impl Future` to be a future that resolves to `u8`, but it resolves to `()` async {} } let f: F = async { 1 }; diff --git a/src/test/ui/impl-trait/issues/issue-78722.stderr b/src/test/ui/impl-trait/issues/issue-78722.stderr index 690d6abc7..9a0ffbc89 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.stderr +++ b/src/test/ui/impl-trait/issues/issue-78722.stderr @@ -16,7 +16,7 @@ LL | let f: F = async { 1 }; LL | }], | - value is dropped here -error[E0271]: type mismatch resolving ` as Future>::Output == u8` +error[E0271]: expected `impl Future` to be a future that resolves to `u8`, but it resolves to `()` --> $DIR/issue-78722.rs:9:30 | LL | fn concrete_use() -> F { diff --git a/src/test/ui/impl-trait/nested-return-type2-tait2.stderr b/src/test/ui/impl-trait/nested-return-type2-tait2.stderr index fe1ae4fcb..348c737b0 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait2.stderr +++ b/src/test/ui/impl-trait/nested-return-type2-tait2.stderr @@ -5,7 +5,7 @@ LL | || 42 | ^^^^^ the trait `Duh` is not implemented for `Sendable` | = help: the trait `Duh` is implemented for `i32` -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7]` +note: required for `[closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7]` to implement `Trait` --> $DIR/nested-return-type2-tait2.rs:14:31 | LL | impl R> Trait for F { diff --git a/src/test/ui/impl-trait/nested-return-type2-tait3.stderr b/src/test/ui/impl-trait/nested-return-type2-tait3.stderr index c0695d627..6ac671415 100644 --- a/src/test/ui/impl-trait/nested-return-type2-tait3.stderr +++ b/src/test/ui/impl-trait/nested-return-type2-tait3.stderr @@ -5,7 +5,7 @@ LL | || 42 | ^^^^^ the trait `Duh` is not implemented for `impl Send` | = help: the trait `Duh` is implemented for `i32` -note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7]` +note: required for `[closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7]` to implement `Trait` --> $DIR/nested-return-type2-tait3.rs:14:31 | LL | impl R> Trait for F { diff --git a/src/test/ui/impl-trait/nested-rpit-with-anonymous-lifetimes.rs b/src/test/ui/impl-trait/nested-rpit-with-anonymous-lifetimes.rs new file mode 100644 index 000000000..287a030cf --- /dev/null +++ b/src/test/ui/impl-trait/nested-rpit-with-anonymous-lifetimes.rs @@ -0,0 +1,23 @@ +// check-pass + +pub struct VecNumber<'s> { + pub vec_number: Vec>, + pub auxiliary_object: &'s Vec, +} + +pub struct Number<'s> { + pub number: &'s usize, +} + +impl<'s> VecNumber<'s> { + pub fn vec_number_iterable_per_item_in_auxiliary_object( + &self, + ) -> impl Iterator>)> { + self.auxiliary_object.iter().map(move |n| { + let iter_number = self.vec_number.iter(); + (n, iter_number) + }) + } +} + +fn main() {} diff --git a/src/test/ui/impl-trait/nested_impl_trait.stderr b/src/test/ui/impl-trait/nested_impl_trait.stderr index bb4ae5e82..3291cad68 100644 --- a/src/test/ui/impl-trait/nested_impl_trait.stderr +++ b/src/test/ui/impl-trait/nested_impl_trait.stderr @@ -53,7 +53,7 @@ LL | fn bad_in_ret_position(x: impl Into) -> impl Into { x } | ^^^^^^^^^^^^^^^^^^^^^ the trait `From>` is not implemented for `impl Debug` | = help: the trait `Into` is implemented for `T` - = note: required because of the requirements on the impl of `Into` for `impl Into` + = note: required for `impl Into` to implement `Into` error[E0277]: the trait bound `impl Debug: From>` is not satisfied --> $DIR/nested_impl_trait.rs:18:34 @@ -62,7 +62,7 @@ LL | fn bad(x: impl Into) -> impl Into { x } | ^^^^^^^^^^^^^^^^^^^^^ the trait `From>` is not implemented for `impl Debug` | = help: the trait `Into` is implemented for `T` - = note: required because of the requirements on the impl of `Into` for `impl Into` + = note: required for `impl Into` to implement `Into` error: aborting due to 8 previous errors diff --git a/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr b/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr index 365ecd9fc..687dbe65e 100644 --- a/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr +++ b/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr @@ -21,10 +21,10 @@ LL | fn foo() -> Self where Self: Sized; | +++++++++++++++++ error[E0038]: the trait `NotObjectSafe` cannot be made into an object - --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:28:13 + --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:28:17 | LL | fn cat() -> Box { - | ^^^^^^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object + | ^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8 diff --git a/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-impl-trait.stderr b/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-impl-trait.stderr index 5ca01a593..d6f5a1ac2 100644 --- a/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-impl-trait.stderr +++ b/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-impl-trait.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/object-unsafe-trait-in-return-position-impl-trait.rs:36:5 | LL | fn can() -> impl NotObjectSafe { - | ------------------ expected `_` because of return type + | ------------------ expected `A` because of return type ... LL | B | ^ expected struct `A`, found struct `B` @@ -11,7 +11,7 @@ error[E0308]: mismatched types --> $DIR/object-unsafe-trait-in-return-position-impl-trait.rs:43:5 | LL | fn cat() -> impl ObjectSafe { - | --------------- expected `_` because of return type + | --------------- expected `A` because of return type ... LL | B | ^ expected struct `A`, found struct `B` diff --git a/src/test/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr b/src/test/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr index 10510c175..3c65fd998 100644 --- a/src/test/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr +++ b/src/test/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr @@ -2,28 +2,43 @@ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:5:5 | LL | fn foo() -> impl std::fmt::Display { - | ---------------------- expected `_` because of return type + | ---------------------- expected `i32` because of return type ... LL | 1u32 | ^^^^ expected `i32`, found `u32` + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | 1i32 + | ~~~ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:12:16 | LL | fn bar() -> impl std::fmt::Display { - | ---------------------- expected `_` because of return type + | ---------------------- expected `i32` because of return type ... LL | return 1u32; | ^^^^ expected `i32`, found `u32` + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | return 1i32; + | ~~~ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:20:9 | LL | fn baz() -> impl std::fmt::Display { - | ---------------------- expected `_` because of return type + | ---------------------- expected `i32` because of return type ... LL | 1u32 | ^^^^ expected `i32`, found `u32` + | +help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit + | +LL | }.try_into().unwrap() + | ++++++++++++++++++++ error[E0308]: `if` and `else` have incompatible types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:28:9 @@ -36,36 +51,66 @@ LL | | 1u32 | | ^^^^ expected `i32`, found `u32` LL | | } | |_____- `if` and `else` have incompatible types + | +help: you could change the return type to be a boxed trait object + | +LL | fn qux() -> Box { + | ~~~~~~~ + +help: if you change the return type to expect trait objects, box the returned expressions + | +LL ~ Box::new(0i32) +LL | } else { +LL ~ Box::new(1u32) + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | 1i32 + | ~~~ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:35:14 | LL | fn bat() -> impl std::fmt::Display { - | ---------------------- expected `_` because of return type + | ---------------------- expected `i32` because of return type ... LL | _ => 1u32, | ^^^^ expected `i32`, found `u32` + | +help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit + | +LL | }.try_into().unwrap() + | ++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:40:5 | LL | fn can() -> impl std::fmt::Display { - | ---------------------- expected `_` because of return type + | ---------------------- expected `i32` because of return type LL | / match 13 { LL | | 0 => return 0i32, LL | | 1 => 1u32, LL | | _ => 2u32, LL | | } | |_____^ expected `i32`, found `u32` + | +help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit + | +LL | }.try_into().unwrap() + | ++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:53:13 | LL | fn cat() -> impl std::fmt::Display { - | ---------------------- expected `_` because of return type + | ---------------------- expected `i32` because of return type ... LL | 1u32 | ^^^^ expected `i32`, found `u32` + | +help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit + | +LL | }.try_into().unwrap() + | ++++++++++++++++++++ error[E0308]: `match` arms have incompatible types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:61:14 @@ -78,6 +123,20 @@ LL | | 1 => 1u32, LL | | _ => 2u32, LL | | } | |_____- `match` arms have incompatible types + | +help: you could change the return type to be a boxed trait object + | +LL | fn dog() -> Box { + | ~~~~~~~ + +help: if you change the return type to expect trait objects, box the returned expressions + | +LL ~ 0 => Box::new(0i32), +LL ~ 1 => Box::new(1u32), + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | 1 => 1i32, + | ~~~ error[E0308]: `if` and `else` have incompatible types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:97:9 @@ -90,6 +149,21 @@ LL | | 1u32 | | ^^^^ expected `i32`, found `u32` LL | | } | |_____- `if` and `else` have incompatible types + | +help: you could change the return type to be a boxed trait object + | +LL | fn apt() -> Box { + | ~~~~~~~ + +help: if you change the return type to expect trait objects, box the returned expressions + | +LL ~ Box::new(0i32) +LL | } else { +LL ~ Box::new(1u32) + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | 1i32 + | ~~~ error[E0746]: return type cannot have an unboxed trait object --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:66:13 @@ -125,6 +199,11 @@ LL | | 1 => 1u32, LL | | _ => 2u32, LL | | } | |_____- `match` arms have incompatible types + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | 1 => 1i32, + | ~~~ error[E0746]: return type cannot have an unboxed trait object --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:77:13 @@ -164,6 +243,11 @@ LL | | 1u32 | | ^^^^ expected `i32`, found `u32` LL | | } | |_____- `if` and `else` have incompatible types + | +help: change the type of the numeric literal from `u32` to `i32` + | +LL | 1i32 + | ~~~ error[E0746]: return type cannot have an unboxed trait object --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:85:13 diff --git a/src/test/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr b/src/test/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr index ade0dfa1b..cf2998bbf 100644 --- a/src/test/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr +++ b/src/test/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr @@ -9,7 +9,7 @@ note: expected this to be `u8` | LL | type Assoc = u8; | ^^ -note: required because of the requirements on the impl of `Test` for `()` +note: required for `()` to implement `Test` --> $DIR/projection-mismatch-in-impl-where-clause.rs:11:9 | LL | impl Test for T where T: Super {} diff --git a/src/test/ui/impl-trait/suggest-calling-rpit-closure.stderr b/src/test/ui/impl-trait/suggest-calling-rpit-closure.stderr index 2a328a0e6..c10a856d8 100644 --- a/src/test/ui/impl-trait/suggest-calling-rpit-closure.stderr +++ b/src/test/ui/impl-trait/suggest-calling-rpit-closure.stderr @@ -11,7 +11,7 @@ LL | fn opaque() -> impl Fn() -> i32 { | = note: expected type `i32` found opaque type `impl Fn() -> i32` -help: use parentheses to call this closure +help: use parentheses to call this opaque type | LL | opaque()() | ++ diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr index 58a2f79ef..9b346387d 100644 --- a/src/test/ui/impl-trait/where-allowed.stderr +++ b/src/test/ui/impl-trait/where-allowed.stderr @@ -162,12 +162,18 @@ error[E0562]: `impl Trait` only allowed in function and inherent method return t | 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 --> $DIR/where-allowed.rs:125:34 | 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 --> $DIR/where-allowed.rs:138:33 diff --git a/src/test/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.rs b/src/test/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.rs new file mode 100644 index 000000000..33b746c5e --- /dev/null +++ b/src/test/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.rs @@ -0,0 +1,27 @@ +// Test for a less than ideal interaction of implied bounds and normalization. +trait Tr { + type Ty; +} + +impl Tr for T { + type Ty = &'static T; +} + +// `<&'a u8 as Tr>::Ty` should cause an error because `&'a u8: Tr` doesn't hold for +// all possible 'a. However, we consider normalized types for implied bounds. +// +// We normalize this projection to `&'static &'a u8` and add a nested `&'a u8: 'static` +// bound. This bound is then proven using the implied bounds for `&'static &'a u8` which +// we only get by normalizing in the first place. +fn test<'a>(x: &'a u8, _wf: <&'a u8 as Tr>::Ty) -> &'static u8 { x } + +fn main() { + // This works as we have 'static references due to promotion. + let _: &'static u8 = test(&3, &&3); + // This causes an error because the projection requires 'a to be 'static. + // It would be unsound if this compiled. + let x: u8 = 3; + let _: &'static u8 = test(&x, &&3); + //~^ ERROR `x` does not live long enough + +} diff --git a/src/test/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.stderr b/src/test/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.stderr new file mode 100644 index 000000000..d0249e74f --- /dev/null +++ b/src/test/ui/implied-bounds/assoc-ty-wf-used-to-get-assoc-ty.stderr @@ -0,0 +1,15 @@ +error[E0597]: `x` does not live long enough + --> $DIR/assoc-ty-wf-used-to-get-assoc-ty.rs:24:31 + | +LL | let _: &'static u8 = test(&x, &&3); + | -----^^------ + | | | + | | borrowed value does not live long enough + | argument requires that `x` is borrowed for `'static` +... +LL | } + | - `x` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/implied-bounds/impl-header-unnormalized-types.rs b/src/test/ui/implied-bounds/impl-header-unnormalized-types.rs new file mode 100644 index 000000000..d84539f8a --- /dev/null +++ b/src/test/ui/implied-bounds/impl-header-unnormalized-types.rs @@ -0,0 +1,28 @@ +struct Foo(T); + +trait GoodBye { + type Forget; +} +impl GoodBye for T { + type Forget = (); +} + +trait NeedsWf<'a, 'b> { + type Assoc; +} + +impl<'a, 'b> NeedsWf<'a, 'b> for Foo<<&'a &'b () as GoodBye>::Forget> { + type Assoc = &'a &'b (); + //~^ ERROR in type `&'a &'b ()`, reference has a longer lifetime than the data it references +} + +fn needs_wf<'a, 'b, T: NeedsWf<'a, 'b>>() {} + +fn foo<'a: 'a, 'b: 'b>(_: &'b String) { + needs_wf::<'a, 'b, Foo<()>>(); +} + +fn main() { + let x = String::from("hello"); + foo::<'static, '_>(&x); +} diff --git a/src/test/ui/implied-bounds/impl-header-unnormalized-types.stderr b/src/test/ui/implied-bounds/impl-header-unnormalized-types.stderr new file mode 100644 index 000000000..88abd5f54 --- /dev/null +++ b/src/test/ui/implied-bounds/impl-header-unnormalized-types.stderr @@ -0,0 +1,20 @@ +error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references + --> $DIR/impl-header-unnormalized-types.rs:15:18 + | +LL | type Assoc = &'a &'b (); + | ^^^^^^^^^^ + | +note: the pointer is valid for the lifetime `'a` as defined here + --> $DIR/impl-header-unnormalized-types.rs:14:6 + | +LL | impl<'a, 'b> NeedsWf<'a, 'b> for Foo<<&'a &'b () as GoodBye>::Forget> { + | ^^ +note: but the referenced data is only valid for the lifetime `'b` as defined here + --> $DIR/impl-header-unnormalized-types.rs:14:10 + | +LL | impl<'a, 'b> NeedsWf<'a, 'b> for Foo<<&'a &'b () as GoodBye>::Forget> { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0491`. diff --git a/src/test/ui/implied-bounds/issue-100690.rs b/src/test/ui/implied-bounds/issue-100690.rs new file mode 100644 index 000000000..5599cd410 --- /dev/null +++ b/src/test/ui/implied-bounds/issue-100690.rs @@ -0,0 +1,45 @@ +// This code (probably) _should_ compile, but it currently does not because we +// are not smart enough about implied bounds. + +use std::io; + +fn real_dispatch(f: F) -> Result<(), io::Error> +//~^ NOTE required by a bound in this +where + F: FnOnce(&mut UIView) -> Result<(), io::Error> + Send + 'static, + //~^ NOTE required by this bound in `real_dispatch` + //~| NOTE required by a bound in `real_dispatch` +{ + todo!() +} + +#[derive(Debug)] +struct UIView<'a, T: 'a> { + _phantom: std::marker::PhantomData<&'a mut T>, +} + +trait Handle<'a, T: 'a, V, R> { + fn dispatch(&self, f: F) -> Result<(), io::Error> + where + F: FnOnce(&mut V) -> R + Send + 'static; +} + +#[derive(Debug, Clone)] +struct TUIHandle { + _phantom: std::marker::PhantomData, +} + +impl<'a, T: 'a> Handle<'a, T, UIView<'a, T>, Result<(), io::Error>> for TUIHandle { + fn dispatch(&self, f: F) -> Result<(), io::Error> + where + F: FnOnce(&mut UIView<'a, T>) -> Result<(), io::Error> + Send + 'static, + { + real_dispatch(f) + //~^ ERROR expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` + //~| NOTE expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` + //~| NOTE expected a closure with arguments + //~| NOTE required by a bound introduced by this call + } +} + +fn main() {} diff --git a/src/test/ui/implied-bounds/issue-100690.stderr b/src/test/ui/implied-bounds/issue-100690.stderr new file mode 100644 index 000000000..3f6af70d8 --- /dev/null +++ b/src/test/ui/implied-bounds/issue-100690.stderr @@ -0,0 +1,22 @@ +error[E0277]: expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` + --> $DIR/issue-100690.rs:37:23 + | +LL | real_dispatch(f) + | ------------- ^ expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` + | | + | required by a bound introduced by this call + | + = note: expected a closure with arguments `(&mut UIView<'a, T>,)` + found a closure with arguments `(&mut UIView<'_, T>,)` +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 +... +LL | F: FnOnce(&mut UIView) -> Result<(), io::Error> + Send + 'static, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `real_dispatch` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/implied-bounds/issue-101951.rs b/src/test/ui/implied-bounds/issue-101951.rs new file mode 100644 index 000000000..108fef8a1 --- /dev/null +++ b/src/test/ui/implied-bounds/issue-101951.rs @@ -0,0 +1,50 @@ +// Taken directly from that issue. +// +// This test detected that we didn't correctly resolve +// inference variables when computing implied bounds. +// +// check-pass +pub trait BuilderFn<'a> { + type Output; +} + +impl<'a, F, Out> BuilderFn<'a> for F +where + F: FnOnce(&'a mut ()) -> Out, +{ + type Output = Out; +} + +pub trait ConstructionFirm { + type Builder: for<'a> BuilderFn<'a>; +} + +pub trait Campus +where + T: ConstructionFirm, +{ + fn add_building( + &mut self, + building: &mut <::Builder as BuilderFn<'_>>::Output, + ); +} + +struct ArchitectsInc {} + +impl ConstructionFirm for ArchitectsInc { + type Builder = fn(&mut ()) -> PrettyCondo<'_>; +} + +struct PrettyCondo<'a> { + _marker: &'a mut (), +} + +struct CondoEstate {} + +impl Campus for CondoEstate { + fn add_building(&mut self, _building: &mut PrettyCondo<'_>) { + todo!() + } +} + +fn main() {} diff --git a/src/test/ui/index-help.stderr b/src/test/ui/index-help.stderr index b36f4dab8..e020d0298 100644 --- a/src/test/ui/index-help.stderr +++ b/src/test/ui/index-help.stderr @@ -6,7 +6,7 @@ LL | x[0i32]; | = help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `Vec<{integer}>` + = note: required for `Vec<{integer}>` to implement `Index` error: aborting due to previous error diff --git a/src/test/ui/indexing-requires-a-uint.stderr b/src/test/ui/indexing-requires-a-uint.stderr index fbff20f8d..7a741cfc7 100644 --- a/src/test/ui/indexing-requires-a-uint.stderr +++ b/src/test/ui/indexing-requires-a-uint.stderr @@ -6,7 +6,7 @@ LL | [0][0u8]; | = help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `[{integer}]` + = note: required for `[{integer}]` to implement `Index` error[E0308]: mismatched types --> $DIR/indexing-requires-a-uint.rs:12:18 diff --git a/src/test/ui/inference/issue-71732.stderr b/src/test/ui/inference/issue-71732.stderr index 04673a375..79bee3328 100644 --- a/src/test/ui/inference/issue-71732.stderr +++ b/src/test/ui/inference/issue-71732.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-71732.rs:18:10 | LL | .get(&"key".into()) - | ^^^ cannot infer type of the type parameter `Q` declared on the associated function `get` + | ^^^ ------------- type must be known at this point + | | + | cannot infer type of the type parameter `Q` declared on the associated function `get` | = note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`: - impl Borrow for String; @@ -13,7 +15,7 @@ note: required by a bound in `HashMap::::get` | LL | K: Borrow, | ^^^^^^^^^ required by this bound in `HashMap::::get` -help: consider specifying the type argument in the function call +help: consider specifying the generic argument | LL | .get::(&"key".into()) | +++++ diff --git a/src/test/ui/inference/issue-86162-1.stderr b/src/test/ui/inference/issue-86162-1.stderr index e395e65fa..4f621b82d 100644 --- a/src/test/ui/inference/issue-86162-1.stderr +++ b/src/test/ui/inference/issue-86162-1.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | foo(gen()); //<- Do not suggest `foo::()`! | --- ^^^ cannot infer type of the type parameter `T` declared on the function `gen` | | - | type must be known at this point + | required by a bound introduced by this call | = note: cannot satisfy `_: Clone` note: required by a bound in `foo` diff --git a/src/test/ui/inference/issue-86162-2.stderr b/src/test/ui/inference/issue-86162-2.stderr index 30e6e10ea..9aff2cec1 100644 --- a/src/test/ui/inference/issue-86162-2.stderr +++ b/src/test/ui/inference/issue-86162-2.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | Foo::bar(gen()); //<- Do not suggest `Foo::bar::()`! | -------- ^^^ cannot infer type of the type parameter `T` declared on the function `gen` | | - | type must be known at this point + | required by a bound introduced by this call | = note: cannot satisfy `_: Clone` note: required by a bound in `Foo::bar` diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs index bcd29bb4e..b0c0d3397 100644 --- a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs +++ b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Foo { type Output; diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr index 65a75b68c..cbc2477de 100644 --- a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr +++ b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/expr-struct-type-relative-gat.rs:17:9 + --> $DIR/expr-struct-type-relative-gat.rs:15:9 | LL | Self::Output::Simple {}; | ^^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the associated type `Output` diff --git a/src/test/ui/integral-indexing.stderr b/src/test/ui/integral-indexing.stderr index 3f9094d12..bbbb2a86a 100644 --- a/src/test/ui/integral-indexing.stderr +++ b/src/test/ui/integral-indexing.stderr @@ -6,7 +6,7 @@ LL | v[3u8]; | = help: the trait `SliceIndex<[isize]>` is not implemented for `u8` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `Vec` + = note: required for `Vec` to implement `Index` error[E0277]: the type `[isize]` cannot be indexed by `i8` --> $DIR/integral-indexing.rs:7:7 @@ -16,7 +16,7 @@ LL | v[3i8]; | = help: the trait `SliceIndex<[isize]>` is not implemented for `i8` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `Vec` + = note: required for `Vec` to implement `Index` error[E0277]: the type `[isize]` cannot be indexed by `u32` --> $DIR/integral-indexing.rs:8:7 @@ -26,7 +26,7 @@ LL | v[3u32]; | = help: the trait `SliceIndex<[isize]>` is not implemented for `u32` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `Vec` + = note: required for `Vec` to implement `Index` error[E0277]: the type `[isize]` cannot be indexed by `i32` --> $DIR/integral-indexing.rs:9:7 @@ -36,7 +36,7 @@ LL | v[3i32]; | = help: the trait `SliceIndex<[isize]>` is not implemented for `i32` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `Vec` + = note: required for `Vec` to implement `Index` error[E0277]: the type `[u8]` cannot be indexed by `u8` --> $DIR/integral-indexing.rs:12:18 @@ -46,7 +46,7 @@ LL | s.as_bytes()[3u8]; | = help: the trait `SliceIndex<[u8]>` is not implemented for `u8` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `[u8]` + = note: required for `[u8]` to implement `Index` error[E0277]: the type `[u8]` cannot be indexed by `i8` --> $DIR/integral-indexing.rs:13:18 @@ -56,7 +56,7 @@ LL | s.as_bytes()[3i8]; | = help: the trait `SliceIndex<[u8]>` is not implemented for `i8` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `[u8]` + = note: required for `[u8]` to implement `Index` error[E0277]: the type `[u8]` cannot be indexed by `u32` --> $DIR/integral-indexing.rs:14:18 @@ -66,7 +66,7 @@ LL | s.as_bytes()[3u32]; | = help: the trait `SliceIndex<[u8]>` is not implemented for `u32` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `[u8]` + = note: required for `[u8]` to implement `Index` error[E0277]: the type `[u8]` cannot be indexed by `i32` --> $DIR/integral-indexing.rs:15:18 @@ -76,7 +76,7 @@ LL | s.as_bytes()[3i32]; | = help: the trait `SliceIndex<[u8]>` is not implemented for `i32` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `[u8]` + = note: required for `[u8]` to implement `Index` error: aborting due to 8 previous errors diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index 349fb6daf..94f41c925 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -1,12 +1,14 @@ error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/interior-mutability.rs:5:5 + --> $DIR/interior-mutability.rs:5:18 | LL | catch_unwind(|| { x.set(23); }); - | ^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ------------ ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | | + | required by a bound introduced by this call | = help: within `Cell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` = note: required because it appears within the type `Cell` - = note: required because of the requirements on the impl of `UnwindSafe` for `&Cell` + = note: required for `&Cell` to implement `UnwindSafe` note: required because it's used within this closure --> $DIR/interior-mutability.rs:5:18 | diff --git a/src/test/ui/intrinsics/const-eval-select-backtrace-std.rs b/src/test/ui/intrinsics/const-eval-select-backtrace-std.rs new file mode 100644 index 000000000..29aefe071 --- /dev/null +++ b/src/test/ui/intrinsics/const-eval-select-backtrace-std.rs @@ -0,0 +1,6 @@ +// See issue #100696. +// run-fail +// check-run-results +fn main() { + &""[1..]; +} diff --git a/src/test/ui/intrinsics/const-eval-select-backtrace-std.run.stderr b/src/test/ui/intrinsics/const-eval-select-backtrace-std.run.stderr new file mode 100644 index 000000000..e53e60346 --- /dev/null +++ b/src/test/ui/intrinsics/const-eval-select-backtrace-std.run.stderr @@ -0,0 +1,2 @@ +thread 'main' panicked at 'byte index 1 is out of bounds of ``', $DIR/const-eval-select-backtrace-std.rs:5:6 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/test/ui/intrinsics/const-eval-select-backtrace.rs b/src/test/ui/intrinsics/const-eval-select-backtrace.rs new file mode 100644 index 000000000..99f072520 --- /dev/null +++ b/src/test/ui/intrinsics/const-eval-select-backtrace.rs @@ -0,0 +1,18 @@ +#![feature(core_intrinsics)] +// See issue #100696. +// run-fail +// check-run-results + +#[track_caller] +fn uhoh() { + panic!("Aaah!") +} + +const fn c() {} + +fn main() { + // safety: this is unsound and just used to test + unsafe { + std::intrinsics::const_eval_select((), c, uhoh); + } +} diff --git a/src/test/ui/intrinsics/const-eval-select-backtrace.run.stderr b/src/test/ui/intrinsics/const-eval-select-backtrace.run.stderr new file mode 100644 index 000000000..2fd730ac7 --- /dev/null +++ b/src/test/ui/intrinsics/const-eval-select-backtrace.run.stderr @@ -0,0 +1,2 @@ +thread 'main' panicked at 'Aaah!', $DIR/const-eval-select-backtrace.rs:16:9 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/test/ui/intrinsics/const-eval-select-bad.rs b/src/test/ui/intrinsics/const-eval-select-bad.rs index 52f4e594f..fa14efad7 100644 --- a/src/test/ui/intrinsics/const-eval-select-bad.rs +++ b/src/test/ui/intrinsics/const-eval-select-bad.rs @@ -5,10 +5,13 @@ use std::intrinsics::const_eval_select; const fn not_fn_items() { const_eval_select((), || {}, || {}); - //~^ ERROR the trait bound + //~^ ERROR this argument must be a function item + //~| ERROR this argument must be a function item const_eval_select((), 42, 0xDEADBEEF); - //~^ ERROR the trait bound + //~^ ERROR expected a `FnOnce<()>` closure //~| ERROR expected a `FnOnce<()>` closure + //~| ERROR this argument must be a function item + //~| ERROR this argument must be a function item } const fn foo(n: i32) -> i32 { @@ -27,7 +30,7 @@ fn baz(n: bool) -> i32 { const fn return_ty_mismatch() { const_eval_select((1,), foo, bar); - //~^ ERROR type mismatch + //~^ ERROR expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it returns `bool` } const fn args_ty_mismatch() { @@ -35,4 +38,9 @@ const fn args_ty_mismatch() { //~^ ERROR type mismatch } +const fn non_const_fn() { + const_eval_select((1,), bar, bar); + //~^ ERROR this argument must be a `const fn` +} + fn main() {} diff --git a/src/test/ui/intrinsics/const-eval-select-bad.stderr b/src/test/ui/intrinsics/const-eval-select-bad.stderr index 89dba12c8..3720528ad 100644 --- a/src/test/ui/intrinsics/const-eval-select-bad.stderr +++ b/src/test/ui/intrinsics/const-eval-select-bad.stderr @@ -1,42 +1,57 @@ -error[E0277]: the trait bound `[closure@$DIR/const-eval-select-bad.rs:7:27: 7:29]: FnOnce<()>` is not satisfied +error: this argument must be a function item --> $DIR/const-eval-select-bad.rs:7:27 | LL | const_eval_select((), || {}, || {}); - | ----------------- ^^^^^ expected an `FnOnce<()>` closure, found `[closure@$DIR/const-eval-select-bad.rs:7:27: 7:29]` - | | - | required by a bound introduced by this call + | ^^^^^ | - = help: the trait `~const FnOnce<()>` is not implemented for `[closure@$DIR/const-eval-select-bad.rs:7:27: 7:29]` -note: the trait `FnOnce<()>` is implemented for `[closure@$DIR/const-eval-select-bad.rs:7:27: 7:29]`, but that implementation is not `const` - --> $DIR/const-eval-select-bad.rs:7:27 + = note: expected a function item, found [closure@$DIR/const-eval-select-bad.rs:7:27: 7:29] + = help: consult the documentation on `const_eval_select` for more information + +error: this argument must be a function item + --> $DIR/const-eval-select-bad.rs:7:34 | LL | const_eval_select((), || {}, || {}); - | ^^^^^ - = note: wrap the `[closure@$DIR/const-eval-select-bad.rs:7:27: 7:29]` in a closure with no arguments: `|| { /* code */ }` -note: required by a bound in `const_eval_select` - --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + | ^^^^^ | -LL | F: ~const FnOnce, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` + = note: expected a function item, found [closure@$DIR/const-eval-select-bad.rs:7:34: 7:36] + = help: consult the documentation on `const_eval_select` for more information -error[E0277]: the trait bound `{integer}: FnOnce<()>` is not satisfied - --> $DIR/const-eval-select-bad.rs:9:27 +error: this argument must be a function item + --> $DIR/const-eval-select-bad.rs:10:27 + | +LL | const_eval_select((), 42, 0xDEADBEEF); + | ^^ + | + = note: expected a function item, found {integer} + = help: consult the documentation on `const_eval_select` for more information + +error[E0277]: expected a `FnOnce<()>` closure, found `{integer}` + --> $DIR/const-eval-select-bad.rs:10:27 | LL | const_eval_select((), 42, 0xDEADBEEF); | ----------------- ^^ expected an `FnOnce<()>` closure, found `{integer}` | | | required by a bound introduced by this call | - = help: the trait `~const FnOnce<()>` is not implemented for `{integer}` + = help: the trait `FnOnce<()>` is not implemented for `{integer}` = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL | -LL | F: ~const FnOnce, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` +LL | F: FnOnce; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` + +error: this argument must be a function item + --> $DIR/const-eval-select-bad.rs:10:31 + | +LL | const_eval_select((), 42, 0xDEADBEEF); + | ^^^^^^^^^^ + | + = note: expected a function item, found {integer} + = help: consult the documentation on `const_eval_select` for more information error[E0277]: expected a `FnOnce<()>` closure, found `{integer}` - --> $DIR/const-eval-select-bad.rs:9:31 + --> $DIR/const-eval-select-bad.rs:10:31 | LL | const_eval_select((), 42, 0xDEADBEEF); | ----------------- ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `{integer}` @@ -48,23 +63,25 @@ LL | const_eval_select((), 42, 0xDEADBEEF); note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL | -LL | G: FnOnce + ~const Destruct, - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` +LL | G: FnOnce, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` -error[E0271]: type mismatch resolving ` bool {bar} as FnOnce<(i32,)>>::Output == i32` - --> $DIR/const-eval-select-bad.rs:29:5 +error[E0271]: expected `fn(i32) -> bool {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); - | ^^^^^^^^^^^^^^^^^ expected `i32`, found `bool` + | ----------------- ^^^ expected `i32`, found `bool` + | | + | required by a bound introduced by this call | note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL | -LL | G: FnOnce + ~const Destruct, - | ^^^^^^^^^^^^ required by this bound in `const_eval_select` +LL | G: FnOnce, + | ^^^^^^^^^^^^ required by this bound in `const_eval_select` error[E0631]: type mismatch in function arguments - --> $DIR/const-eval-select-bad.rs:34:32 + --> $DIR/const-eval-select-bad.rs:37:32 | LL | const fn foo(n: i32) -> i32 { | --------------------------- found signature defined here @@ -79,10 +96,18 @@ LL | const_eval_select((true,), foo, baz); note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL | -LL | F: ~const FnOnce, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` +LL | F: FnOnce; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` + +error: this argument must be a `const fn` + --> $DIR/const-eval-select-bad.rs:42:29 + | +LL | const_eval_select((1,), bar, bar); + | ^^^ + | + = help: consult the documentation on `const_eval_select` for more information -error: aborting due to 5 previous errors +error: aborting due to 9 previous errors Some errors have detailed explanations: E0271, E0277, E0631. For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/issue-94866.stderr b/src/test/ui/issue-94866.stderr index 5477d83f4..b3c17ce89 100644 --- a/src/test/ui/issue-94866.stderr +++ b/src/test/ui/issue-94866.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `B` not covered +error[E0004]: non-exhaustive patterns: `Enum::B` not covered --> $DIR/issue-94866.rs:10:11 | LL | match Enum::A { - | ^^^^^^^ pattern `B` not covered + | ^^^^^^^ pattern `Enum::B` not covered | note: `Enum` defined here --> $DIR/issue-94866.rs:7:16 @@ -13,7 +13,7 @@ LL | enum Enum { A, B } help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Enum::A => m!(), -LL + B => todo!() +LL + Enum::B => todo!() | error: aborting due to previous error diff --git a/src/test/ui/issues/auxiliary/issue-2380.rs b/src/test/ui/issues/auxiliary/issue-2380.rs index 9a51a73c9..79fd62d16 100644 --- a/src/test/ui/issues/auxiliary/issue-2380.rs +++ b/src/test/ui/issues/auxiliary/issue-2380.rs @@ -1,8 +1,6 @@ #![crate_name="a"] #![crate_type = "lib"] -#![feature(box_syntax)] - pub trait i { fn dummy(&self, t: T) -> T { panic!() } @@ -11,5 +9,5 @@ pub trait i pub fn f() -> Box+'static> { impl i for () { } - box () as Box+'static> + Box::new(()) as Box+'static> } diff --git a/src/test/ui/issues/issue-100550-normalization-ice-exposed-by-mir-inlining.rs b/src/test/ui/issues/issue-100550-normalization-ice-exposed-by-mir-inlining.rs deleted file mode 100644 index 2ed50d709..000000000 --- a/src/test/ui/issues/issue-100550-normalization-ice-exposed-by-mir-inlining.rs +++ /dev/null @@ -1,39 +0,0 @@ -// check-pass - -// compile-flags: --emit=mir,link -O - -// There is an ICE somewhere in type normalization, and we are hitting it during -// the MIR inlining pass on this code. -// -// Long term, we should fix that ICE and change the compile-flags for this test -// to explicitly enable MIR inlining. -// -// Short term, we are diabling MIR inlining for Rust 1.64-beta, so that we avoid -// this ICE in this instance. - -pub trait Trait { - type Associated; -} -impl Trait for T { - type Associated = T; -} - -pub struct Struct(::Associated); - -pub fn foo() -> Struct -where - T: Trait, -{ - bar() -} - -#[inline] -fn bar() -> Struct { - Struct(baz()) -} - -fn baz() -> T { - unimplemented!() -} - -fn main() { } diff --git a/src/test/ui/issues/issue-100605.rs b/src/test/ui/issues/issue-100605.rs new file mode 100644 index 000000000..917a45c15 --- /dev/null +++ b/src/test/ui/issues/issue-100605.rs @@ -0,0 +1,9 @@ +fn takes_option(_arg: Option<&String>) {} + +fn main() { + takes_option(&None); //~ ERROR 4:18: 4:23: mismatched types [E0308] + + let x = String::from("x"); + let res = Some(x); + takes_option(&res); //~ ERROR 8:18: 8:22: mismatched types [E0308] +} diff --git a/src/test/ui/issues/issue-100605.stderr b/src/test/ui/issues/issue-100605.stderr new file mode 100644 index 000000000..886e3cd6b --- /dev/null +++ b/src/test/ui/issues/issue-100605.stderr @@ -0,0 +1,46 @@ +error[E0308]: mismatched types + --> $DIR/issue-100605.rs:4:18 + | +LL | takes_option(&None); + | ------------ ^^^^^ expected enum `Option`, found `&Option<_>` + | | + | arguments to this function are incorrect + | + = note: expected enum `Option<&String>` + found reference `&Option<_>` +note: function defined here + --> $DIR/issue-100605.rs:1:4 + | +LL | fn takes_option(_arg: Option<&String>) {} + | ^^^^^^^^^^^^ --------------------- +help: you can convert from `&Option` to `Option<&T>` using `.as_ref()` + | +LL | takes_option(None.as_ref()); + | ~~~~~~~~~~~~~ +help: consider removing the borrow + | +LL - takes_option(&None); +LL + takes_option(None); + | + +error[E0308]: mismatched types + --> $DIR/issue-100605.rs:8:18 + | +LL | takes_option(&res); + | ------------ ^^^^ + | | | + | | expected enum `Option`, found `&Option` + | | help: you can convert from `&Option` to `Option<&T>` using `.as_ref()`: `res.as_ref()` + | arguments to this function are incorrect + | + = note: expected enum `Option<&String>` + found reference `&Option` +note: function defined here + --> $DIR/issue-100605.rs:1:4 + | +LL | fn takes_option(_arg: Option<&String>) {} + | ^^^^^^^^^^^^ --------------------- + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-10682.rs b/src/test/ui/issues/issue-10682.rs index afaa90f05..72e4559d3 100644 --- a/src/test/ui/issues/issue-10682.rs +++ b/src/test/ui/issues/issue-10682.rs @@ -4,12 +4,10 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - fn work(_: Box) {} fn foo(_: F) {} pub fn main() { - let a = box 1; + let a = Box::new(1); foo(move|| { foo(move|| { work(a) }) }) } diff --git a/src/test/ui/issues/issue-10767.rs b/src/test/ui/issues/issue-10767.rs index f40815fdb..5670cd458 100644 --- a/src/test/ui/issues/issue-10767.rs +++ b/src/test/ui/issues/issue-10767.rs @@ -1,10 +1,8 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub fn main() { fn f() { } - let _: Box = box (f as fn()); + let _: Box = Box::new(f as fn()); } diff --git a/src/test/ui/issues/issue-10802.rs b/src/test/ui/issues/issue-10802.rs index f1d6b37a6..99e1a92df 100644 --- a/src/test/ui/issues/issue-10802.rs +++ b/src/test/ui/issues/issue-10802.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -#![feature(box_syntax)] struct DroppableStruct; enum DroppableEnum { @@ -33,14 +32,14 @@ impl Whatever { fn main() { { - let f: Box<_> = box DroppableStruct; - let _a = Whatever::new(box f as Box); + let f: Box<_> = Box::new(DroppableStruct); + let _a = Whatever::new(Box::new(f) as Box); } assert!(unsafe { DROPPED }); unsafe { DROPPED = false; } { - let f: Box<_> = box DroppableEnum::DroppableVariant1; - let _a = Whatever::new(box f as Box); + let f: Box<_> = Box::new(DroppableEnum::DroppableVariant1); + let _a = Whatever::new(Box::new(f) as Box); } assert!(unsafe { DROPPED }); } diff --git a/src/test/ui/issues/issue-11192.rs b/src/test/ui/issues/issue-11192.rs index 3bf91675e..1a3d8c9fe 100644 --- a/src/test/ui/issues/issue-11192.rs +++ b/src/test/ui/issues/issue-11192.rs @@ -1,20 +1,20 @@ -#![feature(box_syntax)] - struct Foo { x: isize } + impl Drop for Foo { fn drop(&mut self) { println!("drop {}", self.x); } } + fn main() { - let mut ptr: Box<_> = box Foo { x: 0 }; + let mut ptr: Box<_> = Box::new(Foo { x: 0 }); let mut test = |foo: &Foo| { println!("access {}", foo.x); - ptr = box Foo { x: ptr.x + 1 }; + ptr = Box::new(Foo { x: ptr.x + 1 }); println!("access {}", foo.x); }; test(&*ptr); diff --git a/src/test/ui/issues/issue-11192.stderr b/src/test/ui/issues/issue-11192.stderr index 2a9d91317..fc1548013 100644 --- a/src/test/ui/issues/issue-11192.stderr +++ b/src/test/ui/issues/issue-11192.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as m LL | let mut test = |foo: &Foo| { | ----------- mutable borrow occurs here LL | println!("access {}", foo.x); -LL | ptr = box Foo { x: ptr.x + 1 }; +LL | ptr = Box::new(Foo { x: ptr.x + 1 }); | --- first borrow occurs due to use of `ptr` in closure ... LL | test(&*ptr); diff --git a/src/test/ui/issues/issue-11374.stderr b/src/test/ui/issues/issue-11374.stderr index 3a1d43310..15b2bbeb7 100644 --- a/src/test/ui/issues/issue-11374.stderr +++ b/src/test/ui/issues/issue-11374.stderr @@ -14,7 +14,7 @@ note: associated function defined here --> $DIR/issue-11374.rs:13:12 | LL | pub fn read_to(&mut self, vec: &mut [u8]) { - | ^^^^^^^ --------- -------------- + | ^^^^^^^ -------------- error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11515.rs b/src/test/ui/issues/issue-11515.rs index 2072f9c47..b5c942f96 100644 --- a/src/test/ui/issues/issue-11515.rs +++ b/src/test/ui/issues/issue-11515.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax)] - struct Test { func: Box, } + + fn main() { let closure: Box = Box::new(|| ()); - let test = box Test { func: closure }; //~ ERROR trait upcasting coercion is experimental [E0658] + let test = Box::new(Test { func: closure }); //~ ERROR trait upcasting coercion is experimental [E0658] } diff --git a/src/test/ui/issues/issue-11515.stderr b/src/test/ui/issues/issue-11515.stderr index 17bfae2a4..accd47f0f 100644 --- a/src/test/ui/issues/issue-11515.stderr +++ b/src/test/ui/issues/issue-11515.stderr @@ -1,8 +1,8 @@ error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental - --> $DIR/issue-11515.rs:9:33 + --> $DIR/issue-11515.rs:9:38 | -LL | let test = box Test { func: closure }; - | ^^^^^^^ +LL | let test = Box::new(Test { func: closure }); + | ^^^^^^^ | = note: see issue #65991 for more information = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable diff --git a/src/test/ui/issues/issue-11552.rs b/src/test/ui/issues/issue-11552.rs index bae12375d..9fb9f3d2e 100644 --- a/src/test/ui/issues/issue-11552.rs +++ b/src/test/ui/issues/issue-11552.rs @@ -1,6 +1,5 @@ // run-pass #![feature(box_patterns)] -#![feature(box_syntax)] #[derive(Clone)] enum Noun @@ -18,5 +17,8 @@ fn fas(n: &Noun) -> Noun } pub fn main() { - fas(&Noun::Cell(box Noun::Atom(2), box Noun::Cell(box Noun::Atom(2), box Noun::Atom(3)))); + fas( + &Noun::Cell(Box::new(Noun::Atom(2)), + Box::new(Noun::Cell(Box::new(Noun::Atom(2)), Box::new(Noun::Atom(3))))) + ); } diff --git a/src/test/ui/issues/issue-11844.rs b/src/test/ui/issues/issue-11844.rs index bb06f00d5..f974a4702 100644 --- a/src/test/ui/issues/issue-11844.rs +++ b/src/test/ui/issues/issue-11844.rs @@ -1,7 +1,5 @@ -#![feature(box_syntax)] - fn main() { - let a = Some(box 1); + let a = Some(Box::new(1)); match a { Ok(a) => //~ ERROR: mismatched types println!("{}",a), diff --git a/src/test/ui/issues/issue-11844.stderr b/src/test/ui/issues/issue-11844.stderr index 9d7470e7a..81cf918a1 100644 --- a/src/test/ui/issues/issue-11844.stderr +++ b/src/test/ui/issues/issue-11844.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-11844.rs:6:9 + --> $DIR/issue-11844.rs:4:9 | LL | match a { | - this expression has type `Option>` diff --git a/src/test/ui/issues/issue-12127.rs b/src/test/ui/issues/issue-12127.rs index bb2c27345..8b30ddc2d 100644 --- a/src/test/ui/issues/issue-12127.rs +++ b/src/test/ui/issues/issue-12127.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax, unboxed_closures)] +#![feature(unboxed_closures)] fn to_fn_once>(f: F) -> F { f } fn do_it(x: &isize) { } fn main() { - let x: Box<_> = box 22; + let x: Box<_> = Box::new(22); let f = to_fn_once(move|| do_it(&*x)); to_fn_once(move|| { f(); diff --git a/src/test/ui/issues/issue-13323.rs b/src/test/ui/issues/issue-13323.rs index 26847ee7a..71e14d4da 100644 --- a/src/test/ui/issues/issue-13323.rs +++ b/src/test/ui/issues/issue-13323.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] struct StrWrap { s: String @@ -48,7 +47,7 @@ impl Matcher for EqualTo { } fn equal_to(expected: T) -> Box> { - box EqualTo { expected: expected } + Box::new(EqualTo { expected: expected }) } pub fn main() { diff --git a/src/test/ui/issues/issue-14399.rs b/src/test/ui/issues/issue-14399.rs index 6bf8a5899..7b32bf8e4 100644 --- a/src/test/ui/issues/issue-14399.rs +++ b/src/test/ui/issues/issue-14399.rs @@ -6,8 +6,6 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - #[derive(Clone)] struct B1; @@ -15,6 +13,6 @@ trait A { fn foo(&self) {} } impl A for B1 {} fn main() { - let v: Box<_> = box B1; + let v: Box<_> = Box::new(B1); let _c: Box = v.clone(); } diff --git a/src/test/ui/issues/issue-14915.rs b/src/test/ui/issues/issue-14915.rs index 909540355..127b909dd 100644 --- a/src/test/ui/issues/issue-14915.rs +++ b/src/test/ui/issues/issue-14915.rs @@ -1,7 +1,5 @@ -#![feature(box_syntax)] - fn main() { - let x: Box = box 0; + let x: Box = Box::new(0); println!("{}", x + 1); //~^ ERROR cannot add `{integer}` to `Box` diff --git a/src/test/ui/issues/issue-14915.stderr b/src/test/ui/issues/issue-14915.stderr index bd0b1d39a..6e6326929 100644 --- a/src/test/ui/issues/issue-14915.stderr +++ b/src/test/ui/issues/issue-14915.stderr @@ -1,5 +1,5 @@ error[E0369]: cannot add `{integer}` to `Box` - --> $DIR/issue-14915.rs:6:22 + --> $DIR/issue-14915.rs:4:22 | LL | println!("{}", x + 1); | - ^ - {integer} diff --git a/src/test/ui/issues/issue-15524.rs b/src/test/ui/issues/issue-15524.rs deleted file mode 100644 index 565db2d0f..000000000 --- a/src/test/ui/issues/issue-15524.rs +++ /dev/null @@ -1,16 +0,0 @@ -const N: isize = 1; - -enum Foo { - //~^ ERROR discriminant value `1` assigned more than once - //~| ERROR discriminant value `1` assigned more than once - //~| ERROR discriminant value `1` assigned more than once - A = 1, - B = 1, - C = 0, - D, - - E = N, - -} - -fn main() {} diff --git a/src/test/ui/issues/issue-15524.stderr b/src/test/ui/issues/issue-15524.stderr deleted file mode 100644 index 1195e0a34..000000000 --- a/src/test/ui/issues/issue-15524.stderr +++ /dev/null @@ -1,40 +0,0 @@ -error[E0081]: discriminant value `1` assigned more than once - --> $DIR/issue-15524.rs:3:1 - | -LL | enum Foo { - | ^^^^^^^^ -... -LL | A = 1, - | - first assignment of `1` -LL | B = 1, - | - second assignment of `1` - -error[E0081]: discriminant value `1` assigned more than once - --> $DIR/issue-15524.rs:3:1 - | -LL | enum Foo { - | ^^^^^^^^ -... -LL | A = 1, - | - first assignment of `1` -LL | B = 1, -LL | C = 0, - | ----- assigned discriminant for `D` was incremented from this discriminant -LL | D, - | - second assignment of `1` - -error[E0081]: discriminant value `1` assigned more than once - --> $DIR/issue-15524.rs:3:1 - | -LL | enum Foo { - | ^^^^^^^^ -... -LL | A = 1, - | - first assignment of `1` -... -LL | E = N, - | - second assignment of `1` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0081`. diff --git a/src/test/ui/issues/issue-15571.rs b/src/test/ui/issues/issue-15571.rs index 5381d6523..5f228b286 100644 --- a/src/test/ui/issues/issue-15571.rs +++ b/src/test/ui/issues/issue-15571.rs @@ -1,8 +1,7 @@ // run-pass -#![feature(box_syntax)] fn match_on_local() { - let mut foo: Option> = Some(box 5); + let mut foo: Option> = Some(Box::new(5)); match foo { None => {}, Some(x) => { @@ -37,7 +36,7 @@ fn match_on_binding() { } fn match_on_upvar() { - let mut foo: Option> = Some(box 8); + let mut foo: Option> = Some(Box::new(8)); let f = move|| { match foo { None => {}, @@ -52,7 +51,7 @@ fn match_on_upvar() { fn main() { match_on_local(); - match_on_arg(Some(box 6)); + match_on_arg(Some(Box::new(6))); match_on_binding(); match_on_upvar(); } diff --git a/src/test/ui/issues/issue-15763.rs b/src/test/ui/issues/issue-15763.rs index 9ceffff2e..ae0863615 100644 --- a/src/test/ui/issues/issue-15763.rs +++ b/src/test/ui/issues/issue-15763.rs @@ -1,6 +1,5 @@ // run-pass #![allow(unreachable_code)] -#![feature(box_syntax)] #[derive(PartialEq, Debug)] struct Bar { @@ -78,12 +77,12 @@ fn main() { assert_eq!(cc().unwrap(), 3); assert_eq!(dd().unwrap(), 3); - let i = box 32isize as Box; + let i = Box::new(32isize) as Box; assert_eq!(i.aaa(), 3); - let i = box 32isize as Box; + let i = Box::new(32isize) as Box; assert_eq!(i.bbb(), 3); - let i = box 32isize as Box; + let i = Box::new(32isize) as Box; assert_eq!(i.ccc().unwrap(), 3); - let i = box 32isize as Box; + let i = Box::new(32isize) as Box; assert_eq!(i.ddd().unwrap(), 3); } diff --git a/src/test/ui/issues/issue-16538.mir.stderr b/src/test/ui/issues/issue-16538.mir.stderr index 7dab7de76..e320df4b7 100644 --- a/src/test/ui/issues/issue-16538.mir.stderr +++ b/src/test/ui/issues/issue-16538.mir.stderr @@ -5,6 +5,7 @@ LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error[E0133]: use of extern static is unsafe and requires unsafe function or block --> $DIR/issue-16538.rs:14:30 diff --git a/src/test/ui/issues/issue-16538.thir.stderr b/src/test/ui/issues/issue-16538.thir.stderr index a18b0197d..4a8628692 100644 --- a/src/test/ui/issues/issue-16538.thir.stderr +++ b/src/test/ui/issues/issue-16538.thir.stderr @@ -21,6 +21,7 @@ LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-16739.rs b/src/test/ui/issues/issue-16739.rs index 94da2ca5c..b21ea4bcd 100644 --- a/src/test/ui/issues/issue-16739.rs +++ b/src/test/ui/issues/issue-16739.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] #![feature(unboxed_closures, fn_traits)] // Test that unboxing shim for calling rust-call ABI methods through a @@ -35,12 +34,12 @@ impl FnOnce<(u32,u32)> for Foo { } fn main() { - let mut f = box Foo { foo: 42 } as Box u32>; + let mut f = Box::new(Foo { foo: 42 }) as Box u32>; assert_eq!(f.call_mut(()), 42); - let mut f = box Foo { foo: 40 } as Box u32>; + let mut f = Box::new(Foo { foo: 40 }) as Box u32>; assert_eq!(f.call_mut((2,)), 42); - let mut f = box Foo { foo: 40 } as Box u32>; + let mut f = Box::new(Foo { foo: 40 }) as Box u32>; assert_eq!(f.call_mut((1, 1)), 42); } diff --git a/src/test/ui/issues/issue-16774.rs b/src/test/ui/issues/issue-16774.rs index 9e9b84034..2b308ef76 100644 --- a/src/test/ui/issues/issue-16774.rs +++ b/src/test/ui/issues/issue-16774.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] #![feature(box_patterns)] use std::ops::{Deref, DerefMut}; @@ -35,7 +34,7 @@ impl DerefMut for X { fn main() { { - let mut test = X(box 5); + let mut test = X(Box::new(5)); { let mut change = || { *test = 10 }; change(); diff --git a/src/test/ui/issues/issue-16939.stderr b/src/test/ui/issues/issue-16939.stderr index aaa3c49b3..766456454 100644 --- a/src/test/ui/issues/issue-16939.stderr +++ b/src/test/ui/issues/issue-16939.stderr @@ -12,7 +12,7 @@ LL | fn _foo (f: F) { help: remove the extra argument | LL | |t| f(); - | ~~~ + | ~~ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17252.stderr b/src/test/ui/issues/issue-17252.stderr index 3a629e1eb..4856418ed 100644 --- a/src/test/ui/issues/issue-17252.stderr +++ b/src/test/ui/issues/issue-17252.stderr @@ -2,7 +2,7 @@ error[E0391]: cycle detected when const-evaluating + checking `FOO` --> $DIR/issue-17252.rs:1:1 | LL | const FOO: usize = FOO; - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which immediately requires const-evaluating + checking `FOO` again note: cycle used when const-evaluating + checking `main::{constant#0}` diff --git a/src/test/ui/issues/issue-17322.rs b/src/test/ui/issues/issue-17322.rs index 20a8d1361..b4fc40c3f 100644 --- a/src/test/ui/issues/issue-17322.rs +++ b/src/test/ui/issues/issue-17322.rs @@ -1,8 +1,6 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - use std::io::{self, Write}; fn f(wr: &mut dyn Write) { @@ -10,6 +8,6 @@ fn f(wr: &mut dyn Write) { } fn main() { - let mut wr = box io::stdout() as Box; + let mut wr = Box::new(io::stdout()) as Box; f(&mut wr); } diff --git a/src/test/ui/issues/issue-18611.stderr b/src/test/ui/issues/issue-18611.stderr index bd18d4622..22c3470b6 100644 --- a/src/test/ui/issues/issue-18611.stderr +++ b/src/test/ui/issues/issue-18611.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied - --> $DIR/issue-18611.rs:1:18 + --> $DIR/issue-18611.rs:1:1 | -LL | fn add_state(op: ::State) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize` +LL | / fn add_state(op: ::State) { +LL | | +LL | | } + | |_^ the trait `HasState` is not implemented for `isize` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18819.stderr b/src/test/ui/issues/issue-18819.stderr index 6499dd0d8..767fdd5ca 100644 --- a/src/test/ui/issues/issue-18819.stderr +++ b/src/test/ui/issues/issue-18819.stderr @@ -2,11 +2,13 @@ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/issue-18819.rs:16:5 | LL | print_x(X); - | ^^^^^^^--- - | || - | |expected reference, found struct `X` - | an argument of type `&str` is missing + | ^^^^^^^--- an argument of type `&str` is missing | +note: expected reference, found struct `X` + --> $DIR/issue-18819.rs:16:13 + | +LL | print_x(X); + | ^ = note: expected reference `&dyn Foo` found struct `X` note: function defined here @@ -21,7 +23,7 @@ LL | print_x(&X); help: provide the argument | LL | print_x(/* &dyn Foo */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20162.stderr b/src/test/ui/issues/issue-20162.stderr index d70bf6e1d..3f9b3be98 100644 --- a/src/test/ui/issues/issue-20162.stderr +++ b/src/test/ui/issues/issue-20162.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `X: Ord` is not satisfied - --> $DIR/issue-20162.rs:5:7 + --> $DIR/issue-20162.rs:5:5 | LL | b.sort(); - | ^^^^ the trait `Ord` is not implemented for `X` + | ^ ---- required by a bound introduced by this call + | | + | the trait `Ord` is not implemented for `X` | note: required by a bound in `slice::::sort` --> $SRC_DIR/alloc/src/slice.rs:LL:COL diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index ea493c58a..2db60b641 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -14,13 +14,13 @@ LL | impl Foo for T where NoData: Foo { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` +note: required for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Foo` --> $DIR/issue-20413.rs:8:9 | LL | impl Foo for T where NoData: Foo { | ^^^ ^ = note: 127 redundant requirements hidden - = note: required because of the requirements on the impl of `Foo` for `NoData` + = note: required for `NoData` to implement `Foo` error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` --> $DIR/issue-20413.rs:27:42 @@ -29,18 +29,18 @@ LL | impl Bar for T where EvenLessData: Baz { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required because of the requirements on the impl of `Bar` for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` +note: required for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar` --> $DIR/issue-20413.rs:27:9 | LL | impl Bar for T where EvenLessData: Baz { | ^^^ ^ -note: required because of the requirements on the impl of `Baz` for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` +note: required for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz` --> $DIR/issue-20413.rs:34:9 | LL | impl Baz for T where AlmostNoData: Bar { | ^^^ ^ = note: 126 redundant requirements hidden - = note: required because of the requirements on the impl of `Baz` for `EvenLessData` + = note: required for `EvenLessData` to implement `Baz` error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` --> $DIR/issue-20413.rs:34:42 @@ -49,18 +49,18 @@ LL | impl Baz for T where AlmostNoData: Bar { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required because of the requirements on the impl of `Baz` for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` +note: required for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz` --> $DIR/issue-20413.rs:34:9 | LL | impl Baz for T where AlmostNoData: Bar { | ^^^ ^ -note: required because of the requirements on the impl of `Bar` for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` +note: required for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar` --> $DIR/issue-20413.rs:27:9 | LL | impl Bar for T where EvenLessData: Baz { | ^^^ ^ = note: 126 redundant requirements hidden - = note: required because of the requirements on the impl of `Bar` for `AlmostNoData` + = note: required for `AlmostNoData` to implement `Bar` error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-20605.stderr b/src/test/ui/issues/issue-20605.stderr index 41eefe3f8..e1858b639 100644 --- a/src/test/ui/issues/issue-20605.stderr +++ b/src/test/ui/issues/issue-20605.stderr @@ -2,10 +2,10 @@ error[E0277]: the size for values of type `dyn Iterator` cann --> $DIR/issue-20605.rs:2:17 | LL | for item in *things { *item = 0 } - | ^^^^^^^ expected an implementor of trait `IntoIterator` + | ^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator` | = note: the trait bound `dyn Iterator: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `dyn Iterator` + = note: required for `dyn Iterator` to implement `IntoIterator` help: consider mutably borrowing here | LL | for item in &mut *things { *item = 0 } diff --git a/src/test/ui/issues/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr index 57f9575bd..ef62dece8 100644 --- a/src/test/ui/issues/issue-20831-debruijn.stderr +++ b/src/test/ui/issues/issue-20831-debruijn.stderr @@ -1,8 +1,14 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/issue-20831-debruijn.rs:28:8 + --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | fn subscribe(&mut self, t : Box::Output> + 'a>) { - | ^^^^^^^^^ +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | | // Not obvious, but there is an implicit lifetime here -------^ +LL | | +LL | | // +... | +LL | | self.sub = t; +LL | | } + | |_____^ | note: first, the lifetime cannot outlive the anonymous lifetime defined here... --> $DIR/issue-20831-debruijn.rs:28:58 @@ -15,10 +21,16 @@ note: ...but the lifetime must also be valid for the lifetime `'a` as defined he LL | impl<'a> Publisher<'a> for MyStruct<'a> { | ^^ note: ...so that the types are compatible - --> $DIR/issue-20831-debruijn.rs:28:8 + --> $DIR/issue-20831-debruijn.rs:28:5 | -LL | fn subscribe(&mut self, t : Box::Output> + 'a>) { - | ^^^^^^^^^ +LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { +LL | | // Not obvious, but there is an implicit lifetime here -------^ +LL | | +LL | | // +... | +LL | | self.sub = t; +LL | | } + | |_____^ = note: expected ` as Publisher<'_>>` found ` as Publisher<'_>>` diff --git a/src/test/ui/issues/issue-21033.rs b/src/test/ui/issues/issue-21033.rs index 86cc7707e..91f72eb36 100644 --- a/src/test/ui/issues/issue-21033.rs +++ b/src/test/ui/issues/issue-21033.rs @@ -4,7 +4,6 @@ // pretty-expanded FIXME #23616 #![feature(box_patterns)] -#![feature(box_syntax)] enum E { StructVar { boxed: Box } @@ -13,7 +12,7 @@ enum E { fn main() { // Test matching each shorthand notation for field patterns. - let mut a = E::StructVar { boxed: box 3 }; + let mut a = E::StructVar { boxed: Box::new(3) }; match a { E::StructVar { box boxed } => { } } @@ -38,7 +37,7 @@ fn main() { // Test matching non shorthand notation. Recreate a since last test // moved `boxed` - let mut a = E::StructVar { boxed: box 3 }; + let mut a = E::StructVar { boxed: Box::new(3) }; match a { E::StructVar { boxed: box ref mut num } => { } } diff --git a/src/test/ui/issues/issue-21763.stderr b/src/test/ui/issues/issue-21763.stderr index b8b38c0a7..72c650297 100644 --- a/src/test/ui/issues/issue-21763.stderr +++ b/src/test/ui/issues/issue-21763.stderr @@ -1,12 +1,12 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely - --> $DIR/issue-21763.rs:9:5 + --> $DIR/issue-21763.rs:9:11 | LL | foo::, Rc<()>>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely | = help: within `(Rc<()>, Rc<()>)`, the trait `Send` is not implemented for `Rc<()>` = note: required because it appears within the type `(Rc<()>, Rc<()>)` - = note: required because of the requirements on the impl of `Send` for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` + = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send` = note: required because it appears within the type `hashbrown::map::HashMap, Rc<()>, RandomState>` = note: required because it appears within the type `HashMap, Rc<()>>` note: required by a bound in `foo` diff --git a/src/test/ui/issues/issue-21950.stderr b/src/test/ui/issues/issue-21950.stderr index 4909398bb..731615a6b 100644 --- a/src/test/ui/issues/issue-21950.stderr +++ b/src/test/ui/issues/issue-21950.stderr @@ -1,3 +1,12 @@ +error[E0191]: the value of the associated type `Output` (from trait `Add`) must be specified + --> $DIR/issue-21950.rs:10:25 + | +LL | type Output; + | ----------- `Output` defined here +... +LL | let x = &10 as &dyn Add; + | ^^^ help: specify the associated type: `Add` + error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/issue-21950.rs:10:25 | @@ -9,15 +18,6 @@ LL | let x = &10 as &dyn Add; | = note: because of the default `Self` reference, type parameters must be specified on object types -error[E0191]: the value of the associated type `Output` (from trait `Add`) must be specified - --> $DIR/issue-21950.rs:10:25 - | -LL | type Output; - | ----------- `Output` defined here -... -LL | let x = &10 as &dyn Add; - | ^^^ help: specify the associated type: `Add` - error: aborting due to 2 previous errors Some errors have detailed explanations: E0191, E0393. diff --git a/src/test/ui/issues/issue-22872.stderr b/src/test/ui/issues/issue-22872.stderr index a84cb7d8c..7382d40c0 100644 --- a/src/test/ui/issues/issue-22872.stderr +++ b/src/test/ui/issues/issue-22872.stderr @@ -5,7 +5,7 @@ LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator | = help: the trait `Iterator` is not implemented for `

>::Item` -note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for `Wrapper

` +note: required for `Wrapper

` to implement `for<'b> Wrap<'b>` --> $DIR/issue-22872.rs:7:13 | LL | impl<'b, P> Wrap<'b> for Wrapper

{ | ^^^ error[E0277]: `dyn Future + Send` cannot be unpinned - --> $DIR/expected-boxed-future-isnt-pinned.rs:19:5 + --> $DIR/expected-boxed-future-isnt-pinned.rs:19:14 | LL | Pin::new(x) - | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` + | -------- ^ the trait `Unpin` is not implemented for `dyn Future + Send` + | | + | required by a bound introduced by this call | = note: consider using `Box::pin` note: required by a bound in `Pin::

::new` @@ -59,10 +61,12 @@ LL | impl> Pin

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

::new` error[E0277]: `dyn Future + Send` cannot be unpinned - --> $DIR/expected-boxed-future-isnt-pinned.rs:24:5 + --> $DIR/expected-boxed-future-isnt-pinned.rs:24:14 | LL | Pin::new(Box::new(x)) - | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` + | -------- ^^^^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` + | | + | required by a bound introduced by this call | = note: consider using `Box::pin` note: required by a bound in `Pin::

::new` @@ -87,7 +91,7 @@ LL | pub const fn from_generator(gen: T) -> impl Future | ------------------------------- the found opaque type | = note: expected struct `Pin + Send + 'static)>>` - found opaque type `impl Future` + found opaque type `impl Future` help: you need to pin and box this expression | LL ~ Box::pin(async { diff --git a/src/test/ui/suggestions/field-access-considering-privacy.rs b/src/test/ui/suggestions/field-access-considering-privacy.rs new file mode 100644 index 000000000..3de06b214 --- /dev/null +++ b/src/test/ui/suggestions/field-access-considering-privacy.rs @@ -0,0 +1,35 @@ +use a::TyCtxt; + +mod a { + use std::ops::Deref; + pub struct TyCtxt<'tcx> { + gcx: &'tcx GlobalCtxt<'tcx>, + } + + impl<'tcx> Deref for TyCtxt<'tcx> { + type Target = &'tcx GlobalCtxt<'tcx>; + + fn deref(&self) -> &Self::Target { + &self.gcx + } + } + + pub struct GlobalCtxt<'tcx> { + pub sess: &'tcx Session, + _t: &'tcx (), + } + + pub struct Session { + pub opts: (), + } +} + +mod b { + fn foo<'tcx>(tcx: crate::TyCtxt<'tcx>) { + tcx.opts; + //~^ ERROR no field `opts` on type `TyCtxt<'tcx>` + //~| HELP one of the expressions' fields has a field of the same name + } +} + +fn main() {} diff --git a/src/test/ui/suggestions/field-access-considering-privacy.stderr b/src/test/ui/suggestions/field-access-considering-privacy.stderr new file mode 100644 index 000000000..cbf6f3d10 --- /dev/null +++ b/src/test/ui/suggestions/field-access-considering-privacy.stderr @@ -0,0 +1,14 @@ +error[E0609]: no field `opts` on type `TyCtxt<'tcx>` + --> $DIR/field-access-considering-privacy.rs:29:13 + | +LL | tcx.opts; + | ^^^^ unknown field + | +help: one of the expressions' fields has a field of the same name + | +LL | tcx.sess.opts; + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0609`. diff --git a/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index fb0a6f70b..fe603b675 100644 --- a/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/src/test/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -5,7 +5,7 @@ LL | fn foo() -> impl T { S } | --- consider calling this function ... LL | bar(foo); - | --- ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}` + | --- ^^^ the trait `T` is not implemented for fn item `fn() -> impl T {foo}` | | | required by a bound introduced by this call | @@ -25,7 +25,7 @@ error[E0277]: the trait bound `[closure@$DIR/fn-ctor-passed-as-arg-where-it-shou LL | let closure = || S; | -- consider calling this closure LL | bar(closure); - | --- ^^^^^^^ the trait `T` is not implemented for `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21]` + | --- ^^^^^^^ the trait `T` is not implemented for closure `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21]` | | | required by a bound introduced by this call | diff --git a/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr b/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr index e75ce0da8..3c7b895e3 100644 --- a/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr +++ b/src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr @@ -33,8 +33,8 @@ LL | let _: usize = foo; found fn item `fn(usize, usize) -> usize {foo}` help: use parentheses to call this function | -LL | let _: usize = foo(_, _); - | ++++++ +LL | let _: usize = foo(/* usize */, /* usize */); + | ++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:30:16 @@ -51,8 +51,8 @@ LL | let _: S = S; found fn item `fn(usize, usize) -> S {S}` help: use parentheses to instantiate this tuple struct | -LL | let _: S = S(_, _); - | ++++++ +LL | let _: S = S(/* usize */, /* usize */); + | ++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:31:20 @@ -103,10 +103,10 @@ LL | let _: usize = T::baz; | = note: expected type `usize` found fn item `fn(usize, usize) -> usize {<_ as T>::baz}` -help: use parentheses to call this function +help: use parentheses to call this associated function | -LL | let _: usize = T::baz(_, _); - | ++++++ +LL | let _: usize = T::baz(/* usize */, /* usize */); + | ++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:34:20 @@ -121,10 +121,10 @@ LL | let _: usize = T::bat; | = note: expected type `usize` found fn item `fn(usize) -> usize {<_ as T>::bat}` -help: use parentheses to call this function +help: use parentheses to call this associated function | -LL | let _: usize = T::bat(_); - | +++ +LL | let _: usize = T::bat(/* usize */); + | +++++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:35:16 @@ -141,8 +141,8 @@ LL | let _: E = E::A; found fn item `fn(usize) -> E {E::A}` help: use parentheses to instantiate this tuple variant | -LL | let _: E = E::A(_); - | +++ +LL | let _: E = E::A(/* usize */); + | +++++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:37:20 @@ -157,10 +157,10 @@ LL | let _: usize = X::baz; | = note: expected type `usize` found fn item `fn(usize, usize) -> usize {::baz}` -help: use parentheses to call this function +help: use parentheses to call this associated function | -LL | let _: usize = X::baz(_, _); - | ++++++ +LL | let _: usize = X::baz(/* usize */, /* usize */); + | ++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:38:20 @@ -175,10 +175,10 @@ LL | let _: usize = X::bat; | = note: expected type `usize` found fn item `fn(usize) -> usize {::bat}` -help: use parentheses to call this function +help: use parentheses to call this associated function | -LL | let _: usize = X::bat(_); - | +++ +LL | let _: usize = X::bat(/* usize */); + | +++++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:39:20 @@ -193,10 +193,10 @@ LL | let _: usize = X::bax; | = note: expected type `usize` found fn item `fn(usize) -> usize {::bax}` -help: use parentheses to call this function +help: use parentheses to call this associated function | -LL | let _: usize = X::bax(_); - | +++ +LL | let _: usize = X::bax(/* usize */); + | +++++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:40:20 @@ -211,10 +211,10 @@ LL | let _: usize = X::bach; | = note: expected type `usize` found fn item `fn(usize) -> usize {::bach}` -help: use parentheses to call this function +help: use parentheses to call this associated function | -LL | let _: usize = X::bach(_); - | +++ +LL | let _: usize = X::bach(/* usize */); + | +++++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:41:20 @@ -229,10 +229,10 @@ LL | let _: usize = X::ban; | = note: expected type `usize` found fn item `for<'r> fn(&'r X) -> usize {::ban}` -help: use parentheses to call this function +help: use parentheses to call this associated function | -LL | let _: usize = X::ban(_); - | +++ +LL | let _: usize = X::ban(/* &X */); + | ++++++++++ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:42:20 @@ -247,10 +247,10 @@ LL | let _: usize = X::bal; | = note: expected type `usize` found fn item `for<'r> fn(&'r X) -> usize {::bal}` -help: use parentheses to call this function +help: use parentheses to call this associated function | -LL | let _: usize = X::bal(_); - | +++ +LL | let _: usize = X::bal(/* &X */); + | ++++++++++ error[E0615]: attempted to take value of method `ban` on type `X` --> $DIR/fn-or-tuple-struct-without-args.rs:43:22 diff --git a/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr index ba6af8f15..864ab0535 100644 --- a/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr +++ b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `for<'b> &'b S: Trait` is not satisfied - --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:17:5 + --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:17:14 | LL | foo::(s); - | ^^^^^^^^ the trait `for<'b> Trait` is not implemented for `&'b S` + | -------- ^ the trait `for<'b> Trait` is not implemented for `&'b S` + | | + | required by a bound introduced by this call | = help: the trait `Trait` is implemented for `&'a mut S` = note: `for<'b> Trait` is implemented for `&'b mut S`, but not for `&'b S` diff --git a/src/test/ui/suggestions/imm-ref-trait-object-literal.stderr b/src/test/ui/suggestions/imm-ref-trait-object-literal.stderr index 5f3f62a7b..e01102e38 100644 --- a/src/test/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/src/test/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -21,7 +21,7 @@ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:13:7 | LL | foo(s); - | --- ^ expected an implementor of trait `Trait` + | --- ^ the trait `Trait` is not implemented for `S` | | | required by a bound introduced by this call | diff --git a/src/test/ui/suggestions/into-str.stderr b/src/test/ui/suggestions/into-str.stderr index 8ae5c8479..a56a2a188 100644 --- a/src/test/ui/suggestions/into-str.stderr +++ b/src/test/ui/suggestions/into-str.stderr @@ -14,7 +14,7 @@ LL | foo(String::new()); >> >> > - = note: required because of the requirements on the impl of `Into<&str>` for `String` + = note: required for `String` to implement `Into<&str>` note: required by a bound in `foo` --> $DIR/into-str.rs:1:31 | diff --git a/src/test/ui/suggestions/issue-101421.rs b/src/test/ui/suggestions/issue-101421.rs new file mode 100644 index 000000000..b615997d1 --- /dev/null +++ b/src/test/ui/suggestions/issue-101421.rs @@ -0,0 +1,12 @@ +pub trait Ice { + fn f(&self, _: ()); +} + +impl Ice for () { + fn f(&self, _: ()) {} +} + +fn main() { + ().f::<()>(()); + //~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied +} diff --git a/src/test/ui/suggestions/issue-101421.stderr b/src/test/ui/suggestions/issue-101421.stderr new file mode 100644 index 000000000..f8e1efb88 --- /dev/null +++ b/src/test/ui/suggestions/issue-101421.stderr @@ -0,0 +1,17 @@ +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-101421.rs:10:8 + | +LL | ().f::<()>(()); + | ^------ help: remove these generics + | | + | expected 0 generic arguments + | +note: associated function defined here, with 0 generic parameters + --> $DIR/issue-101421.rs:2:8 + | +LL | fn f(&self, _: ()); + | ^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/suggestions/issue-101465.rs b/src/test/ui/suggestions/issue-101465.rs new file mode 100644 index 000000000..8e42e2c22 --- /dev/null +++ b/src/test/ui/suggestions/issue-101465.rs @@ -0,0 +1,25 @@ +#![feature(trait_alias)] + +struct B; +struct C; + +trait Tr {} + +impl Tr for B {} +impl Tr for C {} + +trait Tr2 = Into; + +fn foo2>() {} + +fn foo() -> impl Tr { + let x = foo2::<_>(); + + match true { + true => B, + false => C, + //~^ `match` arms have incompatible types + } +} + +fn main() {} diff --git a/src/test/ui/suggestions/issue-101465.stderr b/src/test/ui/suggestions/issue-101465.stderr new file mode 100644 index 000000000..e2ca77712 --- /dev/null +++ b/src/test/ui/suggestions/issue-101465.stderr @@ -0,0 +1,25 @@ +error[E0308]: `match` arms have incompatible types + --> $DIR/issue-101465.rs:20:18 + | +LL | / match true { +LL | | true => B, + | | - this is found to be of type `B` +LL | | false => C, + | | ^ expected struct `B`, found struct `C` +LL | | +LL | | } + | |_____- `match` arms have incompatible types + | +help: you could change the return type to be a boxed trait object + | +LL | fn foo() -> Box { + | ~~~~~~~ + +help: if you change the return type to expect trait objects, box the returned expressions + | +LL ~ true => Box::new(B), +LL ~ false => Box::new(C), + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/issue-101984.rs b/src/test/ui/suggestions/issue-101984.rs new file mode 100644 index 000000000..5f7ecb77e --- /dev/null +++ b/src/test/ui/suggestions/issue-101984.rs @@ -0,0 +1,27 @@ +use std::marker::PhantomData; + +type Component = fn(&()); + +struct Wrapper { + router: Router<(Component, Box)>, +} + +struct Match(PhantomData); + +struct Router(PhantomData); + +impl Router { + pub fn at(&self) -> Result, ()> { + todo!() + } +} + +impl Wrapper { + fn at(&self, path: &str) -> Result<(Component, Box), ()> { + let (cmp, router) = self.router.at()?; + //~^ ERROR mismatched types + todo!() + } +} + +fn main() {} diff --git a/src/test/ui/suggestions/issue-101984.stderr b/src/test/ui/suggestions/issue-101984.stderr new file mode 100644 index 000000000..c744c62d1 --- /dev/null +++ b/src/test/ui/suggestions/issue-101984.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-101984.rs:21:13 + | +LL | let (cmp, router) = self.router.at()?; + | ^^^^^^^^^^^^^ ----------------- this expression has type `Match<&(for<'r> fn(&'r ()), Box)>` + | | + | expected struct `Match`, found tuple + | + = note: expected struct `Match<&(for<'r> fn(&'r ()), Box)>` + found tuple `(_, _)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/issue-61963.stderr b/src/test/ui/suggestions/issue-61963.stderr index c0d776e59..a788cab6e 100644 --- a/src/test/ui/suggestions/issue-61963.stderr +++ b/src/test/ui/suggestions/issue-61963.stderr @@ -13,9 +13,8 @@ LL | #![deny(bare_trait_objects)] = note: for more information, see help: use `dyn` | -LL - bar: Box, -LL + bar: Box, - | +LL | bar: Box, + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -27,9 +26,8 @@ LL | pub struct Foo { = note: for more information, see help: use `dyn` | -LL - pub struct Foo { -LL + dyn pub struct Foo { - | +LL | dyn pub struct Foo { + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:28:14 @@ -41,9 +39,8 @@ LL | bar: Box, = note: for more information, see help: use `dyn` | -LL - bar: Box, -LL + bar: Box, - | +LL | bar: Box, + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:28:14 @@ -55,9 +52,8 @@ LL | bar: Box, = note: for more information, see help: use `dyn` | -LL - bar: Box, -LL + bar: Box, - | +LL | bar: Box, + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -69,9 +65,8 @@ LL | pub struct Foo { = note: for more information, see help: use `dyn` | -LL - pub struct Foo { -LL + dyn pub struct Foo { - | +LL | dyn pub struct Foo { + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -83,9 +78,8 @@ LL | pub struct Foo { = note: for more information, see help: use `dyn` | -LL - pub struct Foo { -LL + dyn pub struct Foo { - | +LL | dyn pub struct Foo { + | +++ error: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-61963.rs:18:1 @@ -97,9 +91,8 @@ LL | pub struct Foo { = note: for more information, see help: use `dyn` | -LL - pub struct Foo { -LL + dyn pub struct Foo { - | +LL | dyn pub struct Foo { + | +++ error: aborting due to 7 previous errors diff --git a/src/test/ui/suggestions/issue-62843.stderr b/src/test/ui/suggestions/issue-62843.stderr index bc1c69406..62f0943d4 100644 --- a/src/test/ui/suggestions/issue-62843.stderr +++ b/src/test/ui/suggestions/issue-62843.stderr @@ -2,12 +2,12 @@ error[E0277]: expected a `FnMut<(char,)>` closure, found `String` --> $DIR/issue-62843.rs:4:32 | LL | println!("{:?}", line.find(pattern)); - | ---- ^^^^^^^ expected an implementor of trait `Pattern<'_>` + | ---- ^^^^^^^ 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 because of the requirements on the impl of `Pattern<'_>` for `String` + = note: required for `String` to implement `Pattern<'_>` note: required by a bound in `core::str::::find` --> $SRC_DIR/core/src/str/mod.rs:LL:COL | diff --git a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr index 383f40d47..684db23e1 100644 --- a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr +++ b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr @@ -1,13 +1,15 @@ error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied - --> $DIR/issue-71394-no-from-impl.rs:3:25 + --> $DIR/issue-71394-no-from-impl.rs:3:20 | LL | let _: &[i8] = data.into(); - | ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]` + | ^^^^ ---- required by a bound introduced by this call + | | + | the trait `From<&[u8]>` is not implemented for `&[i8]` | = help: the following other types implement trait `From`: <[T; LANES] as From>> <[bool; LANES] as From>> - = note: required because of the requirements on the impl of `Into<&[i8]>` for `&[u8]` + = note: required for `&[u8]` to implement `Into<&[i8]>` error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-84973-2.stderr b/src/test/ui/suggestions/issue-84973-2.stderr index 2c54ea672..513bf28fb 100644 --- a/src/test/ui/suggestions/issue-84973-2.stderr +++ b/src/test/ui/suggestions/issue-84973-2.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `i32: Tr` is not satisfied --> $DIR/issue-84973-2.rs:11:9 | LL | foo(a); - | --- ^ expected an implementor of trait `Tr` + | --- ^ the trait `Tr` is not implemented for `i32` | | | required by a bound introduced by this call | diff --git a/src/test/ui/suggestions/issue-84973-blacklist.stderr b/src/test/ui/suggestions/issue-84973-blacklist.stderr index ae0d3efca..c20cc8164 100644 --- a/src/test/ui/suggestions/issue-84973-blacklist.stderr +++ b/src/test/ui/suggestions/issue-84973-blacklist.stderr @@ -31,10 +31,12 @@ LL | #[derive(Clone)] | error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` cannot be unpinned - --> $DIR/issue-84973-blacklist.rs:17:5 + --> $DIR/issue-84973-blacklist.rs:17:13 | LL | f_unpin(static || { yield; }); - | ^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` + | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` + | | + | required by a bound introduced by this call | = note: consider using `Box::pin` note: required by a bound in `f_unpin` diff --git a/src/test/ui/suggestions/issue-84973-negative.stderr b/src/test/ui/suggestions/issue-84973-negative.stderr index 15559d4ae..ce838bce0 100644 --- a/src/test/ui/suggestions/issue-84973-negative.stderr +++ b/src/test/ui/suggestions/issue-84973-negative.stderr @@ -17,7 +17,7 @@ error[E0277]: the trait bound `f32: Tr` is not satisfied --> $DIR/issue-84973-negative.rs:11:9 | LL | bar(b); - | --- ^ expected an implementor of trait `Tr` + | --- ^ the trait `Tr` is not implemented for `f32` | | | required by a bound introduced by this call | diff --git a/src/test/ui/suggestions/issue-84973.stderr b/src/test/ui/suggestions/issue-84973.stderr index 24c989ec3..ae2bf5aac 100644 --- a/src/test/ui/suggestions/issue-84973.stderr +++ b/src/test/ui/suggestions/issue-84973.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Fancy: SomeTrait` is not satisfied --> $DIR/issue-84973.rs:6:24 | LL | let o = Other::new(f); - | ---------- ^ expected an implementor of trait `SomeTrait` + | ---------- ^ the trait `SomeTrait` is not implemented for `Fancy` | | | required by a bound introduced by this call | diff --git a/src/test/ui/suggestions/issue-85347.rs b/src/test/ui/suggestions/issue-85347.rs index f08e38689..02b5fb618 100644 --- a/src/test/ui/suggestions/issue-85347.rs +++ b/src/test/ui/suggestions/issue-85347.rs @@ -1,9 +1,8 @@ -#![allow(incomplete_features)] -#![feature(generic_associated_types)] 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 bindings are not allowed here //~| HELP add missing } diff --git a/src/test/ui/suggestions/issue-85347.stderr b/src/test/ui/suggestions/issue-85347.stderr index fccd2ef8d..17c1b7dc4 100644 --- a/src/test/ui/suggestions/issue-85347.stderr +++ b/src/test/ui/suggestions/issue-85347.stderr @@ -1,11 +1,11 @@ error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/issue-85347.rs:5:42 + --> $DIR/issue-85347.rs:3:42 | LL | type Bar<'a>: Deref::Bar>; | ^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-85347.rs:5:10 + --> $DIR/issue-85347.rs:3:10 | LL | type Bar<'a>: Deref::Bar>; | ^^^ -- @@ -14,6 +14,13 @@ help: add missing lifetime argument LL | type Bar<'a>: Deref::Bar<'a, Target = Self>>; | +++ -error: aborting due to previous error +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-85347.rs:3:46 + | +LL | type Bar<'a>: Deref::Bar>; + | ^^^^^^^^^^^^^ associated type not allowed here + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0107`. +Some errors have detailed explanations: E0107, E0229. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/suggestions/issue-89064.rs b/src/test/ui/suggestions/issue-89064.rs new file mode 100644 index 000000000..fa5fc899d --- /dev/null +++ b/src/test/ui/suggestions/issue-89064.rs @@ -0,0 +1,35 @@ +use std::convert::TryInto; + +trait A { + fn foo() {} +} + +trait B { + fn bar() {} +} + +struct S; + +impl A for S {} +impl B for S {} + +fn main() { + let _ = A::foo::(); + //~^ ERROR + //~| HELP remove these generics + //~| HELP consider moving this generic argument + + let _ = B::bar::(); + //~^ ERROR + //~| HELP remove these generics + //~| HELP consider moving these generic arguments + + let _ = A::::foo::(); + //~^ ERROR + //~| HELP remove these generics + + let _ = 42.into::>(); + //~^ ERROR + //~| HELP remove these generics + //~| HELP consider moving this generic argument +} diff --git a/src/test/ui/suggestions/issue-89064.stderr b/src/test/ui/suggestions/issue-89064.stderr new file mode 100644 index 000000000..8b2a38816 --- /dev/null +++ b/src/test/ui/suggestions/issue-89064.stderr @@ -0,0 +1,82 @@ +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-89064.rs:17:16 + | +LL | let _ = A::foo::(); + | ^^^ expected 0 generic arguments + | +note: associated function defined here, with 0 generic parameters + --> $DIR/issue-89064.rs:4:8 + | +LL | fn foo() {} + | ^^^ +help: consider moving this generic argument to the `A` trait, which takes up to 1 argument + | +LL - let _ = A::foo::(); +LL + let _ = A::::foo(); + | +help: remove these generics + | +LL - let _ = A::foo::(); +LL + let _ = A::foo(); + | + +error[E0107]: this associated function takes 0 generic arguments but 2 generic arguments were supplied + --> $DIR/issue-89064.rs:22:16 + | +LL | let _ = B::bar::(); + | ^^^ expected 0 generic arguments + | +note: associated function defined here, with 0 generic parameters + --> $DIR/issue-89064.rs:8:8 + | +LL | fn bar() {} + | ^^^ +help: consider moving these generic arguments to the `B` trait, which takes up to 2 arguments + | +LL - let _ = B::bar::(); +LL + let _ = B::::bar(); + | +help: remove these generics + | +LL - let _ = B::bar::(); +LL + let _ = B::bar(); + | + +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-89064.rs:27:21 + | +LL | let _ = A::::foo::(); + | ^^^----- help: remove these generics + | | + | expected 0 generic arguments + | +note: associated function defined here, with 0 generic parameters + --> $DIR/issue-89064.rs:4:8 + | +LL | fn foo() {} + | ^^^ + +error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-89064.rs:31:16 + | +LL | let _ = 42.into::>(); + | ^^^^ expected 0 generic arguments + | +note: associated function defined here, with 0 generic parameters + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL + | +LL | fn into(self) -> T; + | ^^^^ +help: consider moving this generic argument to the `Into` trait, which takes up to 1 argument + | +LL | let _ = Into::>::into(42); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +help: remove these generics + | +LL - let _ = 42.into::>(); +LL + let _ = 42.into(); + | + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/suggestions/issue-96223.stderr b/src/test/ui/suggestions/issue-96223.stderr index 513725d99..72a9a739a 100644 --- a/src/test/ui/suggestions/issue-96223.stderr +++ b/src/test/ui/suggestions/issue-96223.stderr @@ -7,12 +7,12 @@ LL | icey_bounds(&p); | required by a bound introduced by this call | = help: the trait `Foo<'de>` is implemented for `Baz` -note: required because of the requirements on the impl of `for<'de> Foo<'de>` for `Baz>` +note: required for `Baz>` to implement `for<'de> Foo<'de>` --> $DIR/issue-96223.rs:16:14 | LL | impl<'de, T> Foo<'de> for Baz where T: Foo<'de> {} | ^^^^^^^^ ^^^^^^ -note: required because of the requirements on the impl of `Dummy` for `Empty` +note: required for `Empty` to implement `Dummy` --> $DIR/issue-96223.rs:20:9 | LL | impl Dummy for Empty diff --git a/src/test/ui/suggestions/issue-96555.stderr b/src/test/ui/suggestions/issue-96555.stderr index a1a603cf2..9a8a183dc 100644 --- a/src/test/ui/suggestions/issue-96555.stderr +++ b/src/test/ui/suggestions/issue-96555.stderr @@ -8,7 +8,7 @@ LL | m::f1().await; | = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` + = note: required for `()` to implement `IntoFuture` help: remove the `.await` | LL - m::f1().await; @@ -29,7 +29,7 @@ LL | m::f2().await; | = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` + = note: required for `()` to implement `IntoFuture` help: remove the `.await` | LL - m::f2().await; @@ -50,7 +50,7 @@ LL | m::f3().await; | = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` + = note: required for `()` to implement `IntoFuture` help: remove the `.await` | LL - m::f3().await; diff --git a/src/test/ui/suggestions/issue-97677.fixed b/src/test/ui/suggestions/issue-97677.fixed index 73ca9f97b..1e7569fa4 100644 --- a/src/test/ui/suggestions/issue-97677.fixed +++ b/src/test/ui/suggestions/issue-97677.fixed @@ -1,6 +1,6 @@ // run-rustfix -fn add_ten>(n: N) -> N { +fn add_ten>(n: N) -> N { n + 10 //~^ ERROR cannot add `{integer}` to `N` } diff --git a/src/test/ui/suggestions/issue-97677.stderr b/src/test/ui/suggestions/issue-97677.stderr index 069b184ac..575d79267 100644 --- a/src/test/ui/suggestions/issue-97677.stderr +++ b/src/test/ui/suggestions/issue-97677.stderr @@ -8,8 +8,8 @@ LL | n + 10 | help: consider restricting type parameter `N` | -LL | fn add_ten>(n: N) -> N { - | ++++++++++++++++++++++++++++++ +LL | fn add_ten>(n: N) -> N { + | ++++++++++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr index 0212c2d71..e5d2ead6a 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr @@ -22,8 +22,8 @@ LL | | }); | |______^ help: consider adding an explicit lifetime bound... | -LL | fn func(foo: &Foo, t: T) { - | ++++ +LL | fn func<'a, T: Test + 'a>(foo: &Foo, t: T) { + | +++ ++++ error: aborting due to previous error diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index 0d749f04b..ed1b91676 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -47,8 +47,10 @@ LL | | } | |_____^ help: consider adding an explicit lifetime bound... | -LL | G: Get + 'a, - | ++++ +LL ~ fn bar<'a, G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ +LL | where +LL ~ G: Get + 'a, + | error[E0311]: the parameter type `G` may not live long enough --> $DIR/missing-lifetimes-in-signature.rs:52:5 @@ -74,8 +76,8 @@ LL | | } | |_____^ help: consider adding an explicit lifetime bound... | -LL | fn qux<'a, G: 'a + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ++++ +LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + | +++ ++++ error[E0311]: the parameter type `G` may not live long enough --> $DIR/missing-lifetimes-in-signature.rs:61:9 @@ -101,8 +103,8 @@ LL | | } | |_________^ help: consider adding an explicit lifetime bound... | -LL | fn qux<'b, G: Get + 'b + 'c, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { - | ++++ +LL | fn qux<'c, 'b, G: Get + 'b + 'c, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { + | +++ ++++ error[E0311]: the parameter type `G` may not live long enough --> $DIR/missing-lifetimes-in-signature.rs:73:5 @@ -130,8 +132,8 @@ LL | | } | |_____^ help: consider adding an explicit lifetime bound... | -LL | fn bat<'a, G: 'a + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a - | ++++ +LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a + | +++ ++++ error[E0621]: explicit lifetime required in the type of `dest` --> $DIR/missing-lifetimes-in-signature.rs:73:5 diff --git a/src/test/ui/suggestions/many-type-ascription.rs b/src/test/ui/suggestions/many-type-ascription.rs new file mode 100644 index 000000000..31ac556b9 --- /dev/null +++ b/src/test/ui/suggestions/many-type-ascription.rs @@ -0,0 +1,4 @@ +fn main() { + let _ = 0: i32; //~ ERROR: type ascription is experimental + let _ = 0: i32; // (error only emitted once) +} diff --git a/src/test/ui/suggestions/many-type-ascription.stderr b/src/test/ui/suggestions/many-type-ascription.stderr new file mode 100644 index 000000000..3706bbae9 --- /dev/null +++ b/src/test/ui/suggestions/many-type-ascription.stderr @@ -0,0 +1,12 @@ +error[E0658]: type ascription is experimental + --> $DIR/many-type-ascription.rs:2:13 + | +LL | let _ = 0: i32; + | ^^^^^^ + | + = note: see issue #23416 for more information + = help: add `#![feature(type_ascription)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/suggestions/move-generic-to-trait-in-method-with-params.rs b/src/test/ui/suggestions/move-generic-to-trait-in-method-with-params.rs new file mode 100644 index 000000000..2f540060a --- /dev/null +++ b/src/test/ui/suggestions/move-generic-to-trait-in-method-with-params.rs @@ -0,0 +1,18 @@ +// Generalizes the suggestion introduced in #100838 + +trait Foo { + fn bar(&self, _: T); +} + +impl Foo for i32 { + fn bar(&self, x: i32) { + println!("{}", self + x); + } +} + +fn main() { + 1.bar::(0); + //~^ ERROR this associated function 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/src/test/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr b/src/test/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr new file mode 100644 index 000000000..9557220f6 --- /dev/null +++ b/src/test/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr @@ -0,0 +1,24 @@ +error[E0107]: this associated function 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 + --> $DIR/move-generic-to-trait-in-method-with-params.rs:4:8 + | +LL | fn bar(&self, _: T); + | ^^^ +help: consider moving this generic argument to the `Foo` trait, which takes up to 1 argument + | +LL | Foo::::bar(1, 0); + | ~~~~~~~~~~~~~~~~~~~~~ +help: remove these generics + | +LL - 1.bar::(0); +LL + 1.bar(0); + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/suggestions/option-content-move.fixed b/src/test/ui/suggestions/option-content-move.fixed deleted file mode 100644 index ba16bcc8a..000000000 --- a/src/test/ui/suggestions/option-content-move.fixed +++ /dev/null @@ -1,39 +0,0 @@ -//run-rustfix - -pub struct LipogramCorpora { - selections: Vec<(char, Option)>, -} - -impl LipogramCorpora { - pub fn validate_all(&mut self) -> Result<(), char> { - for selection in &self.selections { - if selection.1.is_some() { - if selection.1.as_ref().unwrap().contains(selection.0) { - //~^ ERROR cannot move out of `selection.1` - return Err(selection.0); - } - } - } - Ok(()) - } -} - -pub struct LipogramCorpora2 { - selections: Vec<(char, Result)>, -} - -impl LipogramCorpora2 { - pub fn validate_all(&mut self) -> Result<(), char> { - for selection in &self.selections { - if selection.1.is_ok() { - if selection.1.as_ref().unwrap().contains(selection.0) { - //~^ ERROR cannot move out of `selection.1` - return Err(selection.0); - } - } - } - Ok(()) - } -} - -fn main() {} diff --git a/src/test/ui/suggestions/option-content-move.rs b/src/test/ui/suggestions/option-content-move.rs index ef38f114e..46c895b95 100644 --- a/src/test/ui/suggestions/option-content-move.rs +++ b/src/test/ui/suggestions/option-content-move.rs @@ -1,5 +1,3 @@ -//run-rustfix - pub struct LipogramCorpora { selections: Vec<(char, Option)>, } diff --git a/src/test/ui/suggestions/option-content-move.stderr b/src/test/ui/suggestions/option-content-move.stderr index fccfbe1d7..a6f1ebc97 100644 --- a/src/test/ui/suggestions/option-content-move.stderr +++ b/src/test/ui/suggestions/option-content-move.stderr @@ -1,9 +1,10 @@ error[E0507]: cannot move out of `selection.1` which is behind a shared reference - --> $DIR/option-content-move.rs:11:20 + --> $DIR/option-content-move.rs:9:20 | LL | if selection.1.unwrap().contains(selection.0) { | ^^^^^^^^^^^ -------- `selection.1` moved due to this method call | | + | help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents | move occurs because `selection.1` has type `Option`, which does not implement the `Copy` trait | note: this function takes ownership of the receiver `self`, which moves `selection.1` @@ -11,17 +12,14 @@ note: this function takes ownership of the receiver `self`, which moves `selecti | LL | pub const fn unwrap(self) -> T { | ^^^^ -help: consider calling `.as_ref()` to borrow the type's contents - | -LL | if selection.1.as_ref().unwrap().contains(selection.0) { - | +++++++++ error[E0507]: cannot move out of `selection.1` which is behind a shared reference - --> $DIR/option-content-move.rs:29:20 + --> $DIR/option-content-move.rs:27:20 | LL | if selection.1.unwrap().contains(selection.0) { | ^^^^^^^^^^^ -------- `selection.1` moved due to this method call | | + | help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents | move occurs because `selection.1` has type `Result`, which does not implement the `Copy` trait | note: this function takes ownership of the receiver `self`, which moves `selection.1` @@ -29,10 +27,6 @@ note: this function takes ownership of the receiver `self`, which moves `selecti | LL | pub fn unwrap(self) -> T | ^^^^ -help: consider calling `.as_ref()` to borrow the type's contents - | -LL | if selection.1.as_ref().unwrap().contains(selection.0) { - | +++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/restrict-type-not-param.rs b/src/test/ui/suggestions/restrict-type-not-param.rs new file mode 100644 index 000000000..60f5ba45c --- /dev/null +++ b/src/test/ui/suggestions/restrict-type-not-param.rs @@ -0,0 +1,12 @@ +use std::ops::Add; + +struct Wrapper(T); + +trait Foo {} + +fn qux(a: Wrapper, b: T) -> T { + a + b + //~^ ERROR cannot add `T` to `Wrapper` +} + +fn main() {} diff --git a/src/test/ui/suggestions/restrict-type-not-param.stderr b/src/test/ui/suggestions/restrict-type-not-param.stderr new file mode 100644 index 000000000..e7d9c5ecb --- /dev/null +++ b/src/test/ui/suggestions/restrict-type-not-param.stderr @@ -0,0 +1,26 @@ +error[E0369]: cannot add `T` to `Wrapper` + --> $DIR/restrict-type-not-param.rs:8:7 + | +LL | a + b + | - ^ - T + | | + | Wrapper + | +note: an implementation of `Add<_>` might be missing for `Wrapper` + --> $DIR/restrict-type-not-param.rs:3:1 + | +LL | struct Wrapper(T); + | ^^^^^^^^^^^^^^^^^ must implement `Add<_>` +note: the following trait must be implemented + --> $SRC_DIR/core/src/ops/arith.rs:LL:COL + | +LL | pub trait Add { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn qux(a: Wrapper, b: T) -> T where Wrapper: Add { + | ++++++++++++++++++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/suggestions/return-closures.rs b/src/test/ui/suggestions/return-closures.rs new file mode 100644 index 000000000..86c7c1537 --- /dev/null +++ b/src/test/ui/suggestions/return-closures.rs @@ -0,0 +1,13 @@ +fn foo() { + //~^ HELP try adding a return type + |x: &i32| 1i32 + //~^ ERROR mismatched types +} + +fn bar(i: impl Sized) { + //~^ HELP a return type might be missing here + || i + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/src/test/ui/suggestions/return-closures.stderr b/src/test/ui/suggestions/return-closures.stderr new file mode 100644 index 000000000..e273793ea --- /dev/null +++ b/src/test/ui/suggestions/return-closures.stderr @@ -0,0 +1,27 @@ +error[E0308]: mismatched types + --> $DIR/return-closures.rs:3:5 + | +LL | fn foo() { + | - help: try adding a return type: `-> impl for<'r> Fn(&'r i32) -> i32` +LL | +LL | |x: &i32| 1i32 + | ^^^^^^^^^^^^^^ expected `()`, found closure + | + = note: expected unit type `()` + found closure `[closure@$DIR/return-closures.rs:3:5: 3:14]` + +error[E0308]: mismatched types + --> $DIR/return-closures.rs:9:5 + | +LL | fn bar(i: impl Sized) { + | - help: a return type might be missing here: `-> _` +LL | +LL | || i + | ^^^^ expected `()`, found closure + | + = note: expected unit type `()` + found closure `[closure@$DIR/return-closures.rs:9:5: 9:7]` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/return-cycle-2.rs b/src/test/ui/suggestions/return-cycle-2.rs new file mode 100644 index 000000000..d6d24be1b --- /dev/null +++ b/src/test/ui/suggestions/return-cycle-2.rs @@ -0,0 +1,14 @@ +use std::marker::PhantomData; + +struct Token(PhantomData); + +impl Token { + fn as_ref(_: i32, _: i32) -> _ { + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + //~| NOTE not allowed in type signatures + //~| HELP replace with the correct return type + Token(PhantomData::<&T>) + } +} + +fn main() {} diff --git a/src/test/ui/suggestions/return-cycle-2.stderr b/src/test/ui/suggestions/return-cycle-2.stderr new file mode 100644 index 000000000..3a1a0f7f4 --- /dev/null +++ b/src/test/ui/suggestions/return-cycle-2.stderr @@ -0,0 +1,12 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/return-cycle-2.rs:6:34 + | +LL | fn as_ref(_: i32, _: i32) -> _ { + | ^ + | | + | not allowed in type signatures + | help: replace with the correct return type: `Token<&'static T>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/src/test/ui/suggestions/return-cycle.rs b/src/test/ui/suggestions/return-cycle.rs new file mode 100644 index 000000000..60b80e35a --- /dev/null +++ b/src/test/ui/suggestions/return-cycle.rs @@ -0,0 +1,14 @@ +use std::marker::PhantomData; + +struct Token(PhantomData); + +impl Token { + fn new() -> _ { + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + //~| NOTE not allowed in type signatures + //~| HELP replace with the correct return type + Token(PhantomData::<()>) + } +} + +fn main() {} diff --git a/src/test/ui/suggestions/return-cycle.stderr b/src/test/ui/suggestions/return-cycle.stderr new file mode 100644 index 000000000..63fa9e040 --- /dev/null +++ b/src/test/ui/suggestions/return-cycle.stderr @@ -0,0 +1,12 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/return-cycle.rs:6:17 + | +LL | fn new() -> _ { + | ^ + | | + | not allowed in type signatures + | help: replace with the correct return type: `Token<()>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/src/test/ui/suggestions/slice-issue-87994.stderr b/src/test/ui/suggestions/slice-issue-87994.stderr index fd2a44f9a..84ecd749b 100644 --- a/src/test/ui/suggestions/slice-issue-87994.stderr +++ b/src/test/ui/suggestions/slice-issue-87994.stderr @@ -2,10 +2,10 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation --> $DIR/slice-issue-87994.rs:3:12 | LL | for _ in v[1..] { - | ^^^^^^ expected an implementor of trait `IntoIterator` + | ^^^^^^ the trait `IntoIterator` is not implemented for `[i32]` | = note: the trait bound `[i32]: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `[i32]` + = note: required for `[i32]` to implement `IntoIterator` help: consider borrowing here | LL | for _ in &v[1..] { @@ -17,10 +17,10 @@ error[E0277]: `[i32]` is not an iterator --> $DIR/slice-issue-87994.rs:3:12 | LL | for _ in v[1..] { - | ^^^^^^ expected an implementor of trait `IntoIterator` + | ^^^^^^ the trait `IntoIterator` is not implemented for `[i32]` | = note: the trait bound `[i32]: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `[i32]` + = note: required for `[i32]` to implement `IntoIterator` help: consider borrowing here | LL | for _ in &v[1..] { @@ -32,10 +32,10 @@ error[E0277]: the size for values of type `[K]` cannot be known at compilation t --> $DIR/slice-issue-87994.rs:11:13 | LL | for i2 in v2[1..] { - | ^^^^^^^ expected an implementor of trait `IntoIterator` + | ^^^^^^^ the trait `IntoIterator` is not implemented for `[K]` | = note: the trait bound `[K]: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `[K]` + = note: required for `[K]` to implement `IntoIterator` help: consider borrowing here | LL | for i2 in &v2[1..] { @@ -47,10 +47,10 @@ error[E0277]: `[K]` is not an iterator --> $DIR/slice-issue-87994.rs:11:13 | LL | for i2 in v2[1..] { - | ^^^^^^^ expected an implementor of trait `IntoIterator` + | ^^^^^^^ the trait `IntoIterator` is not implemented for `[K]` | = note: the trait bound `[K]: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `[K]` + = note: required for `[K]` to implement `IntoIterator` help: consider borrowing here | LL | for i2 in &v2[1..] { diff --git a/src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.rs b/src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.rs new file mode 100644 index 000000000..21ab6830b --- /dev/null +++ b/src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.rs @@ -0,0 +1,10 @@ +// When build the suggesttion take in consideration the `:?` +// https://github.com/rust-lang/rust/issues/100648 +#![deny(warnings)] + +fn main () { + println!("hello {:?}", world = "world"); + //~^ ERROR named argument `world` is not used by name + //~| HELP use the named argument by name to avoid ambiguity + //~| SUGGESTION world +} diff --git a/src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.stderr b/src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.stderr new file mode 100644 index 000000000..850f69f2d --- /dev/null +++ b/src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.stderr @@ -0,0 +1,21 @@ +error: named argument `world` is not used by name + --> $DIR/sugg_with_positional_args_and_debug_fmt.rs:6:28 + | +LL | println!("hello {:?}", world = "world"); + | ---- ^^^^^ this named argument is referred to by position in formatting string + | | + | this formatting argument uses named argument `world` by position + | +note: the lint level is defined here + --> $DIR/sugg_with_positional_args_and_debug_fmt.rs:3:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(named_arguments_used_positionally)]` implied by `#[deny(warnings)]` +help: use the named argument by name to avoid ambiguity + | +LL | println!("hello {world:?}", world = "world"); + | +++++ + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.fixed b/src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.fixed new file mode 100644 index 000000000..e9b8a9caa --- /dev/null +++ b/src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.fixed @@ -0,0 +1,15 @@ +// run-rustfix +#![allow(unused_variables)] + +fn foo(foo: &mut usize) { + todo!() +} + +fn bar(bar: &usize) { + todo!() +} + +fn main() { + foo(&mut Default::default()); //~ the trait bound `&mut usize: Default` is not satisfied + bar(&Default::default()); //~ the trait bound `&usize: Default` is not satisfied +} diff --git a/src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.rs b/src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.rs new file mode 100644 index 000000000..5fae21ccc --- /dev/null +++ b/src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.rs @@ -0,0 +1,15 @@ +// run-rustfix +#![allow(unused_variables)] + +fn foo(foo: &mut usize) { + todo!() +} + +fn bar(bar: &usize) { + todo!() +} + +fn main() { + foo(Default::default()); //~ the trait bound `&mut usize: Default` is not satisfied + bar(Default::default()); //~ the trait bound `&usize: Default` is not satisfied +} diff --git a/src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.stderr b/src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.stderr new file mode 100644 index 000000000..125a8b44f --- /dev/null +++ b/src/test/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.stderr @@ -0,0 +1,25 @@ +error[E0277]: the trait bound `&mut usize: Default` is not satisfied + --> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:13:9 + | +LL | foo(Default::default()); + | ^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `&mut usize` + | +help: consider mutably borrowing here + | +LL | foo(&mut Default::default()); + | ++++ + +error[E0277]: the trait bound `&usize: Default` is not satisfied + --> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:14:9 + | +LL | bar(Default::default()); + | ^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `&usize` + | +help: consider borrowing here + | +LL | bar(&Default::default()); + | + + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/suggest-blanket-impl-local-trait.rs b/src/test/ui/suggestions/suggest-blanket-impl-local-trait.rs index 7cf536f79..14fef1b52 100644 --- a/src/test/ui/suggestions/suggest-blanket-impl-local-trait.rs +++ b/src/test/ui/suggestions/suggest-blanket-impl-local-trait.rs @@ -1,5 +1,5 @@ // Ensure that the compiler include the blanklet implementation suggestion -// when inside a `impl` statment are used two local traits. +// when inside a `impl` statement are used two local traits. // // edition:2021 use std::fmt; diff --git a/src/test/ui/suggestions/suggest-blanket-impl-local-trait.stderr b/src/test/ui/suggestions/suggest-blanket-impl-local-trait.stderr index d739a8272..398caa98b 100644 --- a/src/test/ui/suggestions/suggest-blanket-impl-local-trait.stderr +++ b/src/test/ui/suggestions/suggest-blanket-impl-local-trait.stderr @@ -6,9 +6,8 @@ LL | impl LocalTraitTwo for LocalTraitOne {} | help: add `dyn` keyword before this trait | -LL - impl LocalTraitTwo for LocalTraitOne {} -LL + impl LocalTraitTwo for dyn LocalTraitOne {} - | +LL | impl LocalTraitTwo for dyn LocalTraitOne {} + | +++ help: alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne` | LL | impl LocalTraitTwo for T {} @@ -22,9 +21,8 @@ LL | impl fmt::Display for LocalTraitOne { | help: add `dyn` keyword before this trait | -LL - impl fmt::Display for LocalTraitOne { -LL + impl fmt::Display for dyn LocalTraitOne { - | +LL | impl fmt::Display for dyn LocalTraitOne { + | +++ error[E0782]: trait objects must include the `dyn` keyword --> $DIR/suggest-blanket-impl-local-trait.rs:26:23 @@ -34,9 +32,8 @@ LL | impl fmt::Display for LocalTraitTwo + Send { | help: add `dyn` keyword before this trait | -LL - impl fmt::Display for LocalTraitTwo + Send { -LL + impl fmt::Display for dyn LocalTraitTwo + Send { - | +LL | impl fmt::Display for dyn LocalTraitTwo + Send { + | +++ error[E0782]: trait objects must include the `dyn` keyword --> $DIR/suggest-blanket-impl-local-trait.rs:34:24 @@ -46,9 +43,8 @@ LL | impl LocalTraitOne for fmt::Display {} | help: add `dyn` keyword before this trait | -LL - impl LocalTraitOne for fmt::Display {} -LL + impl LocalTraitOne for dyn fmt::Display {} - | +LL | impl LocalTraitOne for dyn fmt::Display {} + | +++ help: alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display` | LL | impl LocalTraitOne for T {} @@ -62,9 +58,8 @@ LL | impl LocalTraitOne for fmt::Display + Send {} | help: add `dyn` keyword before this trait | -LL - impl LocalTraitOne for fmt::Display + Send {} -LL + impl LocalTraitOne for dyn fmt::Display + Send {} - | +LL | impl LocalTraitOne for dyn fmt::Display + Send {} + | +++ help: alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display + Send` | LL | impl LocalTraitOne for T {} @@ -78,9 +73,8 @@ LL | impl GenericTrait for LocalTraitOne {} | help: add `dyn` keyword before this trait | -LL - impl GenericTrait for LocalTraitOne {} -LL + impl GenericTrait for dyn LocalTraitOne {} - | +LL | impl GenericTrait for dyn LocalTraitOne {} + | +++ help: alternatively use a blanket implementation to implement `GenericTrait` for all types that also implement `LocalTraitOne` | LL | impl GenericTrait for T {} @@ -94,9 +88,8 @@ LL | impl GenericTraitTwo for GenericTrait {} | help: add `dyn` keyword before this trait | -LL - impl GenericTraitTwo for GenericTrait {} -LL + impl GenericTraitTwo for dyn GenericTrait {} - | +LL | impl GenericTraitTwo for dyn GenericTrait {} + | +++ help: alternatively use a blanket implementation to implement `GenericTraitTwo` for all types that also implement `GenericTrait` | LL | impl> GenericTraitTwo for U {} diff --git a/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr b/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr index 6b6e40613..6ce9bfd9d 100644 --- a/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr +++ b/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr @@ -2,9 +2,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> $DIR/suggest-borrow-to-dyn-object.rs:12:11 | LL | check(s); - | ----- ^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^ doesn't have a size known at compile-time | = help: within `OsStr`, the trait `Sized` is not implemented for `[u8]` = note: required because it appears within the type `OsStr` diff --git a/src/test/ui/suggestions/suggest-dereferencing-index.stderr b/src/test/ui/suggestions/suggest-dereferencing-index.stderr index c8b87af7b..147dc9234 100644 --- a/src/test/ui/suggestions/suggest-dereferencing-index.stderr +++ b/src/test/ui/suggestions/suggest-dereferencing-index.stderr @@ -6,7 +6,7 @@ LL | let one_item_please: i32 = [1, 2, 3][i]; | = help: the trait `SliceIndex<[{integer}]>` is not implemented for `&usize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index<&usize>` for `[{integer}]` + = note: required for `[{integer}]` to implement `Index<&usize>` help: dereference this index | LL | let one_item_please: i32 = [1, 2, 3][*i]; diff --git a/src/test/ui/suggestions/suggest-imm-mut-trait-implementations.stderr b/src/test/ui/suggestions/suggest-imm-mut-trait-implementations.stderr index 6583cabe1..f2eb651ea 100644 --- a/src/test/ui/suggestions/suggest-imm-mut-trait-implementations.stderr +++ b/src/test/ui/suggestions/suggest-imm-mut-trait-implementations.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `A: Trait` is not satisfied --> $DIR/suggest-imm-mut-trait-implementations.rs:20:9 | LL | foo(a); - | --- ^ expected an implementor of trait `Trait` + | --- ^ the trait `Trait` is not implemented for `A` | | | required by a bound introduced by this call | @@ -22,7 +22,7 @@ error[E0277]: the trait bound `B: Trait` is not satisfied --> $DIR/suggest-imm-mut-trait-implementations.rs:21:9 | LL | foo(b); - | --- ^ expected an implementor of trait `Trait` + | --- ^ the trait `Trait` is not implemented for `B` | | | required by a bound introduced by this call | @@ -40,7 +40,7 @@ error[E0277]: the trait bound `C: Trait` is not satisfied --> $DIR/suggest-imm-mut-trait-implementations.rs:22:9 | LL | foo(c); - | --- ^ expected an implementor of trait `Trait` + | --- ^ the trait `Trait` is not implemented for `C` | | | required by a bound introduced by this call | diff --git a/src/test/ui/suggestions/suggest-methods.stderr b/src/test/ui/suggestions/suggest-methods.stderr index 97d7e6696..03cb9c779 100644 --- a/src/test/ui/suggestions/suggest-methods.stderr +++ b/src/test/ui/suggestions/suggest-methods.stderr @@ -5,25 +5,25 @@ LL | struct Foo; | ---------- method `bat` not found for this struct ... LL | f.bat(1.0); - | ^^^ help: there is an associated function with a similar name: `bar` + | ^^^ help: there is a method with a similar name: `bar` error[E0599]: no method named `is_emtpy` found for struct `String` in the current scope --> $DIR/suggest-methods.rs:21:15 | LL | let _ = s.is_emtpy(); - | ^^^^^^^^ help: there is an associated function with a similar name: `is_empty` + | ^^^^^^^^ help: there is a method with a similar name: `is_empty` error[E0599]: no method named `count_eos` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:25:19 | LL | let _ = 63u32.count_eos(); - | ^^^^^^^^^ help: there is an associated function with a similar name: `count_zeros` + | ^^^^^^^^^ help: there is a method with a similar name: `count_zeros` error[E0599]: no method named `count_o` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:28:19 | LL | let _ = 63u32.count_o(); - | ^^^^^^^ help: there is an associated function with a similar name: `count_ones` + | ^^^^^^^ help: there is a method with a similar name: `count_ones` error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-move-lifetimes.stderr b/src/test/ui/suggestions/suggest-move-lifetimes.stderr index f52631cae..b1a49447d 100644 --- a/src/test/ui/suggestions/suggest-move-lifetimes.stderr +++ b/src/test/ui/suggestions/suggest-move-lifetimes.stderr @@ -1,22 +1,22 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:1:13 | LL | struct A { | ----^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:5:13 | LL | struct B { | ----^^---- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:10:16 | LL | struct C { | -------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, T, U>` -error: lifetime parameters must be declared prior to type parameters +error: lifetime parameters must be declared prior to type and const parameters --> $DIR/suggest-move-lifetimes.rs:15:16 | LL | struct D { diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr index 1a6032db0..b222e8142 100644 --- a/src/test/ui/suggestions/suggest-move-types.stderr +++ b/src/test/ui/suggestions/suggest-move-types.stderr @@ -121,7 +121,7 @@ LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime` + = help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, 'c, T, U, V>` error[E0747]: lifetime provided when a type was expected --> $DIR/suggest-move-types.rs:82:56 @@ -130,7 +130,7 @@ LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime` + = help: reorder the arguments: lifetimes, then type and consts: `<'a, 'b, 'c, T, U, V>` error: aborting due to 12 previous errors diff --git a/src/test/ui/suggestions/suggest-ref-macro.stderr b/src/test/ui/suggestions/suggest-ref-macro.stderr index 84cbc9357..17de49fbd 100644 --- a/src/test/ui/suggestions/suggest-ref-macro.stderr +++ b/src/test/ui/suggestions/suggest-ref-macro.stderr @@ -10,14 +10,8 @@ LL | #[hello] note: function defined here --> $DIR/suggest-ref-macro.rs:8:1 | -LL | #[hello] - | _-^^^^^^^ -LL | | fn abc() {} -LL | | -LL | | fn x(_: &mut i32) {} -LL | | -LL | | macro_rules! bla { - | |_____________- +LL | #[hello] + | ^^^^^^^^ = note: this error originates in the attribute macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types diff --git a/src/test/ui/suggestions/suggest-remove-refs-1.stderr b/src/test/ui/suggestions/suggest-remove-refs-1.stderr index 1083b2f97..1a843f3f5 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-1.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-1.stderr @@ -8,7 +8,7 @@ LL | for (i, _) in &v.iter().enumerate() { | help: consider removing the leading `&`-reference | = help: the trait `Iterator` is not implemented for `&Enumerate>` - = note: required because of the requirements on the impl of `IntoIterator` for `&Enumerate>` + = note: required for `&Enumerate>` to implement `IntoIterator` error: aborting due to previous error diff --git a/src/test/ui/suggestions/suggest-remove-refs-2.stderr b/src/test/ui/suggestions/suggest-remove-refs-2.stderr index 197b19a1b..f39361d52 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-2.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-2.stderr @@ -8,7 +8,7 @@ LL | for (i, _) in & & & & &v.iter().enumerate() { | help: consider removing 5 leading `&`-references | = help: the trait `Iterator` is not implemented for `&&&&&Enumerate>` - = note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate>` + = note: required for `&&&&&Enumerate>` to implement `IntoIterator` error: aborting due to previous error diff --git a/src/test/ui/suggestions/suggest-remove-refs-3.stderr b/src/test/ui/suggestions/suggest-remove-refs-3.stderr index bb0cceac1..4d0732427 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-3.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-3.stderr @@ -12,7 +12,7 @@ LL | | .enumerate() { | |_____________________^ `&&&&&Enumerate>` is not an iterator | = help: the trait `Iterator` is not implemented for `&&&&&Enumerate>` - = note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate>` + = note: required for `&&&&&Enumerate>` to implement `IntoIterator` error: aborting due to previous error diff --git a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr index fc880d6b8..87e716436 100644 --- a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr +++ b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr @@ -39,9 +39,8 @@ LL | impl<'a, T> Struct for Trait<'a, T> {} | help: add `dyn` keyword before this trait | -LL - impl<'a, T> Struct for Trait<'a, T> {} -LL + impl<'a, T> Struct for dyn Trait<'a, T> {} - | +LL | impl<'a, T> Struct for dyn Trait<'a, T> {} + | +++ error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr index f5143762d..f716e6c17 100644 --- a/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr +++ b/src/test/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr @@ -42,9 +42,8 @@ LL | impl<'a, T> Struct for Trait<'a, T> {} = note: for more information, see help: use `dyn` | -LL - impl<'a, T> Struct for Trait<'a, T> {} -LL + impl<'a, T> Struct for dyn Trait<'a, T> {} - | +LL | impl<'a, T> Struct for dyn Trait<'a, T> {} + | +++ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/src/test/ui/suggestions/too-many-field-suggestions.rs b/src/test/ui/suggestions/too-many-field-suggestions.rs new file mode 100644 index 000000000..905f9502c --- /dev/null +++ b/src/test/ui/suggestions/too-many-field-suggestions.rs @@ -0,0 +1,29 @@ +struct Thing { + a0: Foo, + a1: Foo, + a2: Foo, + a3: Foo, + a4: Foo, + a5: Foo, + a6: Foo, + a7: Foo, + a8: Foo, + a9: Foo, +} + +struct Foo { + field: Field, +} + +struct Field; + +impl Foo { + fn bar(&self) {} +} + +fn bar(t: Thing) { + t.bar(); //~ ERROR no method named `bar` found for struct `Thing` + t.field; //~ ERROR no field `field` on type `Thing` +} + +fn main() {} diff --git a/src/test/ui/suggestions/too-many-field-suggestions.stderr b/src/test/ui/suggestions/too-many-field-suggestions.stderr new file mode 100644 index 000000000..63ad6fdb1 --- /dev/null +++ b/src/test/ui/suggestions/too-many-field-suggestions.stderr @@ -0,0 +1,44 @@ +error[E0599]: no method named `bar` found for struct `Thing` in the current scope + --> $DIR/too-many-field-suggestions.rs:25:7 + | +LL | struct Thing { + | ------------ method `bar` not found for this struct +... +LL | t.bar(); + | ^^^ method not found in `Thing` + | +help: some of the expressions' fields have a method of the same name + | +LL | t.a0.bar(); + | +++ +LL | t.a1.bar(); + | +++ +LL | t.a2.bar(); + | +++ +LL | t.a3.bar(); + | +++ + and 6 other candidates + +error[E0609]: no field `field` on type `Thing` + --> $DIR/too-many-field-suggestions.rs:26:7 + | +LL | t.field; + | ^^^^^ unknown field + | + = note: available fields are: `a0`, `a1`, `a2`, `a3`, `a4` ... and 5 others +help: some of the expressions' fields have a field of the same name + | +LL | t.a0.field; + | +++ +LL | t.a1.field; + | +++ +LL | t.a2.field; + | +++ +LL | t.a3.field; + | +++ + and 6 other candidates + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0599, E0609. +For more information about an error, try `rustc --explain E0599`. diff --git a/src/test/ui/suggestions/try-removing-the-field.rs b/src/test/ui/suggestions/try-removing-the-field.rs new file mode 100644 index 000000000..9d0573ca2 --- /dev/null +++ b/src/test/ui/suggestions/try-removing-the-field.rs @@ -0,0 +1,17 @@ +// run-pass + +#![allow(dead_code)] + +struct Foo { + foo: i32, + bar: (), + baz: (), +} + +fn use_foo(x: Foo) -> i32 { + let Foo { foo, bar, .. } = x; //~ WARNING unused variable: `bar` + //~| help: try removing the field + return foo; +} + +fn main() {} diff --git a/src/test/ui/suggestions/try-removing-the-field.stderr b/src/test/ui/suggestions/try-removing-the-field.stderr new file mode 100644 index 000000000..448a2c3d2 --- /dev/null +++ b/src/test/ui/suggestions/try-removing-the-field.stderr @@ -0,0 +1,12 @@ +warning: unused variable: `bar` + --> $DIR/try-removing-the-field.rs:12:20 + | +LL | let Foo { foo, bar, .. } = x; + | ^^^- + | | + | help: try removing the field + | + = note: `#[warn(unused_variables)]` on by default + +warning: 1 warning emitted + diff --git a/src/test/ui/suggestions/type-ascription-and-other-error.rs b/src/test/ui/suggestions/type-ascription-and-other-error.rs new file mode 100644 index 000000000..99ab2f3c8 --- /dev/null +++ b/src/test/ui/suggestions/type-ascription-and-other-error.rs @@ -0,0 +1,6 @@ +fn main() { + not rust; //~ ERROR + let _ = 0: i32; // (error hidden by existing error) + #[cfg(FALSE)] + let _ = 0: i32; // (warning hidden by existing error) +} diff --git a/src/test/ui/suggestions/type-ascription-and-other-error.stderr b/src/test/ui/suggestions/type-ascription-and-other-error.stderr new file mode 100644 index 000000000..eadf634bb --- /dev/null +++ b/src/test/ui/suggestions/type-ascription-and-other-error.stderr @@ -0,0 +1,8 @@ +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `rust` + --> $DIR/type-ascription-and-other-error.rs:2:9 + | +LL | not rust; + | ^^^^ expected one of 8 possible tokens + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/unnamable-types.stderr b/src/test/ui/suggestions/unnamable-types.stderr index de64269d1..ede3ebfa7 100644 --- a/src/test/ui/suggestions/unnamable-types.stderr +++ b/src/test/ui/suggestions/unnamable-types.stderr @@ -1,8 +1,8 @@ error: missing type for `const` item - --> $DIR/unnamable-types.rs:6:7 + --> $DIR/unnamable-types.rs:6:8 | LL | const A = 5; - | ^ help: provide a type for the constant: `A: i32` + | ^ help: provide a type for the constant: `: i32` error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/unnamable-types.rs:10:11 @@ -26,10 +26,10 @@ LL | const C: _ = || 42; | ^^^^^ error: missing type for `const` item - --> $DIR/unnamable-types.rs:23:7 + --> $DIR/unnamable-types.rs:23:8 | LL | const D = S { t: { let i = 0; move || -> i32 { i } } }; - | ^ + | ^ | note: however, the inferred type `S<[closure@$DIR/unnamable-types.rs:23:31: 23:45]>` cannot be named --> $DIR/unnamable-types.rs:23:11 @@ -38,22 +38,22 @@ LL | const D = S { t: { let i = 0; move || -> i32 { i } } }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing type for `const` item - --> $DIR/unnamable-types.rs:29:7 + --> $DIR/unnamable-types.rs:29:8 | LL | const E = foo; - | ^ help: provide a type for the constant: `E: fn() -> i32` + | ^ help: provide a type for the constant: `: fn() -> i32` error: missing type for `const` item - --> $DIR/unnamable-types.rs:32:7 + --> $DIR/unnamable-types.rs:32:8 | LL | const F = S { t: foo }; - | ^ help: provide a type for the constant: `F: S i32>` + | ^ help: provide a type for the constant: `: S i32>` error: missing type for `const` item - --> $DIR/unnamable-types.rs:37:7 + --> $DIR/unnamable-types.rs:37:8 | LL | const G = || -> i32 { yield 0; return 1; }; - | ^ + | ^ | note: however, the inferred type `[generator@$DIR/unnamable-types.rs:37:11: 37:20]` cannot be named --> $DIR/unnamable-types.rs:37:11 diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr index 7038a572b..75b919232 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -12,7 +12,7 @@ LL | pub trait T { help: replace the generic bounds with the associated types | LL | i: Box>, - | ~~~~~~~~~ ~~~~~~~~~ + | +++ +++ error[E0191]: the value of the associated types `A` (from trait `T`), `C` (from trait `T`) must be specified --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16 diff --git a/src/test/ui/tag-variant-disr-dup.rs b/src/test/ui/tag-variant-disr-dup.rs deleted file mode 100644 index e497f993d..000000000 --- a/src/test/ui/tag-variant-disr-dup.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Black and White have the same discriminator value ... - -enum Color { - //~^ ERROR discriminant value `0` assigned more than once - Red = 0xff0000, - Green = 0x00ff00, - Blue = 0x0000ff, - Black = 0x000000, - White = 0x000000, -} - -fn main() { } diff --git a/src/test/ui/tag-variant-disr-dup.stderr b/src/test/ui/tag-variant-disr-dup.stderr deleted file mode 100644 index 6b1ba43d2..000000000 --- a/src/test/ui/tag-variant-disr-dup.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0081]: discriminant value `0` assigned more than once - --> $DIR/tag-variant-disr-dup.rs:3:1 - | -LL | enum Color { - | ^^^^^^^^^^ -... -LL | Black = 0x000000, - | -------- first assignment of `0` -LL | White = 0x000000, - | -------- second assignment of `0` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0081`. diff --git a/src/test/ui/thir-tree.stdout b/src/test/ui/thir-tree.stdout index 3c84be8e8..5fcdfca18 100644 --- a/src/test/ui/thir-tree.stdout +++ b/src/test/ui/thir-tree.stdout @@ -1,6 +1,17 @@ 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: (), @@ -9,15 +20,7 @@ Thir { ), span: $DIR/thir-tree.rs:4:15: 4:17 (#0), kind: Block { - body: 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, - }, + block: b0, }, }, Expr { @@ -51,5 +54,6 @@ Thir { }, ], stmts: [], + params: [], } diff --git a/src/test/ui/traits/alias/cross-crate.stderr b/src/test/ui/traits/alias/cross-crate.stderr index d0d00c97e..ae9d7d0a9 100644 --- a/src/test/ui/traits/alias/cross-crate.stderr +++ b/src/test/ui/traits/alias/cross-crate.stderr @@ -5,7 +5,7 @@ LL | use_alias::>(); | ^^^^^^^ `Rc` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Rc` - = note: required because of the requirements on the impl of `SendSync` for `Rc` + = note: required for `Rc` to implement `SendSync` note: required by a bound in `use_alias` --> $DIR/cross-crate.rs:10:17 | @@ -19,7 +19,7 @@ LL | use_alias::>(); | ^^^^^^^ `Rc` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Rc` - = note: required because of the requirements on the impl of `SendSync` for `Rc` + = note: required for `Rc` to implement `SendSync` note: required by a bound in `use_alias` --> $DIR/cross-crate.rs:10:17 | diff --git a/src/test/ui/traits/alias/generic-default-in-dyn.rs b/src/test/ui/traits/alias/generic-default-in-dyn.rs new file mode 100644 index 000000000..d44e1c2a9 --- /dev/null +++ b/src/test/ui/traits/alias/generic-default-in-dyn.rs @@ -0,0 +1,10 @@ +trait SendEqAlias = PartialEq; +//~^ ERROR trait aliases are experimental + +struct Foo(dyn SendEqAlias); +//~^ ERROR the type parameter `Rhs` must be explicitly specified [E0393] + +struct Bar(dyn SendEqAlias, T); +//~^ ERROR the type parameter `Rhs` must be explicitly specified [E0393] + +fn main() {} diff --git a/src/test/ui/traits/alias/generic-default-in-dyn.stderr b/src/test/ui/traits/alias/generic-default-in-dyn.stderr new file mode 100644 index 000000000..76a068e86 --- /dev/null +++ b/src/test/ui/traits/alias/generic-default-in-dyn.stderr @@ -0,0 +1,39 @@ +error[E0658]: trait aliases are experimental + --> $DIR/generic-default-in-dyn.rs:1:1 + | +LL | trait SendEqAlias = PartialEq; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #41517 for more information + = help: add `#![feature(trait_alias)]` to the crate attributes to enable + +error[E0393]: the type parameter `Rhs` must be explicitly specified + --> $DIR/generic-default-in-dyn.rs:4:19 + | +LL | struct Foo(dyn SendEqAlias); + | ^^^^^^^^^^^^^^ missing reference to `Rhs` + | + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | +LL | pub trait PartialEq { + | --------------------------------------- type parameter `Rhs` must be specified for this + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error[E0393]: the type parameter `Rhs` must be explicitly specified + --> $DIR/generic-default-in-dyn.rs:7:19 + | +LL | struct Bar(dyn SendEqAlias, T); + | ^^^^^^^^^^^^^^ missing reference to `Rhs` + | + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | +LL | pub trait PartialEq { + | --------------------------------------- type parameter `Rhs` must be specified for this + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0393, E0658. +For more information about an error, try `rustc --explain E0393`. diff --git a/src/test/ui/traits/alias/self-in-const-generics.rs b/src/test/ui/traits/alias/self-in-const-generics.rs new file mode 100644 index 000000000..b0de8ccd6 --- /dev/null +++ b/src/test/ui/traits/alias/self-in-const-generics.rs @@ -0,0 +1,12 @@ +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] +#![feature(trait_alias)] + +trait Bar {} + +trait BB = Bar<{ 2 + 1 }>; + +fn foo(x: &dyn BB) {} +//~^ ERROR the trait alias `BB` cannot be made into an object [E0038] + +fn main() {} diff --git a/src/test/ui/traits/alias/self-in-const-generics.stderr b/src/test/ui/traits/alias/self-in-const-generics.stderr new file mode 100644 index 000000000..61cc217cf --- /dev/null +++ b/src/test/ui/traits/alias/self-in-const-generics.stderr @@ -0,0 +1,11 @@ +error[E0038]: the trait alias `BB` cannot be made into an object + --> $DIR/self-in-const-generics.rs:9:16 + | +LL | fn foo(x: &dyn BB) {} + | ^^ + | + = note: it cannot use `Self` as a type parameter in a supertrait or `where`-clause + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/traits/alias/self-in-generics.rs b/src/test/ui/traits/alias/self-in-generics.rs new file mode 100644 index 000000000..0bb6335f9 --- /dev/null +++ b/src/test/ui/traits/alias/self-in-generics.rs @@ -0,0 +1,15 @@ +// 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)] + +pub trait SelfInput = Fn(&mut Self); + +pub fn f(_f: &dyn SelfInput) {} +//~^ ERROR the trait alias `SelfInput` cannot be made into an object [E0038] + +fn main() {} diff --git a/src/test/ui/traits/alias/self-in-generics.stderr b/src/test/ui/traits/alias/self-in-generics.stderr new file mode 100644 index 000000000..110d60e6e --- /dev/null +++ b/src/test/ui/traits/alias/self-in-generics.stderr @@ -0,0 +1,11 @@ +error[E0038]: the trait alias `SelfInput` cannot be made into an object + --> $DIR/self-in-generics.rs:12:19 + | +LL | pub fn f(_f: &dyn SelfInput) {} + | ^^^^^^^^^ + | + = note: it cannot use `Self` as a type parameter in a supertrait or `where`-clause + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/traits/assoc-type-in-superbad.rs b/src/test/ui/traits/assoc-type-in-superbad.rs index 579ce7cf7..d7d6241ef 100644 --- a/src/test/ui/traits/assoc-type-in-superbad.rs +++ b/src/test/ui/traits/assoc-type-in-superbad.rs @@ -4,13 +4,13 @@ use std::vec::IntoIter; -pub trait Foo: Iterator::Key> { +pub trait Foo: Iterator::Key> { type Key; } impl Foo for IntoIter { - type Key = u32; //~ ERROR type mismatch + type Key = u32; + //~^ ERROR expected `std::vec::IntoIter` to be an iterator that yields `u32`, but it yields `i32` } -fn main() { -} +fn main() {} diff --git a/src/test/ui/traits/assoc-type-in-superbad.stderr b/src/test/ui/traits/assoc-type-in-superbad.stderr index f36947914..3e2d9d903 100644 --- a/src/test/ui/traits/assoc-type-in-superbad.stderr +++ b/src/test/ui/traits/assoc-type-in-superbad.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving ` as Iterator>::Item == u32` +error[E0271]: expected `std::vec::IntoIter` to be an iterator that yields `u32`, but it yields `i32` --> $DIR/assoc-type-in-superbad.rs:12:16 | LL | type Key = u32; @@ -7,8 +7,8 @@ LL | type Key = u32; note: required by a bound in `Foo` --> $DIR/assoc-type-in-superbad.rs:7:25 | -LL | pub trait Foo: Iterator::Key> { - | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo` +LL | pub trait Foo: Iterator::Key> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo` error: aborting due to previous error diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr index bfbbe7fd2..fa7a8a2a0 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/check-trait-object-bounds-1.rs:12:5 + --> $DIR/check-trait-object-bounds-1.rs:12:9 | LL | f::>(); - | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `f` diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr index 46e8ce788..4084f69a6 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr @@ -1,8 +1,8 @@ error[E0277]: expected a `FnOnce<(&i32,)>` closure, found `i32` - --> $DIR/check-trait-object-bounds-2.rs:13:5 + --> $DIR/check-trait-object-bounds-2.rs:13:9 | LL | f:: X<'x, F = i32>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32` | = help: the trait `for<'r> FnOnce<(&'r i32,)>` is not implemented for `i32` note: required by a bound in `f` diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr index 3ca36d5d2..4891ee9c2 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/check-trait-object-bounds-4.rs:15:5 + --> $DIR/check-trait-object-bounds-4.rs:15:9 | LL | f::>(); - | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `f` diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr index 4251c1a1e..00fdb3753 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-5.stderr @@ -1,8 +1,10 @@ error[E0271]: type mismatch resolving `::T == i64` - --> $DIR/check-trait-object-bounds-5.rs:23:5 + --> $DIR/check-trait-object-bounds-5.rs:23:12 | LL | is_obj(x) - | ^^^^^^ type mismatch resolving `::T == i64` + | ------ ^ type mismatch resolving `::T == i64` + | | + | required by a bound introduced by this call | note: expected this to be `i64` --> $DIR/check-trait-object-bounds-5.rs:9:14 diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr index 5b23a513e..9b0975e5e 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-6.stderr @@ -1,8 +1,10 @@ error[E0271]: type mismatch resolving `::T == i64` - --> $DIR/check-trait-object-bounds-6.rs:20:5 + --> $DIR/check-trait-object-bounds-6.rs:20:12 | LL | is_obj(x) - | ^^^^^^ type mismatch resolving `::T == i64` + | ------ ^ type mismatch resolving `::T == i64` + | | + | required by a bound introduced by this call | note: expected this to be `i64` --> $DIR/check-trait-object-bounds-6.rs:9:14 diff --git a/src/test/ui/traits/bad-method-typaram-kind.stderr b/src/test/ui/traits/bad-method-typaram-kind.stderr index 8befa4c5f..56acfbe80 100644 --- a/src/test/ui/traits/bad-method-typaram-kind.stderr +++ b/src/test/ui/traits/bad-method-typaram-kind.stderr @@ -1,8 +1,8 @@ error[E0277]: `T` cannot be sent between threads safely - --> $DIR/bad-method-typaram-kind.rs:2:7 + --> $DIR/bad-method-typaram-kind.rs:2:13 | LL | 1.bar::(); - | ^^^ `T` cannot be sent between threads safely + | ^ `T` cannot be sent between threads safely | note: required by a bound in `Bar::bar` --> $DIR/bad-method-typaram-kind.rs:6:14 diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs index 1d2345180..f9a934764 100644 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs +++ b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs @@ -2,10 +2,9 @@ fn strip_lf(s: &str) -> &str { s.strip_suffix(b'\n').unwrap_or(s) //~^ ERROR expected a `FnMut<(char,)>` closure, found `u8` //~| NOTE expected an `FnMut<(char,)>` closure, found `u8` - //~| NOTE required by a bound introduced by this call //~| HELP the trait `FnMut<(char,)>` is not implemented for `u8` //~| HELP the following other types implement trait `Pattern<'a>`: - //~| NOTE required because of the requirements on the impl of `Pattern<'_>` for `u8` + //~| NOTE required for `u8` to implement `Pattern<'_>` } diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr index 6ce57b626..ce9ab2d81 100644 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr @@ -1,10 +1,8 @@ error[E0277]: expected a `FnMut<(char,)>` closure, found `u8` - --> $DIR/assoc-fn-bound-root-obligation.rs:2:20 + --> $DIR/assoc-fn-bound-root-obligation.rs:2:7 | LL | s.strip_suffix(b'\n').unwrap_or(s) - | ------------ ^^^^^ expected an `FnMut<(char,)>` closure, found `u8` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^ expected an `FnMut<(char,)>` closure, found `u8` | = help: the trait `FnMut<(char,)>` is not implemented for `u8` = help: the following other types implement trait `Pattern<'a>`: @@ -15,7 +13,7 @@ LL | s.strip_suffix(b'\n').unwrap_or(s) &'c &'b str [char; N] char - = note: required because of the requirements on the impl of `Pattern<'_>` for `u8` + = note: required for `u8` to implement `Pattern<'_>` error: aborting due to previous error diff --git a/src/test/ui/traits/bound/not-on-bare-trait.stderr b/src/test/ui/traits/bound/not-on-bare-trait.stderr index 8a92dd118..1c52629da 100644 --- a/src/test/ui/traits/bound/not-on-bare-trait.stderr +++ b/src/test/ui/traits/bound/not-on-bare-trait.stderr @@ -9,9 +9,8 @@ LL | fn foo(_x: Foo + Send) { = note: for more information, see help: use `dyn` | -LL - fn foo(_x: Foo + Send) { -LL + fn foo(_x: dyn Foo + Send) { - | +LL | fn foo(_x: dyn Foo + Send) { + | +++ error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time --> $DIR/not-on-bare-trait.rs:7:8 diff --git a/src/test/ui/traits/bound/on-structs-and-enums-locals.rs b/src/test/ui/traits/bound/on-structs-and-enums-locals.rs index 21c0ce80f..60ba343bb 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-locals.rs +++ b/src/test/ui/traits/bound/on-structs-and-enums-locals.rs @@ -8,8 +8,8 @@ struct Foo { fn main() { let foo = Foo { - //~^ ERROR E0277 x: 3 + //~^ ERROR E0277 }; let baz: Foo = loop { }; diff --git a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr b/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr index c9068a270..20bbe69c0 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr @@ -11,10 +11,10 @@ LL | struct Foo { | ^^^^^ required by this bound in `Foo` error[E0277]: the trait bound `{integer}: Trait` is not satisfied - --> $DIR/on-structs-and-enums-locals.rs:10:15 + --> $DIR/on-structs-and-enums-locals.rs:11:12 | -LL | let foo = Foo { - | ^^^ the trait `Trait` is not implemented for `{integer}` +LL | x: 3 + | ^ the trait `Trait` is not implemented for `{integer}` | note: required by a bound in `Foo` --> $DIR/on-structs-and-enums-locals.rs:5:14 diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc1.rs b/src/test/ui/traits/bound/on-structs-and-enums-xc1.rs index 8156868e0..5ef35b513 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc1.rs +++ b/src/test/ui/traits/bound/on-structs-and-enums-xc1.rs @@ -6,8 +6,8 @@ use on_structs_and_enums_xc::{Bar, Foo, Trait}; fn main() { let foo = Foo { - //~^ ERROR E0277 x: 3 + //~^ ERROR E0277 }; let bar: Bar = return; //~^ ERROR E0277 diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr b/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr index f4cc64af9..3fb5decb7 100644 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr +++ b/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr @@ -11,10 +11,10 @@ LL | pub enum Bar { | ^^^^^ required by this bound in `Bar` error[E0277]: the trait bound `{integer}: Trait` is not satisfied - --> $DIR/on-structs-and-enums-xc1.rs:8:15 + --> $DIR/on-structs-and-enums-xc1.rs:9:12 | -LL | let foo = Foo { - | ^^^ the trait `Trait` is not implemented for `{integer}` +LL | x: 3 + | ^ the trait `Trait` is not implemented for `{integer}` | note: required by a bound in `Foo` --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18 diff --git a/src/test/ui/traits/cycle-cache-err-60010.stderr b/src/test/ui/traits/cycle-cache-err-60010.stderr index 859403f20..2478eb354 100644 --- a/src/test/ui/traits/cycle-cache-err-60010.stderr +++ b/src/test/ui/traits/cycle-cache-err-60010.stderr @@ -17,12 +17,12 @@ note: required because it appears within the type `RootDatabase` | LL | struct RootDatabase { | ^^^^^^^^^^^^ -note: required because of the requirements on the impl of `SourceDatabase` for `RootDatabase` +note: required for `RootDatabase` to implement `SourceDatabase` --> $DIR/cycle-cache-err-60010.rs:44:9 | LL | impl SourceDatabase for T | ^^^^^^^^^^^^^^ ^ -note: required because of the requirements on the impl of `Query` for `ParseQuery` +note: required for `ParseQuery` to implement `Query` --> $DIR/cycle-cache-err-60010.rs:37:10 | LL | impl Query for ParseQuery diff --git a/src/test/ui/traits/inductive-overflow/lifetime.rs b/src/test/ui/traits/inductive-overflow/lifetime.rs index c36c17d3d..004e47737 100644 --- a/src/test/ui/traits/inductive-overflow/lifetime.rs +++ b/src/test/ui/traits/inductive-overflow/lifetime.rs @@ -28,5 +28,5 @@ fn main() { is_send::>>(); //~^ ERROR overflow evaluating //~| 3 redundant requirements hidden - //~| required because of + //~| required for } diff --git a/src/test/ui/traits/inductive-overflow/lifetime.stderr b/src/test/ui/traits/inductive-overflow/lifetime.stderr index 9ca615aac..b72d53bdd 100644 --- a/src/test/ui/traits/inductive-overflow/lifetime.stderr +++ b/src/test/ui/traits/inductive-overflow/lifetime.stderr @@ -4,13 +4,13 @@ error[E0275]: overflow evaluating the requirement `X>: NotAuto` LL | is_send::>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | -note: required because of the requirements on the impl of `NotAuto` for `Box>>` +note: required for `Box>>` to implement `NotAuto` --> $DIR/lifetime.rs:18:18 | LL | impl NotAuto for Box {} | ^^^^^^^ ^^^^^^ = note: 3 redundant requirements hidden - = note: required because of the requirements on the impl of `NotAuto` for `X>` + = note: required for `X>` to implement `NotAuto` note: required by a bound in `is_send` --> $DIR/lifetime.rs:22:15 | diff --git a/src/test/ui/traits/inductive-overflow/simultaneous.stderr b/src/test/ui/traits/inductive-overflow/simultaneous.stderr index 230c2638c..09930e60e 100644 --- a/src/test/ui/traits/inductive-overflow/simultaneous.stderr +++ b/src/test/ui/traits/inductive-overflow/simultaneous.stderr @@ -4,7 +4,7 @@ error[E0275]: overflow evaluating the requirement `{integer}: Tweedledum` LL | is_ee(4); | ^^^^^ | -note: required because of the requirements on the impl of `Combo` for `{integer}` +note: required for `{integer}` to implement `Combo` --> $DIR/simultaneous.rs:11:34 | LL | impl Combo for T {} diff --git a/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr b/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr index d7697dcc6..3ec288d13 100644 --- a/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr +++ b/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr @@ -14,7 +14,7 @@ LL | let (a, b) = copy(NoClone); | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Magic` for `NoClone` +note: required for `NoClone` to implement `Magic` --> $DIR/supertrait-auto-trait.rs:8:12 | LL | auto trait Magic: Copy {} diff --git a/src/test/ui/traits/inductive-overflow/supertrait.stderr b/src/test/ui/traits/inductive-overflow/supertrait.stderr index 95325a534..4b862cf79 100644 --- a/src/test/ui/traits/inductive-overflow/supertrait.stderr +++ b/src/test/ui/traits/inductive-overflow/supertrait.stderr @@ -4,7 +4,7 @@ error[E0275]: overflow evaluating the requirement `NoClone: Magic` LL | let (a, b) = copy(NoClone); | ^^^^ | -note: required because of the requirements on the impl of `Magic` for `NoClone` +note: required for `NoClone` to implement `Magic` --> $DIR/supertrait.rs:5:16 | LL | impl Magic for T {} diff --git a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr index cab0ccdf7..656e0d0bf 100644 --- a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -1,18 +1,22 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:26:7 + --> $DIR/repeated-supertrait-ambig.rs:26:15 | LL | c.same_as(22) - | ^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` + | ------- ^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` + | | + | required by a bound introduced by this call | = help: the following other types implement trait `CompareTo`: > > error[E0277]: the trait bound `C: CompareTo` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:30:7 + --> $DIR/repeated-supertrait-ambig.rs:30:15 | LL | c.same_as(22) - | ^^^^^^^ the trait `CompareTo` is not implemented for `C` + | ------- ^^ the trait `CompareTo` is not implemented for `C` + | | + | required by a bound introduced by this call | help: consider further restricting this bound | @@ -20,20 +24,24 @@ LL | fn with_trait>(c: &C) -> bool { | ++++++++++++++++ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:34:5 + --> $DIR/repeated-supertrait-ambig.rs:34:37 | LL | ::same_as(c, 22) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` + | ---------------------------- ^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` + | | + | required by a bound introduced by this call | = help: the following other types implement trait `CompareTo`: > > error[E0277]: the trait bound `C: CompareTo` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:38:5 + --> $DIR/repeated-supertrait-ambig.rs:38:27 | LL | CompareTo::same_as(c, 22) - | ^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `C` + | ------------------ ^^ the trait `CompareTo` is not implemented for `C` + | | + | required by a bound introduced by this call | help: consider further restricting this bound | @@ -41,10 +49,12 @@ LL | fn with_ufcs2>(c: &C) -> bool { | ++++++++++++++++ error[E0277]: the trait bound `i64: CompareTo` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:42:23 + --> $DIR/repeated-supertrait-ambig.rs:42:31 | LL | assert_eq!(22_i64.same_as(22), true); - | ^^^^^^^ the trait `CompareTo` is not implemented for `i64` + | ------- ^^ the trait `CompareTo` is not implemented for `i64` + | | + | required by a bound introduced by this call | = help: the following other types implement trait `CompareTo`: > diff --git a/src/test/ui/traits/issue-18400.stderr b/src/test/ui/traits/issue-18400.stderr index 92e0f6007..4394e6f7e 100644 --- a/src/test/ui/traits/issue-18400.stderr +++ b/src/test/ui/traits/issue-18400.stderr @@ -5,13 +5,13 @@ LL | 0.contains(bits); | ^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_18400`) -note: required because of the requirements on the impl of `Set<&[_]>` for `{integer}` +note: required for `{integer}` to implement `Set<&[_]>` --> $DIR/issue-18400.rs:6:16 | LL | impl<'a, T, S> Set<&'a [T]> for S where | ^^^^^^^^^^^^ ^ = note: 128 redundant requirements hidden - = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}` + = note: required for `{integer}` to implement `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` error: aborting due to previous error diff --git a/src/test/ui/traits/issue-20692.stderr b/src/test/ui/traits/issue-20692.stderr index 1d7f252e5..2028994cd 100644 --- a/src/test/ui/traits/issue-20692.stderr +++ b/src/test/ui/traits/issue-20692.stderr @@ -27,7 +27,7 @@ LL | trait Array: Sized + Copy {} | | | | | ...because it requires `Self: Sized` | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Array>` for `&T` + = note: required for `&T` to implement `CoerceUnsized<&dyn Array>` = note: required by cast to type `&dyn Array` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/issue-38604.stderr b/src/test/ui/traits/issue-38604.stderr index d41488c15..50d6fb054 100644 --- a/src/test/ui/traits/issue-38604.stderr +++ b/src/test/ui/traits/issue-38604.stderr @@ -25,7 +25,7 @@ LL | trait Foo where u32: Q { | --- ^^^^^^^ ...because it uses `Self` as a type parameter | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized>` for `Box<()>` + = note: required for `Box<()>` to implement `CoerceUnsized>` = note: required by cast to type `Box` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/issue-71036.rs b/src/test/ui/traits/issue-71036.rs index 3d2df6fe9..69eed0c04 100644 --- a/src/test/ui/traits/issue-71036.rs +++ b/src/test/ui/traits/issue-71036.rs @@ -12,6 +12,6 @@ impl<'a, T: ?Sized + Unsize, U: ?Sized> DispatchFromDyn> for Foo<' //~^ ERROR the trait bound `&'a T: Unsize<&'a U>` is not satisfied //~| NOTE the trait `Unsize<&'a U>` is not implemented for `&'a T` //~| NOTE all implementations of `Unsize` are provided automatically by the compiler -//~| NOTE required because of the requirements on the impl +//~| NOTE required for fn main() {} diff --git a/src/test/ui/traits/issue-71036.stderr b/src/test/ui/traits/issue-71036.stderr index 3ee6db40e..79eb7a2ae 100644 --- a/src/test/ui/traits/issue-71036.stderr +++ b/src/test/ui/traits/issue-71036.stderr @@ -5,7 +5,7 @@ LL | impl<'a, T: ?Sized + Unsize, U: ?Sized> DispatchFromDyn> for | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unsize<&'a U>` is not implemented for `&'a T` | = note: all implementations of `Unsize` are provided automatically by the compiler, see for more information - = note: required because of the requirements on the impl of `DispatchFromDyn<&'a &'a U>` for `&'a &'a T` + = note: required for `&'a &'a T` to implement `DispatchFromDyn<&'a &'a U>` error: aborting due to previous error diff --git a/src/test/ui/traits/issue-71136.stderr b/src/test/ui/traits/issue-71136.stderr index 62a2a64ed..f54173392 100644 --- a/src/test/ui/traits/issue-71136.stderr +++ b/src/test/ui/traits/issue-71136.stderr @@ -7,7 +7,7 @@ LL | struct FooHolster { LL | the_foos: Vec, | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo` | - = note: required because of the requirements on the impl of `Clone` for `Vec` + = note: required for `Vec` to implement `Clone` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Foo` with `#[derive(Clone)]` | diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr index 2b832e27c..e210f11b3 100644 --- a/src/test/ui/traits/issue-77982.stderr +++ b/src/test/ui/traits/issue-77982.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:8:10 | LL | opts.get(opt.as_ref()); - | ^^^ cannot infer type of the type parameter `Q` declared on the associated function `get` + | ^^^ ------------ type must be known at this point + | | + | cannot infer type of the type parameter `Q` declared on the associated function `get` | = note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`: - impl Borrow for String; @@ -13,7 +15,7 @@ note: required by a bound in `HashMap::::get` | LL | K: Borrow, | ^^^^^^^^^ required by this bound in `HashMap::::get` -help: consider specifying the type argument in the function call +help: consider specifying the generic argument | LL | opts.get::(opt.as_ref()); | +++++ @@ -42,7 +44,7 @@ error[E0283]: type annotations needed LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); | --------- ^^^^ | | - | type must be known at this point + | required by a bound introduced by this call | = note: multiple `impl`s satisfying `u32: From<_>` found in the following crates: `core`, `std`: - impl From for u32; diff --git a/src/test/ui/traits/issue-82830.stderr b/src/test/ui/traits/issue-82830.stderr index f863143c7..6a597a402 100644 --- a/src/test/ui/traits/issue-82830.stderr +++ b/src/test/ui/traits/issue-82830.stderr @@ -4,7 +4,7 @@ error[E0275]: overflow evaluating the requirement `P: Sized` LL | t: MaybeBox

, | ^^^^^^^^^^^ | -note: required because of the requirements on the impl of `A>` for `P` +note: required for `P` to implement `A>` --> $DIR/issue-82830.rs:10:12 | LL | impl A for P { diff --git a/src/test/ui/traits/issue-91594.stderr b/src/test/ui/traits/issue-91594.stderr index f2b3de13b..5fcd090a8 100644 --- a/src/test/ui/traits/issue-91594.stderr +++ b/src/test/ui/traits/issue-91594.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `Foo: HasComponent<()>` is not satisfied - --> $DIR/issue-91594.rs:10:6 + --> $DIR/issue-91594.rs:10:1 | LL | impl HasComponent<>::Interface> for Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasComponent<()>` is not implemented for `Foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasComponent<()>` is not implemented for `Foo` | = help: the trait `HasComponent<>::Interface>` is implemented for `Foo` -note: required because of the requirements on the impl of `Component` for `Foo` +note: required for `Foo` to implement `Component` --> $DIR/issue-91594.rs:13:27 | LL | impl> Component for Foo { diff --git a/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr b/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr index f5d6d72af..6acf2fe65 100644 --- a/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -15,9 +15,9 @@ LL | recurse(IteratorOfWrapped(elements).map(|t| t.0)) error[E0275]: overflow evaluating the requirement `(): Sized` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "512"]` attribute to your crate (`issue_91949_hangs_on_recursion`) - = note: required because of the requirements on the impl of `Iterator` for `std::iter::Empty<()>` + = note: required for `std::iter::Empty<()>` to implement `Iterator` = note: 171 redundant requirements hidden - = note: required because of the requirements on the impl of `Iterator` for `IteratorOfWrapped<(), Map>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>` + = note: required for `IteratorOfWrapped<(), Map>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:26:45: 26:48]>>` to implement `Iterator` error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/traits/issue-97576.stderr b/src/test/ui/traits/issue-97576.stderr index bdee073d6..146d38d07 100644 --- a/src/test/ui/traits/issue-97576.stderr +++ b/src/test/ui/traits/issue-97576.stderr @@ -1,10 +1,12 @@ error[E0277]: the trait bound `String: From` is not satisfied - --> $DIR/issue-97576.rs:8:22 + --> $DIR/issue-97576.rs:8:18 | LL | bar: bar.into(), - | ^^^^ the trait `From` is not implemented for `String` + | ^^^ ---- required by a bound introduced by this call + | | + | the trait `From` is not implemented for `String` | - = note: required because of the requirements on the impl of `Into` for `impl ToString` + = note: required for `impl ToString` to implement `Into` error: aborting due to previous error diff --git a/src/test/ui/traits/multidispatch-bad.stderr b/src/test/ui/traits/multidispatch-bad.stderr index 8b6e61006..d58f1e2d9 100644 --- a/src/test/ui/traits/multidispatch-bad.stderr +++ b/src/test/ui/traits/multidispatch-bad.stderr @@ -10,7 +10,7 @@ note: function defined here --> $DIR/multidispatch-bad.rs:13:4 | LL | fn test(_: T, _: U) - | ^^^^ ---- ---- + | ^^^^ ---- help: change the type of the numeric literal from `i32` to `u32` | LL | test(22i32, 44u32); diff --git a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr index cbec35934..6e6172eea 100644 --- a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr +++ b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr @@ -13,7 +13,9 @@ error[E0283]: type annotations needed --> $DIR/multidispatch-convert-ambig-dest.rs:26:5 | LL | test(22, std::default::Default::default()); - | ^^^^ cannot infer type of the type parameter `U` declared on the function `test` + | ^^^^ -------------------------------- type must be known at this point + | | + | cannot infer type of the type parameter `U` declared on the function `test` | note: multiple `impl`s satisfying `i32: Convert<_>` found --> $DIR/multidispatch-convert-ambig-dest.rs:8:1 @@ -30,10 +32,10 @@ LL | fn test(_: T, _: U) | ---- required by a bound in this LL | where T : Convert | ^^^^^^^^^^ required by this bound in `test` -help: consider specifying the type arguments in the function call +help: consider specifying the generic arguments | -LL | test::(22, std::default::Default::default()); - | ++++++++ +LL | test::(22, std::default::Default::default()); + | ++++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/negative-impls/explicitly-unimplemented-error-message.rs b/src/test/ui/traits/negative-impls/explicitly-unimplemented-error-message.rs index 1314f9cb0..17ddaa312 100644 --- a/src/test/ui/traits/negative-impls/explicitly-unimplemented-error-message.rs +++ b/src/test/ui/traits/negative-impls/explicitly-unimplemented-error-message.rs @@ -1,5 +1,5 @@ // This tests issue #79683: note in the error message that the trait is -// explicitely unimplemented instead of suggesting to implement it. +// explicitly unimplemented instead of suggesting to implement it. #![feature(negative_impls)] diff --git a/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr b/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr index c5d4ccc2f..41fc3600f 100644 --- a/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -61,12 +61,12 @@ error[E0277]: `dummy2::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:48:13 | LL | is_send(Box::new(TestType)); - | ------- ^^^^^^^^^^^^^^^^^^ expected an implementor of trait `Send` + | ------- ^^^^^^^^^^^^^^^^^^ the trait `Send` is not implemented for `Unique` | | | required by a bound introduced by this call | = note: the trait bound `Unique: Send` is not satisfied - = note: required because of the requirements on the impl of `Send` for `Unique` + = note: required for `Unique` to implement `Send` = note: required because it appears within the type `Box` note: required by a bound in `is_send` --> $DIR/negated-auto-traits-error.rs:16:15 @@ -92,7 +92,7 @@ note: required because it appears within the type `Outer2` | LL | struct Outer2(T); | ^^^^^^ - = note: required because of the requirements on the impl of `Send` for `Unique>` + = note: required for `Unique>` to implement `Send` = note: required because it appears within the type `Box>` note: required by a bound in `is_send` --> $DIR/negated-auto-traits-error.rs:16:15 @@ -109,7 +109,7 @@ LL | is_sync(Outer2(TestType)); | required by a bound introduced by this call | = help: the trait `Send` is not implemented for `main::TestType` -note: required because of the requirements on the impl of `Sync` for `Outer2` +note: required for `Outer2` to implement `Sync` --> $DIR/negated-auto-traits-error.rs:14:22 | LL | unsafe impl Sync for Outer2 {} diff --git a/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr index 75d45d905..53178328c 100644 --- a/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr +++ b/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr @@ -22,7 +22,7 @@ LL | impl I for B {} | ^^^^^^^^^^^^^^^^^ LL | impl I for B {} | ^^^^^^^^^^^^^^^^^ -note: required because of the requirements on the impl of `V<_>` for `A` +note: required for `A` to implement `V<_>` --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:12:12 | LL | impl V for A diff --git a/src/test/ui/traits/object/enforce-supertrait-projection.stderr b/src/test/ui/traits/object/enforce-supertrait-projection.stderr index eab42ca56..cbf093866 100644 --- a/src/test/ui/traits/object/enforce-supertrait-projection.stderr +++ b/src/test/ui/traits/object/enforce-supertrait-projection.stderr @@ -1,12 +1,12 @@ error[E0271]: type mismatch resolving ` as SuperTrait>::A == B` - --> $DIR/enforce-supertrait-projection.rs:9:5 + --> $DIR/enforce-supertrait-projection.rs:9:17 | LL | fn transmute(x: A) -> B { | - - expected type parameter | | | found type parameter LL | foo::>(x) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `B`, found type parameter `A` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `B`, found type parameter `A` | = note: expected type parameter `B` found type parameter `A` diff --git a/src/test/ui/traits/object/safety.stderr b/src/test/ui/traits/object/safety.stderr index cf534d984..dc18adeaf 100644 --- a/src/test/ui/traits/object/safety.stderr +++ b/src/test/ui/traits/object/safety.stderr @@ -11,7 +11,7 @@ LL | trait Tr { | -- this trait cannot be made into an object... LL | fn foo(); | ^^^ ...because associated function `foo` has no `self` parameter - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Tr>` for `&St` + = note: required for `&St` to implement `CoerceUnsized<&dyn Tr>` = note: required by cast to type `&dyn Tr` help: consider turning `foo` into a method by giving it a `&self` argument | diff --git a/src/test/ui/traits/pointee-tail-is-generic-errors.stderr b/src/test/ui/traits/pointee-tail-is-generic-errors.stderr index 8456f8456..0c3d7060d 100644 --- a/src/test/ui/traits/pointee-tail-is-generic-errors.stderr +++ b/src/test/ui/traits/pointee-tail-is-generic-errors.stderr @@ -1,8 +1,8 @@ error[E0271]: type mismatch resolving `::Metadata == ()` - --> $DIR/pointee-tail-is-generic-errors.rs:13:5 + --> $DIR/pointee-tail-is-generic-errors.rs:13:15 | LL | is_thin::(); - | ^^^^^^^^^^^^ expected `()`, found associated type + | ^ expected `()`, found associated type | = note: expected unit type `()` found associated type `::Metadata` @@ -15,13 +15,13 @@ LL | fn is_thin + ?Sized>() {} | ^^^^^^^^^^^^^ required by this bound in `is_thin` error[E0271]: type mismatch resolving `::Metadata == ()` - --> $DIR/pointee-tail-is-generic-errors.rs:16:5 + --> $DIR/pointee-tail-is-generic-errors.rs:16:15 | LL | type Opaque = impl std::fmt::Debug + ?Sized; | ----------------------------- the found opaque type ... LL | is_thin::(); - | ^^^^^^^^^^^^^^^^^ expected `()`, found associated type + | ^^^^^^ expected `()`, found associated type | = note: expected unit type `()` found associated type `::Metadata` diff --git a/src/test/ui/traits/resolution-in-overloaded-op.stderr b/src/test/ui/traits/resolution-in-overloaded-op.stderr index 34fae64e4..fe5e1d6d2 100644 --- a/src/test/ui/traits/resolution-in-overloaded-op.stderr +++ b/src/test/ui/traits/resolution-in-overloaded-op.stderr @@ -8,8 +8,8 @@ LL | a * b | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | fn foo>(a: &T, b: f64) -> f64 where &T: Mul { - | ++++++++++++++++++ +LL | fn foo>(a: &T, b: f64) -> f64 where &T: Mul { + | ++++++++++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/traits/suggest-deferences/issue-39029.stderr b/src/test/ui/traits/suggest-deferences/issue-39029.stderr index 5c324cd38..eb2b88059 100644 --- a/src/test/ui/traits/suggest-deferences/issue-39029.stderr +++ b/src/test/ui/traits/suggest-deferences/issue-39029.stderr @@ -2,18 +2,20 @@ error[E0277]: the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied --> $DIR/issue-39029.rs:16:37 | LL | let _errors = TcpListener::bind(&bad); - | ----------------- ^^^^ - | | | - | | the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` - | | help: consider dereferencing here: `&*bad` + | ----------------- ^^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` + | | | required by a bound introduced by this call | - = note: required because of the requirements on the impl of `ToSocketAddrs` for `&NoToSocketAddrs` + = note: required for `&NoToSocketAddrs` to implement `ToSocketAddrs` note: required by a bound in `TcpListener::bind` --> $SRC_DIR/std/src/net/tcp.rs:LL:COL | LL | pub fn bind(addr: A) -> io::Result { | ^^^^^^^^^^^^^ required by this bound in `TcpListener::bind` +help: consider dereferencing here + | +LL | let _errors = TcpListener::bind(&*bad); + | + error: aborting due to previous error diff --git a/src/test/ui/traits/suggest-deferences/issue-62530.stderr b/src/test/ui/traits/suggest-deferences/issue-62530.stderr index d129328da..e47ae0b65 100644 --- a/src/test/ui/traits/suggest-deferences/issue-62530.stderr +++ b/src/test/ui/traits/suggest-deferences/issue-62530.stderr @@ -2,10 +2,8 @@ error[E0277]: the trait bound `&String: SomeTrait` is not satisfied --> $DIR/issue-62530.rs:13:26 | LL | takes_type_parameter(&string); // Error - | -------------------- ^^^^^^^ - | | | - | | the trait `SomeTrait` is not implemented for `&String` - | | help: consider dereferencing here: `&*string` + | -------------------- ^^^^^^^ the trait `SomeTrait` is not implemented for `&String` + | | | required by a bound introduced by this call | note: required by a bound in `takes_type_parameter` @@ -13,6 +11,10 @@ note: required by a bound in `takes_type_parameter` | LL | fn takes_type_parameter(_x: T) where T: SomeTrait {} | ^^^^^^^^^ required by this bound in `takes_type_parameter` +help: consider dereferencing here + | +LL | takes_type_parameter(&*string); // Error + | + error: aborting due to previous error diff --git a/src/test/ui/traits/suggest-deferences/multiple-0.stderr b/src/test/ui/traits/suggest-deferences/multiple-0.stderr index efb3c7d12..6a4d4b8d5 100644 --- a/src/test/ui/traits/suggest-deferences/multiple-0.stderr +++ b/src/test/ui/traits/suggest-deferences/multiple-0.stderr @@ -2,10 +2,8 @@ error[E0277]: the trait bound `&Baz: Happy` is not satisfied --> $DIR/multiple-0.rs:34:9 | LL | foo(&baz); - | --- ^^^^ - | | | - | | the trait `Happy` is not implemented for `&Baz` - | | help: consider dereferencing here: `&***baz` + | --- ^^^^ the trait `Happy` is not implemented for `&Baz` + | | | required by a bound introduced by this call | note: required by a bound in `foo` @@ -13,6 +11,10 @@ note: required by a bound in `foo` | LL | fn foo(_: T) where T: Happy {} | ^^^^^ required by this bound in `foo` +help: consider dereferencing here + | +LL | foo(&***baz); + | +++ error: aborting due to previous error diff --git a/src/test/ui/traits/suggest-deferences/root-obligation.stderr b/src/test/ui/traits/suggest-deferences/root-obligation.stderr index 16e03e79c..76663ace7 100644 --- a/src/test/ui/traits/suggest-deferences/root-obligation.stderr +++ b/src/test/ui/traits/suggest-deferences/root-obligation.stderr @@ -7,8 +7,8 @@ LL | .filter(|c| "aeiou".contains(c)) | required by a bound introduced by this call | = help: the trait `Fn<(char,)>` is not implemented for `char` - = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&char` - = note: required because of the requirements on the impl of `Pattern<'_>` for `&char` + = note: required for `&char` to implement `FnOnce<(char,)>` + = note: required for `&char` to implement `Pattern<'_>` note: required by a bound in `core::str::::contains` --> $SRC_DIR/core/src/str/mod.rs:LL:COL | diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index d4d9b4967..747e2477b 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -19,13 +19,13 @@ LL + fn check() { | error[E0277]: the size for values of type `U` cannot be known at compilation time - --> $DIR/suggest-where-clause.rs:10:5 + --> $DIR/suggest-where-clause.rs:10:20 | LL | fn check() { | - this type parameter needs to be `std::marker::Sized` ... LL | mem::size_of::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^ doesn't have a size known at compile-time | note: required because it appears within the type `Misc` --> $DIR/suggest-where-clause.rs:3:8 diff --git a/src/test/ui/traits/test-2.stderr b/src/test/ui/traits/test-2.stderr index 77ea4e4e9..eaa20b0b4 100644 --- a/src/test/ui/traits/test-2.stderr +++ b/src/test/ui/traits/test-2.stderr @@ -76,7 +76,7 @@ LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | this trait cannot be made into an object... = help: consider moving `dup` to another trait = help: consider moving `blah` to another trait - = note: required because of the requirements on the impl of `CoerceUnsized>` for `Box<{integer}>` + = note: required for `Box<{integer}>` to implement `CoerceUnsized>` = note: required by cast to type `Box` error: aborting due to 5 previous errors diff --git a/src/test/ui/traits/trait-upcasting/subtrait-method.stderr b/src/test/ui/traits/trait-upcasting/subtrait-method.stderr index 8c6901180..af7a410f6 100644 --- a/src/test/ui/traits/trait-upcasting/subtrait-method.stderr +++ b/src/test/ui/traits/trait-upcasting/subtrait-method.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `c` found for reference `&dyn Bar` in the current --> $DIR/subtrait-method.rs:56:9 | LL | bar.c(); - | ^ help: there is an associated function with a similar name: `a` + | ^ help: there is a method with a similar name: `a` | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it @@ -15,7 +15,7 @@ error[E0599]: no method named `b` found for reference `&dyn Foo` in the current --> $DIR/subtrait-method.rs:60:9 | LL | foo.b(); - | ^ help: there is an associated function with a similar name: `a` + | ^ help: there is a method with a similar name: `a` | = help: items from traits can only be used if the trait is implemented and in scope note: `Bar` defines an item `b`, perhaps you need to implement it @@ -28,7 +28,7 @@ error[E0599]: no method named `c` found for reference `&dyn Foo` in the current --> $DIR/subtrait-method.rs:62:9 | LL | foo.c(); - | ^ help: there is an associated function with a similar name: `a` + | ^ help: there is a method with a similar name: `a` | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it @@ -41,7 +41,7 @@ error[E0599]: no method named `b` found for reference `&dyn Foo` in the current --> $DIR/subtrait-method.rs:66:9 | LL | foo.b(); - | ^ help: there is an associated function with a similar name: `a` + | ^ help: there is a method with a similar name: `a` | = help: items from traits can only be used if the trait is implemented and in scope note: `Bar` defines an item `b`, perhaps you need to implement it @@ -54,7 +54,7 @@ error[E0599]: no method named `c` found for reference `&dyn Foo` in the current --> $DIR/subtrait-method.rs:68:9 | LL | foo.c(); - | ^ help: there is an associated function with a similar name: `a` + | ^ help: there is a method with a similar name: `a` | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it diff --git a/src/test/ui/traits/unspecified-self-in-trait-ref.rs b/src/test/ui/traits/unspecified-self-in-trait-ref.rs new file mode 100644 index 000000000..158b5a985 --- /dev/null +++ b/src/test/ui/traits/unspecified-self-in-trait-ref.rs @@ -0,0 +1,30 @@ +pub trait Foo { + fn foo(&self); +} + +pub trait Bar { + fn foo(&self); +} + +fn main() { + let a = Foo::lol(); + //~^ ERROR no function or associated item named + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition + let b = Foo::<_>::lol(); + //~^ ERROR no function or associated item named + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition + let c = Bar::lol(); + //~^ ERROR no function or associated item named + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition + let d = Bar::::lol(); + //~^ ERROR no function or associated item named + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition + let e = Bar::::lol(); + //~^ ERROR must be explicitly specified + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition +} diff --git a/src/test/ui/traits/unspecified-self-in-trait-ref.stderr b/src/test/ui/traits/unspecified-self-in-trait-ref.stderr new file mode 100644 index 000000000..7869176bb --- /dev/null +++ b/src/test/ui/traits/unspecified-self-in-trait-ref.stderr @@ -0,0 +1,105 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/unspecified-self-in-trait-ref.rs:10:13 + | +LL | let a = Foo::lol(); + | ^^^ + | + = note: `#[warn(bare_trait_objects)]` on by default + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL | let a = ::lol(); + | ++++ + + +error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope + --> $DIR/unspecified-self-in-trait-ref.rs:10:18 + | +LL | let a = Foo::lol(); + | ^^^ function or associated item not found in `dyn Foo<_>` + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/unspecified-self-in-trait-ref.rs:14:13 + | +LL | let b = Foo::<_>::lol(); + | ^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL | let b = >::lol(); + | ++++ + + +error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope + --> $DIR/unspecified-self-in-trait-ref.rs:14:23 + | +LL | let b = Foo::<_>::lol(); + | ^^^ function or associated item not found in `dyn Foo<_>` + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/unspecified-self-in-trait-ref.rs:18:13 + | +LL | let c = Bar::lol(); + | ^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL | let c = ::lol(); + | ++++ + + +error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar<_, _>` in the current scope + --> $DIR/unspecified-self-in-trait-ref.rs:18:18 + | +LL | let c = Bar::lol(); + | ^^^ function or associated item not found in `dyn Bar<_, _>` + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/unspecified-self-in-trait-ref.rs:22:13 + | +LL | let d = Bar::::lol(); + | ^^^^^^^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL | let d = >::lol(); + | ++++ + + +error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar` in the current scope + --> $DIR/unspecified-self-in-trait-ref.rs:22:30 + | +LL | let d = Bar::::lol(); + | ^^^ function or associated item not found in `dyn Bar` + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/unspecified-self-in-trait-ref.rs:26:13 + | +LL | let e = Bar::::lol(); + | ^^^^^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see +help: use `dyn` + | +LL | let e = >::lol(); + | ++++ + + +error[E0393]: the type parameter `A` must be explicitly specified + --> $DIR/unspecified-self-in-trait-ref.rs:26:13 + | +LL | pub trait Bar { + | ------------------------------ type parameter `A` must be specified for this +... +LL | let e = Bar::::lol(); + | ^^^^^^^^^^^^ missing reference to `A` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error: aborting due to 5 previous errors; 5 warnings emitted + +Some errors have detailed explanations: E0393, E0599. +For more information about an error, try `rustc --explain E0393`. diff --git a/src/test/ui/transmutability/abstraction/abstracted_assume.rs b/src/test/ui/transmutability/abstraction/abstracted_assume.rs index 2abbbf3c1..0225c4230 100644 --- a/src/test/ui/transmutability/abstraction/abstracted_assume.rs +++ b/src/test/ui/transmutability/abstraction/abstracted_assume.rs @@ -3,6 +3,7 @@ //! provided indirectly through an abstraction. #![crate_type = "lib"] +#![feature(adt_const_params)] #![feature(transmutability)] #![allow(dead_code, incomplete_features, non_camel_case_types)] @@ -13,19 +14,13 @@ mod assert { Src, Dst, Context, - const ASSUME_ALIGNMENT: bool, - const ASSUME_LIFETIMES: bool, - const ASSUME_VALIDITY: bool, - const ASSUME_VISIBILITY: bool, + const ASSUME: std::mem::Assume, >() where Dst: BikeshedIntrinsicFrom< Src, Context, - ASSUME_ALIGNMENT, - ASSUME_LIFETIMES, - ASSUME_VALIDITY, - ASSUME_VISIBILITY, + ASSUME, >, {} } @@ -35,7 +30,7 @@ fn direct() { #[repr(C)] struct Src; #[repr(C)] struct Dst; - assert::is_transmutable::(); + assert::is_transmutable::(); } fn via_const() { @@ -45,7 +40,7 @@ fn via_const() { const FALSE: bool = false; - assert::is_transmutable::(); + assert::is_transmutable::(); } fn via_associated_const() { @@ -65,9 +60,13 @@ fn via_associated_const() { Src, Dst, Context, - {Ty::FALSE}, - {Ty::FALSE}, - {Ty::FALSE}, - {Ty::FALSE} + { + std::mem::Assume { + alignment: {Ty::FALSE}, + lifetimes: {Ty::FALSE}, + safety: {Ty::FALSE}, + validity: {Ty::FALSE}, + } + } >(); } diff --git a/src/test/ui/transmutability/abstraction/const_generic_fn.rs b/src/test/ui/transmutability/abstraction/const_generic_fn.rs index 94c38bb28..e693a0957 100644 --- a/src/test/ui/transmutability/abstraction/const_generic_fn.rs +++ b/src/test/ui/transmutability/abstraction/const_generic_fn.rs @@ -6,13 +6,13 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn array_like() where - T: BikeshedIntrinsicFrom<[E; N], Context, false, false, false, true>, - [E; N]: BikeshedIntrinsicFrom + T: BikeshedIntrinsicFrom<[E; N], Context, { Assume::SAFETY }>, + [E; N]: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/arrays/should_have_correct_length.rs b/src/test/ui/transmutability/arrays/should_have_correct_length.rs index bfe6d830a..353797d0c 100644 --- a/src/test/ui/transmutability/arrays/should_have_correct_length.rs +++ b/src/test/ui/transmutability/arrays/should_have_correct_length.rs @@ -6,12 +6,12 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/arrays/should_inherit_alignment.rs b/src/test/ui/transmutability/arrays/should_inherit_alignment.rs index fcb1765ea..b00e5c7e4 100644 --- a/src/test/ui/transmutability/arrays/should_inherit_alignment.rs +++ b/src/test/ui/transmutability/arrays/should_inherit_alignment.rs @@ -6,12 +6,17 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/arrays/should_require_well_defined_layout.rs b/src/test/ui/transmutability/arrays/should_require_well_defined_layout.rs index 8e69527c1..853bd9cbc 100644 --- a/src/test/ui/transmutability/arrays/should_require_well_defined_layout.rs +++ b/src/test/ui/transmutability/arrays/should_require_well_defined_layout.rs @@ -5,12 +5,17 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/arrays/should_require_well_defined_layout.stderr b/src/test/ui/transmutability/arrays/should_require_well_defined_layout.stderr index eae0c947d..96a2fdc54 100644 --- a/src/test/ui/transmutability/arrays/should_require_well_defined_layout.stderr +++ b/src/test/ui/transmutability/arrays/should_require_well_defined_layout.stderr @@ -1,98 +1,134 @@ error[E0277]: `[String; 0]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:21:52 + --> $DIR/should_require_well_defined_layout.rs:26:52 | LL | assert::is_maybe_transmutable::(); | ^^ `[String; 0]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom<[String; 0], assert::Context, true, true, true, true>` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom<[String; 0], assert::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `[String; 0]` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:22:47 + --> $DIR/should_require_well_defined_layout.rs:27:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `[String; 0]` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[String; 0]` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[String; 0]` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `[String; 1]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:27:52 + --> $DIR/should_require_well_defined_layout.rs:32:52 | LL | assert::is_maybe_transmutable::(); | ^^ `[String; 1]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom<[String; 1], assert::Context, true, true, true, true>` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom<[String; 1], assert::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `[String; 1]` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:28:47 + --> $DIR/should_require_well_defined_layout.rs:33:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `[String; 1]` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[String; 1]` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[String; 1]` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `[String; 2]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:33:52 + --> $DIR/should_require_well_defined_layout.rs:38:52 | LL | assert::is_maybe_transmutable::(); | ^^ `[String; 2]` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom<[String; 2], assert::Context, true, true, true, true>` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom<[String; 2], assert::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `[String; 2]` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:34:47 + --> $DIR/should_require_well_defined_layout.rs:39:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `[String; 2]` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[String; 2]` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[String; 2]` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error: aborting due to 6 previous errors diff --git a/src/test/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs b/src/test/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs index 18e02b0d2..940f070e7 100644 --- a/src/test/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs +++ b/src/test/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs @@ -5,11 +5,18 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr b/src/test/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr index fa2e3b89b..4da5fcea3 100644 --- a/src/test/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr +++ b/src/test/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr @@ -1,322 +1,462 @@ error[E0277]: `Zst` cannot be safely transmuted into `V0i8` in the defining scope of `n8::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:41:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:48:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `Zst` cannot be safely transmuted into `V0i8` in the defining scope of `n8::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i8` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i8` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0i8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:43:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:50:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0i8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `Zst` cannot be safely transmuted into `V0u8` in the defining scope of `n8::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:49:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:56:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `Zst` cannot be safely transmuted into `V0u8` in the defining scope of `n8::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u8` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u8` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0u8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:51:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:58:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0u8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `V0i16` in the defining scope of `n16::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:65:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:72:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `u8` cannot be safely transmuted into `V0i16` in the defining scope of `n16::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i16` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i16` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0i16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:67:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:74:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0i16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `V0u16` in the defining scope of `n16::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:73:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:80:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `u8` cannot be safely transmuted into `V0u16` in the defining scope of `n16::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u16` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u16` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0u16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:75:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:82:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0u16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `V0i32` in the defining scope of `n32::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:89:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:96:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `u16` cannot be safely transmuted into `V0i32` in the defining scope of `n32::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i32` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0i32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:91:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:98:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0i32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `V0u32` in the defining scope of `n32::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:97:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:104:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `u16` cannot be safely transmuted into `V0u32` in the defining scope of `n32::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u32` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0u32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:99:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:106:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0u32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `V0i64` in the defining scope of `n64::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:113:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:120:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `u32` cannot be safely transmuted into `V0i64` in the defining scope of `n64::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i64` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0i64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:115:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:122:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0i64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `V0u64` in the defining scope of `n64::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:121:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:128:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `u32` cannot be safely transmuted into `V0u64` in the defining scope of `n64::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u64` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0u64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:123:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:130:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0u64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `V0isize` in the defining scope of `nsize::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:137:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:144:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `u8` cannot be safely transmuted into `V0isize` in the defining scope of `nsize::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0isize` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0isize` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0isize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:139:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:146:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0isize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[usize; 2]` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[usize; 2]` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `V0usize` in the defining scope of `nsize::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:145:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:152:44 | LL | assert::is_transmutable::(); | ^^^^^^^ `u8` cannot be safely transmuted into `V0usize` in the defining scope of `nsize::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0usize` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0usize` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error[E0277]: `V0usize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. - --> $DIR/primitive_reprs_should_have_correct_length.rs:147:44 + --> $DIR/primitive_reprs_should_have_correct_length.rs:154:44 | LL | assert::is_transmutable::(); | ^^^^^^ `V0usize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[usize; 2]` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[usize; 2]` note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error: aborting due to 20 previous errors diff --git a/src/test/ui/transmutability/enums/repr/should_require_well_defined_layout.rs b/src/test/ui/transmutability/enums/repr/should_require_well_defined_layout.rs index 978a12648..102111ae2 100644 --- a/src/test/ui/transmutability/enums/repr/should_require_well_defined_layout.rs +++ b/src/test/ui/transmutability/enums/repr/should_require_well_defined_layout.rs @@ -6,12 +6,19 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr b/src/test/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr index 3273e87c8..510b8c56e 100644 --- a/src/test/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr +++ b/src/test/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr @@ -1,98 +1,140 @@ error[E0277]: `void::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:21:52 + --> $DIR/should_require_well_defined_layout.rs:28:52 | LL | assert::is_maybe_transmutable::(); | ^^ `void::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | -LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `void::repr_rust` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:22:47 + --> $DIR/should_require_well_defined_layout.rs:29:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `void::repr_rust` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `void::repr_rust` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `void::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | -LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `singleton::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:27:52 + --> $DIR/should_require_well_defined_layout.rs:34:52 | LL | assert::is_maybe_transmutable::(); | ^^ `singleton::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | -LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `singleton::repr_rust` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:28:47 + --> $DIR/should_require_well_defined_layout.rs:35:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `singleton::repr_rust` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `singleton::repr_rust` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `singleton::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | -LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `duplex::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:33:52 + --> $DIR/should_require_well_defined_layout.rs:40:52 | LL | assert::is_maybe_transmutable::(); | ^^ `duplex::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | -LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `duplex::repr_rust` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:34:47 + --> $DIR/should_require_well_defined_layout.rs:41:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `duplex::repr_rust` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `duplex::repr_rust` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `duplex::repr_rust` note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:14:14 | -LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error: aborting due to 6 previous errors diff --git a/src/test/ui/transmutability/enums/should_order_correctly.rs b/src/test/ui/transmutability/enums/should_order_correctly.rs index 6558d2658..b753cf0e6 100644 --- a/src/test/ui/transmutability/enums/should_order_correctly.rs +++ b/src/test/ui/transmutability/enums/should_order_correctly.rs @@ -7,12 +7,17 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/enums/should_pad_variants.rs b/src/test/ui/transmutability/enums/should_pad_variants.rs index 466b6c8a1..c077c52a3 100644 --- a/src/test/ui/transmutability/enums/should_pad_variants.rs +++ b/src/test/ui/transmutability/enums/should_pad_variants.rs @@ -6,11 +6,16 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/enums/should_pad_variants.stderr b/src/test/ui/transmutability/enums/should_pad_variants.stderr index 429f7211d..a823503d5 100644 --- a/src/test/ui/transmutability/enums/should_pad_variants.stderr +++ b/src/test/ui/transmutability/enums/should_pad_variants.stderr @@ -1,18 +1,24 @@ error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context`. - --> $DIR/should_pad_variants.rs:39:36 + --> $DIR/should_pad_variants.rs:44:36 | LL | assert::is_transmutable::(); | ^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` note: required by a bound in `is_transmutable` --> $DIR/should_pad_variants.rs:13:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/enums/should_respect_endianness.rs b/src/test/ui/transmutability/enums/should_respect_endianness.rs index 67a3c4e94..19ff69005 100644 --- a/src/test/ui/transmutability/enums/should_respect_endianness.rs +++ b/src/test/ui/transmutability/enums/should_respect_endianness.rs @@ -7,12 +7,17 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/enums/should_respect_endianness.stderr b/src/test/ui/transmutability/enums/should_respect_endianness.stderr index 78023cb37..fcb70813b 100644 --- a/src/test/ui/transmutability/enums/should_respect_endianness.stderr +++ b/src/test/ui/transmutability/enums/should_respect_endianness.stderr @@ -1,18 +1,24 @@ error[E0277]: `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context`. - --> $DIR/should_respect_endianness.rs:32:36 + --> $DIR/should_respect_endianness.rs:37:36 | LL | assert::is_transmutable::(); | ^^^^^^^^^^ `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Unexpected` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Unexpected` note: required by a bound in `is_transmutable` --> $DIR/should_respect_endianness.rs:15:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs index e13462d39..b3a1e13b8 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs +++ b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs @@ -10,7 +10,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src.rs b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src.rs index dc51e2a8f..092b205b7 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src.rs +++ b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src.rs @@ -10,7 +10,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs index 86fc8bd6b..ebe34e134 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs +++ b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs @@ -10,7 +10,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs b/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs index bd36748e7..354abf99d 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs +++ b/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs @@ -2,11 +2,13 @@ //! provided. #![crate_type = "lib"] +#![feature(adt_const_params)] +#![feature(generic_const_exprs)] #![feature(transmutability)] #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable< Src, @@ -14,19 +16,34 @@ mod assert { Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, + const ASSUME_SAFETY: bool, const ASSUME_VALIDITY: bool, - const ASSUME_VISIBILITY: bool, >() where Dst: BikeshedIntrinsicFrom< Src, Context, - ASSUME_ALIGNMENT, - ASSUME_LIFETIMES, - ASSUME_VALIDITY, - ASSUME_VISIBILITY, + { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + //~^ ERROR E0080 + //~| ERROR E0080 + //~| ERROR E0080 + //~| ERROR E0080 >, {} + + const fn from_options( + alignment: bool, + lifetimes: bool, + safety: bool, + validity: bool, + ) -> Assume { + Assume { + alignment, + lifetimes, + safety, + validity, + } + } } fn test() { diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr b/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr index e1464e023..a258f2ece 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr +++ b/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr @@ -1,27 +1,52 @@ error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:36:51 + --> $DIR/wrong-type-assume.rs:53:51 | LL | assert::is_transmutable::(); | ^^^ expected `bool`, found `u8` +error[E0080]: evaluation of `assert::is_transmutable::::{constant#0}` failed + --> $DIR/wrong-type-assume.rs:26:15 + | +LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:37:58 + --> $DIR/wrong-type-assume.rs:54:58 | LL | assert::is_transmutable::(); | ^^^ expected `bool`, found `u8` +error[E0080]: evaluation of `assert::is_transmutable::::{constant#0}` failed + --> $DIR/wrong-type-assume.rs:26:15 + | +LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:38:65 + --> $DIR/wrong-type-assume.rs:55:65 | LL | assert::is_transmutable::(); | ^^^ expected `bool`, found `u8` +error[E0080]: evaluation of `assert::is_transmutable::::{constant#0}` failed + --> $DIR/wrong-type-assume.rs:26:15 + | +LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:39:72 + --> $DIR/wrong-type-assume.rs:56:72 | LL | assert::is_transmutable::(); | ^^^ expected `bool`, found `u8` -error: aborting due to 4 previous errors +error[E0080]: evaluation of `assert::is_transmutable::::{constant#0}` failed + --> $DIR/wrong-type-assume.rs:26:15 + | +LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + +error: aborting due to 8 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0080, E0308. +For more information about an error, try `rustc --explain E0080`. diff --git a/src/test/ui/transmutability/primitives/bool.rs b/src/test/ui/transmutability/primitives/bool.rs index 4f79bc253..eebb74fff 100644 --- a/src/test/ui/transmutability/primitives/bool.rs +++ b/src/test/ui/transmutability/primitives/bool.rs @@ -4,17 +4,17 @@ #![allow(incomplete_features)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/primitives/bool.stderr b/src/test/ui/transmutability/primitives/bool.stderr index dc740251c..214b5e150 100644 --- a/src/test/ui/transmutability/primitives/bool.stderr +++ b/src/test/ui/transmutability/primitives/bool.stderr @@ -4,15 +4,15 @@ error[E0277]: `u8` cannot be safely transmuted into `bool` in the defining scope LL | assert::is_transmutable::(); | ^^^^ `u8` cannot be safely transmuted into `bool` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `bool` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `bool` note: required by a bound in `is_transmutable` --> $DIR/bool.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/primitives/numbers.rs b/src/test/ui/transmutability/primitives/numbers.rs index a5f79065d..0df43d204 100644 --- a/src/test/ui/transmutability/primitives/numbers.rs +++ b/src/test/ui/transmutability/primitives/numbers.rs @@ -9,7 +9,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/primitives/numbers.stderr b/src/test/ui/transmutability/primitives/numbers.stderr index 9b802a444..7cb7ca8e6 100644 --- a/src/test/ui/transmutability/primitives/numbers.stderr +++ b/src/test/ui/transmutability/primitives/numbers.stderr @@ -4,15 +4,15 @@ error[E0277]: `i8` cannot be safely transmuted into `i16` in the defining scope LL | assert::is_transmutable::< i8, i16>(); | ^^^ `i8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i16` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i16` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:63:40 @@ -20,15 +20,15 @@ error[E0277]: `i8` cannot be safely transmuted into `u16` in the defining scope LL | assert::is_transmutable::< i8, u16>(); | ^^^ `i8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:64:40 @@ -36,15 +36,15 @@ error[E0277]: `i8` cannot be safely transmuted into `i32` in the defining scope LL | assert::is_transmutable::< i8, i32>(); | ^^^ `i8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:65:40 @@ -52,15 +52,15 @@ error[E0277]: `i8` cannot be safely transmuted into `f32` in the defining scope LL | assert::is_transmutable::< i8, f32>(); | ^^^ `i8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:66:40 @@ -68,15 +68,15 @@ error[E0277]: `i8` cannot be safely transmuted into `u32` in the defining scope LL | assert::is_transmutable::< i8, u32>(); | ^^^ `i8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:67:40 @@ -84,15 +84,15 @@ error[E0277]: `i8` cannot be safely transmuted into `u64` in the defining scope LL | assert::is_transmutable::< i8, u64>(); | ^^^ `i8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:68:40 @@ -100,15 +100,15 @@ error[E0277]: `i8` cannot be safely transmuted into `i64` in the defining scope LL | assert::is_transmutable::< i8, i64>(); | ^^^ `i8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:69:40 @@ -116,15 +116,15 @@ error[E0277]: `i8` cannot be safely transmuted into `f64` in the defining scope LL | assert::is_transmutable::< i8, f64>(); | ^^^ `i8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:70:39 @@ -132,15 +132,15 @@ error[E0277]: `i8` cannot be safely transmuted into `u128` in the defining scope LL | assert::is_transmutable::< i8, u128>(); | ^^^^ `i8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:71:39 @@ -148,15 +148,15 @@ error[E0277]: `i8` cannot be safely transmuted into `i128` in the defining scope LL | assert::is_transmutable::< i8, i128>(); | ^^^^ `i8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:73:40 @@ -164,15 +164,15 @@ error[E0277]: `u8` cannot be safely transmuted into `i16` in the defining scope LL | assert::is_transmutable::< u8, i16>(); | ^^^ `u8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i16` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i16` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:74:40 @@ -180,15 +180,15 @@ error[E0277]: `u8` cannot be safely transmuted into `u16` in the defining scope LL | assert::is_transmutable::< u8, u16>(); | ^^^ `u8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:75:40 @@ -196,15 +196,15 @@ error[E0277]: `u8` cannot be safely transmuted into `i32` in the defining scope LL | assert::is_transmutable::< u8, i32>(); | ^^^ `u8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:76:40 @@ -212,15 +212,15 @@ error[E0277]: `u8` cannot be safely transmuted into `f32` in the defining scope LL | assert::is_transmutable::< u8, f32>(); | ^^^ `u8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:77:40 @@ -228,15 +228,15 @@ error[E0277]: `u8` cannot be safely transmuted into `u32` in the defining scope LL | assert::is_transmutable::< u8, u32>(); | ^^^ `u8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:78:40 @@ -244,15 +244,15 @@ error[E0277]: `u8` cannot be safely transmuted into `u64` in the defining scope LL | assert::is_transmutable::< u8, u64>(); | ^^^ `u8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:79:40 @@ -260,15 +260,15 @@ error[E0277]: `u8` cannot be safely transmuted into `i64` in the defining scope LL | assert::is_transmutable::< u8, i64>(); | ^^^ `u8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:80:40 @@ -276,15 +276,15 @@ error[E0277]: `u8` cannot be safely transmuted into `f64` in the defining scope LL | assert::is_transmutable::< u8, f64>(); | ^^^ `u8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:81:39 @@ -292,15 +292,15 @@ error[E0277]: `u8` cannot be safely transmuted into `u128` in the defining scope LL | assert::is_transmutable::< u8, u128>(); | ^^^^ `u8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:82:39 @@ -308,15 +308,15 @@ error[E0277]: `u8` cannot be safely transmuted into `i128` in the defining scope LL | assert::is_transmutable::< u8, i128>(); | ^^^^ `u8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:84:40 @@ -324,15 +324,15 @@ error[E0277]: `i16` cannot be safely transmuted into `i32` in the defining scope LL | assert::is_transmutable::< i16, i32>(); | ^^^ `i16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:85:40 @@ -340,15 +340,15 @@ error[E0277]: `i16` cannot be safely transmuted into `f32` in the defining scope LL | assert::is_transmutable::< i16, f32>(); | ^^^ `i16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:86:40 @@ -356,15 +356,15 @@ error[E0277]: `i16` cannot be safely transmuted into `u32` in the defining scope LL | assert::is_transmutable::< i16, u32>(); | ^^^ `i16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:87:40 @@ -372,15 +372,15 @@ error[E0277]: `i16` cannot be safely transmuted into `u64` in the defining scope LL | assert::is_transmutable::< i16, u64>(); | ^^^ `i16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:88:40 @@ -388,15 +388,15 @@ error[E0277]: `i16` cannot be safely transmuted into `i64` in the defining scope LL | assert::is_transmutable::< i16, i64>(); | ^^^ `i16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:89:40 @@ -404,15 +404,15 @@ error[E0277]: `i16` cannot be safely transmuted into `f64` in the defining scope LL | assert::is_transmutable::< i16, f64>(); | ^^^ `i16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:90:39 @@ -420,15 +420,15 @@ error[E0277]: `i16` cannot be safely transmuted into `u128` in the defining scop LL | assert::is_transmutable::< i16, u128>(); | ^^^^ `i16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:91:39 @@ -436,15 +436,15 @@ error[E0277]: `i16` cannot be safely transmuted into `i128` in the defining scop LL | assert::is_transmutable::< i16, i128>(); | ^^^^ `i16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:93:40 @@ -452,15 +452,15 @@ error[E0277]: `u16` cannot be safely transmuted into `i32` in the defining scope LL | assert::is_transmutable::< u16, i32>(); | ^^^ `u16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:94:40 @@ -468,15 +468,15 @@ error[E0277]: `u16` cannot be safely transmuted into `f32` in the defining scope LL | assert::is_transmutable::< u16, f32>(); | ^^^ `u16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:95:40 @@ -484,15 +484,15 @@ error[E0277]: `u16` cannot be safely transmuted into `u32` in the defining scope LL | assert::is_transmutable::< u16, u32>(); | ^^^ `u16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:96:40 @@ -500,15 +500,15 @@ error[E0277]: `u16` cannot be safely transmuted into `u64` in the defining scope LL | assert::is_transmutable::< u16, u64>(); | ^^^ `u16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:97:40 @@ -516,15 +516,15 @@ error[E0277]: `u16` cannot be safely transmuted into `i64` in the defining scope LL | assert::is_transmutable::< u16, i64>(); | ^^^ `u16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:98:40 @@ -532,15 +532,15 @@ error[E0277]: `u16` cannot be safely transmuted into `f64` in the defining scope LL | assert::is_transmutable::< u16, f64>(); | ^^^ `u16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:99:39 @@ -548,15 +548,15 @@ error[E0277]: `u16` cannot be safely transmuted into `u128` in the defining scop LL | assert::is_transmutable::< u16, u128>(); | ^^^^ `u16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:100:39 @@ -564,15 +564,15 @@ error[E0277]: `u16` cannot be safely transmuted into `i128` in the defining scop LL | assert::is_transmutable::< u16, i128>(); | ^^^^ `u16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:102:40 @@ -580,15 +580,15 @@ error[E0277]: `i32` cannot be safely transmuted into `u64` in the defining scope LL | assert::is_transmutable::< i32, u64>(); | ^^^ `i32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:103:40 @@ -596,15 +596,15 @@ error[E0277]: `i32` cannot be safely transmuted into `i64` in the defining scope LL | assert::is_transmutable::< i32, i64>(); | ^^^ `i32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:104:40 @@ -612,15 +612,15 @@ error[E0277]: `i32` cannot be safely transmuted into `f64` in the defining scope LL | assert::is_transmutable::< i32, f64>(); | ^^^ `i32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:105:39 @@ -628,15 +628,15 @@ error[E0277]: `i32` cannot be safely transmuted into `u128` in the defining scop LL | assert::is_transmutable::< i32, u128>(); | ^^^^ `i32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:106:39 @@ -644,15 +644,15 @@ error[E0277]: `i32` cannot be safely transmuted into `i128` in the defining scop LL | assert::is_transmutable::< i32, i128>(); | ^^^^ `i32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:108:40 @@ -660,15 +660,15 @@ error[E0277]: `f32` cannot be safely transmuted into `u64` in the defining scope LL | assert::is_transmutable::< f32, u64>(); | ^^^ `f32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:109:40 @@ -676,15 +676,15 @@ error[E0277]: `f32` cannot be safely transmuted into `i64` in the defining scope LL | assert::is_transmutable::< f32, i64>(); | ^^^ `f32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:110:40 @@ -692,15 +692,15 @@ error[E0277]: `f32` cannot be safely transmuted into `f64` in the defining scope LL | assert::is_transmutable::< f32, f64>(); | ^^^ `f32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:111:39 @@ -708,15 +708,15 @@ error[E0277]: `f32` cannot be safely transmuted into `u128` in the defining scop LL | assert::is_transmutable::< f32, u128>(); | ^^^^ `f32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:112:39 @@ -724,15 +724,15 @@ error[E0277]: `f32` cannot be safely transmuted into `i128` in the defining scop LL | assert::is_transmutable::< f32, i128>(); | ^^^^ `f32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:114:40 @@ -740,15 +740,15 @@ error[E0277]: `u32` cannot be safely transmuted into `u64` in the defining scope LL | assert::is_transmutable::< u32, u64>(); | ^^^ `u32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:115:40 @@ -756,15 +756,15 @@ error[E0277]: `u32` cannot be safely transmuted into `i64` in the defining scope LL | assert::is_transmutable::< u32, i64>(); | ^^^ `u32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:116:40 @@ -772,15 +772,15 @@ error[E0277]: `u32` cannot be safely transmuted into `f64` in the defining scope LL | assert::is_transmutable::< u32, f64>(); | ^^^ `u32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `f64` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:117:39 @@ -788,15 +788,15 @@ error[E0277]: `u32` cannot be safely transmuted into `u128` in the defining scop LL | assert::is_transmutable::< u32, u128>(); | ^^^^ `u32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:118:39 @@ -804,15 +804,15 @@ error[E0277]: `u32` cannot be safely transmuted into `i128` in the defining scop LL | assert::is_transmutable::< u32, i128>(); | ^^^^ `u32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:120:39 @@ -820,15 +820,15 @@ error[E0277]: `u64` cannot be safely transmuted into `u128` in the defining scop LL | assert::is_transmutable::< u64, u128>(); | ^^^^ `u64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:121:39 @@ -836,15 +836,15 @@ error[E0277]: `u64` cannot be safely transmuted into `i128` in the defining scop LL | assert::is_transmutable::< u64, i128>(); | ^^^^ `u64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:123:39 @@ -852,15 +852,15 @@ error[E0277]: `i64` cannot be safely transmuted into `u128` in the defining scop LL | assert::is_transmutable::< i64, u128>(); | ^^^^ `i64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:124:39 @@ -868,15 +868,15 @@ error[E0277]: `i64` cannot be safely transmuted into `i128` in the defining scop LL | assert::is_transmutable::< i64, i128>(); | ^^^^ `i64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:126:39 @@ -884,15 +884,15 @@ error[E0277]: `f64` cannot be safely transmuted into `u128` in the defining scop LL | assert::is_transmutable::< f64, u128>(); | ^^^^ `f64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. --> $DIR/numbers.rs:127:39 @@ -900,15 +900,15 @@ error[E0277]: `f64` cannot be safely transmuted into `i128` in the defining scop LL | assert::is_transmutable::< f64, i128>(); | ^^^^ `f64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `i128` note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 57 previous errors diff --git a/src/test/ui/transmutability/primitives/unit.rs b/src/test/ui/transmutability/primitives/unit.rs index 86d474030..1975a61de 100644 --- a/src/test/ui/transmutability/primitives/unit.rs +++ b/src/test/ui/transmutability/primitives/unit.rs @@ -5,11 +5,16 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/primitives/unit.stderr b/src/test/ui/transmutability/primitives/unit.stderr index cf27c0d17..8cabe44a0 100644 --- a/src/test/ui/transmutability/primitives/unit.stderr +++ b/src/test/ui/transmutability/primitives/unit.stderr @@ -1,18 +1,24 @@ error[E0277]: `()` cannot be safely transmuted into `u8` in the defining scope of `should_have_correct_size::Context`. - --> $DIR/unit.rs:23:35 + --> $DIR/unit.rs:28:35 | LL | assert::is_transmutable::<(), u8, Context>(); | ^^ `()` cannot be safely transmuted into `u8` in the defining scope of `should_have_correct_size::Context`. | - = help: the trait `BikeshedIntrinsicFrom<(), should_have_correct_size::Context, true, true, true, true>` is not implemented for `u8` + = help: the trait `BikeshedIntrinsicFrom<(), should_have_correct_size::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `u8` note: required by a bound in `is_transmutable` --> $DIR/unit.rs:12:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/references.rs b/src/test/ui/transmutability/references.rs index c6fd4c43e..af3ff0ec1 100644 --- a/src/test/ui/transmutability/references.rs +++ b/src/test/ui/transmutability/references.rs @@ -5,12 +5,19 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/references.stderr b/src/test/ui/transmutability/references.stderr index b1359ea58..e9c7b144a 100644 --- a/src/test/ui/transmutability/references.stderr +++ b/src/test/ui/transmutability/references.stderr @@ -1,18 +1,25 @@ error[E0277]: `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. - --> $DIR/references.rs:19:37 + --> $DIR/references.rs:26:52 | LL | assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); - | ^^^^^^^^^^^^^ `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. + | ^^^^^^^^^^^^^ `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom<&'static Unit, assert::Context, true, true, true, true>` is not implemented for `&'static Unit` + = help: the trait `BikeshedIntrinsicFrom<&'static Unit, assert::Context, Assume { alignment: true, lifetimes: true, safety: true, validity: true }>` is not implemented for `&'static Unit` note: required by a bound in `is_maybe_transmutable` --> $DIR/references.rs:13:14 | -LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/structs/repr/should_handle_align.rs b/src/test/ui/transmutability/structs/repr/should_handle_align.rs index 71720165a..ea9bf2a23 100644 --- a/src/test/ui/transmutability/structs/repr/should_handle_align.rs +++ b/src/test/ui/transmutability/structs/repr/should_handle_align.rs @@ -6,12 +6,19 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/structs/repr/should_handle_packed.rs b/src/test/ui/transmutability/structs/repr/should_handle_packed.rs index ae8acf504..17dc995fc 100644 --- a/src/test/ui/transmutability/structs/repr/should_handle_packed.rs +++ b/src/test/ui/transmutability/structs/repr/should_handle_packed.rs @@ -6,12 +6,19 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/structs/repr/should_require_well_defined_layout.rs b/src/test/ui/transmutability/structs/repr/should_require_well_defined_layout.rs index 556be989d..9a65b4d70 100644 --- a/src/test/ui/transmutability/structs/repr/should_require_well_defined_layout.rs +++ b/src/test/ui/transmutability/structs/repr/should_require_well_defined_layout.rs @@ -5,12 +5,19 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr b/src/test/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr index 07355f7c2..621dbee84 100644 --- a/src/test/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr +++ b/src/test/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr @@ -1,194 +1,278 @@ error[E0277]: `should_reject_repr_rust::unit::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:21:52 + --> $DIR/should_require_well_defined_layout.rs:28:52 | LL | assert::is_maybe_transmutable::(); | ^^ `should_reject_repr_rust::unit::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::unit::repr_rust` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:22:47 + --> $DIR/should_require_well_defined_layout.rs:29:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `should_reject_repr_rust::unit::repr_rust` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::unit::repr_rust` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::unit::repr_rust` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `should_reject_repr_rust::tuple::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:27:52 + --> $DIR/should_require_well_defined_layout.rs:34:52 | LL | assert::is_maybe_transmutable::(); | ^^ `should_reject_repr_rust::tuple::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::tuple::repr_rust` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:28:47 + --> $DIR/should_require_well_defined_layout.rs:35:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `should_reject_repr_rust::tuple::repr_rust` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::tuple::repr_rust` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::tuple::repr_rust` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `should_reject_repr_rust::braces::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:33:52 + --> $DIR/should_require_well_defined_layout.rs:40:52 | LL | assert::is_maybe_transmutable::(); | ^^ `should_reject_repr_rust::braces::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::braces::repr_rust` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:34:47 + --> $DIR/should_require_well_defined_layout.rs:41:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `should_reject_repr_rust::braces::repr_rust` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::braces::repr_rust` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::braces::repr_rust` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `aligned::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:39:52 + --> $DIR/should_require_well_defined_layout.rs:46:52 | LL | assert::is_maybe_transmutable::(); | ^^ `aligned::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `aligned::repr_rust` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:40:47 + --> $DIR/should_require_well_defined_layout.rs:47:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `aligned::repr_rust` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `aligned::repr_rust` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `aligned::repr_rust` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `packed::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:45:52 + --> $DIR/should_require_well_defined_layout.rs:52:52 | LL | assert::is_maybe_transmutable::(); | ^^ `packed::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `packed::repr_rust` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:46:47 + --> $DIR/should_require_well_defined_layout.rs:53:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `packed::repr_rust` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `packed::repr_rust` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `packed::repr_rust` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `nested::repr_c` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:52:49 + --> $DIR/should_require_well_defined_layout.rs:59:49 | LL | assert::is_maybe_transmutable::(); | ^^ `nested::repr_c` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `nested::repr_c` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:53:47 + --> $DIR/should_require_well_defined_layout.rs:60:47 | LL | assert::is_maybe_transmutable::(); | ^^^^^^ `u128` cannot be safely transmuted into `nested::repr_c` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `nested::repr_c` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `nested::repr_c` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error: aborting due to 12 previous errors diff --git a/src/test/ui/transmutability/structs/should_order_fields_correctly.rs b/src/test/ui/transmutability/structs/should_order_fields_correctly.rs index db49b914f..28724562b 100644 --- a/src/test/ui/transmutability/structs/should_order_fields_correctly.rs +++ b/src/test/ui/transmutability/structs/should_order_fields_correctly.rs @@ -6,12 +6,17 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/unions/boolish.rs b/src/test/ui/transmutability/unions/boolish.rs index 975118b99..e469c4973 100644 --- a/src/test/ui/transmutability/unions/boolish.rs +++ b/src/test/ui/transmutability/unions/boolish.rs @@ -7,12 +7,12 @@ #![allow(incomplete_features)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/unions/repr/should_handle_align.rs b/src/test/ui/transmutability/unions/repr/should_handle_align.rs index e215799a2..09c13cc4d 100644 --- a/src/test/ui/transmutability/unions/repr/should_handle_align.rs +++ b/src/test/ui/transmutability/unions/repr/should_handle_align.rs @@ -6,12 +6,19 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/unions/repr/should_handle_packed.rs b/src/test/ui/transmutability/unions/repr/should_handle_packed.rs index 34a53c7a8..24c2abd69 100644 --- a/src/test/ui/transmutability/unions/repr/should_handle_packed.rs +++ b/src/test/ui/transmutability/unions/repr/should_handle_packed.rs @@ -6,12 +6,19 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/unions/repr/should_require_well_defined_layout.rs b/src/test/ui/transmutability/unions/repr/should_require_well_defined_layout.rs index cec8e389f..b1d5f71dc 100644 --- a/src/test/ui/transmutability/unions/repr/should_require_well_defined_layout.rs +++ b/src/test/ui/transmutability/unions/repr/should_require_well_defined_layout.rs @@ -5,12 +5,19 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr b/src/test/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr index 2ed01b159..523bde85a 100644 --- a/src/test/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr +++ b/src/test/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr @@ -1,34 +1,48 @@ error[E0277]: `should_reject_repr_rust::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:23:48 + --> $DIR/should_require_well_defined_layout.rs:30:48 | LL | assert::is_maybe_transmutable::(); | ^^ `should_reject_repr_rust::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::repr_rust` in the defining scope of `assert::Context`. - --> $DIR/should_require_well_defined_layout.rs:24:43 + --> $DIR/should_require_well_defined_layout.rs:31:43 | LL | assert::is_maybe_transmutable::(); | ^^^^^^^^^ `u128` cannot be safely transmuted into `should_reject_repr_rust::repr_rust` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::repr_rust` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `should_reject_repr_rust::repr_rust` 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 -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` error: aborting due to 2 previous errors diff --git a/src/test/ui/transmutability/unions/should_pad_variants.rs b/src/test/ui/transmutability/unions/should_pad_variants.rs index c4757900f..cabe54467 100644 --- a/src/test/ui/transmutability/unions/should_pad_variants.rs +++ b/src/test/ui/transmutability/unions/should_pad_variants.rs @@ -6,11 +6,16 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/unions/should_pad_variants.stderr b/src/test/ui/transmutability/unions/should_pad_variants.stderr index 429f7211d..a823503d5 100644 --- a/src/test/ui/transmutability/unions/should_pad_variants.stderr +++ b/src/test/ui/transmutability/unions/should_pad_variants.stderr @@ -1,18 +1,24 @@ error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context`. - --> $DIR/should_pad_variants.rs:39:36 + --> $DIR/should_pad_variants.rs:44:36 | LL | assert::is_transmutable::(); | ^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` note: required by a bound in `is_transmutable` --> $DIR/should_pad_variants.rs:13:14 | -LL | pub fn is_transmutable() - | --------------- required by a bound in this -LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs b/src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs index 2493d7155..1007fdd79 100644 --- a/src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs +++ b/src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs @@ -7,13 +7,12 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom - // validity IS assumed --------------------------------^^^^ + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/unions/should_reject_contraction.rs b/src/test/ui/transmutability/unions/should_reject_contraction.rs index e8138d0e0..a24dfccd3 100644 --- a/src/test/ui/transmutability/unions/should_reject_contraction.rs +++ b/src/test/ui/transmutability/unions/should_reject_contraction.rs @@ -5,12 +5,12 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/unions/should_reject_contraction.stderr b/src/test/ui/transmutability/unions/should_reject_contraction.stderr index 99f589008..41f0cedc3 100644 --- a/src/test/ui/transmutability/unions/should_reject_contraction.stderr +++ b/src/test/ui/transmutability/unions/should_reject_contraction.stderr @@ -4,15 +4,15 @@ error[E0277]: `Superset` cannot be safely transmuted into `Subset` in the defini LL | assert::is_transmutable::(); | ^^^^^^ `Superset` cannot be safely transmuted into `Subset` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Subset` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Subset` note: required by a bound in `is_transmutable` --> $DIR/should_reject_contraction.rs:13:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/unions/should_reject_disjoint.rs b/src/test/ui/transmutability/unions/should_reject_disjoint.rs index 16160e29a..43aaa6905 100644 --- a/src/test/ui/transmutability/unions/should_reject_disjoint.rs +++ b/src/test/ui/transmutability/unions/should_reject_disjoint.rs @@ -5,13 +5,12 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_maybe_transmutable() where - Dst: BikeshedIntrinsicFrom - // validity IS assumed --------------------------------^^^^ + Dst: BikeshedIntrinsicFrom {} } diff --git a/src/test/ui/transmutability/unions/should_reject_disjoint.stderr b/src/test/ui/transmutability/unions/should_reject_disjoint.stderr index 5714e2bf3..4323f9740 100644 --- a/src/test/ui/transmutability/unions/should_reject_disjoint.stderr +++ b/src/test/ui/transmutability/unions/should_reject_disjoint.stderr @@ -1,34 +1,34 @@ error[E0277]: `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context`. - --> $DIR/should_reject_disjoint.rs:34:40 + --> $DIR/should_reject_disjoint.rs:33:40 | LL | assert::is_maybe_transmutable::(); | ^ `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `B` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `B` 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 LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. - --> $DIR/should_reject_disjoint.rs:35:40 + --> $DIR/should_reject_disjoint.rs:34:40 | LL | assert::is_maybe_transmutable::(); | ^ `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `A` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `A` 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 LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error: aborting due to 2 previous errors diff --git a/src/test/ui/transmutability/unions/should_reject_intersecting.rs b/src/test/ui/transmutability/unions/should_reject_intersecting.rs index 58e399fb9..9cd4233ee 100644 --- a/src/test/ui/transmutability/unions/should_reject_intersecting.rs +++ b/src/test/ui/transmutability/unions/should_reject_intersecting.rs @@ -6,13 +6,13 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub struct Context; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // validity is NOT assumed ----------------------------^^^^^ + Dst: BikeshedIntrinsicFrom + // validity is NOT assumed --------------^^^^^^^^^^^^^^^^^^ {} } diff --git a/src/test/ui/transmutability/unions/should_reject_intersecting.stderr b/src/test/ui/transmutability/unions/should_reject_intersecting.stderr index 92689a5f8..e009888ae 100644 --- a/src/test/ui/transmutability/unions/should_reject_intersecting.stderr +++ b/src/test/ui/transmutability/unions/should_reject_intersecting.stderr @@ -4,15 +4,15 @@ error[E0277]: `A` cannot be safely transmuted into `B` in the defining scope of LL | assert::is_transmutable::(); | ^ `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `B` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `B` 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 LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. --> $DIR/should_reject_intersecting.rs:37:34 @@ -20,15 +20,15 @@ error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of LL | assert::is_transmutable::(); | ^ `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `A` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `A` 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 LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 2 previous errors diff --git a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_field.rs b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_field.rs index 5a8c81049..8a41669c6 100644 --- a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_field.rs +++ b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_field.rs @@ -7,12 +7,12 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility IS assumed -------------------------------------^^^^ + Dst: BikeshedIntrinsicFrom + // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ {} } diff --git a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_variant.rs b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_variant.rs index 77ab4fa6b..dd57b877d 100644 --- a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_variant.rs +++ b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_variant.rs @@ -7,12 +7,12 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility IS assumed -------------------------------------^^^^ + Dst: BikeshedIntrinsicFrom + // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ {} } diff --git a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_tricky_unreachable_field.rs b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_tricky_unreachable_field.rs index 2421b24cb..ebce8ce87 100644 --- a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_tricky_unreachable_field.rs +++ b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_tricky_unreachable_field.rs @@ -13,12 +13,12 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility IS assumed -------------------------------------^^^^ + Dst: BikeshedIntrinsicFrom + // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ {} } diff --git a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs index 80b454fda..546fcbaa3 100644 --- a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs +++ b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs @@ -8,12 +8,12 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility IS assumed -------------------------------------^^^^ + Dst: BikeshedIntrinsicFrom + // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ {} } diff --git a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.rs b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.rs index 7c53c91e4..b9b74d183 100644 --- a/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.rs +++ b/src/test/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.rs @@ -8,12 +8,12 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility IS assumed -------------------------------------^^^^ + Dst: BikeshedIntrinsicFrom + // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ {} } diff --git a/src/test/ui/transmutability/visibility/should_accept_if_src_has_private_field.rs b/src/test/ui/transmutability/visibility/should_accept_if_src_has_private_field.rs index c3f298f01..5a0df09d4 100644 --- a/src/test/ui/transmutability/visibility/should_accept_if_src_has_private_field.rs +++ b/src/test/ui/transmutability/visibility/should_accept_if_src_has_private_field.rs @@ -11,8 +11,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility is NOT assumed ---------------------------------^^^^^ + Dst: BikeshedIntrinsicFrom // safety is NOT assumed {} } diff --git a/src/test/ui/transmutability/visibility/should_accept_if_src_has_private_variant.rs b/src/test/ui/transmutability/visibility/should_accept_if_src_has_private_variant.rs index 73f6aece5..0f69630cc 100644 --- a/src/test/ui/transmutability/visibility/should_accept_if_src_has_private_variant.rs +++ b/src/test/ui/transmutability/visibility/should_accept_if_src_has_private_variant.rs @@ -11,8 +11,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility is NOT assumed ---------------------------------^^^^^ + Dst: BikeshedIntrinsicFrom // safety is NOT assumed {} } diff --git a/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs b/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs index 6d602601e..9c8345a8e 100644 --- a/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs +++ b/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs @@ -11,8 +11,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility is NOT assumed ---------------------------------^^^^^ + Dst: BikeshedIntrinsicFrom // safety is NOT assumed {} } diff --git a/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr b/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr index 3f7d08d0a..39b73302e 100644 --- a/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr +++ b/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr @@ -1,5 +1,5 @@ error[E0446]: private type `src::Zst` in public interface - --> $DIR/should_accept_if_src_has_unreachable_field.rs:23:9 + --> $DIR/should_accept_if_src_has_unreachable_field.rs:22:9 | LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type | -------------------- `src::Zst` declared as private diff --git a/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.rs b/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.rs index 1943fb871..acf9f2302 100644 --- a/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.rs +++ b/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.rs @@ -11,8 +11,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility is NOT assumed ---------------------------------^^^^^ + Dst: BikeshedIntrinsicFrom // safety is NOT assumed {} } diff --git a/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.stderr b/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.stderr index e961984e1..76dc7f340 100644 --- a/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.stderr +++ b/src/test/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.stderr @@ -1,11 +1,11 @@ error[E0603]: struct `Src` is private - --> $DIR/should_accept_if_src_has_unreachable_ty.rs:38:36 + --> $DIR/should_accept_if_src_has_unreachable_ty.rs:37:36 | LL | assert::is_transmutable::(); | ^^^ private struct | note: the struct `Src` is defined here - --> $DIR/should_accept_if_src_has_unreachable_ty.rs:23:16 + --> $DIR/should_accept_if_src_has_unreachable_ty.rs:22:16 | LL | #[repr(C)] pub(self) struct Src { | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_field.rs b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_field.rs index fcf3f3a52..e8c3fbc9a 100644 --- a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_field.rs +++ b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_field.rs @@ -10,8 +10,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility is NOT assumed ---------------------------------^^^^^ + Dst: BikeshedIntrinsicFrom // safety is NOT assumed {} } diff --git a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr index 85124019e..d5d6d431b 100644 --- a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr +++ b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr @@ -1,18 +1,18 @@ error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. - --> $DIR/should_reject_if_dst_has_private_field.rs:36:41 + --> $DIR/should_reject_if_dst_has_private_field.rs:35:41 | LL | assert::is_transmutable::(); | ^^^^^^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` 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 LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.rs b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.rs index 566b56467..47bca27ab 100644 --- a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.rs +++ b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.rs @@ -10,8 +10,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility is NOT assumed ---------------------------------^^^^^ + Dst: BikeshedIntrinsicFrom // safety is NOT assumed {} } diff --git a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr index 0be564d93..a1ca2ced5 100644 --- a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr +++ b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr @@ -1,18 +1,18 @@ error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. - --> $DIR/should_reject_if_dst_has_private_variant.rs:37:41 + --> $DIR/should_reject_if_dst_has_private_variant.rs:36:41 | LL | assert::is_transmutable::(); | ^^^^^^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` 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 LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_tricky_unreachable_field.rs b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_tricky_unreachable_field.rs index 35fff5966..662c32af1 100644 --- a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_tricky_unreachable_field.rs +++ b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_tricky_unreachable_field.rs @@ -23,8 +23,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility is NOT assumed ---------------------------------^^^^^ + Dst: BikeshedIntrinsicFrom // safety is NOT assumed {} } diff --git a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.rs b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.rs index 42799d803..d7e21676f 100644 --- a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.rs +++ b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.rs @@ -12,8 +12,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility is NOT assumed ---------------------------------^^^^^ + Dst: BikeshedIntrinsicFrom // safety is NOT assumed {} } diff --git a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr index 95c68d452..4e648664d 100644 --- a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr +++ b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr @@ -1,18 +1,18 @@ error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. - --> $DIR/should_reject_if_dst_has_unreachable_field.rs:38:41 + --> $DIR/should_reject_if_dst_has_unreachable_field.rs:37:41 | LL | assert::is_transmutable::(); | ^^^^^^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` 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 LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to previous error diff --git a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.rs b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.rs index e13b32b30..c7b59f15b 100644 --- a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.rs +++ b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.rs @@ -12,8 +12,7 @@ mod assert { pub fn is_transmutable() where - Dst: BikeshedIntrinsicFrom - // visibility is NOT assumed ---------------------------------^^^^^ + Dst: BikeshedIntrinsicFrom // safety is NOT assumed {} } diff --git a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr index 3391839e3..bd72d64cc 100644 --- a/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr +++ b/src/test/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr @@ -1,30 +1,30 @@ error[E0603]: struct `Dst` is private - --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:39:46 + --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:38:46 | LL | assert::is_transmutable::(); | ^^^ private struct | note: the struct `Dst` is defined here - --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:32:16 + --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:31:16 | LL | #[repr(C)] pub(self) struct Dst { | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. - --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:39:41 + --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:38:41 | LL | assert::is_transmutable::(); | ^^^^^^^^ `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context`. | - = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Dst` 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 LL | where -LL | Dst: BikeshedIntrinsicFrom - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 2 previous errors diff --git a/src/test/ui/try-block/try-block-bad-type.stderr b/src/test/ui/try-block/try-block-bad-type.stderr index f9906713f..e11c3f810 100644 --- a/src/test/ui/try-block/try-block-bad-type.stderr +++ b/src/test/ui/try-block/try-block-bad-type.stderr @@ -6,7 +6,7 @@ LL | Err("")?; | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = help: the trait `From` is implemented for `TryFromSliceError` - = note: required because of the requirements on the impl of `FromResidual>` for `Result` + = note: required for `Result` to implement `FromResidual>` error[E0271]: type mismatch resolving ` as Try>::Output == &str` --> $DIR/try-block-bad-type.rs:12:9 diff --git a/src/test/ui/try-trait/bad-interconversion.stderr b/src/test/ui/try-trait/bad-interconversion.stderr index 1dbf3ebdf..27e6a603a 100644 --- a/src/test/ui/try-trait/bad-interconversion.stderr +++ b/src/test/ui/try-trait/bad-interconversion.stderr @@ -17,18 +17,15 @@ LL | Ok(Err(123_i32)?) > > and 67 others - = note: required because of the requirements on the impl of `FromResidual>` for `Result` + = note: required for `Result` to implement `FromResidual>` error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result` --> $DIR/bad-interconversion.rs:11:12 | -LL | / fn option_to_result() -> Result { -LL | | Some(3)?; - | | ^ use `.ok_or(...)?` to provide an error compatible with `Result` -LL | | -LL | | Ok(10) -LL | | } - | |_- this function returns a `Result` +LL | fn option_to_result() -> Result { + | -------------------------------------------- this function returns a `Result` +LL | Some(3)?; + | ^ use `.ok_or(...)?` to provide an error compatible with `Result` | = help: the trait `FromResidual>` is not implemented for `Result` = help: the following other types implement trait `FromResidual`: @@ -38,12 +35,10 @@ LL | | } error[E0277]: the `?` operator can only be used on `Result`s in a function that returns `Result` --> $DIR/bad-interconversion.rs:17:31 | -LL | / fn control_flow_to_result() -> Result { -LL | | Ok(ControlFlow::Break(123)?) - | | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Result` -LL | | -LL | | } - | |_- this function returns a `Result` +LL | fn control_flow_to_result() -> Result { + | -------------------------------------------------- this function returns a `Result` +LL | Ok(ControlFlow::Break(123)?) + | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Result` | = help: the trait `FromResidual>` is not implemented for `Result` = help: the following other types implement trait `FromResidual`: @@ -53,12 +48,10 @@ LL | | } error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option` --> $DIR/bad-interconversion.rs:22:22 | -LL | / fn result_to_option() -> Option { -LL | | Some(Err("hello")?) - | | ^ use `.ok()?` if you want to discard the `Result` error information -LL | | -LL | | } - | |_- this function returns an `Option` +LL | fn result_to_option() -> Option { + | ------------------------------------ this function returns an `Option` +LL | Some(Err("hello")?) + | ^ use `.ok()?` if you want to discard the `Result` error information | = help: the trait `FromResidual>` is not implemented for `Option` = help: the following other types implement trait `FromResidual`: @@ -68,12 +61,10 @@ LL | | } error[E0277]: the `?` operator can only be used on `Option`s in a function that returns `Option` --> $DIR/bad-interconversion.rs:27:33 | -LL | / fn control_flow_to_option() -> Option { -LL | | Some(ControlFlow::Break(123)?) - | | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Option` -LL | | -LL | | } - | |_- this function returns an `Option` +LL | fn control_flow_to_option() -> Option { + | ------------------------------------------ this function returns an `Option` +LL | Some(ControlFlow::Break(123)?) + | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Option` | = help: the trait `FromResidual>` is not implemented for `Option` = help: the following other types implement trait `FromResidual`: @@ -83,12 +74,10 @@ LL | | } error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` --> $DIR/bad-interconversion.rs:32:39 | -LL | / fn result_to_control_flow() -> ControlFlow { -LL | | ControlFlow::Continue(Err("hello")?) - | | ^ this `?` produces `Result`, which is incompatible with `ControlFlow` -LL | | -LL | | } - | |_- this function returns a `ControlFlow` +LL | fn result_to_control_flow() -> ControlFlow { + | -------------------------------------------------- this function returns a `ControlFlow` +LL | ControlFlow::Continue(Err("hello")?) + | ^ this `?` produces `Result`, which is incompatible with `ControlFlow` | = help: the trait `FromResidual>` is not implemented for `ControlFlow` = help: the trait `FromResidual` is implemented for `ControlFlow` @@ -96,13 +85,10 @@ LL | | } error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` --> $DIR/bad-interconversion.rs:37:12 | -LL | / fn option_to_control_flow() -> ControlFlow { -LL | | Some(3)?; - | | ^ this `?` produces `Option`, which is incompatible with `ControlFlow` -LL | | -LL | | ControlFlow::Break(10) -LL | | } - | |_- this function returns a `ControlFlow` +LL | fn option_to_control_flow() -> ControlFlow { + | ----------------------------------------------- this function returns a `ControlFlow` +LL | Some(3)?; + | ^ this `?` produces `Option`, which is incompatible with `ControlFlow` | = help: the trait `FromResidual>` is not implemented for `ControlFlow` = help: the trait `FromResidual` is implemented for `ControlFlow` @@ -110,13 +96,10 @@ LL | | } error[E0277]: the `?` operator in a function that returns `ControlFlow` can only be used on other `ControlFlow`s (with the same Break type) --> $DIR/bad-interconversion.rs:43:29 | -LL | / fn control_flow_to_control_flow() -> ControlFlow { -LL | | ControlFlow::Break(4_u8)?; - | | ^ this `?` produces `ControlFlow`, which is incompatible with `ControlFlow` -LL | | -LL | | ControlFlow::Continue(()) -LL | | } - | |_- this function returns a `ControlFlow` +LL | fn control_flow_to_control_flow() -> ControlFlow { + | ----------------------------------------------------- this function returns a `ControlFlow` +LL | ControlFlow::Break(4_u8)?; + | ^ this `?` produces `ControlFlow`, which is incompatible with `ControlFlow` | = help: the trait `FromResidual>` is not implemented for `ControlFlow` = note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow` diff --git a/src/test/ui/try-trait/option-to-result.stderr b/src/test/ui/try-trait/option-to-result.stderr index ae5c3ad62..fabc1ff2c 100644 --- a/src/test/ui/try-trait/option-to-result.stderr +++ b/src/test/ui/try-trait/option-to-result.stderr @@ -1,13 +1,11 @@ error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result` --> $DIR/option-to-result.rs:5:6 | -LL | / fn test_result() -> Result<(),()> { -LL | | let a:Option<()> = Some(()); -LL | | a?; - | | ^ use `.ok_or(...)?` to provide an error compatible with `Result<(), ()>` -LL | | Ok(()) -LL | | } - | |_- this function returns a `Result` +LL | fn test_result() -> Result<(),()> { + | --------------------------------- this function returns a `Result` +LL | let a:Option<()> = Some(()); +LL | a?; + | ^ use `.ok_or(...)?` to provide an error compatible with `Result<(), ()>` | = help: the trait `FromResidual>` is not implemented for `Result<(), ()>` = help: the following other types implement trait `FromResidual`: @@ -17,13 +15,11 @@ LL | | } error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option` --> $DIR/option-to-result.rs:11:6 | -LL | / fn test_option() -> Option{ -LL | | let a:Result = Ok(5); -LL | | a?; - | | ^ use `.ok()?` if you want to discard the `Result` error information -LL | | Some(5) -LL | | } - | |_- this function returns an `Option` +LL | fn test_option() -> Option{ + | ------------------------------- this function returns an `Option` +LL | let a:Result = Ok(5); +LL | a?; + | ^ use `.ok()?` if you want to discard the `Result` error information | = help: the trait `FromResidual>` is not implemented for `Option` = help: the following other types implement trait `FromResidual`: diff --git a/src/test/ui/try-trait/try-on-option-diagnostics.stderr b/src/test/ui/try-trait/try-on-option-diagnostics.stderr index a6badd190..9ee540c79 100644 --- a/src/test/ui/try-trait/try-on-option-diagnostics.stderr +++ b/src/test/ui/try-trait/try-on-option-diagnostics.stderr @@ -1,51 +1,44 @@ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-diagnostics.rs:7:6 | -LL | / fn a_function() -> u32 { -LL | | let x: Option = None; -LL | | x?; - | | ^ cannot use the `?` operator in a function that returns `u32` -LL | | 22 -LL | | } - | |_- this function should return `Result` or `Option` to accept `?` +LL | fn a_function() -> u32 { + | ---------------------- this function should return `Result` or `Option` to accept `?` +LL | let x: Option = None; +LL | x?; + | ^ cannot use the `?` operator in a function that returns `u32` | = help: the trait `FromResidual>` is not implemented for `u32` error[E0277]: the `?` operator can only be used in a closure that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-diagnostics.rs:14:10 | -LL | let a_closure = || { - | _____________________- -LL | | let x: Option = None; -LL | | x?; - | | ^ cannot use the `?` operator in a closure that returns `{integer}` -LL | | 22 -LL | | }; - | |_____- this function should return `Result` or `Option` to accept `?` +LL | let a_closure = || { + | -- this function should return `Result` or `Option` to accept `?` +LL | let x: Option = None; +LL | x?; + | ^ cannot use the `?` operator in a closure that returns `{integer}` | = help: the trait `FromResidual>` is not implemented for `{integer}` error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-diagnostics.rs:26:14 | -LL | / fn a_method() { -LL | | let x: Option = None; -LL | | x?; - | | ^ cannot use the `?` operator in a method that returns `()` -LL | | } - | |_________- this function should return `Result` or `Option` to accept `?` +LL | fn a_method() { + | ------------- this function should return `Result` or `Option` to accept `?` +LL | let x: Option = None; +LL | x?; + | ^ cannot use the `?` operator in a method that returns `()` | = help: the trait `FromResidual>` is not implemented for `()` error[E0277]: the `?` operator can only be used in a trait method that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-diagnostics.rs:39:14 | -LL | / fn a_trait_method() { -LL | | let x: Option = None; -LL | | x?; - | | ^ cannot use the `?` operator in a trait method that returns `()` -LL | | } - | |_________- this function should return `Result` or `Option` to accept `?` +LL | fn a_trait_method() { + | ------------------- this function should return `Result` or `Option` to accept `?` +LL | let x: Option = None; +LL | x?; + | ^ cannot use the `?` operator in a trait method that returns `()` | = help: the trait `FromResidual>` is not implemented for `()` diff --git a/src/test/ui/try-trait/try-on-option.stderr b/src/test/ui/try-trait/try-on-option.stderr index ba85a7cad..fad6a1fe8 100644 --- a/src/test/ui/try-trait/try-on-option.stderr +++ b/src/test/ui/try-trait/try-on-option.stderr @@ -1,13 +1,11 @@ error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result` --> $DIR/try-on-option.rs:5:6 | -LL | / fn foo() -> Result { -LL | | let x: Option = None; -LL | | x?; - | | ^ use `.ok_or(...)?` to provide an error compatible with `Result` -LL | | Ok(22) -LL | | } - | |_- this function returns a `Result` +LL | fn foo() -> Result { + | --------------------------- this function returns a `Result` +LL | let x: Option = None; +LL | x?; + | ^ use `.ok_or(...)?` to provide an error compatible with `Result` | = help: the trait `FromResidual>` is not implemented for `Result` = help: the following other types implement trait `FromResidual`: @@ -17,13 +15,11 @@ LL | | } error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option.rs:11:6 | -LL | / fn bar() -> u32 { -LL | | let x: Option = None; -LL | | x?; - | | ^ cannot use the `?` operator in a function that returns `u32` -LL | | 22 -LL | | } - | |_- this function should return `Result` or `Option` to accept `?` +LL | fn bar() -> u32 { + | --------------- this function should return `Result` or `Option` to accept `?` +LL | let x: Option = None; +LL | x?; + | ^ cannot use the `?` operator in a function that returns `u32` | = help: the trait `FromResidual>` is not implemented for `u32` diff --git a/src/test/ui/try-trait/try-operator-on-main.stderr b/src/test/ui/try-trait/try-operator-on-main.stderr index ad55f40b5..7cd38e0cf 100644 --- a/src/test/ui/try-trait/try-operator-on-main.stderr +++ b/src/test/ui/try-trait/try-operator-on-main.stderr @@ -1,15 +1,11 @@ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-operator-on-main.rs:7:31 | -LL | / fn main() { -LL | | // error for a `Try` type on a non-`Try` fn -LL | | std::fs::File::open("foo")?; - | | ^ cannot use the `?` operator in a function that returns `()` -LL | | -... | -LL | | try_trait_generic::<()>(); -LL | | } - | |_- this function should return `Result` or `Option` to accept `?` +LL | fn main() { + | --------- this function should return `Result` or `Option` to accept `?` +LL | // error for a `Try` type on a non-`Try` fn +LL | std::fs::File::open("foo")?; + | ^ cannot use the `?` operator in a function that returns `()` | = help: the trait `FromResidual>` is not implemented for `()` @@ -24,17 +20,11 @@ LL | ()?; error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-operator-on-main.rs:10:7 | -LL | / fn main() { -LL | | // error for a `Try` type on a non-`Try` fn -LL | | std::fs::File::open("foo")?; -LL | | -LL | | // a non-`Try` type on a non-`Try` fn -LL | | ()?; - | | ^ cannot use the `?` operator in a function that returns `()` -... | -LL | | try_trait_generic::<()>(); -LL | | } - | |_- this function should return `Result` or `Option` to accept `?` +LL | fn main() { + | --------- this function should return `Result` or `Option` to accept `?` +... +LL | ()?; + | ^ cannot use the `?` operator in a function that returns `()` | = help: the trait `FromResidual<_>` is not implemented for `()` diff --git a/src/test/ui/tuple/add-tuple-within-arguments.stderr b/src/test/ui/tuple/add-tuple-within-arguments.stderr index 95df96ca0..7029d298d 100644 --- a/src/test/ui/tuple/add-tuple-within-arguments.stderr +++ b/src/test/ui/tuple/add-tuple-within-arguments.stderr @@ -8,7 +8,7 @@ note: function defined here --> $DIR/add-tuple-within-arguments.rs:1:4 | LL | fn foo(s: &str, a: (i32, i32), s2: &str) {} - | ^^^ ------- ------------- -------- + | ^^^ ------------- help: wrap these arguments in parentheses to construct a tuple | LL | foo("hi", (1, 2), "hi"); @@ -28,7 +28,7 @@ note: function defined here --> $DIR/add-tuple-within-arguments.rs:3:4 | LL | fn bar(s: &str, a: (&str,), s2: &str) {} - | ^^^ ------- ---------- -------- + | ^^^ ---------- help: use a trailing comma to create a tuple with one element | LL | bar("hi", ("hi",), "hi"); diff --git a/src/test/ui/tuple/builtin-fail.rs b/src/test/ui/tuple/builtin-fail.rs new file mode 100644 index 000000000..312080961 --- /dev/null +++ b/src/test/ui/tuple/builtin-fail.rs @@ -0,0 +1,19 @@ +#![feature(tuple_trait)] + +fn assert_is_tuple() {} + +struct TupleStruct(i32, i32); + +fn from_param_env() { + assert_is_tuple::(); + //~^ ERROR `T` is not a tuple +} + +fn main() { + assert_is_tuple::(); + //~^ ERROR `i32` is not a tuple + assert_is_tuple::<(i32)>(); + //~^ ERROR `i32` is not a tuple + assert_is_tuple::(); + //~^ ERROR `TupleStruct` is not a tuple +} diff --git a/src/test/ui/tuple/builtin-fail.stderr b/src/test/ui/tuple/builtin-fail.stderr new file mode 100644 index 000000000..e3e29a73f --- /dev/null +++ b/src/test/ui/tuple/builtin-fail.stderr @@ -0,0 +1,55 @@ +error[E0277]: `T` is not a tuple + --> $DIR/builtin-fail.rs:8:23 + | +LL | assert_is_tuple::(); + | ^ the trait `Tuple` is not implemented for `T` + | +note: required by a bound in `assert_is_tuple` + --> $DIR/builtin-fail.rs:3:23 + | +LL | fn assert_is_tuple() {} + | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` +help: consider restricting type parameter `T` + | +LL | fn from_param_env() { + | ++++++++++++++++++++ + +error[E0277]: `i32` is not a tuple + --> $DIR/builtin-fail.rs:13:23 + | +LL | assert_is_tuple::(); + | ^^^ the trait `Tuple` is not implemented for `i32` + | +note: required by a bound in `assert_is_tuple` + --> $DIR/builtin-fail.rs:3:23 + | +LL | fn assert_is_tuple() {} + | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` + +error[E0277]: `i32` is not a tuple + --> $DIR/builtin-fail.rs:15:24 + | +LL | assert_is_tuple::<(i32)>(); + | ^^^ the trait `Tuple` is not implemented for `i32` + | +note: required by a bound in `assert_is_tuple` + --> $DIR/builtin-fail.rs:3:23 + | +LL | fn assert_is_tuple() {} + | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` + +error[E0277]: `TupleStruct` is not a tuple + --> $DIR/builtin-fail.rs:17:23 + | +LL | assert_is_tuple::(); + | ^^^^^^^^^^^ the trait `Tuple` is not implemented for `TupleStruct` + | +note: required by a bound in `assert_is_tuple` + --> $DIR/builtin-fail.rs:3:23 + | +LL | fn assert_is_tuple() {} + | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/tuple/builtin.rs b/src/test/ui/tuple/builtin.rs new file mode 100644 index 000000000..d87ce5263 --- /dev/null +++ b/src/test/ui/tuple/builtin.rs @@ -0,0 +1,20 @@ +// check-pass + +#![feature(tuple_trait)] + +fn assert_is_tuple() {} + +struct Unsized([u8]); + +fn from_param_env() { + assert_is_tuple::(); +} + +fn main() { + assert_is_tuple::<()>(); + assert_is_tuple::<(i32,)>(); + assert_is_tuple::<(Unsized,)>(); + from_param_env::<()>(); + from_param_env::<(i32,)>(); + from_param_env::<(Unsized,)>(); +} diff --git a/src/test/ui/tuple/wrong_argument_ice-3.stderr b/src/test/ui/tuple/wrong_argument_ice-3.stderr index 2733fb314..f3a547fa2 100644 --- a/src/test/ui/tuple/wrong_argument_ice-3.stderr +++ b/src/test/ui/tuple/wrong_argument_ice-3.stderr @@ -2,10 +2,13 @@ error[E0061]: this function 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 - | | - | expected tuple, found struct `Vec` + | ^^^^ ------------- argument of type `Vec<&Process>` unexpected | +note: expected tuple, found struct `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 @@ -16,7 +19,7 @@ LL | pub fn push(&mut self, value: T) { help: remove the extra argument | LL | groups.push(/* (Vec, Vec) */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/tuple/wrong_argument_ice-4.stderr b/src/test/ui/tuple/wrong_argument_ice-4.stderr index 828ae21b4..a2686ab94 100644 --- a/src/test/ui/tuple/wrong_argument_ice-4.stderr +++ b/src/test/ui/tuple/wrong_argument_ice-4.stderr @@ -16,7 +16,7 @@ LL | (|| {})(|| { help: remove the extra argument | LL | (|| {})(); - | ~~~~~~~~~ + | ~~ error: aborting due to previous error diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr index 006253f84..eb58ee73c 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr @@ -12,7 +12,7 @@ LL | V(u8) help: provide the argument | LL | ::V(/* u8 */); - | ~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:22:17 diff --git a/src/test/ui/type-alias-impl-trait/closure_args.rs b/src/test/ui/type-alias-impl-trait/closure_args.rs new file mode 100644 index 000000000..c5e7af81d --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/closure_args.rs @@ -0,0 +1,16 @@ +// check-pass + +// regression test for https://github.com/rust-lang/rust/issues/100800 + +#![feature(type_alias_impl_trait)] + +trait Anything {} +impl Anything for T {} +type Input = impl Anything; +fn run ()>(f: F, i: Input) { + f(i); +} + +fn main() { + run(|x: u32| {println!("{x}");}, 0); +} diff --git a/src/test/ui/type-alias-impl-trait/closure_args2.rs b/src/test/ui/type-alias-impl-trait/closure_args2.rs new file mode 100644 index 000000000..82386c280 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/closure_args2.rs @@ -0,0 +1,23 @@ +// run-pass + +#![feature(type_alias_impl_trait)] + +trait Foo { + // This was reachable in https://github.com/rust-lang/rust/issues/100800 + fn foo(&self) { unreachable!() } +} +impl Foo for T {} + +struct B; +impl B { + fn foo(&self) {} +} + +type Input = impl Foo; +fn run1(f: F, i: Input) {f(i)} +fn run2(f: F, i: B) {f(i)} + +fn main() { + run1(|x: B| {x.foo()}, B); + run2(|x: B| {x.foo()}, B); +} diff --git a/src/test/ui/type-alias-impl-trait/constrain_inputs.rs b/src/test/ui/type-alias-impl-trait/constrain_inputs.rs index c32174288..03fb64b7b 100644 --- a/src/test/ui/type-alias-impl-trait/constrain_inputs.rs +++ b/src/test/ui/type-alias-impl-trait/constrain_inputs.rs @@ -1,17 +1,33 @@ -// check-pass - #![feature(type_alias_impl_trait)] -mod foo { +mod lifetime_params { type Ty<'a> = impl Sized; fn defining(s: &str) -> Ty<'_> { s } fn execute(ty: Ty<'_>) -> &str { todo!() } + //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types + + type BadFnSig = fn(Ty<'_>) -> &str; + //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types + type BadTraitRef = dyn Fn(Ty<'_>) -> &str; + //~^ ERROR binding for associated type `Output` references an anonymous lifetime } -mod bar { +mod lifetime_params_2 { type Ty<'a> = impl FnOnce() -> &'a str; fn defining(s: &str) -> Ty<'_> { move || s } fn execute(ty: Ty<'_>) -> &str { ty() } + //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types +} + +// regression test for https://github.com/rust-lang/rust/issues/97104 +mod type_params { + type Ty = impl Sized; + fn define(s: T) -> Ty { s } + + type BadFnSig = fn(Ty<&str>) -> &str; + //~^ ERROR return type references an anonymous lifetime, which is not constrained by the fn input types + type BadTraitRef = dyn Fn(Ty<&str>) -> &str; + //~^ ERROR binding for associated type `Output` references an anonymous lifetime } fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/constrain_inputs.stderr b/src/test/ui/type-alias-impl-trait/constrain_inputs.stderr new file mode 100644 index 000000000..93953fd06 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/constrain_inputs.stderr @@ -0,0 +1,58 @@ +error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types + --> $DIR/constrain_inputs.rs:6:31 + | +LL | fn execute(ty: Ty<'_>) -> &str { todo!() } + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types + --> $DIR/constrain_inputs.rs:9:35 + | +LL | type BadFnSig = fn(Ty<'_>) -> &str; + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0582]: binding for associated type `Output` references an anonymous lifetime, which does not appear in the trait input types + --> $DIR/constrain_inputs.rs:11:42 + | +LL | type BadTraitRef = dyn Fn(Ty<'_>) -> &str; + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types + --> $DIR/constrain_inputs.rs:18:31 + | +LL | fn execute(ty: Ty<'_>) -> &str { ty() } + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types + --> $DIR/constrain_inputs.rs:27:37 + | +LL | type BadFnSig = fn(Ty<&str>) -> &str; + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error[E0582]: binding for associated type `Output` references an anonymous lifetime, which does not appear in the trait input types + --> $DIR/constrain_inputs.rs:29:44 + | +LL | type BadTraitRef = dyn Fn(Ty<&str>) -> &str; + | ^^^^ + | + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0581, E0582. +For more information about an error, try `rustc --explain E0581`. diff --git a/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.rs b/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.rs new file mode 100644 index 000000000..3bae0f173 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.rs @@ -0,0 +1,31 @@ +#![feature(type_alias_impl_trait)] + +trait Static: 'static {} +impl Static for () {} + +type Gal = impl Static; +fn _defining() -> Gal {} + +trait Callable { type Output; } + +/// We can infer `>::Output: 'static`, +/// because we know `C: 'static` and `Arg: 'static`, +fn box_str(s: C::Output) -> Box + 'static> +where + Arg: Static, + C: ?Sized + Callable + 'static, + C::Output: AsRef, +{ + Box::new(s) +} + +fn extend_lifetime(s: &str) -> Box + 'static> { + type MalformedTy = dyn for<'a> Callable, Output = &'a str>; + //~^ ERROR binding for associated type `Output` references lifetime `'a` + box_str::(s) +} + +fn main() { + let extended = extend_lifetime(&String::from("hello")); + println!("{}", extended.as_ref().as_ref()); +} diff --git a/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr b/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr new file mode 100644 index 000000000..d5fc46cb1 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/constrain_inputs_unsound.stderr @@ -0,0 +1,9 @@ +error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types + --> $DIR/constrain_inputs_unsound.rs:23:58 + | +LL | type MalformedTy = dyn for<'a> Callable, Output = &'a str>; + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0582`. diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr index 2768f0c3a..586ea8234 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr @@ -4,7 +4,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, u) | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, U)` + = note: required for `(T, U)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; @@ -16,7 +16,7 @@ error[E0277]: `U` doesn't implement `Debug` LL | (t, u) | ^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, U)` + = note: required for `(T, U)` to implement `Debug` help: consider restricting type parameter `U` | LL | type Two = impl Debug; @@ -28,7 +28,7 @@ error[E0277]: `U` doesn't implement `Debug` LL | (u, t) | ^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, T)` + = note: required for `(U, T)` to implement `Debug` help: consider restricting type parameter `U` | LL | type Two = impl Debug; @@ -40,7 +40,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (u, t) | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, T)` + = note: required for `(U, T)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr index c1712ca2e..cb162d382 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr @@ -4,7 +4,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, t) | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, T)` + = note: required for `(T, T)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; @@ -16,7 +16,7 @@ error[E0277]: `U` doesn't implement `Debug` LL | (u, t) | ^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, T)` + = note: required for `(U, T)` to implement `Debug` help: consider restricting type parameter `U` | LL | type Two = impl Debug; @@ -28,7 +28,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (u, t) | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, T)` + = note: required for `(U, T)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr index b83105c45..14cbfb380 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr @@ -4,7 +4,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, 4u32) | ^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, u32)` + = note: required for `(T, u32)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; @@ -16,7 +16,7 @@ error[E0277]: `U` doesn't implement `Debug` LL | (u, 4u32) | ^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(U, u32)` + = note: required for `(U, u32)` to implement `Debug` help: consider restricting type parameter `U` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr index 50cf98273..722693e42 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr @@ -15,7 +15,7 @@ error[E0277]: `A` doesn't implement `Debug` LL | (t, u, T::BAR) | ^^^^^^^^^^^^^^ `A` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(A, B, _)` + = note: required for `(A, B, _)` to implement `Debug` help: consider restricting type parameter `A` | LL | type Two = impl Debug; @@ -27,7 +27,7 @@ error[E0277]: `B` doesn't implement `Debug` LL | (t, u, T::BAR) | ^^^^^^^^^^^^^^ `B` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(A, B, _)` + = note: required for `(A, B, _)` to implement `Debug` help: consider restricting type parameter `B` | LL | type Two = impl Debug; @@ -39,7 +39,7 @@ error[E0277]: `A` doesn't implement `Debug` LL | (t, u, 42) | ^^^^^^^^^^ `A` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(A, B, i32)` + = note: required for `(A, B, i32)` to implement `Debug` help: consider restricting type parameter `A` | LL | type Two = impl Debug; @@ -51,7 +51,7 @@ error[E0277]: `B` doesn't implement `Debug` LL | (t, u, 42) | ^^^^^^^^^^ `B` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(A, B, i32)` + = note: required for `(A, B, i32)` to implement `Debug` help: consider restricting type parameter `B` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/issue-57961.rs b/src/test/ui/type-alias-impl-trait/issue-57961.rs index 472886c9c..24b3a0458 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57961.rs +++ b/src/test/ui/type-alias-impl-trait/issue-57961.rs @@ -8,7 +8,7 @@ trait Foo { impl Foo for () { type Bar = std::vec::IntoIter; - //~^ ERROR type mismatch resolving ` as Iterator>::Item == X + //~^ ERROR expected `std::vec::IntoIter` to be an iterator that yields `X`, but it yields `u32` } fn incoherent() { diff --git a/src/test/ui/type-alias-impl-trait/issue-57961.stderr b/src/test/ui/type-alias-impl-trait/issue-57961.stderr index ed4caf6ce..fb40895c4 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57961.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-57961.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving ` as Iterator>::Item == X` +error[E0271]: expected `std::vec::IntoIter` to be an iterator that yields `X`, but it yields `u32` --> $DIR/issue-57961.rs:10:16 | LL | type X = impl Sized; diff --git a/src/test/ui/type-alias-impl-trait/issue-60371.stderr b/src/test/ui/type-alias-impl-trait/issue-60371.stderr index 082b0f0c3..d0c04371b 100644 --- a/src/test/ui/type-alias-impl-trait/issue-60371.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-60371.stderr @@ -11,7 +11,7 @@ error[E0277]: the trait bound `(): Bug` is not satisfied --> $DIR/issue-60371.rs:10:40 | LL | const FUN: fn() -> Self::Item = || (); - | ^ the trait `Bug` is not implemented for `()` + | ^^ the trait `Bug` is not implemented for `()` | = help: the trait `Bug` is implemented for `&()` diff --git a/src/test/ui/type-alias-impl-trait/issue-74280.stderr b/src/test/ui/type-alias-impl-trait/issue-74280.stderr index 5ed29e0ac..66886db6e 100644 --- a/src/test/ui/type-alias-impl-trait/issue-74280.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-74280.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-74280.rs:9:5 | LL | fn test() -> Test { - | ---- expected `_` because of return type + | ---- expected `()` because of return type LL | let y = || -> Test { () }; LL | 7 | ^ expected `()`, found integer diff --git a/src/test/ui/type-alias-impl-trait/issue-90400-1.rs b/src/test/ui/type-alias-impl-trait/issue-90400-1.rs index 8550a3e86..15aead2f6 100644 --- a/src/test/ui/type-alias-impl-trait/issue-90400-1.rs +++ b/src/test/ui/type-alias-impl-trait/issue-90400-1.rs @@ -1,7 +1,6 @@ // Regression test for #90400, // taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836 -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] trait Bar { diff --git a/src/test/ui/type-alias-impl-trait/issue-90400-1.stderr b/src/test/ui/type-alias-impl-trait/issue-90400-1.stderr index 428a10740..ead28769f 100644 --- a/src/test/ui/type-alias-impl-trait/issue-90400-1.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-90400-1.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `B: Bar` is not satisfied - --> $DIR/issue-90400-1.rs:23:9 + --> $DIR/issue-90400-1.rs:22:9 | LL | move || bar.bar() | ^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` | note: required by a bound in `::foo` - --> $DIR/issue-90400-1.rs:22:15 + --> $DIR/issue-90400-1.rs:21:15 | LL | fn foo(&self, bar: B) -> Self::FooFn { | ^^^ required by this bound in `::foo` diff --git a/src/test/ui/type-alias-impl-trait/issue-90400-2.rs b/src/test/ui/type-alias-impl-trait/issue-90400-2.rs index 2b369bb8a..4c6e893c1 100644 --- a/src/test/ui/type-alias-impl-trait/issue-90400-2.rs +++ b/src/test/ui/type-alias-impl-trait/issue-90400-2.rs @@ -1,7 +1,6 @@ // Regression test for #90400, // taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836 -#![feature(generic_associated_types)] #![feature(type_alias_impl_trait)] trait Bar { diff --git a/src/test/ui/type-alias-impl-trait/issue-90400-2.stderr b/src/test/ui/type-alias-impl-trait/issue-90400-2.stderr index 5da05a439..50b2dc049 100644 --- a/src/test/ui/type-alias-impl-trait/issue-90400-2.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-90400-2.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `B: Bar` is not satisfied - --> $DIR/issue-90400-2.rs:26:9 + --> $DIR/issue-90400-2.rs:25:9 | LL | MyBaz(bar) | ^^^^^^^^^^ the trait `Bar` is not implemented for `B` | -note: required because of the requirements on the impl of `Baz` for `MyBaz` - --> $DIR/issue-90400-2.rs:31:14 +note: required for `MyBaz` to implement `Baz` + --> $DIR/issue-90400-2.rs:30:14 | LL | impl Baz for MyBaz { | ^^^ ^^^^^^^^ diff --git a/src/test/ui/type-alias-impl-trait/issue-98604.rs b/src/test/ui/type-alias-impl-trait/issue-98604.rs index a4fd8a82a..32c2f9ed5 100644 --- a/src/test/ui/type-alias-impl-trait/issue-98604.rs +++ b/src/test/ui/type-alias-impl-trait/issue-98604.rs @@ -1,13 +1,11 @@ // edition:2018 -type AsyncFnPtr = Box< - dyn Fn() -> std::pin::Pin>>, ->; +type AsyncFnPtr = Box std::pin::Pin>>>; async fn test() {} #[allow(unused_must_use)] fn main() { Box::new(test) as AsyncFnPtr; - //~^ ERROR type mismatch + //~^ ERROR expected `fn() -> impl Future {test}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` } diff --git a/src/test/ui/type-alias-impl-trait/issue-98604.stderr b/src/test/ui/type-alias-impl-trait/issue-98604.stderr index f04d1b4d7..92d01eb0d 100644 --- a/src/test/ui/type-alias-impl-trait/issue-98604.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-98604.stderr @@ -1,11 +1,11 @@ -error[E0271]: type mismatch resolving ` impl Future {test} as FnOnce<()>>::Output == Pin + 'static)>>` - --> $DIR/issue-98604.rs:11:5 +error[E0271]: expected `fn() -> impl Future {test}` to be a fn item that returns `Pin + 'static)>>`, but it returns `impl Future` + --> $DIR/issue-98604.rs:9:5 | LL | Box::new(test) as AsyncFnPtr; | ^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type | note: while checking the return type of the `async fn` - --> $DIR/issue-98604.rs:7:17 + --> $DIR/issue-98604.rs:5:17 | LL | async fn test() {} | ^ checked the `Output` of this `async fn`, found opaque type diff --git a/src/test/ui/type-alias-impl-trait/issue-98608.rs b/src/test/ui/type-alias-impl-trait/issue-98608.rs index d75762a8b..1f89af045 100644 --- a/src/test/ui/type-alias-impl-trait/issue-98608.rs +++ b/src/test/ui/type-alias-impl-trait/issue-98608.rs @@ -1,8 +1,10 @@ -fn hi() -> impl Sized { std::ptr::null::() } +fn hi() -> impl Sized { + std::ptr::null::() +} fn main() { let b: Box Box> = Box::new(hi); - //~^ ERROR type mismatch resolving ` impl Sized {hi} as FnOnce<()>>::Output == Box` + //~^ ERROR expected `fn() -> impl Sized {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/src/test/ui/type-alias-impl-trait/issue-98608.stderr b/src/test/ui/type-alias-impl-trait/issue-98608.stderr index 8f3ec7d9d..916a58451 100644 --- a/src/test/ui/type-alias-impl-trait/issue-98608.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-98608.stderr @@ -1,7 +1,7 @@ -error[E0271]: type mismatch resolving ` impl Sized {hi} as FnOnce<()>>::Output == Box` - --> $DIR/issue-98608.rs:4:39 +error[E0271]: expected `fn() -> impl Sized {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 { std::ptr::null::() } +LL | fn hi() -> impl Sized { | ---------- the found opaque type ... LL | let b: Box Box> = Box::new(hi); diff --git a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr index cdaae99e2..66a6b0bbf 100644 --- a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr +++ b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `&'static B: From<&A>` is not satisfied LL | fn f(a: &'static A, b: B) -> (X, X) { | ^^^^^^^^^^^^^^^^^^ the trait `From<&A>` is not implemented for `&'static B` | - = note: required because of the requirements on the impl of `Into<&'static B>` for `&A` + = note: required for `&A` to implement `Into<&'static B>` help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn f(a: &'static A, b: B) -> (X, X) where &'static B: From<&A> { diff --git a/src/test/ui/type-alias-impl-trait/not_a_defining_use.stderr b/src/test/ui/type-alias-impl-trait/not_a_defining_use.stderr index a5ac38c38..b11198c58 100644 --- a/src/test/ui/type-alias-impl-trait/not_a_defining_use.stderr +++ b/src/test/ui/type-alias-impl-trait/not_a_defining_use.stderr @@ -4,7 +4,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, 5i8) | ^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, i8)` + = note: required for `(T, i8)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; @@ -27,7 +27,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | (t, ::FOO) | ^^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: required because of the requirements on the impl of `Debug` for `(T, _)` + = note: required for `(T, _)` to implement `Debug` help: consider restricting type parameter `T` | LL | type Two = impl Debug; diff --git a/src/test/ui/type-alias-impl-trait/underconstrained_generic.stderr b/src/test/ui/type-alias-impl-trait/underconstrained_generic.stderr index e70916573..95fb6f6a5 100644 --- a/src/test/ui/type-alias-impl-trait/underconstrained_generic.stderr +++ b/src/test/ui/type-alias-impl-trait/underconstrained_generic.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | () | ^^ the trait `Trait` is not implemented for `T` | -note: required because of the requirements on the impl of `ProofForConversion` for `()` +note: required for `()` to implement `ProofForConversion` --> $DIR/underconstrained_generic.rs:13:16 | LL | impl ProofForConversion for () { diff --git a/src/test/ui/type/issue-100584.rs b/src/test/ui/type/issue-100584.rs new file mode 100644 index 000000000..102846563 --- /dev/null +++ b/src/test/ui/type/issue-100584.rs @@ -0,0 +1,15 @@ +#![deny(unused)] +fn foo(xyza: &str) { +//~^ ERROR unused variable: `xyza` + let _ = "{xyza}"; +} + +fn foo3(xyza: &str) { +//~^ ERROR unused variable: `xyza` + let _ = "aaa{xyza}bbb"; +} + +fn main() { + foo("x"); + foo3("xx"); +} diff --git a/src/test/ui/type/issue-100584.stderr b/src/test/ui/type/issue-100584.stderr new file mode 100644 index 000000000..e1db14d1f --- /dev/null +++ b/src/test/ui/type/issue-100584.stderr @@ -0,0 +1,44 @@ +error: unused variable: `xyza` + --> $DIR/issue-100584.rs:2:8 + | +LL | fn foo(xyza: &str) { + | ^^^^ unused variable +LL | +LL | let _ = "{xyza}"; + | -------- you might have meant to use string interpolation in this string literal + | +note: the lint level is defined here + --> $DIR/issue-100584.rs:1:9 + | +LL | #![deny(unused)] + | ^^^^^^ + = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` +help: string interpolation only works in `format!` invocations + | +LL | let _ = format!("{xyza}"); + | ++++++++ + +help: if this is intentional, prefix it with an underscore + | +LL | fn foo(_xyza: &str) { + | ~~~~~ + +error: unused variable: `xyza` + --> $DIR/issue-100584.rs:7:9 + | +LL | fn foo3(xyza: &str) { + | ^^^^ unused variable +LL | +LL | let _ = "aaa{xyza}bbb"; + | -------------- you might have meant to use string interpolation in this string literal + | +help: string interpolation only works in `format!` invocations + | +LL | let _ = format!("aaa{xyza}bbb"); + | ++++++++ + +help: if this is intentional, prefix it with an underscore + | +LL | fn foo3(_xyza: &str) { + | ~~~~~ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/type/type-alias-bounds.rs b/src/test/ui/type/type-alias-bounds.rs index 65b79650d..e49731725 100644 --- a/src/test/ui/type/type-alias-bounds.rs +++ b/src/test/ui/type/type-alias-bounds.rs @@ -52,7 +52,7 @@ type T2 where U: Bound = U::Assoc; //~ WARN not enforced in type aliases // Do this instead: type T4 = ::Assoc; -// Make sure the help about associatd types is not shown incorrectly +// Make sure the help about associated types is not shown incorrectly type T5 = ::Assoc; //~ WARN not enforced in type aliases type T6 = ::std::vec::Vec; //~ WARN not enforced in type aliases diff --git a/src/test/ui/type/type-arg-out-of-scope.stderr b/src/test/ui/type/type-arg-out-of-scope.stderr index 0b6283fbc..7f18b4510 100644 --- a/src/test/ui/type/type-arg-out-of-scope.stderr +++ b/src/test/ui/type/type-arg-out-of-scope.stderr @@ -4,9 +4,9 @@ error[E0401]: can't use generic parameters from outer function LL | fn foo(x: T) { | - type parameter from outer function LL | fn bar(f: Box T>) { } - | --- ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `bar` + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `` error[E0401]: can't use generic parameters from outer function --> $DIR/type-arg-out-of-scope.rs:3:35 @@ -14,9 +14,9 @@ error[E0401]: can't use generic parameters from outer function LL | fn foo(x: T) { | - type parameter from outer function LL | fn bar(f: Box T>) { } - | --- ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `bar` + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `` error: aborting due to 2 previous errors diff --git a/src/test/ui/type/type-ascription-instead-of-initializer.stderr b/src/test/ui/type/type-ascription-instead-of-initializer.stderr index fcac6c495..de578ca93 100644 --- a/src/test/ui/type/type-ascription-instead-of-initializer.stderr +++ b/src/test/ui/type/type-ascription-instead-of-initializer.stderr @@ -21,7 +21,7 @@ LL | pub fn with_capacity(capacity: usize) -> Self { help: remove the extra argument | LL | let x: Vec::with_capacity(10); - | ~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~ error: aborting due to 2 previous errors diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index 56a9b5317..cf77c057d 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -1,8 +1,8 @@ error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32` - --> $DIR/type-check-defaults.rs:6:19 + --> $DIR/type-check-defaults.rs:6:23 | LL | struct WellFormed>(Z); - | ^^^^^^^^^^^^^^^^^ value of type `i32` cannot be built from `std::iter::Iterator` + | ^^^^^^^^^^^^^ value of type `i32` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator` is not implemented for `i32` note: required by a bound in `Foo` @@ -12,10 +12,10 @@ LL | struct Foo>(T, U); | ^^^^^^^^^^^^^^^ required by this bound in `Foo` error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32` - --> $DIR/type-check-defaults.rs:8:27 + --> $DIR/type-check-defaults.rs:8:38 | LL | struct WellFormedNoBounds>(Z); - | ^^^^^^^^^^^^^^^^^^^^^^^^ value of type `i32` cannot be built from `std::iter::Iterator` + | ^^^^^^^^^^^^^ value of type `i32` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator` is not implemented for `i32` note: required by a bound in `Foo` diff --git a/src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr b/src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr index 615fd2ccb..847bc517e 100644 --- a/src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr +++ b/src/test/ui/type/type-check/issue-88577-check-fn-with-more-than-65535-arguments.stderr @@ -1,13 +1,13 @@ error: function can not have more than 65535 arguments - --> $DIR/issue-88577-check-fn-with-more-than-65535-arguments.rs:6:24 + --> $DIR/issue-88577-check-fn-with-more-than-65535-arguments.rs:6:22 | -LL | fn _f($($t: ()),*) {} - | ________________________^ -LL | | } -LL | | } -LL | | -LL | | many_args!{[_]########## ######} - | |____________^ +LL | fn _f($($t: ()),*) {} + | ^ +... +LL | many_args!{[_]########## ######} + | -------------------------------- in this macro invocation + | + = note: this error originates in the macro `many_args` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/type/type-params-in-different-spaces-2.stderr b/src/test/ui/type/type-params-in-different-spaces-2.stderr index 53610985f..220b3929c 100644 --- a/src/test/ui/type/type-params-in-different-spaces-2.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-2.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `Self: Tr` is not satisfied - --> $DIR/type-params-in-different-spaces-2.rs:10:9 + --> $DIR/type-params-in-different-spaces-2.rs:10:16 | LL | Tr::op(u) - | ^^^^^^ the trait `Tr` is not implemented for `Self` + | ------ ^ the trait `Tr` is not implemented for `Self` + | | + | required by a bound introduced by this call | help: consider further restricting `Self` | @@ -10,10 +12,12 @@ LL | fn test(u: U) -> Self where Self: Tr { | +++++++++++++++++ error[E0277]: the trait bound `Self: Tr` is not satisfied - --> $DIR/type-params-in-different-spaces-2.rs:16:9 + --> $DIR/type-params-in-different-spaces-2.rs:16:16 | LL | Tr::op(u) - | ^^^^^^ the trait `Tr` is not implemented for `Self` + | ------ ^ the trait `Tr` is not implemented for `Self` + | | + | required by a bound introduced by this call | help: consider further restricting `Self` | diff --git a/src/test/ui/type_length_limit.stderr b/src/test/ui/type_length_limit.stderr index 1508b84c1..84ac48b1e 100644 --- a/src/test/ui/type_length_limit.stderr +++ b/src/test/ui/type_length_limit.stderr @@ -4,8 +4,8 @@ error: reached the type-length limit while instantiating `std::mem::drop::(_x: T) {} | ^^^^^^^^^^^^^^^^^^^^^ | - = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt' = help: consider adding a `#![type_length_limit="8"]` attribute to your crate + = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt' error: reached the type-length limit while instantiating `<[closure@std::rt::lang_start<()...e<()>>::call_once - shim(vtable)` --> $SRC_DIR/core/src/ops/function.rs:LL:COL @@ -13,8 +13,8 @@ error: reached the type-length limit while instantiating `<[closure@std::rt::lan LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt' = help: consider adding a `#![type_length_limit="8"]` attribute to your crate + = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt' error: aborting due to 2 previous errors diff --git a/src/test/ui/typeck/assign-non-lval-derefmut.stderr b/src/test/ui/typeck/assign-non-lval-derefmut.stderr index a6fcdfe21..e394cf820 100644 --- a/src/test/ui/typeck/assign-non-lval-derefmut.stderr +++ b/src/test/ui/typeck/assign-non-lval-derefmut.stderr @@ -19,7 +19,7 @@ LL | x.lock().unwrap() += 1; | | | cannot use `+=` on type `MutexGuard<'_, usize>` | -help: `+=` can be used on `usize`, you can dereference `x.lock().unwrap()` +help: `+=` can be used on `usize` if you dereference the left-hand side | LL | *x.lock().unwrap() += 1; | + @@ -47,7 +47,7 @@ LL | y += 1; | | | cannot use `+=` on type `MutexGuard<'_, usize>` | -help: `+=` can be used on `usize`, you can dereference `y` +help: `+=` can be used on `usize` if you dereference the left-hand side | LL | *y += 1; | + diff --git a/src/test/ui/typeck/assign-non-lval-mut-ref.stderr b/src/test/ui/typeck/assign-non-lval-mut-ref.stderr index be2e9fe95..cbdc960ba 100644 --- a/src/test/ui/typeck/assign-non-lval-mut-ref.stderr +++ b/src/test/ui/typeck/assign-non-lval-mut-ref.stderr @@ -19,7 +19,7 @@ LL | x.last_mut().unwrap() += 1; | | | cannot use `+=` on type `&mut usize` | -help: `+=` can be used on `usize`, you can dereference `x.last_mut().unwrap()` +help: `+=` can be used on `usize` if you dereference the left-hand side | LL | *x.last_mut().unwrap() += 1; | + @@ -45,7 +45,7 @@ LL | y += 1; | | | cannot use `+=` on type `&mut usize` | -help: `+=` can be used on `usize`, you can dereference `y` +help: `+=` can be used on `usize` if you dereference the left-hand side | LL | *y += 1; | + diff --git a/src/test/ui/typeck/assign-non-lval-needs-deref.rs b/src/test/ui/typeck/assign-non-lval-needs-deref.rs new file mode 100644 index 000000000..c979d76b4 --- /dev/null +++ b/src/test/ui/typeck/assign-non-lval-needs-deref.rs @@ -0,0 +1,19 @@ +// issue #101376 + +use std::ops::AddAssign; +struct Foo; + +impl AddAssign<()> for Foo { + fn add_assign(&mut self, _: ()) {} +} + +impl AddAssign<()> for &mut Foo { + fn add_assign(&mut self, _: ()) {} +} + +fn main() { + (&mut Foo) += (); + //~^ ERROR invalid left-hand side of assignment + //~| NOTE cannot assign to this expression + //~| HELP consider dereferencing the left-hand side of this operation +} diff --git a/src/test/ui/typeck/assign-non-lval-needs-deref.stderr b/src/test/ui/typeck/assign-non-lval-needs-deref.stderr new file mode 100644 index 000000000..ee83b1453 --- /dev/null +++ b/src/test/ui/typeck/assign-non-lval-needs-deref.stderr @@ -0,0 +1,16 @@ +error[E0067]: invalid left-hand side of assignment + --> $DIR/assign-non-lval-needs-deref.rs:15:16 + | +LL | (&mut Foo) += (); + | ---------- ^^ + | | + | cannot assign to this expression + | +help: consider dereferencing the left-hand side of this operation + | +LL | *(&mut Foo) += (); + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0067`. diff --git a/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs new file mode 100644 index 000000000..97e0b213f --- /dev/null +++ b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs @@ -0,0 +1,8 @@ +trait Foo { + const A; //~ ERROR missing type for `const` item + static B; + //~^ ERROR associated `static` items are not allowed + //~| ERROR missing type for `static` item +} + +fn main() {} diff --git a/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr new file mode 100644 index 000000000..8982d6285 --- /dev/null +++ b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr @@ -0,0 +1,20 @@ +error: associated `static` items are not allowed + --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:3:5 + | +LL | static B; + | ^^^^^^^^^ + +error: missing type for `const` item + --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:2:12 + | +LL | const A; + | ^ help: provide a type for the item: `: ` + +error: missing type for `static` item + --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:3:13 + | +LL | static B; + | ^ help: provide a type for the item: `: ` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/typeck/issue-100164.fixed b/src/test/ui/typeck/issue-100164.fixed new file mode 100644 index 000000000..a5f68beb1 --- /dev/null +++ b/src/test/ui/typeck/issue-100164.fixed @@ -0,0 +1,9 @@ +// run-rustfix + +const _A: i32 = 123; +//~^ ERROR: missing type for `const` item + +fn main() { + const _B: i32 = 123; + //~^ ERROR: missing type for `const` item +} diff --git a/src/test/ui/typeck/issue-100164.rs b/src/test/ui/typeck/issue-100164.rs new file mode 100644 index 000000000..7efb9ac62 --- /dev/null +++ b/src/test/ui/typeck/issue-100164.rs @@ -0,0 +1,9 @@ +// run-rustfix + +const _A: = 123; +//~^ ERROR: missing type for `const` item + +fn main() { + const _B: = 123; + //~^ ERROR: missing type for `const` item +} diff --git a/src/test/ui/typeck/issue-100164.stderr b/src/test/ui/typeck/issue-100164.stderr new file mode 100644 index 000000000..06a132d65 --- /dev/null +++ b/src/test/ui/typeck/issue-100164.stderr @@ -0,0 +1,14 @@ +error: missing type for `const` item + --> $DIR/issue-100164.rs:3:10 + | +LL | const _A: = 123; + | ^ help: provide a type for the constant: `i32` + +error: missing type for `const` item + --> $DIR/issue-100164.rs:7:14 + | +LL | const _B: = 123; + | ^ help: provide a type for the constant: `i32` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/typeck/issue-100246.rs b/src/test/ui/typeck/issue-100246.rs new file mode 100644 index 000000000..8f0b34bab --- /dev/null +++ b/src/test/ui/typeck/issue-100246.rs @@ -0,0 +1,30 @@ +#![recursion_limit = "5"] // To reduce noise + +//expect incompatible type error when ambiguous traits are in scope +//and not an overflow error on the span in the main function. + +struct Ratio(T); + +pub trait Pow { + fn pow(self) -> Self; +} + +impl<'a, T> Pow for &'a Ratio +where + &'a T: Pow, +{ + fn pow(self) -> Self { + self + } +} + +fn downcast<'a, W: ?Sized>() -> std::io::Result<&'a W> { + todo!() +} + +struct Other; + +fn main() -> std::io::Result<()> { + let other: Other = downcast()?;//~ERROR 28:24: 28:35: `?` operator has incompatible types + Ok(()) +} diff --git a/src/test/ui/typeck/issue-100246.stderr b/src/test/ui/typeck/issue-100246.stderr new file mode 100644 index 000000000..8b77de94e --- /dev/null +++ b/src/test/ui/typeck/issue-100246.stderr @@ -0,0 +1,13 @@ +error[E0308]: `?` operator has incompatible types + --> $DIR/issue-100246.rs:28:24 + | +LL | let other: Other = downcast()?; + | ^^^^^^^^^^^ expected struct `Other`, found reference + | + = note: `?` operator cannot convert from `&_` to `Other` + = note: expected struct `Other` + found reference `&_` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/typeck/issue-100285.rs b/src/test/ui/typeck/issue-100285.rs new file mode 100644 index 000000000..e206469b8 --- /dev/null +++ b/src/test/ui/typeck/issue-100285.rs @@ -0,0 +1,22 @@ +fn foo(n: i32) -> i32 { + for i in 0..0 { + //~^ ERROR: mismatched types [E0308] + if n < 0 { + return i; + } else if n < 10 { + return 1; + } else if n < 20 { + return 2; + } else if n < 30 { + return 3; + } else if n < 40 { + return 4; + } else { + return 5; + } + + } + //~| help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility +} + +fn main() {} diff --git a/src/test/ui/typeck/issue-100285.stderr b/src/test/ui/typeck/issue-100285.stderr new file mode 100644 index 000000000..42c64b039 --- /dev/null +++ b/src/test/ui/typeck/issue-100285.stderr @@ -0,0 +1,34 @@ +error[E0308]: mismatched types + --> $DIR/issue-100285.rs:2:5 + | +LL | fn foo(n: i32) -> i32 { + | --- expected `i32` because of return type +LL | / for i in 0..0 { +LL | | +LL | | if n < 0 { +LL | | return i; +... | +LL | | +LL | | } + | |_____^ expected `i32`, found `()` + | +note: the function expects a value to always be returned, but loops might run zero times + --> $DIR/issue-100285.rs:2:5 + | +LL | for i in 0..0 { + | ^^^^^^^^^^^^^ this might have zero elements to iterate on +... +LL | return i; + | -------- if the loop doesn't execute, this value would never get returned +LL | } else if n < 10 { +LL | return 1; + | -------- if the loop doesn't execute, this value would never get returned +LL | } else if n < 20 { +LL | return 2; + | -------- if the loop doesn't execute, this value would never get returned + = note: if the loop doesn't execute, 3 other values would never get returned + = help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/typeck/issue-29124.stderr b/src/test/ui/typeck/issue-29124.stderr index c5d2ec084..a837a7d2d 100644 --- a/src/test/ui/typeck/issue-29124.stderr +++ b/src/test/ui/typeck/issue-29124.stderr @@ -2,17 +2,13 @@ error[E0599]: no method named `x` found for fn item `fn() -> Ret {Obj::func}` in --> $DIR/issue-29124.rs:15:15 | LL | Obj::func.x(); - | --------- ^ method not found in `fn() -> Ret {Obj::func}` - | | - | this is a function, perhaps you wish to call it + | ^ method not found in `fn() -> Ret {Obj::func}` error[E0599]: no method named `x` found for fn item `fn() -> Ret {func}` in the current scope --> $DIR/issue-29124.rs:17:10 | LL | func.x(); - | ---- ^ method not found in `fn() -> Ret {func}` - | | - | this is a function, perhaps you wish to call it + | ^ method not found in `fn() -> Ret {func}` error: aborting due to 2 previous errors diff --git a/src/test/ui/typeck/issue-79040.stderr b/src/test/ui/typeck/issue-79040.stderr index aec2e1ec9..c820d1e08 100644 --- a/src/test/ui/typeck/issue-79040.stderr +++ b/src/test/ui/typeck/issue-79040.stderr @@ -7,10 +7,10 @@ LL | const FOO = "hello" + 1; | &str error: missing type for `const` item - --> $DIR/issue-79040.rs:2:11 + --> $DIR/issue-79040.rs:2:14 | LL | const FOO = "hello" + 1; - | ^^^ help: provide a type for the item: `FOO: ` + | ^ help: provide a type for the item: `: ` error: aborting due to 2 previous errors diff --git a/src/test/ui/typeck/issue-87181/empty-tuple-method.rs b/src/test/ui/typeck/issue-87181/empty-tuple-method.rs index 1875d8280..be68ad32a 100644 --- a/src/test/ui/typeck/issue-87181/empty-tuple-method.rs +++ b/src/test/ui/typeck/issue-87181/empty-tuple-method.rs @@ -4,7 +4,7 @@ struct Bar { struct Foo(); impl Foo { - fn foo() { } + fn foo(&self) { } } fn main() { diff --git a/src/test/ui/typeck/issue-87181/empty-tuple-method.stderr b/src/test/ui/typeck/issue-87181/empty-tuple-method.stderr index 6ed70b301..a18c54a29 100644 --- a/src/test/ui/typeck/issue-87181/empty-tuple-method.stderr +++ b/src/test/ui/typeck/issue-87181/empty-tuple-method.stderr @@ -2,11 +2,9 @@ error[E0599]: no method named `foo` found for fn item `fn() -> Foo {Foo}` in the --> $DIR/empty-tuple-method.rs:12:15 | LL | thing.bar.foo(); - | --------- ^^^ method not found in `fn() -> Foo {Foo}` - | | - | this is the constructor of a struct + | ^^^ method not found in `fn() -> Foo {Foo}` | -help: call the constructor +help: use parentheses to instantiate this tuple struct | LL | (thing.bar)().foo(); | + +++ diff --git a/src/test/ui/typeck/issue-87181/enum-variant.rs b/src/test/ui/typeck/issue-87181/enum-variant.rs index 3b926b90f..d87f99c3c 100644 --- a/src/test/ui/typeck/issue-87181/enum-variant.rs +++ b/src/test/ui/typeck/issue-87181/enum-variant.rs @@ -6,7 +6,7 @@ enum Foo{ Tup() } impl Foo { - fn foo() { } + fn foo(&self) { } } fn main() { diff --git a/src/test/ui/typeck/issue-87181/enum-variant.stderr b/src/test/ui/typeck/issue-87181/enum-variant.stderr index a3a818696..90641410d 100644 --- a/src/test/ui/typeck/issue-87181/enum-variant.stderr +++ b/src/test/ui/typeck/issue-87181/enum-variant.stderr @@ -2,11 +2,9 @@ error[E0599]: no method named `foo` found for fn item `fn() -> Foo {Foo::Tup}` i --> $DIR/enum-variant.rs:14:15 | LL | thing.bar.foo(); - | --------- ^^^ method not found in `fn() -> Foo {Foo::Tup}` - | | - | this is the constructor of an enum variant + | ^^^ method not found in `fn() -> Foo {Foo::Tup}` | -help: call the constructor +help: use parentheses to instantiate this tuple variant | LL | (thing.bar)().foo(); | + +++ diff --git a/src/test/ui/typeck/issue-87181/tuple-field.stderr b/src/test/ui/typeck/issue-87181/tuple-field.stderr index 4d22ada02..c1ca26ee9 100644 --- a/src/test/ui/typeck/issue-87181/tuple-field.stderr +++ b/src/test/ui/typeck/issue-87181/tuple-field.stderr @@ -2,14 +2,12 @@ error[E0609]: no field `0` on type `fn(char, u16) -> Foo {Foo}` --> $DIR/tuple-field.rs:12:15 | LL | thing.bar.0; - | --------- ^ - | | - | this is the constructor of a struct + | ^ | -help: call the constructor +help: use parentheses to instantiate this tuple struct | -LL | (thing.bar)(_, _).0; - | + +++++++ +LL | (thing.bar)(/* char */, /* u16 */).0; + | + ++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/typeck/issue-87181/tuple-method.stderr b/src/test/ui/typeck/issue-87181/tuple-method.stderr index 1e392e179..e27c41858 100644 --- a/src/test/ui/typeck/issue-87181/tuple-method.stderr +++ b/src/test/ui/typeck/issue-87181/tuple-method.stderr @@ -2,14 +2,7 @@ error[E0599]: no method named `foo` found for fn item `fn(u8, i32) -> Foo {Foo}` --> $DIR/tuple-method.rs:12:15 | LL | thing.bar.foo(); - | --------- ^^^ method not found in `fn(u8, i32) -> Foo {Foo}` - | | - | this is the constructor of a struct - | -help: call the constructor - | -LL | (thing.bar)(_, _).foo(); - | + +++++++ + | ^^^ method not found in `fn(u8, i32) -> Foo {Foo}` error: aborting due to previous error diff --git a/src/test/ui/typeck/issue-90101.stderr b/src/test/ui/typeck/issue-90101.stderr index ab9a72edf..d2729d853 100644 --- a/src/test/ui/typeck/issue-90101.stderr +++ b/src/test/ui/typeck/issue-90101.stderr @@ -12,7 +12,7 @@ LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world") >> > > - = note: required because of the requirements on the impl of `Into` for `Cow<'_, str>` + = note: required for `Cow<'_, str>` to implement `Into` note: required by a bound in `func` --> $DIR/issue-90101.rs:3:20 | diff --git a/src/test/ui/typeck/issue-91210-ptr-method.stderr b/src/test/ui/typeck/issue-91210-ptr-method.stderr index 503a32373..7a0cfb2cf 100644 --- a/src/test/ui/typeck/issue-91210-ptr-method.stderr +++ b/src/test/ui/typeck/issue-91210-ptr-method.stderr @@ -2,9 +2,12 @@ error[E0615]: attempted to take value of method `read` on type `*mut Foo` --> $DIR/issue-91210-ptr-method.rs:10:7 | LL | x.read = 4; - | - ^^^^ method, not a field - | | - | help: to access the field, dereference first: `(*x)` + | ^^^^ method, not a field + | +help: to access the field, dereference first + | +LL | (*x).read = 4; + | ++ + error: aborting due to previous error diff --git a/src/test/ui/typeck/issue-91633.rs b/src/test/ui/typeck/issue-91633.rs new file mode 100644 index 000000000..331a798dd --- /dev/null +++ b/src/test/ui/typeck/issue-91633.rs @@ -0,0 +1,8 @@ +// check-pass +fn f (it: &[T]) +where + [T] : std::ops::Index, +{ + let _ = &it[0]; +} +fn main(){} diff --git a/src/test/ui/typeck/issue-96738.stderr b/src/test/ui/typeck/issue-96738.stderr index 32f538498..0d4d87ef4 100644 --- a/src/test/ui/typeck/issue-96738.stderr +++ b/src/test/ui/typeck/issue-96738.stderr @@ -2,27 +2,13 @@ error[E0599]: no method named `nonexistent_method` found for fn item `fn(_) -> O --> $DIR/issue-96738.rs:2:10 | LL | Some.nonexistent_method(); - | ---- ^^^^^^^^^^^^^^^^^^ method not found in `fn(_) -> Option<_> {Option::<_>::Some}` - | | - | this is the constructor of an enum variant - | -help: call the constructor - | -LL | (Some)(_).nonexistent_method(); - | + ++++ + | ^^^^^^^^^^^^^^^^^^ method not found in `fn(_) -> Option<_> {Option::<_>::Some}` error[E0609]: no field `nonexistent_field` on type `fn(_) -> Option<_> {Option::<_>::Some}` --> $DIR/issue-96738.rs:3:10 | LL | Some.nonexistent_field; - | ---- ^^^^^^^^^^^^^^^^^ - | | - | this is the constructor of an enum variant - | -help: call the constructor - | -LL | (Some)(_).nonexistent_field; - | + ++++ + | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/typeck/issue-98982.rs b/src/test/ui/typeck/issue-98982.rs new file mode 100644 index 000000000..2553824bb --- /dev/null +++ b/src/test/ui/typeck/issue-98982.rs @@ -0,0 +1,9 @@ +fn foo() -> i32 { + for i in 0..0 { + //~^ ERROR: mismatched types [E0308] + return i; + } + //~| help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility +} + +fn main() {} diff --git a/src/test/ui/typeck/issue-98982.stderr b/src/test/ui/typeck/issue-98982.stderr new file mode 100644 index 000000000..3c9806ac9 --- /dev/null +++ b/src/test/ui/typeck/issue-98982.stderr @@ -0,0 +1,24 @@ +error[E0308]: mismatched types + --> $DIR/issue-98982.rs:2:5 + | +LL | fn foo() -> i32 { + | --- expected `i32` because of return type +LL | / for i in 0..0 { +LL | | +LL | | return i; +LL | | } + | |_____^ expected `i32`, found `()` + | +note: the function expects a value to always be returned, but loops might run zero times + --> $DIR/issue-98982.rs:2:5 + | +LL | for i in 0..0 { + | ^^^^^^^^^^^^^ this might have zero elements to iterate on +LL | +LL | return i; + | -------- if the loop doesn't execute, this value would never get returned + = help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/typeck/point-at-type-param-in-path-expr.rs b/src/test/ui/typeck/point-at-type-param-in-path-expr.rs new file mode 100644 index 000000000..9a21536f9 --- /dev/null +++ b/src/test/ui/typeck/point-at-type-param-in-path-expr.rs @@ -0,0 +1,6 @@ +fn foo() {} + +fn main() { + let x = foo::<()>; + //~^ ERROR `()` doesn't implement `std::fmt::Display` +} diff --git a/src/test/ui/typeck/point-at-type-param-in-path-expr.stderr b/src/test/ui/typeck/point-at-type-param-in-path-expr.stderr new file mode 100644 index 000000000..1feaa0508 --- /dev/null +++ b/src/test/ui/typeck/point-at-type-param-in-path-expr.stderr @@ -0,0 +1,17 @@ +error[E0277]: `()` doesn't implement `std::fmt::Display` + --> $DIR/point-at-type-param-in-path-expr.rs:4:19 + | +LL | let x = foo::<()>; + | ^^ `()` cannot be formatted with the default formatter + | + = help: the trait `std::fmt::Display` is not implemented for `()` + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `foo` + --> $DIR/point-at-type-param-in-path-expr.rs:1:11 + | +LL | fn foo() {} + | ^^^^^^^^^^^^^^^^^ 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/src/test/ui/typeck/remove-extra-argument.stderr b/src/test/ui/typeck/remove-extra-argument.stderr index 703032a83..b734bcd4e 100644 --- a/src/test/ui/typeck/remove-extra-argument.stderr +++ b/src/test/ui/typeck/remove-extra-argument.stderr @@ -12,7 +12,7 @@ LL | fn l(_a: Vec) {} help: remove the extra argument | LL | l(vec![]) - | + | ~~~~~~~~ error: aborting due to previous error diff --git a/src/test/ui/typeck/struct-enum-wrong-args.stderr b/src/test/ui/typeck/struct-enum-wrong-args.stderr index f72082d53..ea94bcbc2 100644 --- a/src/test/ui/typeck/struct-enum-wrong-args.stderr +++ b/src/test/ui/typeck/struct-enum-wrong-args.stderr @@ -12,7 +12,7 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), 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 @@ -30,7 +30,7 @@ LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), help: remove the extra arguments | 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 @@ -46,7 +46,7 @@ LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), help: provide the argument | LL | let _ = Ok(/* value */); - | ~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~ error[E0061]: this struct takes 1 argument but 0 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:9:13 @@ -62,7 +62,7 @@ LL | struct Wrapper(i32); help: provide the argument | LL | let _ = Wrapper(/* i32 */); - | ~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~ error[E0061]: this struct takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:10:13 @@ -78,7 +78,7 @@ 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 @@ -94,7 +94,7 @@ LL | struct DoubleWrapper(i32, i32); help: provide the arguments | LL | let _ = DoubleWrapper(/* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this struct takes 2 arguments but 1 argument was supplied --> $DIR/struct-enum-wrong-args.rs:12:13 @@ -110,7 +110,7 @@ LL | struct DoubleWrapper(i32, i32); help: provide the argument | LL | let _ = DoubleWrapper(5, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:13:13 @@ -126,7 +126,7 @@ 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/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr b/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr index e8e069708..503015f3b 100644 --- a/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr +++ b/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr @@ -4,7 +4,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.e1; | ^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0e1; | + @@ -15,7 +15,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.E1; | ^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0E1; | + @@ -26,7 +26,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.f32; | ^^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0f32; | + @@ -37,7 +37,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.f64; | ^^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0f64; | + @@ -48,7 +48,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.e+12; | ^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0e+12; | + @@ -59,7 +59,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.e-12; | ^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0e-12; | + @@ -70,7 +70,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.e1f32; | ^^^^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0e1f32; | + diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr index 6bb5e1f54..b9fca1a1b 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr @@ -12,10 +12,10 @@ LL | fn is_sync() {} | ^^^^ required by this bound in `is_sync` error[E0277]: `UnsafeCell` cannot be shared between threads safely - --> $DIR/typeck-default-trait-impl-negation-sync.rs:36:5 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:36:15 | LL | is_sync::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` cannot be shared between threads safely + | ^^^^^^^^^^^^^ `UnsafeCell` cannot be shared between threads safely | = help: within `MyTypeWUnsafe`, the trait `Sync` is not implemented for `UnsafeCell` note: required because it appears within the type `MyTypeWUnsafe` @@ -30,10 +30,10 @@ LL | fn is_sync() {} | ^^^^ required by this bound in `is_sync` error[E0277]: `Managed` cannot be shared between threads safely - --> $DIR/typeck-default-trait-impl-negation-sync.rs:39:5 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:39:15 | LL | is_sync::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely + | ^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely | = help: within `MyTypeManaged`, the trait `Sync` is not implemented for `Managed` note: required because it appears within the type `MyTypeManaged` diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.stderr index 3ea317dfb..c57f71b80 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item.stderr @@ -189,10 +189,10 @@ LL ~ b: (T, T), | error: missing type for `static` item - --> $DIR/typeck_type_placeholder_item.rs:73:12 + --> $DIR/typeck_type_placeholder_item.rs:73:13 | LL | static A = 42; - | ^ help: provide a type for the static variable: `A: i32` + | ^ help: provide a type for the static variable: `: i32` error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:75:15 diff --git a/src/test/ui/typeof/issue-100183.rs b/src/test/ui/typeof/issue-100183.rs new file mode 100644 index 000000000..13e9493ea --- /dev/null +++ b/src/test/ui/typeof/issue-100183.rs @@ -0,0 +1,6 @@ +struct Struct { + y: (typeof("hey"),), + //~^ ERROR `typeof` is a reserved keyword but unimplemented +} + +fn main() {} diff --git a/src/test/ui/typeof/issue-100183.stderr b/src/test/ui/typeof/issue-100183.stderr new file mode 100644 index 000000000..01d3079b2 --- /dev/null +++ b/src/test/ui/typeof/issue-100183.stderr @@ -0,0 +1,14 @@ +error[E0516]: `typeof` is a reserved keyword but unimplemented + --> $DIR/issue-100183.rs:2:9 + | +LL | y: (typeof("hey"),), + | ^^^^^^^^^^^^^ reserved keyword + | +help: consider replacing `typeof(...)` with an actual type + | +LL | y: (&'static str,), + | ~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0516`. diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs index 939b3c522..ec86213f8 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs @@ -3,6 +3,7 @@ use std::ops::Add; fn main() { >::add(1, 2); //~^ ERROR cannot add `u32` to `i32` + //~| ERROR cannot add `u32` to `i32` >::add(1u32, 2); //~^ ERROR mismatched types >::add(1, 2u32); diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index c6f9b3661..eaab6ff3d 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -1,8 +1,10 @@ error[E0277]: cannot add `u32` to `i32` - --> $DIR/ufcs-qpath-self-mismatch.rs:4:5 + --> $DIR/ufcs-qpath-self-mismatch.rs:4:31 | LL | >::add(1, 2); - | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` + | ---------------------- ^ no implementation for `i32 + u32` + | | + | required by a bound introduced by this call | = help: the trait `Add` is not implemented for `i32` = help: the following other types implement trait `Add`: @@ -17,7 +19,7 @@ LL | >::add(1, 2); and 48 others error[E0308]: mismatched types - --> $DIR/ufcs-qpath-self-mismatch.rs:6:28 + --> $DIR/ufcs-qpath-self-mismatch.rs:7:28 | LL | >::add(1u32, 2); | ---------------------- ^^^^ expected `i32`, found `u32` @@ -35,7 +37,7 @@ LL | >::add(1i32, 2); | ~~~ error[E0308]: mismatched types - --> $DIR/ufcs-qpath-self-mismatch.rs:8:31 + --> $DIR/ufcs-qpath-self-mismatch.rs:9:31 | LL | >::add(1, 2u32); | ---------------------- ^^^^ expected `i32`, found `u32` @@ -52,7 +54,25 @@ help: change the type of the numeric literal from `u32` to `i32` LL | >::add(1, 2i32); | ~~~ -error: aborting due to 3 previous errors +error[E0277]: cannot add `u32` to `i32` + --> $DIR/ufcs-qpath-self-mismatch.rs:4:5 + | +LL | >::add(1, 2); + | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` + | + = help: the trait `Add` is not implemented for `i32` + = help: the following other types implement trait `Add`: + <&'a f32 as Add> + <&'a f64 as Add> + <&'a i128 as Add> + <&'a i16 as Add> + <&'a i32 as Add> + <&'a i64 as Add> + <&'a i8 as Add> + <&'a isize as Add> + and 48 others + +error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.rs b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.rs new file mode 100644 index 000000000..925463d6d --- /dev/null +++ b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.rs @@ -0,0 +1,8 @@ +#![feature(unboxed_closures)] + +fn a>(f: F) {} + +fn main() { + a(|_: usize| {}); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr new file mode 100644 index 000000000..9a24fb8c2 --- /dev/null +++ b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/non-tupled-arg-mismatch.rs:6:5 + | +LL | a(|_: usize| {}); + | ^ types differ + | + = note: expected trait `Fn` + found trait `Fn<(usize,)>` +note: required by a bound in `a` + --> $DIR/non-tupled-arg-mismatch.rs:3:9 + | +LL | fn a>(f: F) {} + | ^^^^^^^^^ required by this bound in `a` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr index 85ff49d61..635ebbb71 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr @@ -6,7 +6,17 @@ LL | let c = || drop(y.0); | | | this closure implements `FnOnce`, not `Fn` LL | foo(c); - | --- the requirement to implement `Fn` derives from here + | --- - the requirement to implement `Fn` derives from here + | | + | required by a bound introduced by this call + | +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 +LL | where F: Fn() + | ^^^^ required by this bound in `foo` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr index 4f89afa32..e5ca0edd7 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr @@ -2,9 +2,7 @@ error[E0599]: no method named `call` found for closure `[closure@$DIR/unboxed-cl --> $DIR/unboxed-closures-static-call-wrong-trait.rs:7:10 | LL | mut_.call((0, )); - | ---- ^^^^ method not found in `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:29]` - | | - | this is a function, perhaps you wish to call it + | ^^^^ method not found in `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:29]` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr index 3241c9f85..455f83f57 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr @@ -6,11 +6,11 @@ LL | let z = f(1_usize, 2); | | | arguments to this function are incorrect | -note: closure defined here - --> $DIR/unboxed-closures-type-mismatch.rs:4:17 +note: closure parameter defined here + --> $DIR/unboxed-closures-type-mismatch.rs:4:18 | LL | let mut f = |x: isize, y: isize| -> isize { x + y }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ help: change the type of the numeric literal from `usize` to `isize` | LL | let z = f(1_isize, 2); diff --git a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr index 18e133957..9833304c6 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr @@ -6,7 +6,7 @@ LL | let x = call_it(&square, 22); | | | required by a bound introduced by this call | - = help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` + = help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for fn item `for<'r> unsafe fn(&'r isize) -> isize {square}` = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `call_it` --> $DIR/unboxed-closures-unsafe-extern-fn.rs:9:15 @@ -22,7 +22,7 @@ LL | let y = call_it_mut(&mut square, 22); | | | required by a bound introduced by this call | - = help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` + = help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for fn item `for<'r> unsafe fn(&'r isize) -> isize {square}` = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `call_it_mut` --> $DIR/unboxed-closures-unsafe-extern-fn.rs:12:19 @@ -38,7 +38,7 @@ LL | let z = call_it_once(square, 22); | | | required by a bound introduced by this call | - = help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` + = help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for fn item `for<'r> unsafe fn(&'r isize) -> isize {square}` = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `call_it_once` --> $DIR/unboxed-closures-unsafe-extern-fn.rs:15:20 diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr index 77c176de6..54c92e0cd 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr @@ -6,7 +6,7 @@ LL | let x = call_it(&square, 22); | | | required by a bound introduced by this call | - = help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` + = help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for fn item `for<'r> extern "C" fn(&'r isize) -> isize {square}` note: required by a bound in `call_it` --> $DIR/unboxed-closures-wrong-abi.rs:9:15 | @@ -21,7 +21,7 @@ LL | let y = call_it_mut(&mut square, 22); | | | required by a bound introduced by this call | - = help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` + = help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for fn item `for<'r> extern "C" fn(&'r isize) -> isize {square}` note: required by a bound in `call_it_mut` --> $DIR/unboxed-closures-wrong-abi.rs:12:19 | @@ -36,7 +36,7 @@ LL | let z = call_it_once(square, 22); | | | required by a bound introduced by this call | - = help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` + = help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for fn item `for<'r> extern "C" fn(&'r isize) -> isize {square}` note: required by a bound in `call_it_once` --> $DIR/unboxed-closures-wrong-abi.rs:15:20 | diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr index c826af3c4..2fedb5b92 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr @@ -6,7 +6,7 @@ LL | let x = call_it(&square, 22); | | | required by a bound introduced by this call | - = help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` + = help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for fn item `unsafe fn(isize) -> isize {square}` = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `call_it` --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:10:15 @@ -22,7 +22,7 @@ LL | let y = call_it_mut(&mut square, 22); | | | required by a bound introduced by this call | - = help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` + = help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for fn item `unsafe fn(isize) -> isize {square}` = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `call_it_mut` --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:13:19 @@ -38,7 +38,7 @@ LL | let z = call_it_once(square, 22); | | | required by a bound introduced by this call | - = help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` + = help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for fn item `unsafe fn(isize) -> isize {square}` = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `call_it_once` --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:16:20 diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.rs b/src/test/ui/uninhabited/uninhabited-irrefutable.rs index 661b5486a..1a0f3c5e5 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.rs +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.rs @@ -24,5 +24,5 @@ enum Foo { fn main() { let x: Foo = Foo::D(123, 456); - let Foo::D(_y, _z) = x; //~ ERROR refutable pattern in local binding: `A(_)` not covered + let Foo::D(_y, _z) = x; //~ ERROR refutable pattern in local binding: `Foo::A(_)` not covered } diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr index c571e17a7..32f287a18 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr @@ -1,8 +1,8 @@ -error[E0005]: refutable pattern in local binding: `A(_)` not covered +error[E0005]: refutable pattern in local binding: `Foo::A(_)` not covered --> $DIR/uninhabited-irrefutable.rs:27:9 | LL | let Foo::D(_y, _z) = x; - | ^^^^^^^^^^^^^^ pattern `A(_)` not covered + | ^^^^^^^^^^^^^^ pattern `Foo::A(_)` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html @@ -18,7 +18,7 @@ help: you might want to use `if let` to ignore the variant that isn't matched | LL | let (_y, _z) = if let Foo::D(_y, _z) = x { (_y, _z) } else { todo!() }; | +++++++++++++++++ +++++++++++++++++++++++++++++ -help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched +help: alternatively, you might want to use let else to handle the variant that isn't matched | LL | let Foo::D(_y, _z) = x else { todo!() }; | ++++++++++++++++ diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 2c107b1f7..c78829634 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -122,7 +122,7 @@ help: you might want to use `if let` to ignore the variant that isn't matched | LL | let x = if let Ok(x) = x { x } else { todo!() }; | ++++++++++ ++++++++++++++++++++++ -help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched +help: alternatively, you might want to use let else to handle the variant that isn't matched | LL | let Ok(x) = x else { todo!() }; | ++++++++++++++++ diff --git a/src/test/ui/union/union-generic.mirunsafeck.stderr b/src/test/ui/union/union-generic.mirunsafeck.stderr index a4f0c400d..037022a91 100644 --- a/src/test/ui/union/union-generic.mirunsafeck.stderr +++ b/src/test/ui/union/union-generic.mirunsafeck.stderr @@ -11,10 +11,10 @@ LL | union U { | ^^^^ required by this bound in `U` error[E0277]: the trait bound `Rc: Copy` is not satisfied - --> $DIR/union-generic.rs:13:13 + --> $DIR/union-generic.rs:13:17 | LL | let u = U::> { a: Default::default() }; - | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc` + | ^^^^^^^ the trait `Copy` is not implemented for `Rc` | note: required by a bound in `U` --> $DIR/union-generic.rs:6:12 diff --git a/src/test/ui/union/union-generic.thirunsafeck.stderr b/src/test/ui/union/union-generic.thirunsafeck.stderr index a4f0c400d..037022a91 100644 --- a/src/test/ui/union/union-generic.thirunsafeck.stderr +++ b/src/test/ui/union/union-generic.thirunsafeck.stderr @@ -11,10 +11,10 @@ LL | union U { | ^^^^ required by this bound in `U` error[E0277]: the trait bound `Rc: Copy` is not satisfied - --> $DIR/union-generic.rs:13:13 + --> $DIR/union-generic.rs:13:17 | LL | let u = U::> { a: Default::default() }; - | ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc` + | ^^^^^^^ the trait `Copy` is not implemented for `Rc` | note: required by a bound in `U` --> $DIR/union-generic.rs:6:12 diff --git a/src/test/ui/unpretty/avoid-crash.rs b/src/test/ui/unpretty/avoid-crash.rs new file mode 100644 index 000000000..fd84b70d9 --- /dev/null +++ b/src/test/ui/unpretty/avoid-crash.rs @@ -0,0 +1,4 @@ +// normalize-stderr-test "error `.*`" -> "$$ERROR_MESSAGE" +// compile-flags: -o/tmp/ -Zunpretty=ast-tree + +fn main() {} diff --git a/src/test/ui/unpretty/avoid-crash.stderr b/src/test/ui/unpretty/avoid-crash.stderr new file mode 100644 index 000000000..11cd3866f --- /dev/null +++ b/src/test/ui/unpretty/avoid-crash.stderr @@ -0,0 +1,4 @@ +error: pretty-print failed to write `/tmp/` due to $ERROR_MESSAGE + +error: aborting due to previous error + diff --git a/src/test/ui/unpretty/bad-literal.rs b/src/test/ui/unpretty/bad-literal.rs new file mode 100644 index 000000000..6dcc0da30 --- /dev/null +++ b/src/test/ui/unpretty/bad-literal.rs @@ -0,0 +1,8 @@ +// compile-flags: -Zunpretty=hir +// check-fail + +// In #100948 this caused an ICE with -Zunpretty=hir. +fn main() { + 1u; + //~^ ERROR invalid suffix `u` for number literal +} diff --git a/src/test/ui/unpretty/bad-literal.stderr b/src/test/ui/unpretty/bad-literal.stderr new file mode 100644 index 000000000..f3fcb4a4e --- /dev/null +++ b/src/test/ui/unpretty/bad-literal.stderr @@ -0,0 +1,10 @@ +error: invalid suffix `u` for number literal + --> $DIR/bad-literal.rs:6:5 + | +LL | 1u; + | ^^ invalid suffix `u` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: aborting due to previous error + diff --git a/src/test/ui/unpretty/bad-literal.stdout b/src/test/ui/unpretty/bad-literal.stdout new file mode 100644 index 000000000..8df933270 --- /dev/null +++ b/src/test/ui/unpretty/bad-literal.stdout @@ -0,0 +1,11 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +// compile-flags: -Zunpretty=hir +// check-fail + +// In #100948 this caused an ICE with -Zunpretty=hir. +fn main() { + ; + } diff --git a/src/test/ui/unpretty/pretty-let-else.rs b/src/test/ui/unpretty/pretty-let-else.rs new file mode 100644 index 000000000..b5ae52969 --- /dev/null +++ b/src/test/ui/unpretty/pretty-let-else.rs @@ -0,0 +1,10 @@ +// compile-flags: -Zunpretty=hir +// check-pass + + + +fn foo(x: Option) { + let Some(_) = x else { panic!() }; +} + +fn main() {} diff --git a/src/test/ui/unpretty/pretty-let-else.stdout b/src/test/ui/unpretty/pretty-let-else.stdout new file mode 100644 index 000000000..35ad1cd1b --- /dev/null +++ b/src/test/ui/unpretty/pretty-let-else.stdout @@ -0,0 +1,18 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +// compile-flags: -Zunpretty=hir +// check-pass + + + +fn foo(x: + Option) { + let Some(_) = x else + { + + { ::std::rt::begin_panic("explicit panic") } + }; + } +fn main() { } diff --git a/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr b/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr index fd58e1b1e..b968174dd 100644 --- a/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr +++ b/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.mir.stderr @@ -81,40 +81,8 @@ error: unnecessary `unsafe` block LL | unsafe { unsafe { unsf() } } | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:60:5 - | -LL | unsafe fn allow_level() { - | ----------------------- because it's nested under this `unsafe` fn -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:53:9 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:72:9 - | -LL | unsafe fn nested_allow_level() { - | ------------------------------ because it's nested under this `unsafe` fn -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:65:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - error[E0133]: call to unsafe function is unsafe and requires unsafe block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:78:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5 | LL | unsf(); | ^^^^^^ call to unsafe function @@ -122,13 +90,13 @@ LL | unsf(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:83:9 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:81:9 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior -error: aborting due to 13 previous errors +error: aborting due to 11 previous errors For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs b/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs index 30b072340..db1e916a3 100644 --- a/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs +++ b/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.rs @@ -58,7 +58,6 @@ unsafe fn allow_level() { VOID = (); unsafe { unsf() } - //~^ ERROR unnecessary `unsafe` block } unsafe fn nested_allow_level() { @@ -70,7 +69,6 @@ unsafe fn nested_allow_level() { VOID = (); unsafe { unsf() } - //~^ ERROR unnecessary `unsafe` block } } diff --git a/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr b/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr index 2ba6a7293..e36529365 100644 --- a/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr +++ b/src/test/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr @@ -83,26 +83,8 @@ LL | unsafe { unsafe { unsf() } } | | | because it's nested under this `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:60:5 - | -LL | unsafe fn allow_level() { - | ----------------------- because it's nested under this `unsafe` fn -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:72:9 - | -LL | unsafe fn nested_allow_level() { - | ------------------------------ because it's nested under this `unsafe` fn -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:78:5 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5 | LL | unsf(); | ^^^^^^ call to unsafe function @@ -110,13 +92,13 @@ LL | unsf(); = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe function or block - --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:83:9 + --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:81:9 | LL | unsf(); | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior -error: aborting due to 13 previous errors +error: aborting due to 11 previous errors For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsized-locals/unsized-exprs.stderr b/src/test/ui/unsized-locals/unsized-exprs.stderr index 6960255d9..a7f57e3fd 100644 --- a/src/test/ui/unsized-locals/unsized-exprs.stderr +++ b/src/test/ui/unsized-locals/unsized-exprs.stderr @@ -12,9 +12,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> $DIR/unsized-exprs.rs:24:22 | LL | udrop::>(A { 0: *foo() }); - | ---------------- ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `A<[u8]>`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `A<[u8]>` diff --git a/src/test/ui/unsized/issue-71659.stderr b/src/test/ui/unsized/issue-71659.stderr index d7b95f557..50060e53a 100644 --- a/src/test/ui/unsized/issue-71659.stderr +++ b/src/test/ui/unsized/issue-71659.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied - --> $DIR/issue-71659.rs:30:15 + --> $DIR/issue-71659.rs:30:13 | LL | let x = x.cast::<[i32]>(); - | ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo` + | ^ ---- required by a bound introduced by this call + | | + | the trait `CastTo<[i32]>` is not implemented for `dyn Foo` | note: required by a bound in `Cast::cast` --> $DIR/issue-71659.rs:19:15 diff --git a/src/test/ui/unsized/issue-75707.stderr b/src/test/ui/unsized/issue-75707.stderr index 7d0a2cb85..97618ed05 100644 --- a/src/test/ui/unsized/issue-75707.stderr +++ b/src/test/ui/unsized/issue-75707.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `MyCall: Callback` is not satisfied - --> $DIR/issue-75707.rs:15:5 + --> $DIR/issue-75707.rs:15:9 | LL | f::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall` | note: required by a bound in `f` --> $DIR/issue-75707.rs:9:9 diff --git a/src/test/ui/unsized/issue-75899-but-gats.rs b/src/test/ui/unsized/issue-75899-but-gats.rs new file mode 100644 index 000000000..5716817f4 --- /dev/null +++ b/src/test/ui/unsized/issue-75899-but-gats.rs @@ -0,0 +1,21 @@ +// check-pass + +use std::fmt::Debug; +use std::marker::PhantomData; + +trait Foo { + type Gat<'a>: ?Sized where Self: 'a; +} + +struct Bar<'a, T: Foo + 'a>(T::Gat<'a>); + +struct Baz(PhantomData); + +impl Foo for Baz { + type Gat<'a> = T where Self: 'a; +} + +fn main() { + let x = Bar::<'_, Baz<()>>(()); + let y: &Bar<'_, Baz> = &x; +} diff --git a/src/test/ui/unsized/issue-75899.rs b/src/test/ui/unsized/issue-75899.rs new file mode 100644 index 000000000..abff17e11 --- /dev/null +++ b/src/test/ui/unsized/issue-75899.rs @@ -0,0 +1,18 @@ +// check-pass + +trait Trait {} +impl Trait for T {} + +trait Noop { + type Assoc: ?Sized; +} +impl Noop for T { + type Assoc = T; +} + +struct NoopNewtype(T::Assoc); +fn coerce_newtype(x: &NoopNewtype) -> &NoopNewtype { + x +} + +fn main() {} diff --git a/src/test/ui/unsized/unsized-fn-param.stderr b/src/test/ui/unsized/unsized-fn-param.stderr index 0221ef16b..b47726054 100644 --- a/src/test/ui/unsized/unsized-fn-param.stderr +++ b/src/test/ui/unsized/unsized-fn-param.stderr @@ -2,9 +2,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:11:11 | LL | foo11("bar", &"baz"); - | ----- ^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` = note: required for the cast from `str` to the object type `dyn AsRef` @@ -17,9 +15,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:13:19 | LL | foo12(&"bar", "baz"); - | ----- ^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` = note: required for the cast from `str` to the object type `dyn AsRef` @@ -32,9 +28,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:16:11 | LL | foo21("bar", &"baz"); - | ----- ^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` = note: required for the cast from `str` to the object type `dyn AsRef` @@ -47,9 +41,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:18:19 | LL | foo22(&"bar", "baz"); - | ----- ^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` = note: required for the cast from `str` to the object type `dyn AsRef` diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index c9510e92f..dff1b0a51 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -25,10 +25,10 @@ LL + fn foo2() { not_sized::>() } | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/unsized-struct.rs:13:24 + --> $DIR/unsized-struct.rs:13:35 | LL | fn bar2() { is_sized::>() } - | - ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | - ^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | diff --git a/src/test/ui/unsized/unsized3.stderr b/src/test/ui/unsized/unsized3.stderr index d64091b15..9ad1ac6b4 100644 --- a/src/test/ui/unsized/unsized3.stderr +++ b/src/test/ui/unsized/unsized3.stderr @@ -79,14 +79,12 @@ LL | fn f5(x: &Y) {} | ++++++++ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:40:8 + --> $DIR/unsized3.rs:40:5 | LL | fn f9(x1: Box>) { | - this type parameter needs to be `std::marker::Sized` LL | f5(&(*x1, 34)); - | -- ^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^ doesn't have a size known at compile-time | note: required because it appears within the type `S` --> $DIR/unsized3.rs:28:8 @@ -106,9 +104,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim LL | fn f10(x1: Box>) { | - this type parameter needs to be `std::marker::Sized` LL | f5(&(32, *x1)); - | -- ^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^^ doesn't have a size known at compile-time | note: required because it appears within the type `S` --> $DIR/unsized3.rs:28:8 diff --git a/src/test/ui/unspecified-self-in-trait-ref.rs b/src/test/ui/unspecified-self-in-trait-ref.rs deleted file mode 100644 index 158b5a985..000000000 --- a/src/test/ui/unspecified-self-in-trait-ref.rs +++ /dev/null @@ -1,30 +0,0 @@ -pub trait Foo { - fn foo(&self); -} - -pub trait Bar { - fn foo(&self); -} - -fn main() { - let a = Foo::lol(); - //~^ ERROR no function or associated item named - //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition - let b = Foo::<_>::lol(); - //~^ ERROR no function or associated item named - //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition - let c = Bar::lol(); - //~^ ERROR no function or associated item named - //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition - let d = Bar::::lol(); - //~^ ERROR no function or associated item named - //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition - let e = Bar::::lol(); - //~^ ERROR must be explicitly specified - //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition -} diff --git a/src/test/ui/unspecified-self-in-trait-ref.stderr b/src/test/ui/unspecified-self-in-trait-ref.stderr deleted file mode 100644 index 7869176bb..000000000 --- a/src/test/ui/unspecified-self-in-trait-ref.stderr +++ /dev/null @@ -1,105 +0,0 @@ -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/unspecified-self-in-trait-ref.rs:10:13 - | -LL | let a = Foo::lol(); - | ^^^ - | - = note: `#[warn(bare_trait_objects)]` on by default - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see -help: use `dyn` - | -LL | let a = ::lol(); - | ++++ + - -error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:10:18 - | -LL | let a = Foo::lol(); - | ^^^ function or associated item not found in `dyn Foo<_>` - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/unspecified-self-in-trait-ref.rs:14:13 - | -LL | let b = Foo::<_>::lol(); - | ^^^^^^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see -help: use `dyn` - | -LL | let b = >::lol(); - | ++++ + - -error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:14:23 - | -LL | let b = Foo::<_>::lol(); - | ^^^ function or associated item not found in `dyn Foo<_>` - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/unspecified-self-in-trait-ref.rs:18:13 - | -LL | let c = Bar::lol(); - | ^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see -help: use `dyn` - | -LL | let c = ::lol(); - | ++++ + - -error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar<_, _>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:18:18 - | -LL | let c = Bar::lol(); - | ^^^ function or associated item not found in `dyn Bar<_, _>` - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/unspecified-self-in-trait-ref.rs:22:13 - | -LL | let d = Bar::::lol(); - | ^^^^^^^^^^^^^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see -help: use `dyn` - | -LL | let d = >::lol(); - | ++++ + - -error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:22:30 - | -LL | let d = Bar::::lol(); - | ^^^ function or associated item not found in `dyn Bar` - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/unspecified-self-in-trait-ref.rs:26:13 - | -LL | let e = Bar::::lol(); - | ^^^^^^^^^^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see -help: use `dyn` - | -LL | let e = >::lol(); - | ++++ + - -error[E0393]: the type parameter `A` must be explicitly specified - --> $DIR/unspecified-self-in-trait-ref.rs:26:13 - | -LL | pub trait Bar { - | ------------------------------ type parameter `A` must be specified for this -... -LL | let e = Bar::::lol(); - | ^^^^^^^^^^^^ missing reference to `A` - | - = note: because of the default `Self` reference, type parameters must be specified on object types - -error: aborting due to 5 previous errors; 5 warnings emitted - -Some errors have detailed explanations: E0393, E0599. -For more information about an error, try `rustc --explain E0393`. diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.rs b/src/test/ui/variance/variance-use-contravariant-struct-1.rs index 7f5906748..40781fbf0 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.rs +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.rs @@ -1,4 +1,4 @@ -// Test various uses of structs with distint variances to make sure +// Test various uses of structs with distinct variances to make sure // they permit lifetimes to be approximated as expected. struct SomeStruct(fn(T)); diff --git a/src/test/ui/variance/variance-use-contravariant-struct-2.rs b/src/test/ui/variance/variance-use-contravariant-struct-2.rs index 2113eb2ad..d4b2d0834 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-2.rs +++ b/src/test/ui/variance/variance-use-contravariant-struct-2.rs @@ -1,4 +1,4 @@ -// Test various uses of structs with distint variances to make sure +// Test various uses of structs with distinct variances to make sure // they permit lifetimes to be approximated as expected. #![allow(dead_code)] diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.rs b/src/test/ui/variance/variance-use-invariant-struct-1.rs index d40dbceb5..72f50f345 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.rs +++ b/src/test/ui/variance/variance-use-invariant-struct-1.rs @@ -1,4 +1,4 @@ -// Test various uses of structs with distint variances to make sure +// Test various uses of structs with distinct variances to make sure // they permit lifetimes to be approximated as expected. struct SomeStruct(*mut T); diff --git a/src/test/ui/wait-forked-but-failed-child.rs b/src/test/ui/wait-forked-but-failed-child.rs index 0eb0fe071..674c26a43 100644 --- a/src/test/ui/wait-forked-but-failed-child.rs +++ b/src/test/ui/wait-forked-but-failed-child.rs @@ -2,6 +2,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-vxworks no 'ps' +// ignore-fuchsia no 'ps' #![feature(rustc_private)] diff --git a/src/test/ui/wf/hir-wf-check-erase-regions.stderr b/src/test/ui/wf/hir-wf-check-erase-regions.stderr index 037f8b9f3..b04588c57 100644 --- a/src/test/ui/wf/hir-wf-check-erase-regions.stderr +++ b/src/test/ui/wf/hir-wf-check-erase-regions.stderr @@ -6,7 +6,7 @@ LL | type IntoIter = std::iter::Flatten>; | = help: the trait `Iterator` is not implemented for `&T` = help: the trait `Iterator` is implemented for `&mut I` - = note: required because of the requirements on the impl of `IntoIterator` for `&T` + = note: required for `&T` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL | @@ -21,7 +21,7 @@ LL | fn into_iter(self) -> Self::IntoIter { | = help: the trait `Iterator` is not implemented for `&T` = help: the trait `Iterator` is implemented for `&mut I` - = note: required because of the requirements on the impl of `IntoIterator` for `&T` + = note: required for `&T` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL | diff --git a/src/test/ui/wf/wf-const-type.stderr b/src/test/ui/wf/wf-const-type.stderr index e47920d3d..85938364e 100644 --- a/src/test/ui/wf/wf-const-type.stderr +++ b/src/test/ui/wf/wf-const-type.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied LL | const FOO: IsCopy> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | - = note: required because of the requirements on the impl of `Copy` for `Option` + = note: required for `Option` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-const-type.rs:7:17 | diff --git a/src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr b/src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr index 29dfb585a..6cf4f33f9 100644 --- a/src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr +++ b/src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr @@ -11,7 +11,7 @@ LL | trait Trait: Sized {} | ----- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized>` for `Box` + = note: required for `Box` to implement `CoerceUnsized>` = note: required by cast to type `Box` error[E0038]: the trait `Trait` cannot be made into an object @@ -27,7 +27,7 @@ LL | trait Trait: Sized {} | ----- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized>` for `Box` + = note: required for `Box` to implement `CoerceUnsized>` = note: required by cast to type `Box<(dyn Trait + 'static)>` error[E0038]: the trait `Trait` cannot be made into an object @@ -43,7 +43,7 @@ LL | trait Trait: Sized {} | ----- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized>` for `Box` + = note: required for `Box` to implement `CoerceUnsized>` = note: required by cast to type `Box` error: aborting due to 3 previous errors diff --git a/src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr b/src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr index 02169f26f..c9bd4549a 100644 --- a/src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr +++ b/src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr @@ -11,7 +11,7 @@ LL | trait Trait: Sized {} | ----- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Trait>` for `&S` + = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>` = note: required by cast to type `&dyn Trait` error[E0038]: the trait `Trait` cannot be made into an object @@ -27,7 +27,7 @@ LL | trait Trait: Sized {} | ----- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Trait>` for `&S` + = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>` = note: required by cast to type `&dyn Trait` error[E0038]: the trait `Trait` cannot be made into an object @@ -43,7 +43,7 @@ LL | trait Trait: Sized {} | ----- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Trait>` for `&S` + = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>` = note: required by cast to type `&dyn Trait` error: aborting due to 3 previous errors diff --git a/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr b/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr index b03023b5f..78312a091 100644 --- a/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr +++ b/src/test/ui/wf/wf-foreign-fn-decl-ret.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/wf-foreign-fn-decl-ret.rs:11:25 + --> $DIR/wf-foreign-fn-decl-ret.rs:11:5 | LL | pub fn lint_me() -> <() as Foo>::Assoc; - | ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` error[E0277]: the trait bound `u32: Unsatisfied` is not satisfied --> $DIR/wf-foreign-fn-decl-ret.rs:14:32 diff --git a/src/test/ui/wf/wf-static-type.stderr b/src/test/ui/wf/wf-static-type.stderr index 4ae69cf2e..16c6124b6 100644 --- a/src/test/ui/wf/wf-static-type.stderr +++ b/src/test/ui/wf/wf-static-type.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied LL | static FOO: IsCopy> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | - = note: required because of the requirements on the impl of `Copy` for `Option` + = note: required for `Option` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | diff --git a/src/test/ui/wf/wf-trait-fn-ret.stderr b/src/test/ui/wf/wf-trait-fn-ret.stderr index a59ba3400..9bd3cc771 100644 --- a/src/test/ui/wf/wf-trait-fn-ret.stderr +++ b/src/test/ui/wf/wf-trait-fn-ret.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied - --> $DIR/wf-trait-fn-ret.rs:10:22 + --> $DIR/wf-trait-fn-ret.rs:10:23 | LL | fn bar(&self) -> &Bar; - | ^^^^^^^^^^ the trait `Eq` is not implemented for `Self` + | ^^^^^^^^^ the trait `Eq` is not implemented for `Self` | note: required by a bound in `Bar` --> $DIR/wf-trait-fn-ret.rs:7:14 diff --git a/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr b/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr index 6d141a58e..96fc1d36b 100644 --- a/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr +++ b/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr @@ -25,7 +25,7 @@ LL | trait Trait: Sized {} | ----- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Trait>` for `&S` + = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>` = note: required by cast to type `&dyn Trait` error[E0038]: the trait `Trait` cannot be made into an object @@ -45,7 +45,7 @@ LL | trait Trait: Sized {} | ----- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Trait>` for `&R` + = note: required for `&R` to implement `CoerceUnsized<&dyn Trait>` = note: required by cast to type `&dyn Trait` error: aborting due to 3 previous errors diff --git a/src/test/ui/where-clauses/where-clause-method-substituion.stderr b/src/test/ui/where-clauses/where-clause-method-substituion.stderr index f431deee7..8c47ed6d4 100644 --- a/src/test/ui/where-clauses/where-clause-method-substituion.stderr +++ b/src/test/ui/where-clauses/where-clause-method-substituion.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `X: Foo` is not satisfied - --> $DIR/where-clause-method-substituion.rs:20:7 + --> $DIR/where-clause-method-substituion.rs:20:16 | LL | 1.method::(); - | ^^^^^^ the trait `Foo` is not implemented for `X` + | ^ the trait `Foo` is not implemented for `X` | note: required by a bound in `Bar::method` --> $DIR/where-clause-method-substituion.rs:6:34 diff --git a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr index c13552bc2..e90502977 100644 --- a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr +++ b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `Bar: Eq` is not satisfied - --> $DIR/where-clauses-method-unsatisfied.rs:18:14 + --> $DIR/where-clauses-method-unsatisfied.rs:18:7 | LL | x.equals(&x); - | ------ ^^ the trait `Eq` is not implemented for `Bar` - | | - | required by a bound introduced by this call + | ^^^^^^ the trait `Eq` is not implemented for `Bar` | note: required by a bound in `Foo::::equals` --> $DIR/where-clauses-method-unsatisfied.rs:11:52 -- cgit v1.2.3

diff --git a/src/test/ui/issues/issue-2288.rs b/src/test/ui/issues/issue-2288.rs index c74e53fca..6fd690a4d 100644 --- a/src/test/ui/issues/issue-2288.rs +++ b/src/test/ui/issues/issue-2288.rs @@ -1,8 +1,6 @@ // run-pass #![allow(non_camel_case_types)] -#![feature(box_syntax)] - trait clam { fn chowder(&self, y: A); } @@ -30,6 +28,6 @@ fn f(x: Box>, a: A) { pub fn main() { let c = foo(42); - let d: Box> = box c as Box>; + let d: Box> = Box::new(c) as Box>; f(d, c.x); } diff --git a/src/test/ui/issues/issue-23024.rs b/src/test/ui/issues/issue-23024.rs index e92273bd4..010281ee3 100644 --- a/src/test/ui/issues/issue-23024.rs +++ b/src/test/ui/issues/issue-23024.rs @@ -1,11 +1,10 @@ -#![feature(box_syntax)] use std::any::Any; fn main() { fn h(x:i32) -> i32 {3*x} let mut vfnfer:Vec> = vec![]; - vfnfer.push(box h); + vfnfer.push(Box::new(h)); println!("{:?}",(vfnfer[0] as dyn Fn)(3)); //~^ ERROR the precise format of `Fn`-family traits' //~| ERROR missing generics for trait `Fn` diff --git a/src/test/ui/issues/issue-23024.stderr b/src/test/ui/issues/issue-23024.stderr index 7a4d90b44..73f93c51d 100644 --- a/src/test/ui/issues/issue-23024.stderr +++ b/src/test/ui/issues/issue-23024.stderr @@ -1,5 +1,5 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change - --> $DIR/issue-23024.rs:9:39 + --> $DIR/issue-23024.rs:8:39 | LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); | ^^ help: use parenthetical notation instead: `Fn() -> ()` @@ -8,7 +8,7 @@ LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable error[E0107]: missing generics for trait `Fn` - --> $DIR/issue-23024.rs:9:39 + --> $DIR/issue-23024.rs:8:39 | LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); | ^^ expected 1 generic argument @@ -24,7 +24,7 @@ LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); | ~~~~~~~~ error[E0191]: the value of the associated type `Output` (from trait `FnOnce`) must be specified - --> $DIR/issue-23024.rs:9:39 + --> $DIR/issue-23024.rs:8:39 | LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); | ^^ help: specify the associated type: `Fn` diff --git a/src/test/ui/issues/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr index 7519e632d..f6cda3de5 100644 --- a/src/test/ui/issues/issue-23122-2.stderr +++ b/src/test/ui/issues/issue-23122-2.stderr @@ -1,15 +1,10 @@ -error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized` +error[E0275]: overflow evaluating the requirement `::Next` --> $DIR/issue-23122-2.rs:10:17 | LL | type Next = as Next>::Next; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`) -note: required because of the requirements on the impl of `Next` for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` - --> $DIR/issue-23122-2.rs:9:15 - | -LL | impl Next for GetNext { - | ^^^^ ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23302-3.stderr b/src/test/ui/issues/issue-23302-3.stderr index dcb99605d..074939f68 100644 --- a/src/test/ui/issues/issue-23302-3.stderr +++ b/src/test/ui/issues/issue-23302-3.stderr @@ -2,13 +2,13 @@ error[E0391]: cycle detected when const-evaluating + checking `A` --> $DIR/issue-23302-3.rs:1:1 | LL | const A: i32 = B; - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `B`... --> $DIR/issue-23302-3.rs:3:1 | LL | const B: i32 = A; - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^ = note: ...which again requires const-evaluating + checking `A`, completing the cycle note: cycle used when simplifying constant for the type system `A` --> $DIR/issue-23302-3.rs:1:1 diff --git a/src/test/ui/issues/issue-23491.rs b/src/test/ui/issues/issue-23491.rs index 1cb969731..e5f9dd3ef 100644 --- a/src/test/ui/issues/issue-23491.rs +++ b/src/test/ui/issues/issue-23491.rs @@ -1,9 +1,8 @@ // run-pass #![allow(unused_variables)] -#![feature(box_syntax)] struct Node(#[allow(unused_tuple_struct_fields)] T); fn main() { - let x: Box> = box Node([]); + let x: Box> = Box::new(Node([])); } diff --git a/src/test/ui/issues/issue-23611-enum-swap-in-drop.rs b/src/test/ui/issues/issue-23611-enum-swap-in-drop.rs index 403cf970b..cdb130d60 100644 --- a/src/test/ui/issues/issue-23611-enum-swap-in-drop.rs +++ b/src/test/ui/issues/issue-23611-enum-swap-in-drop.rs @@ -97,7 +97,7 @@ pub fn main() { // ever hands f_A off to instances of GaspA, and thus one should // be able to prove the invariant that f_A is *only* invoked from // from an instance of GaspA (either via the GaspA drop - // implementation or the E drop implementaton). Yet the old (bad) + // implementation or the E drop implementation). Yet the old (bad) // behavior allowed a call to f_A to leak in while we are tearing // down a value of type GaspB. } diff --git a/src/test/ui/issues/issue-25901.stderr b/src/test/ui/issues/issue-25901.stderr index e933745c4..c6c80e41c 100644 --- a/src/test/ui/issues/issue-25901.stderr +++ b/src/test/ui/issues/issue-25901.stderr @@ -16,6 +16,7 @@ note: impl defined here, but it is not `const` LL | impl Deref for A { | ^^^^^^^^^^^^^^^^ = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26217.stderr b/src/test/ui/issues/issue-26217.stderr index c7601caac..73c772205 100644 --- a/src/test/ui/issues/issue-26217.stderr +++ b/src/test/ui/issues/issue-26217.stderr @@ -5,6 +5,12 @@ LL | fn bar<'a>() { | -- lifetime `'a` defined here LL | foo::<&'a i32>(); | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/issue-26217.rs:1:30 + | +LL | fn foo() where for<'a> T: 'a {} + | ^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2708.rs b/src/test/ui/issues/issue-2708.rs index abd5e9507..4e53b9d14 100644 --- a/src/test/ui/issues/issue-2708.rs +++ b/src/test/ui/issues/issue-2708.rs @@ -4,7 +4,7 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] + struct Font { fontbuf: usize, @@ -26,5 +26,5 @@ fn Font() -> Font { } pub fn main() { - let _f: Box<_> = box Font(); + let _f: Box<_> = Box::new(Font()); } diff --git a/src/test/ui/issues/issue-2734.rs b/src/test/ui/issues/issue-2734.rs index d449f6449..df4f394dc 100644 --- a/src/test/ui/issues/issue-2734.rs +++ b/src/test/ui/issues/issue-2734.rs @@ -4,21 +4,19 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - trait hax { fn dummy(&self) { } } impl hax for A { } fn perform_hax(x: Box) -> Box { - box x as Box + Box::new(x) as Box } fn deadcode() { - perform_hax(box "deadcode".to_string()); + perform_hax(Box::new("deadcode".to_string())); } pub fn main() { - let _ = perform_hax(box 42); + let _ = perform_hax(Box::new(42)); } diff --git a/src/test/ui/issues/issue-2735.rs b/src/test/ui/issues/issue-2735.rs index 794c7d4ed..20d3949a9 100644 --- a/src/test/ui/issues/issue-2735.rs +++ b/src/test/ui/issues/issue-2735.rs @@ -4,21 +4,19 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - trait hax { fn dummy(&self) { } } impl hax for A { } fn perform_hax(x: Box) -> Box { - box x as Box + Box::new(x) as Box } fn deadcode() { - perform_hax(box "deadcode".to_string()); + perform_hax(Box::new("deadcode".to_string())); } pub fn main() { - perform_hax(box 42); + perform_hax(Box::new(42)); } diff --git a/src/test/ui/issues/issue-28344.stderr b/src/test/ui/issues/issue-28344.stderr index b1d1c01b2..85a8698af 100644 --- a/src/test/ui/issues/issue-28344.stderr +++ b/src/test/ui/issues/issue-28344.stderr @@ -25,7 +25,7 @@ LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); | ^^^^^ | | | function or associated item not found in `dyn BitXor<_>` - | help: there is an associated function with a similar name: `bitxor` + | help: there is a method with a similar name: `bitxor` warning: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-28344.rs:10:13 @@ -53,7 +53,7 @@ LL | let g = BitXor::bitor; | ^^^^^ | | | function or associated item not found in `dyn BitXor<_>` - | help: there is an associated function with a similar name: `bitxor` + | help: there is a method with a similar name: `bitxor` error: aborting due to 4 previous errors; 2 warnings emitted diff --git a/src/test/ui/issues/issue-2935.rs b/src/test/ui/issues/issue-2935.rs index 11641ca73..37f818199 100644 --- a/src/test/ui/issues/issue-2935.rs +++ b/src/test/ui/issues/issue-2935.rs @@ -1,7 +1,6 @@ // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] -#![feature(box_syntax)] //type t = { a: isize }; // type t = { a: bool }; @@ -20,7 +19,7 @@ pub fn main() { // let y = box ({a: 4}); // let z = box ({a: 4} as it); // let z = box ({a: true} as it); - let z: Box<_> = box (box true as Box); + let z: Box<_> = Box::new(Box::new(true) as Box); // x.f(); // y.f(); // (*z).f(); diff --git a/src/test/ui/issues/issue-3026.rs b/src/test/ui/issues/issue-3026.rs index 1dea8134f..4619a3fe7 100644 --- a/src/test/ui/issues/issue-3026.rs +++ b/src/test/ui/issues/issue-3026.rs @@ -1,13 +1,11 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - use std::collections::HashMap; pub fn main() { let x: Box<_>; let mut buggy_map: HashMap = HashMap::new(); - x = box 1; + x = Box::new(1); buggy_map.insert(42, &*x); } diff --git a/src/test/ui/issues/issue-31173.rs b/src/test/ui/issues/issue-31173.rs index 48061ae54..04efa2718 100644 --- a/src/test/ui/issues/issue-31173.rs +++ b/src/test/ui/issues/issue-31173.rs @@ -3,12 +3,13 @@ use std::vec::IntoIter; pub fn get_tok(it: &mut IntoIter) { let mut found_e = false; - let temp: Vec = it.take_while(|&x| { - found_e = true; - false - }) + let temp: Vec = it + //~^ ERROR to be an iterator that yields `&_`, but it yields `u8` + .take_while(|&x| { + found_e = true; + false + }) .cloned() - //~^ ERROR type mismatch resolving .collect(); //~ ERROR the method } diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr index 68337a715..e3334eef3 100644 --- a/src/test/ui/issues/issue-31173.stderr +++ b/src/test/ui/issues/issue-31173.stderr @@ -1,8 +1,16 @@ -error[E0271]: type mismatch resolving `, [closure@$DIR/issue-31173.rs:6:39: 6:43]> as Iterator>::Item == &_` - --> $DIR/issue-31173.rs:10:10 - | -LL | .cloned() - | ^^^^^^ expected reference, found `u8` +error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter, [closure@$DIR/issue-31173.rs:8:21: 8:25]>` to be an iterator that yields `&_`, but it yields `u8` + --> $DIR/issue-31173.rs:6:25 + | +LL | let temp: Vec = it + | _________________________^ +LL | | +LL | | .take_while(|&x| { +LL | | found_e = true; +LL | | false +LL | | }) + | |__________^ expected reference, found `u8` +LL | .cloned() + | ------ required by a bound introduced by this call | = note: expected reference `&_` found type `u8` @@ -12,27 +20,27 @@ note: required by a bound in `cloned` LL | Self: Sized + Iterator, | ^^^^^^^^^^^^ required by this bound in `cloned` -error[E0599]: the method `collect` exists for struct `Cloned, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>`, but its trait bounds were not satisfied - --> $DIR/issue-31173.rs:12:10 +error[E0599]: the method `collect` exists for struct `Cloned, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>`, but its trait bounds were not satisfied + --> $DIR/issue-31173.rs:13:10 | LL | .collect(); - | ^^^^^^^ method cannot be called on `Cloned, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>` due to unsatisfied trait bounds - | - ::: $SRC_DIR/core/src/iter/adapters/cloned.rs:LL:COL - | -LL | pub struct Cloned { - | -------------------- doesn't satisfy `_: Iterator` + | ^^^^^^^ method cannot be called on `Cloned, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>` due to unsatisfied trait bounds | ::: $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL | LL | pub struct TakeWhile { | -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_` | + ::: $SRC_DIR/core/src/iter/adapters/cloned.rs:LL:COL + | +LL | pub struct Cloned { + | -------------------- doesn't satisfy `_: Iterator` + | = note: the following trait bounds were not satisfied: - `, [closure@$DIR/issue-31173.rs:6:39: 6:43]> as Iterator>::Item = &_` - which is required by `Cloned, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>: Iterator` - `Cloned, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>: Iterator` - which is required by `&mut Cloned, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>: Iterator` + `, [closure@$DIR/issue-31173.rs:8:21: 8:25]> as Iterator>::Item = &_` + which is required by `Cloned, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator` + `Cloned, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator` + which is required by `&mut Cloned, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3121.rs b/src/test/ui/issues/issue-3121.rs index f7bbfa9f6..4bf5b9b60 100644 --- a/src/test/ui/issues/issue-3121.rs +++ b/src/test/ui/issues/issue-3121.rs @@ -1,7 +1,6 @@ // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] -#![feature(box_syntax)] #[derive(Copy, Clone)] enum side { mayo, catsup, vinegar } @@ -21,5 +20,5 @@ fn foo(m: Box, cond: bool) { } pub fn main() { - foo(box meal::for_here(order::hamburger), true) + foo(Box::new(meal::for_here(order::hamburger)), true) } diff --git a/src/test/ui/issues/issue-3214.stderr b/src/test/ui/issues/issue-3214.stderr index 4d8eb6360..aa0b5ce64 100644 --- a/src/test/ui/issues/issue-3214.stderr +++ b/src/test/ui/issues/issue-3214.stderr @@ -2,10 +2,9 @@ error[E0401]: can't use generic parameters from outer function --> $DIR/issue-3214.rs:3:12 | LL | fn foo() { - | --- - type parameter from outer function - | | - | try adding a local generic parameter in this method instead + | - type parameter from outer function LL | struct Foo { + | - help: try using a local generic parameter instead: `` LL | x: T, | ^ use of generic parameter from outer function diff --git a/src/test/ui/issues/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr index 112cb3359..1d595ca56 100644 --- a/src/test/ui/issues/issue-32709.stderr +++ b/src/test/ui/issues/issue-32709.stderr @@ -10,7 +10,7 @@ LL | Err(5)?; = help: the following other types implement trait `FromResidual`: as FromResidual>> as FromResidual>> - = note: required because of the requirements on the impl of `FromResidual>` for `Result` + = note: required for `Result` to implement `FromResidual>` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3290.rs b/src/test/ui/issues/issue-3290.rs index 840c7ff83..7014d517f 100644 --- a/src/test/ui/issues/issue-3290.rs +++ b/src/test/ui/issues/issue-3290.rs @@ -1,9 +1,8 @@ // run-pass -#![feature(box_syntax)] #![allow(dead_code)] pub fn main() { - let mut x: Box<_> = box 3; + let mut x: Box<_> = Box::new(3); x = x; assert_eq!(*x, 3); } diff --git a/src/test/ui/issues/issue-33941.rs b/src/test/ui/issues/issue-33941.rs index a1213623e..8430e85df 100644 --- a/src/test/ui/issues/issue-33941.rs +++ b/src/test/ui/issues/issue-33941.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; fn main() { - for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch - //~^ ERROR type mismatch - //~| ERROR type mismatch + for _ in HashMap::new().iter().cloned() {} //~ ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` + //~^ ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` + //~| ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` } diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index e1ce6eed9..691b8f88f 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -1,8 +1,10 @@ -error[E0271]: type mismatch resolving ` as Iterator>::Item == &_` - --> $DIR/issue-33941.rs:6:36 +error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` + --> $DIR/issue-33941.rs:6:14 | LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^ expected reference, found tuple + | ^^^^^^^^^^^^^^^^^^^^^ ------ required by a bound introduced by this call + | | + | expected reference, found tuple | = note: expected reference `&_` found tuple `(&_, &_)` @@ -12,7 +14,7 @@ note: required by a bound in `cloned` LL | Self: Sized + Iterator, | ^^^^^^^^^^^^ required by this bound in `cloned` -error[E0271]: type mismatch resolving ` as Iterator>::Item == &_` +error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` --> $DIR/issue-33941.rs:6:14 | LL | for _ in HashMap::new().iter().cloned() {} @@ -20,10 +22,10 @@ LL | for _ in HashMap::new().iter().cloned() {} | = note: expected tuple `(&_, &_)` found reference `&_` - = note: required because of the requirements on the impl of `Iterator` for `Cloned>` - = note: required because of the requirements on the impl of `IntoIterator` for `Cloned>` + = note: required for `Cloned>` to implement `Iterator` + = note: required for `Cloned>` to implement `IntoIterator` -error[E0271]: type mismatch resolving ` as Iterator>::Item == &_` +error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` --> $DIR/issue-33941.rs:6:14 | LL | for _ in HashMap::new().iter().cloned() {} @@ -31,7 +33,7 @@ LL | for _ in HashMap::new().iter().cloned() {} | = note: expected tuple `(&_, &_)` found reference `&_` - = note: required because of the requirements on the impl of `Iterator` for `Cloned>` + = note: required for `Cloned>` to implement `Iterator` error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index 48ae2df69..72082f0cd 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -13,10 +13,12 @@ LL | let sr: Vec<(u32, _, _)> = vec![]; | + error[E0277]: a value of type `Vec<(u32, _, _)>` cannot be built from an iterator over elements of type `()` - --> $DIR/issue-34334.rs:5:87 + --> $DIR/issue-34334.rs:5:33 | LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); - | ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>` = help: the trait `FromIterator` is implemented for `Vec` diff --git a/src/test/ui/issues/issue-34349.stderr b/src/test/ui/issues/issue-34349.stderr index d0b51961b..8e9a16619 100644 --- a/src/test/ui/issues/issue-34349.stderr +++ b/src/test/ui/issues/issue-34349.stderr @@ -7,7 +7,15 @@ LL | farewell.push_str("!!!"); | -------- closure is `FnMut` because it mutates the variable `farewell` here ... LL | apply(diary); - | ----- the requirement to implement `Fn` derives from here + | ----- ----- the requirement to implement `Fn` derives from here + | | + | required by a bound introduced by this call + | +note: required by a bound in `apply` + --> $DIR/issue-34349.rs:11:32 + | +LL | fn apply(f: F) where F: Fn() { + | ^^^^ required by this bound in `apply` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3447.rs b/src/test/ui/issues/issue-3447.rs index 1e329d152..ee5b22778 100644 --- a/src/test/ui/issues/issue-3447.rs +++ b/src/test/ui/issues/issue-3447.rs @@ -2,7 +2,6 @@ #![allow(dead_code)] #![allow(non_snake_case)] #![allow(non_camel_case_types)] -#![feature(box_syntax)] use std::cell::RefCell; @@ -20,7 +19,7 @@ impl list { next: None }; - self.next = Some(box RefCell::new(newList)); + self.next = Some(Box::new(RefCell::new(newList))); } } diff --git a/src/test/ui/issues/issue-35241.stderr b/src/test/ui/issues/issue-35241.stderr index a66289a1c..9ee7654a0 100644 --- a/src/test/ui/issues/issue-35241.stderr +++ b/src/test/ui/issues/issue-35241.stderr @@ -13,8 +13,8 @@ LL | fn test() -> Foo { Foo } found fn item `fn(u32) -> Foo {Foo}` help: use parentheses to instantiate this tuple struct | -LL | fn test() -> Foo { Foo(_) } - | +++ +LL | fn test() -> Foo { Foo(/* u32 */) } + | +++++++++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-35570.rs b/src/test/ui/issues/issue-35570.rs index 42cef9a47..a2b0222d4 100644 --- a/src/test/ui/issues/issue-35570.rs +++ b/src/test/ui/issues/issue-35570.rs @@ -6,7 +6,8 @@ trait Trait2<'a> { } fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { -//~^ the trait bound `for<'a> (): Trait2<'a>` is not satisfied + //~^ ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied + //~| ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied let _e: (usize, usize) = unsafe{mem::transmute(param)}; } diff --git a/src/test/ui/issues/issue-35570.stderr b/src/test/ui/issues/issue-35570.stderr index 2697d46bd..ebc40f678 100644 --- a/src/test/ui/issues/issue-35570.stderr +++ b/src/test/ui/issues/issue-35570.stderr @@ -1,9 +1,19 @@ +error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied + --> $DIR/issue-35570.rs:8:1 + | +LL | / fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { +LL | | +LL | | +LL | | let _e: (usize, usize) = unsafe{mem::transmute(param)}; +LL | | } + | |_^ the trait `for<'a> Trait2<'a>` is not implemented for `()` + error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied --> $DIR/issue-35570.rs:8:40 | LL | fn _ice(param: Box Trait1<<() as Trait2<'a>>::Ty>>) { | ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()` -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-3794.rs b/src/test/ui/issues/issue-3794.rs index 1809e822c..b1f028fbc 100644 --- a/src/test/ui/issues/issue-3794.rs +++ b/src/test/ui/issues/issue-3794.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] #![allow(dead_code)] trait T { @@ -26,7 +25,7 @@ fn print_s(s: &S) { } pub fn main() { - let s: Box = box S { s: 5 }; + let s: Box = Box::new(S { s: 5 }); print_s(&*s); let t: Box = s as Box; print_t(&*t); diff --git a/src/test/ui/issues/issue-3878.rs b/src/test/ui/issues/issue-3878.rs index a121f0ba8..6de3405af 100644 --- a/src/test/ui/issues/issue-3878.rs +++ b/src/test/ui/issues/issue-3878.rs @@ -2,9 +2,8 @@ // pretty-expanded FIXME #23616 #![allow(path_statements)] -#![feature(box_syntax)] pub fn main() { - let y: Box<_> = box 1; + let y: Box<_> = Box::new(1); y; } diff --git a/src/test/ui/issues/issue-38821.stderr b/src/test/ui/issues/issue-38821.stderr index cdf1f0dfc..9abd2436b 100644 --- a/src/test/ui/issues/issue-38821.stderr +++ b/src/test/ui/issues/issue-38821.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `::SqlType: NotNull` is not sat LL | #[derive(Debug, Copy, Clone)] | ^^^^ the trait `NotNull` is not implemented for `::SqlType` | -note: required because of the requirements on the impl of `IntoNullable` for `::SqlType` +note: required for `::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 | LL | impl IntoNullable for T { diff --git a/src/test/ui/issues/issue-39970.stderr b/src/test/ui/issues/issue-39970.stderr index 1f64a90bc..774575d1d 100644 --- a/src/test/ui/issues/issue-39970.stderr +++ b/src/test/ui/issues/issue-39970.stderr @@ -9,7 +9,7 @@ note: expected this to be `()` | LL | type Element = &'a (); | ^^^^^^ -note: required because of the requirements on the impl of `Visit` for `()` +note: required for `()` to implement `Visit` --> $DIR/issue-39970.rs:13:6 | LL | impl Visit for () where diff --git a/src/test/ui/issues/issue-40510-3.stderr b/src/test/ui/issues/issue-40510-3.stderr index 22186ba9a..eb077415e 100644 --- a/src/test/ui/issues/issue-40510-3.stderr +++ b/src/test/ui/issues/issue-40510-3.stderr @@ -14,6 +14,10 @@ LL | | } | = 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 | move || { + | ++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40827.stderr b/src/test/ui/issues/issue-40827.stderr index 11c23e5b6..7f5c578ae 100644 --- a/src/test/ui/issues/issue-40827.stderr +++ b/src/test/ui/issues/issue-40827.stderr @@ -12,7 +12,7 @@ note: required because it appears within the type `Bar` | LL | enum Bar { | ^^^ - = note: required because of the requirements on the impl of `Send` for `Arc` + = note: required for `Arc` to implement `Send` note: required because it appears within the type `Foo` --> $DIR/issue-40827.rs:4:8 | @@ -38,7 +38,7 @@ note: required because it appears within the type `Bar` | LL | enum Bar { | ^^^ - = note: required because of the requirements on the impl of `Send` for `Arc` + = note: required for `Arc` to implement `Send` note: required because it appears within the type `Foo` --> $DIR/issue-40827.rs:4:8 | diff --git a/src/test/ui/issues/issue-41139.stderr b/src/test/ui/issues/issue-41139.stderr index 48b22bca2..97492e6e0 100644 --- a/src/test/ui/issues/issue-41139.stderr +++ b/src/test/ui/issues/issue-41139.stderr @@ -5,9 +5,7 @@ LL | fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait { | -------------------------------------------------- `get_function` defined here returns `&dyn Fn() -> (dyn Trait + 'static)` ... LL | let t: &dyn Trait = &get_function()(); - | ^^^^^^^^^^^^^^-- - | | - | call expression requires function + | ^^^^^^^^^^^^^^ this trait object returns an unsized value `(dyn Trait + 'static)`, so it cannot be called error: aborting due to previous error diff --git a/src/test/ui/issues/issue-41726.stderr b/src/test/ui/issues/issue-41726.stderr index 22631e7c2..b05c1fb14 100644 --- a/src/test/ui/issues/issue-41726.stderr +++ b/src/test/ui/issues/issue-41726.stderr @@ -5,6 +5,10 @@ LL | things[src.as_str()].sort(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap>` +help: to modify a `HashMap>` use `.get_mut()` + | +LL | things.get_mut(src.as_str()).map(|val| val.sort()); + | ~~~~~~~~~ ~~~~~~~~~~~~~~~ + error: aborting due to previous error diff --git a/src/test/ui/issues/issue-41974.stderr b/src/test/ui/issues/issue-41974.stderr index fcbb40140..e249db9df 100644 --- a/src/test/ui/issues/issue-41974.stderr +++ b/src/test/ui/issues/issue-41974.stderr @@ -7,11 +7,11 @@ LL | impl Drop for T where T: A { = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter -error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions +error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions --> $DIR/issue-41974.rs:7:18 | LL | impl Drop for T where T: A { - | ^ must be a struct, enum, or union + | ^ must be a struct, enum, or union in the current crate error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-43988.stderr b/src/test/ui/issues/issue-43988.stderr index 03aa37f52..02c5dd5bf 100644 --- a/src/test/ui/issues/issue-43988.stderr +++ b/src/test/ui/issues/issue-43988.stderr @@ -31,12 +31,16 @@ error[E0552]: unrecognized representation hint | LL | #[repr(nothing)] | ^^^^^^^ + | + = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` error[E0552]: unrecognized representation hint --> $DIR/issue-43988.rs:18:12 | LL | #[repr(something_not_real)] | ^^^^^^^^^^^^^^^^^^ + | + = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43988.rs:30:5 diff --git a/src/test/ui/issues/issue-47511.stderr b/src/test/ui/issues/issue-47511.stderr index 5b84f7ed6..9998ee0e8 100644 --- a/src/test/ui/issues/issue-47511.stderr +++ b/src/test/ui/issues/issue-47511.stderr @@ -4,7 +4,8 @@ error[E0581]: return type references an anonymous lifetime, which is not constra LL | fn f(_: X) -> X { | ^ | - = note: lifetimes appearing in an associated type are not considered constrained + = note: lifetimes appearing in an associated or opaque type are not considered constrained + = note: consider introducing a named lifetime parameter error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types --> $DIR/issue-47511.rs:12:23 diff --git a/src/test/ui/issues/issue-4759.rs b/src/test/ui/issues/issue-4759.rs index 53785af09..e5b9e2ed5 100644 --- a/src/test/ui/issues/issue-4759.rs +++ b/src/test/ui/issues/issue-4759.rs @@ -2,8 +2,6 @@ // pretty-expanded FIXME #23616 #![allow(non_shorthand_field_patterns)] -#![feature(box_syntax)] - struct T { a: Box } trait U { @@ -15,6 +13,6 @@ impl U for Box { } pub fn main() { - let T { a: a } = T { a: box 0 }; + let T { a: a } = T { a: Box::new(0) }; a.f(); } diff --git a/src/test/ui/issues/issue-4935.stderr b/src/test/ui/issues/issue-4935.stderr index aab19a699..bb45fa083 100644 --- a/src/test/ui/issues/issue-4935.stderr +++ b/src/test/ui/issues/issue-4935.stderr @@ -12,7 +12,7 @@ LL | fn foo(a: usize) {} help: remove the extra argument | LL | fn main() { foo(5) } - | ~~~~~~ + | ~~~ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4972.rs b/src/test/ui/issues/issue-4972.rs index fab258f13..3f1c6f855 100644 --- a/src/test/ui/issues/issue-4972.rs +++ b/src/test/ui/issues/issue-4972.rs @@ -1,5 +1,4 @@ #![feature(box_patterns)] -#![feature(box_syntax)] trait MyTrait { fn dummy(&self) {} diff --git a/src/test/ui/issues/issue-4972.stderr b/src/test/ui/issues/issue-4972.stderr index 40db50278..83daded7e 100644 --- a/src/test/ui/issues/issue-4972.stderr +++ b/src/test/ui/issues/issue-4972.stderr @@ -1,5 +1,5 @@ error[E0033]: type `Box<(dyn MyTrait + 'static)>` cannot be dereferenced - --> $DIR/issue-4972.rs:14:25 + --> $DIR/issue-4972.rs:13:25 | LL | TraitWrapper::A(box ref map) => map, | ^^^^^^^^^^^ type `Box<(dyn MyTrait + 'static)>` cannot be dereferenced diff --git a/src/test/ui/issues/issue-49824.stderr b/src/test/ui/issues/issue-49824.stderr index 2fec48254..14beadece 100644 --- a/src/test/ui/issues/issue-49824.stderr +++ b/src/test/ui/issues/issue-49824.stderr @@ -14,6 +14,10 @@ LL | | } | = 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 | move || { + | ++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5100.rs b/src/test/ui/issues/issue-5100.rs index 5e926fabe..69ed4b0e4 100644 --- a/src/test/ui/issues/issue-5100.rs +++ b/src/test/ui/issues/issue-5100.rs @@ -1,5 +1,5 @@ #![feature(box_patterns)] -#![feature(box_syntax)] + enum A { B, C } diff --git a/src/test/ui/issues/issue-5192.rs b/src/test/ui/issues/issue-5192.rs index 5a83d1c2f..e2f835c19 100644 --- a/src/test/ui/issues/issue-5192.rs +++ b/src/test/ui/issues/issue-5192.rs @@ -2,8 +2,6 @@ #![allow(dead_code)] // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub trait EventLoop { fn dummy(&self) { } } @@ -37,5 +35,5 @@ impl Scheduler { } pub fn main() { - let _sched = Scheduler::new(box UvEventLoop::new() as Box); + let _sched = Scheduler::new(Box::new(UvEventLoop::new()) as Box); } diff --git a/src/test/ui/issues/issue-5439.rs b/src/test/ui/issues/issue-5439.rs index cd039506f..852b264dc 100644 --- a/src/test/ui/issues/issue-5439.rs +++ b/src/test/ui/issues/issue-5439.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - struct Foo { foo: isize, } @@ -10,7 +8,7 @@ struct Bar { impl Bar { fn make_foo (&self, i: isize) -> Box { - return box Foo { nonexistent: self, foo: i }; //~ ERROR: no field named + return Box::new(Foo { nonexistent: self, foo: i }); //~ ERROR: no field named } } diff --git a/src/test/ui/issues/issue-5439.stderr b/src/test/ui/issues/issue-5439.stderr index bd0cb670b..dc8f8b878 100644 --- a/src/test/ui/issues/issue-5439.stderr +++ b/src/test/ui/issues/issue-5439.stderr @@ -1,8 +1,8 @@ error[E0560]: struct `Foo` has no field named `nonexistent` - --> $DIR/issue-5439.rs:13:26 + --> $DIR/issue-5439.rs:11:31 | -LL | return box Foo { nonexistent: self, foo: i }; - | ^^^^^^^^^^^ `Foo` does not have this field +LL | return Box::new(Foo { nonexistent: self, foo: i }); + | ^^^^^^^^^^^ `Foo` does not have this field | = note: available fields are: `foo` diff --git a/src/test/ui/issues/issue-5666.rs b/src/test/ui/issues/issue-5666.rs index aa5132778..810895b1b 100644 --- a/src/test/ui/issues/issue-5666.rs +++ b/src/test/ui/issues/issue-5666.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] struct Dog { name : String @@ -17,8 +16,8 @@ impl Barks for Dog { pub fn main() { - let snoopy = box Dog{name: "snoopy".to_string()}; - let bubbles = box Dog{name: "bubbles".to_string()}; + let snoopy = Box::new(Dog{name: "snoopy".to_string()}); + let bubbles = Box::new(Dog{name: "bubbles".to_string()}); let barker = [snoopy as Box, bubbles as Box]; for pup in &barker { diff --git a/src/test/ui/issues/issue-5718.rs b/src/test/ui/issues/issue-5718.rs index 63efec953..f29a1e2a0 100644 --- a/src/test/ui/issues/issue-5718.rs +++ b/src/test/ui/issues/issue-5718.rs @@ -1,14 +1,12 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - struct Element; macro_rules! foo { ($tag: expr, $string: expr) => { if $tag == $string { - let element: Box<_> = box Element; + let element: Box<_> = Box::new(Element); unsafe { return std::mem::transmute::<_, usize>(element); } diff --git a/src/test/ui/issues/issue-57362-1.stderr b/src/test/ui/issues/issue-57362-1.stderr index 8e19f1400..b10273f14 100644 --- a/src/test/ui/issues/issue-57362-1.stderr +++ b/src/test/ui/issues/issue-57362-1.stderr @@ -2,9 +2,7 @@ error[E0599]: no method named `f` found for fn pointer `fn(&u8)` in the current --> $DIR/issue-57362-1.rs:20:7 | LL | a.f(); - | - ^ method not found in `fn(&u8)` - | | - | this is a function, perhaps you wish to call it + | ^ method not found in `fn(&u8)` | = help: items from traits can only be used if the trait is implemented and in scope note: `Trait` defines an item `f`, perhaps you need to implement it diff --git a/src/test/ui/issues/issue-5884.rs b/src/test/ui/issues/issue-5884.rs index 2f64342a6..991c52321 100644 --- a/src/test/ui/issues/issue-5884.rs +++ b/src/test/ui/issues/issue-5884.rs @@ -2,8 +2,6 @@ #![allow(dead_code)] // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub struct Foo { a: isize, } @@ -14,7 +12,7 @@ struct Bar<'a> { } fn check(a: Box) { - let _ic = Bar{ b: &*a, a: box None }; + let _ic = Bar{ b: &*a, a: Box::new(None) }; } pub fn main(){} diff --git a/src/test/ui/issues/issue-59488.rs b/src/test/ui/issues/issue-59488.rs index 922b59393..384501e3e 100644 --- a/src/test/ui/issues/issue-59488.rs +++ b/src/test/ui/issues/issue-59488.rs @@ -30,4 +30,5 @@ fn main() { assert_eq!(Foo::Bar, i); //~^ ERROR binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` [E0369] //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] + //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] } diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr index 7ce3dedaa..08fe0b35e 100644 --- a/src/test/ui/issues/issue-59488.stderr +++ b/src/test/ui/issues/issue-59488.stderr @@ -6,7 +6,7 @@ LL | foo > 12; | | | fn() -> i32 {foo} | -help: you might have forgotten to call this function +help: use parentheses to call this function | LL | foo() > 12; | ++ @@ -28,10 +28,10 @@ LL | bar > 13; | | | fn(i64) -> i64 {bar} | -help: you might have forgotten to call this function +help: use parentheses to call this function | -LL | bar( /* arguments */ ) > 13; - | +++++++++++++++++++ +LL | bar(/* i64 */) > 13; + | +++++++++++ error[E0308]: mismatched types --> $DIR/issue-59488.rs:18:11 @@ -50,14 +50,10 @@ LL | foo > foo; | | | fn() -> i32 {foo} | -help: you might have forgotten to call this function +help: use parentheses to call these | -LL | foo() > foo; - | ++ -help: you might have forgotten to call this function - | -LL | foo > foo(); - | ++ +LL | foo() > foo(); + | ++ ++ error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` --> $DIR/issue-59488.rs:25:9 @@ -93,7 +89,26 @@ error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` LL | assert_eq!(Foo::Bar, i); | ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}` + = help: the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` + = help: the following other types implement trait `Debug`: + extern "C" fn() -> Ret + extern "C" fn(A, B) -> Ret + extern "C" fn(A, B, ...) -> Ret + extern "C" fn(A, B, C) -> Ret + extern "C" fn(A, B, C, ...) -> Ret + extern "C" fn(A, B, C, D) -> Ret + extern "C" fn(A, B, C, D, ...) -> Ret + extern "C" fn(A, B, C, D, E) -> Ret + and 68 others + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` + --> $DIR/issue-59488.rs:30:5 + | +LL | assert_eq!(Foo::Bar, i); + | ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = help: the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}` = help: the following other types implement trait `Debug`: extern "C" fn() -> Ret extern "C" fn(A, B) -> Ret @@ -106,7 +121,7 @@ LL | assert_eq!(Foo::Bar, i); and 68 others = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors Some errors have detailed explanations: E0277, E0308, E0369. For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-5997-enum.stderr b/src/test/ui/issues/issue-5997-enum.stderr index 1c58b9c39..3a79215d3 100644 --- a/src/test/ui/issues/issue-5997-enum.stderr +++ b/src/test/ui/issues/issue-5997-enum.stderr @@ -2,11 +2,11 @@ error[E0401]: can't use generic parameters from outer function --> $DIR/issue-5997-enum.rs:2:16 | LL | fn f() -> bool { - | - - type parameter from outer function - | | - | try adding a local generic parameter in this method instead + | - type parameter from outer function LL | enum E { V(Z) } - | ^ use of generic parameter from outer function + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5997-struct.stderr b/src/test/ui/issues/issue-5997-struct.stderr index 5b388d16d..d2e97f767 100644 --- a/src/test/ui/issues/issue-5997-struct.stderr +++ b/src/test/ui/issues/issue-5997-struct.stderr @@ -2,11 +2,11 @@ error[E0401]: can't use generic parameters from outer function --> $DIR/issue-5997-struct.rs:2:14 | LL | fn f() -> bool { - | - - type parameter from outer function - | | - | try adding a local generic parameter in this method instead + | - type parameter from outer function LL | struct S(T); - | ^ use of generic parameter from outer function + | -^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-60218.stderr b/src/test/ui/issues/issue-60218.stderr index 870b25014..dd72b6515 100644 --- a/src/test/ui/issues/issue-60218.stderr +++ b/src/test/ui/issues/issue-60218.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `&u32: Foo` is not satisfied - --> $DIR/issue-60218.rs:18:27 + --> $DIR/issue-60218.rs:18:19 | LL | trigger_error(vec![], |x: &u32| x) - | ------------- ^^^^^^^^^^^ the trait `Foo` is not implemented for `&u32` + | ------------- ^^^^^^ the trait `Foo` is not implemented for `&u32` | | | required by a bound introduced by this call | diff --git a/src/test/ui/issues/issue-62480.rs b/src/test/ui/issues/issue-62480.rs index 5c3be3e64..94a9c2ab8 100644 --- a/src/test/ui/issues/issue-62480.rs +++ b/src/test/ui/issues/issue-62480.rs @@ -1,5 +1,3 @@ -#![feature(label_break_value)] - fn main() { // This used to ICE during liveness check because `target_id` passed to // `propagate_through_expr` would be the closure and not the `loop`, which wouldn't be found in diff --git a/src/test/ui/issues/issue-62480.stderr b/src/test/ui/issues/issue-62480.stderr index 17085ef90..db2305370 100644 --- a/src/test/ui/issues/issue-62480.stderr +++ b/src/test/ui/issues/issue-62480.stderr @@ -1,5 +1,5 @@ error[E0767]: use of unreachable label `'a` - --> $DIR/issue-62480.rs:8:18 + --> $DIR/issue-62480.rs:6:18 | LL | 'a: { | -- unreachable label defined here @@ -9,7 +9,7 @@ LL | || break 'a = note: labels are unreachable through functions, closures, async blocks and modules error[E0267]: `break` inside of a closure - --> $DIR/issue-62480.rs:8:12 + --> $DIR/issue-62480.rs:6:12 | LL | || break 'a | -- ^^^^^^^^ cannot `break` inside of a closure diff --git a/src/test/ui/issues/issue-6318.rs b/src/test/ui/issues/issue-6318.rs index d8bd83f0d..e5f245f6f 100644 --- a/src/test/ui/issues/issue-6318.rs +++ b/src/test/ui/issues/issue-6318.rs @@ -1,8 +1,6 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub enum Thing { A(Box) } @@ -16,7 +14,7 @@ pub struct Struct; impl Foo for Struct {} pub fn main() { - match Thing::A(box Struct as Box) { + match Thing::A(Box::new(Struct) as Box) { Thing::A(_a) => 0, }; } diff --git a/src/test/ui/issues/issue-6557.rs b/src/test/ui/issues/issue-6557.rs index e066aa529..757e9608f 100644 --- a/src/test/ui/issues/issue-6557.rs +++ b/src/test/ui/issues/issue-6557.rs @@ -3,7 +3,6 @@ // pretty-expanded FIXME #23616 #![feature(box_patterns)] -#![feature(box_syntax)] fn foo(box (_x, _y): Box<(isize, isize)>) {} diff --git a/src/test/ui/issues/issue-66706.rs b/src/test/ui/issues/issue-66706.rs index 4585bcc8c..835fdfae8 100644 --- a/src/test/ui/issues/issue-66706.rs +++ b/src/test/ui/issues/issue-66706.rs @@ -2,7 +2,6 @@ fn a() { [0; [|_: _ &_| ()].len()] //~^ ERROR expected `,`, found `&` //~| ERROR type annotations needed - //~| ERROR mismatched types } fn b() { @@ -13,13 +12,11 @@ fn b() { fn c() { [0; [|&_: _ &_| {}; 0 ].len()] //~^ ERROR expected `,`, found `&` - //~| ERROR mismatched types } fn d() { [0; match [|f @ &ref _| () ] {} ] //~^ ERROR expected identifier, found reserved identifier `_` - //~| ERROR mismatched types } fn main() {} diff --git a/src/test/ui/issues/issue-66706.stderr b/src/test/ui/issues/issue-66706.stderr index 1c55560cb..8a30c0cad 100644 --- a/src/test/ui/issues/issue-66706.stderr +++ b/src/test/ui/issues/issue-66706.stderr @@ -7,13 +7,13 @@ LL | [0; [|_: _ &_| ()].len()] | help: missing `,` error: expected identifier, found reserved identifier `_` - --> $DIR/issue-66706.rs:9:20 + --> $DIR/issue-66706.rs:8:20 | LL | [0; [|f @ &ref _| {} ; 0 ].len() ]; | ^ expected identifier, found reserved identifier error: expected `,`, found `&` - --> $DIR/issue-66706.rs:14:17 + --> $DIR/issue-66706.rs:13:17 | LL | [0; [|&_: _ &_| {}; 0 ].len()] | -^ expected `,` @@ -21,7 +21,7 @@ LL | [0; [|&_: _ &_| {}; 0 ].len()] | help: missing `,` error: expected identifier, found reserved identifier `_` - --> $DIR/issue-66706.rs:20:26 + --> $DIR/issue-66706.rs:18:26 | LL | [0; match [|f @ &ref _| () ] {} ] | ^ expected identifier, found reserved identifier @@ -32,31 +32,6 @@ error[E0282]: type annotations needed LL | [0; [|_: _ &_| ()].len()] | ^ cannot infer type -error[E0308]: mismatched types - --> $DIR/issue-66706.rs:2:5 - | -LL | fn a() { - | - help: try adding a return type: `-> [i32; _]` -LL | [0; [|_: _ &_| ()].len()] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found array `[{integer}; _]` - -error[E0308]: mismatched types - --> $DIR/issue-66706.rs:14:5 - | -LL | fn c() { - | - help: try adding a return type: `-> [i32; _]` -LL | [0; [|&_: _ &_| {}; 0 ].len()] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found array `[{integer}; _]` - -error[E0308]: mismatched types - --> $DIR/issue-66706.rs:20:5 - | -LL | fn d() { - | - help: try adding a return type: `-> [i32; _]` -LL | [0; match [|f @ &ref _| () ] {} ] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found array `[{integer}; _]` - -error: aborting due to 8 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0282, E0308. -For more information about an error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr index d6e392516..2de150376 100644 --- a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr +++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr @@ -1,8 +1,10 @@ error[E0277]: a value of type `Vec` cannot be built from an iterator over elements of type `&f64` - --> $DIR/issue-66923-show-error-for-correct-call.rs:8:39 + --> $DIR/issue-66923-show-error-for-correct-call.rs:8:24 | LL | let x2: Vec = x1.into_iter().collect(); - | ^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` + | ^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Vec` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec` = help: the trait `FromIterator` is implemented for `Vec` @@ -13,10 +15,12 @@ LL | fn collect>(self) -> B | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error[E0277]: a value of type `Vec` cannot be built from an iterator over elements of type `&f64` - --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29 + --> $DIR/issue-66923-show-error-for-correct-call.rs:12:14 | LL | let x3 = x1.into_iter().collect::>(); - | ^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` + | ^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Vec` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec` = help: the trait `FromIterator` is implemented for `Vec` diff --git a/src/test/ui/issues/issue-67039-unsound-pin-partialeq.stderr b/src/test/ui/issues/issue-67039-unsound-pin-partialeq.stderr index 733456a1a..37e2c3bdd 100644 --- a/src/test/ui/issues/issue-67039-unsound-pin-partialeq.stderr +++ b/src/test/ui/issues/issue-67039-unsound-pin-partialeq.stderr @@ -6,7 +6,7 @@ LL | let _ = Pin::new(Apple) == Rc::pin(Apple); | = note: expected struct `Apple` found struct `Rc` - = note: required because of the requirements on the impl of `PartialEq>>` for `Pin` + = note: required for `Pin` to implement `PartialEq>>` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr index e5ab65169..f581429a2 100644 --- a/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr +++ b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr @@ -17,10 +17,10 @@ LL | | } = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) error: missing type for `const` item - --> $DIR/issue-69396-const-no-type-in-macro.rs:4:19 + --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20 | LL | const A = "A".$fn(); - | ^ help: provide a type for the constant: `A: usize` + | ^ help: provide a type for the constant: `: usize` ... LL | / suite! { LL | | len; @@ -31,13 +31,13 @@ LL | | } = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants - --> $DIR/issue-69396-const-no-type-in-macro.rs:4:19 + --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20 | LL | const A = "A".$fn(); - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `bool` + | ^ + | | + | not allowed in type signatures + | help: replace with the correct type: `bool` ... LL | / suite! { LL | | len; diff --git a/src/test/ui/issues/issue-69455.stderr b/src/test/ui/issues/issue-69455.stderr index b732df764..9d11cf19e 100644 --- a/src/test/ui/issues/issue-69455.stderr +++ b/src/test/ui/issues/issue-69455.stderr @@ -16,7 +16,7 @@ error[E0283]: type annotations needed LL | println!("{}", 23u64.test(xs.iter().sum())); | ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` | | - | type must be known at this point + | required by a bound introduced by this call | note: multiple `impl`s satisfying `u64: Test<_>` found --> $DIR/issue-69455.rs:11:1 diff --git a/src/test/ui/issues/issue-7013.rs b/src/test/ui/issues/issue-7013.rs index c1f400b33..1fb01303c 100644 --- a/src/test/ui/issues/issue-7013.rs +++ b/src/test/ui/issues/issue-7013.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - use std::cell::RefCell; use std::rc::Rc; @@ -23,6 +21,6 @@ struct A { } fn main() { - let a = A {v: box B{v: None} as Box}; + let a = A {v: Box::new(B{v: None}) as Box}; //~^ ERROR `Rc>` cannot be sent between threads safely } diff --git a/src/test/ui/issues/issue-7013.stderr b/src/test/ui/issues/issue-7013.stderr index f6cb1cbdc..4575f4dba 100644 --- a/src/test/ui/issues/issue-7013.stderr +++ b/src/test/ui/issues/issue-7013.stderr @@ -1,13 +1,13 @@ error[E0277]: `Rc>` cannot be sent between threads safely - --> $DIR/issue-7013.rs:26:19 + --> $DIR/issue-7013.rs:24:19 | -LL | let a = A {v: box B{v: None} as Box}; - | ^^^^^^^^^^^^^^ `Rc>` cannot be sent between threads safely +LL | let a = A {v: Box::new(B{v: None}) as Box}; + | ^^^^^^^^^^^^^^^^^^^^ `Rc>` cannot be sent between threads safely | = help: within `B`, the trait `Send` is not implemented for `Rc>` = note: required because it appears within the type `Option>>` note: required because it appears within the type `B` - --> $DIR/issue-7013.rs:10:8 + --> $DIR/issue-7013.rs:8:8 | LL | struct B { | ^ diff --git a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr index c6e6ea1e0..7f29709ce 100644 --- a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr +++ b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr @@ -8,11 +8,6 @@ LL | assert_eq!(a, 0); | {integer} | = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: you might have forgotten to call this function - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - | -LL | if !(*left_val() == *right_val) { - | ++ error[E0308]: mismatched types --> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 @@ -21,7 +16,7 @@ LL | assert_eq!(a, 0); | ^^^^^^^^^^^^^^^^ expected fn item, found integer | = note: expected fn item `fn() -> i32 {a}` - found type `i32` + found type `{integer}` = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `fn() -> i32 {a}` doesn't implement `Debug` @@ -33,7 +28,7 @@ LL | fn a() -> i32 { LL | assert_eq!(a, 0); | ^^^^^^^^^^^^^^^^ `fn() -> i32 {a}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = help: the trait `Debug` is not implemented for `fn() -> i32 {a}` + = help: the trait `Debug` is not implemented for fn item `fn() -> i32 {a}` = help: use parentheses to call the function: `a()` = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/issues/issue-7364.rs b/src/test/ui/issues/issue-7364.rs index 83c52d286..79642bd41 100644 --- a/src/test/ui/issues/issue-7364.rs +++ b/src/test/ui/issues/issue-7364.rs @@ -1,9 +1,7 @@ -#![feature(box_syntax)] - use std::cell::RefCell; // Regression test for issue 7364 -static boxed: Box> = box RefCell::new(0); +static boxed: Box> = Box::new(RefCell::new(0)); //~^ ERROR `RefCell` cannot be shared between threads safely [E0277] fn main() { } diff --git a/src/test/ui/issues/issue-7364.stderr b/src/test/ui/issues/issue-7364.stderr index f2e80f451..5dc8c2b60 100644 --- a/src/test/ui/issues/issue-7364.stderr +++ b/src/test/ui/issues/issue-7364.stderr @@ -1,11 +1,11 @@ error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/issue-7364.rs:6:15 + --> $DIR/issue-7364.rs:4:15 | -LL | static boxed: Box> = box RefCell::new(0); +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: required because of the requirements on the impl of `Sync` for `Unique>` + = 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/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs index 2961dc79f..c089c3308 100644 --- a/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs @@ -8,8 +8,6 @@ */ -#![feature(box_syntax)] - pub fn main() {} trait A { @@ -19,4 +17,4 @@ trait A { impl A for T {} fn owned2(a: Box) { a as Box; } -fn owned3(a: Box) { box a as Box; } +fn owned3(a: Box) { Box::new(a) as Box; } diff --git a/src/test/ui/issues/issue-86756.stderr b/src/test/ui/issues/issue-86756.stderr index 399c940ca..b26c1834d 100644 --- a/src/test/ui/issues/issue-86756.stderr +++ b/src/test/ui/issues/issue-86756.stderr @@ -25,9 +25,8 @@ LL | eq:: = note: for more information, see help: use `dyn` | -LL - eq:: -LL + eq:: - | +LL | eq:: + | +++ error[E0107]: missing generics for trait `Foo` --> $DIR/issue-86756.rs:5:15 diff --git a/src/test/ui/issues/issue-9129.rs b/src/test/ui/issues/issue-9129.rs index 780a6419c..04110b3ae 100644 --- a/src/test/ui/issues/issue-9129.rs +++ b/src/test/ui/issues/issue-9129.rs @@ -4,8 +4,6 @@ #![allow(non_snake_case)] // ignore-pretty unreported -#![feature(box_syntax)] - pub trait bomb { fn boom(&self, _: Ident); } pub struct S; impl bomb for S { fn boom(&self, _: Ident) { } } @@ -29,6 +27,6 @@ pub fn light_fuse(fld: Box) { } pub fn main() { - let b = box S as Box; + let b = Box::new(S) as Box; light_fuse(b); } diff --git a/src/test/ui/issues/issue-9382.rs b/src/test/ui/issues/issue-9382.rs index dbb0fa524..65718343f 100644 --- a/src/test/ui/issues/issue-9382.rs +++ b/src/test/ui/issues/issue-9382.rs @@ -3,7 +3,6 @@ // run-pass #![allow(dead_code)] -#![feature(box_syntax)] // Tests for a previous bug that occurred due to an interaction // between struct field initialization and the auto-coercion @@ -24,11 +23,11 @@ struct Thing2<'a> { pub fn main() { let _t1_fixed = Thing1 { baz: &[], - bar: box 32, + bar: Box::new(32), }; Thing1 { baz: &Vec::new(), - bar: box 32, + bar: Box::new(32), }; let _t2_fixed = Thing2 { baz: &[], diff --git a/src/test/ui/issues/issue-99875.rs b/src/test/ui/issues/issue-99875.rs new file mode 100644 index 000000000..cf73fd8d3 --- /dev/null +++ b/src/test/ui/issues/issue-99875.rs @@ -0,0 +1,16 @@ +struct Argument; +struct Return; + +fn function(_: Argument) -> Return { todo!() } + +trait Trait {} +impl Trait for fn(Argument) -> Return {} + +fn takes(_: impl Trait) {} + +fn main() { + takes(function); + //~^ ERROR the trait bound + takes(|_: Argument| -> Return { todo!() }); + //~^ ERROR the trait bound +} diff --git a/src/test/ui/issues/issue-99875.stderr b/src/test/ui/issues/issue-99875.stderr new file mode 100644 index 000000000..3ff8f12f1 --- /dev/null +++ b/src/test/ui/issues/issue-99875.stderr @@ -0,0 +1,33 @@ +error[E0277]: the trait bound `fn(Argument) -> Return {function}: Trait` is not satisfied + --> $DIR/issue-99875.rs:12:11 + | +LL | takes(function); + | ----- ^^^^^^^^ the trait `Trait` is not implemented for fn item `fn(Argument) -> Return {function}` + | | + | required by a bound introduced by this call + | + = help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return` +note: required by a bound in `takes` + --> $DIR/issue-99875.rs:9:18 + | +LL | fn takes(_: impl Trait) {} + | ^^^^^ required by this bound in `takes` + +error[E0277]: the trait bound `[closure@$DIR/issue-99875.rs:14:11: 14:34]: Trait` is not satisfied + --> $DIR/issue-99875.rs:14:11 + | +LL | takes(|_: Argument| -> Return { todo!() }); + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `[closure@$DIR/issue-99875.rs:14:11: 14:34]` + | | + | required by a bound introduced by this call + | + = help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return` +note: required by a bound in `takes` + --> $DIR/issue-99875.rs:9:18 + | +LL | fn takes(_: impl Trait) {} + | ^^^^^ required by this bound in `takes` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/iterators/collect-into-array.rs b/src/test/ui/iterators/collect-into-array.rs index a1144c8cb..7d35da825 100644 --- a/src/test/ui/iterators/collect-into-array.rs +++ b/src/test/ui/iterators/collect-into-array.rs @@ -4,4 +4,5 @@ fn main() { //~^ ERROR an array of type `[u32; 10]` cannot be built directly from an iterator //~| NOTE try collecting into a `Vec<{integer}>`, then using `.try_into()` //~| NOTE required by a bound in `collect` + //~| NOTE required by a bound introduced by this call } diff --git a/src/test/ui/iterators/collect-into-array.stderr b/src/test/ui/iterators/collect-into-array.stderr index 7be53a487..7fe9707e6 100644 --- a/src/test/ui/iterators/collect-into-array.stderr +++ b/src/test/ui/iterators/collect-into-array.stderr @@ -1,8 +1,10 @@ error[E0277]: an array of type `[u32; 10]` cannot be built directly from an iterator - --> $DIR/collect-into-array.rs:3:39 + --> $DIR/collect-into-array.rs:3:31 | LL | let whatever: [u32; 10] = (0..10).collect(); - | ^^^^^^^ try collecting into a `Vec<{integer}>`, then using `.try_into()` + | ^^^^^^^ ------- required by a bound introduced by this call + | | + | try collecting into a `Vec<{integer}>`, then using `.try_into()` | = help: the trait `FromIterator<{integer}>` is not implemented for `[u32; 10]` note: required by a bound in `collect` diff --git a/src/test/ui/iterators/collect-into-slice.rs b/src/test/ui/iterators/collect-into-slice.rs index aafa6bc8b..5eade0756 100644 --- a/src/test/ui/iterators/collect-into-slice.rs +++ b/src/test/ui/iterators/collect-into-slice.rs @@ -1,15 +1,20 @@ fn process_slice(data: &[i32]) { //~^ NOTE required by a bound in this + //~| NOTE required by a bound in this todo!() } fn main() { let some_generated_vec = (0..10).collect(); //~^ ERROR the size for values of type `[i32]` cannot be known at compilation time + //~| ERROR the size for values of type `[i32]` cannot be known at compilation time //~| ERROR a slice of type `[i32]` cannot be built since `[i32]` has no definite size //~| NOTE try explicitly collecting into a `Vec<{integer}>` //~| NOTE required by a bound in `collect` + //~| NOTE required by a bound in `collect` //~| NOTE all local variables must have a statically known size //~| NOTE doesn't have a size known at compile-time + //~| NOTE doesn't have a size known at compile-time + //~| NOTE required by a bound introduced by this call process_slice(&some_generated_vec); } diff --git a/src/test/ui/iterators/collect-into-slice.stderr b/src/test/ui/iterators/collect-into-slice.stderr index 4842e65fe..bce40118b 100644 --- a/src/test/ui/iterators/collect-into-slice.stderr +++ b/src/test/ui/iterators/collect-into-slice.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/collect-into-slice.rs:7:9 + --> $DIR/collect-into-slice.rs:8:9 | LL | let some_generated_vec = (0..10).collect(); | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -8,11 +8,26 @@ LL | let some_generated_vec = (0..10).collect(); = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +error[E0277]: the size for values of type `[i32]` cannot be known at compilation time + --> $DIR/collect-into-slice.rs:8:38 + | +LL | let some_generated_vec = (0..10).collect(); + | ^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[i32]` +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | fn collect>(self) -> B + | ^ required by this bound in `collect` + error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size - --> $DIR/collect-into-slice.rs:7:38 + --> $DIR/collect-into-slice.rs:8:30 | LL | let some_generated_vec = (0..10).collect(); - | ^^^^^^^ try explicitly collecting into a `Vec<{integer}>` + | ^^^^^^^ ------- required by a bound introduced by this call + | | + | try explicitly collecting into a `Vec<{integer}>` | = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]` note: required by a bound in `collect` @@ -21,6 +36,6 @@ note: required by a bound in `collect` LL | fn collect>(self) -> B | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/iterators/integral.stderr b/src/test/ui/iterators/integral.stderr index 5e2744bab..047a71f98 100644 --- a/src/test/ui/iterators/integral.stderr +++ b/src/test/ui/iterators/integral.stderr @@ -6,7 +6,7 @@ LL | for _ in 42 {} | = help: the trait `Iterator` is not implemented for `{integer}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `{integer}` + = note: required for `{integer}` to implement `IntoIterator` error[E0277]: `u8` is not an iterator --> $DIR/integral.rs:4:14 @@ -16,7 +16,7 @@ LL | for _ in 42 as u8 {} | = help: the trait `Iterator` is not implemented for `u8` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `u8` + = note: required for `u8` to implement `IntoIterator` error[E0277]: `i8` is not an iterator --> $DIR/integral.rs:6:14 @@ -26,7 +26,7 @@ LL | for _ in 42 as i8 {} | = help: the trait `Iterator` is not implemented for `i8` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `i8` + = note: required for `i8` to implement `IntoIterator` error[E0277]: `u16` is not an iterator --> $DIR/integral.rs:8:14 @@ -36,7 +36,7 @@ LL | for _ in 42 as u16 {} | = help: the trait `Iterator` is not implemented for `u16` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `u16` + = note: required for `u16` to implement `IntoIterator` error[E0277]: `i16` is not an iterator --> $DIR/integral.rs:10:14 @@ -46,7 +46,7 @@ LL | for _ in 42 as i16 {} | = help: the trait `Iterator` is not implemented for `i16` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `i16` + = note: required for `i16` to implement `IntoIterator` error[E0277]: `u32` is not an iterator --> $DIR/integral.rs:12:14 @@ -56,7 +56,7 @@ LL | for _ in 42 as u32 {} | = help: the trait `Iterator` is not implemented for `u32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `u32` + = note: required for `u32` to implement `IntoIterator` error[E0277]: `i32` is not an iterator --> $DIR/integral.rs:14:14 @@ -66,7 +66,7 @@ LL | for _ in 42 as i32 {} | = help: the trait `Iterator` is not implemented for `i32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `i32` + = note: required for `i32` to implement `IntoIterator` error[E0277]: `u64` is not an iterator --> $DIR/integral.rs:16:14 @@ -76,7 +76,7 @@ LL | for _ in 42 as u64 {} | = help: the trait `Iterator` is not implemented for `u64` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `u64` + = note: required for `u64` to implement `IntoIterator` error[E0277]: `i64` is not an iterator --> $DIR/integral.rs:18:14 @@ -86,7 +86,7 @@ LL | for _ in 42 as i64 {} | = help: the trait `Iterator` is not implemented for `i64` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `i64` + = note: required for `i64` to implement `IntoIterator` error[E0277]: `usize` is not an iterator --> $DIR/integral.rs:20:14 @@ -96,7 +96,7 @@ LL | for _ in 42 as usize {} | = help: the trait `Iterator` is not implemented for `usize` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `usize` + = note: required for `usize` to implement `IntoIterator` error[E0277]: `isize` is not an iterator --> $DIR/integral.rs:22:14 @@ -106,7 +106,7 @@ LL | for _ in 42 as isize {} | = help: the trait `Iterator` is not implemented for `isize` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `isize` + = note: required for `isize` to implement `IntoIterator` error[E0277]: `{float}` is not an iterator --> $DIR/integral.rs:24:14 @@ -115,7 +115,7 @@ LL | for _ in 42.0 {} | ^^^^ `{float}` is not an iterator | = help: the trait `Iterator` is not implemented for `{float}` - = note: required because of the requirements on the impl of `IntoIterator` for `{float}` + = note: required for `{float}` to implement `IntoIterator` error: aborting due to 12 previous errors diff --git a/src/test/ui/iterators/issue-28098.rs b/src/test/ui/iterators/issue-28098.rs index 62a90d90d..80c77edae 100644 --- a/src/test/ui/iterators/issue-28098.rs +++ b/src/test/ui/iterators/issue-28098.rs @@ -2,12 +2,14 @@ fn main() { let _ = Iterator::next(&mut ()); //~^ ERROR `()` is not an iterator //~| ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator for _ in false {} //~^ ERROR `bool` is not an iterator let _ = Iterator::next(&mut ()); //~^ ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator other() } @@ -18,9 +20,11 @@ pub fn other() { let _ = Iterator::next(&mut ()); //~^ ERROR `()` is not an iterator //~| ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator let _ = Iterator::next(&mut ()); //~^ ERROR `()` is not an iterator + //~| ERROR `()` is not an iterator for _ in false {} //~^ ERROR `bool` is not an iterator diff --git a/src/test/ui/iterators/issue-28098.stderr b/src/test/ui/iterators/issue-28098.stderr index 3beb99292..3256e57d4 100644 --- a/src/test/ui/iterators/issue-28098.stderr +++ b/src/test/ui/iterators/issue-28098.stderr @@ -8,17 +8,25 @@ LL | let _ = Iterator::next(&mut ()); | = help: the trait `Iterator` is not implemented for `()` +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:2:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + error[E0277]: `bool` is not an iterator - --> $DIR/issue-28098.rs:6:14 + --> $DIR/issue-28098.rs:7:14 | LL | for _ in false {} | ^^^^^ `bool` is not an iterator | = help: the trait `Iterator` is not implemented for `bool` - = note: required because of the requirements on the impl of `IntoIterator` for `bool` + = note: required for `bool` to implement `IntoIterator` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:9:28 + --> $DIR/issue-28098.rs:10:28 | LL | let _ = Iterator::next(&mut ()); | -------------- ^^^^^^^ `()` is not an iterator @@ -27,6 +35,14 @@ LL | let _ = Iterator::next(&mut ()); | = help: the trait `Iterator` is not implemented for `()` +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:10:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:2:13 | @@ -36,7 +52,7 @@ LL | let _ = Iterator::next(&mut ()); = help: the trait `Iterator` is not implemented for `()` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:18:28 + --> $DIR/issue-28098.rs:20:28 | LL | let _ = Iterator::next(&mut ()); | -------------- ^^^^^^^ `()` is not an iterator @@ -46,7 +62,15 @@ LL | let _ = Iterator::next(&mut ()); = help: the trait `Iterator` is not implemented for `()` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:22:28 + --> $DIR/issue-28098.rs:20:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:25:28 | LL | let _ = Iterator::next(&mut ()); | -------------- ^^^^^^^ `()` is not an iterator @@ -55,23 +79,31 @@ LL | let _ = Iterator::next(&mut ()); | = help: the trait `Iterator` is not implemented for `()` +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:25:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + error[E0277]: `bool` is not an iterator - --> $DIR/issue-28098.rs:25:14 + --> $DIR/issue-28098.rs:29:14 | LL | for _ in false {} | ^^^^^ `bool` is not an iterator | = help: the trait `Iterator` is not implemented for `bool` - = note: required because of the requirements on the impl of `IntoIterator` for `bool` + = note: required for `bool` to implement `IntoIterator` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:18:13 + --> $DIR/issue-28098.rs:20:13 | LL | let _ = Iterator::next(&mut ()); | ^^^^^^^^^^^^^^ `()` is not an iterator | = help: the trait `Iterator` is not implemented for `()` -error: aborting due to 8 previous errors +error: aborting due to 12 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/iterators/issue-58952-filter-type-length.rs b/src/test/ui/iterators/issue-58952-filter-type-length.rs index ffbe89a14..6d12db8d1 100644 --- a/src/test/ui/iterators/issue-58952-filter-type-length.rs +++ b/src/test/ui/iterators/issue-58952-filter-type-length.rs @@ -1,6 +1,6 @@ // run-pass //! This snippet causes the type length to blowup exponentially, -//! so check that we don't accidentially exceed the type length limit. +//! so check that we don't accidentally exceed the type length limit. // FIXME: Once the size of iterator adaptors is further reduced, // increase the complexity of this test. use std::collections::VecDeque; diff --git a/src/test/ui/iterators/ranges.stderr b/src/test/ui/iterators/ranges.stderr index 440a8960a..b9fbcd530 100644 --- a/src/test/ui/iterators/ranges.stderr +++ b/src/test/ui/iterators/ranges.stderr @@ -6,7 +6,7 @@ LL | for _ in ..10 {} | = help: the trait `Iterator` is not implemented for `RangeTo<{integer}>` = note: `..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a bounded `Range`: `0..end` - = note: required because of the requirements on the impl of `IntoIterator` for `RangeTo<{integer}>` + = note: required for `RangeTo<{integer}>` to implement `IntoIterator` error[E0277]: `RangeToInclusive<{integer}>` is not an iterator --> $DIR/ranges.rs:4:14 @@ -16,7 +16,7 @@ LL | for _ in ..=10 {} | = help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>` = note: `..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant to have a bounded `RangeInclusive`: `0..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `RangeToInclusive<{integer}>` + = note: required for `RangeToInclusive<{integer}>` to implement `IntoIterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/iterators/string.stderr b/src/test/ui/iterators/string.stderr index d9c40fe1b..ddfe0169b 100644 --- a/src/test/ui/iterators/string.stderr +++ b/src/test/ui/iterators/string.stderr @@ -5,7 +5,7 @@ LL | for _ in "".to_owned() {} | ^^^^^^^^^^^^^ `String` is not an iterator; try calling `.chars()` or `.bytes()` | = help: the trait `Iterator` is not implemented for `String` - = note: required because of the requirements on the impl of `IntoIterator` for `String` + = note: required for `String` to implement `IntoIterator` error[E0277]: `&str` is not an iterator --> $DIR/string.rs:4:14 @@ -14,7 +14,7 @@ LL | for _ in "" {} | ^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()` | = help: the trait `Iterator` is not implemented for `&str` - = note: required because of the requirements on the impl of `IntoIterator` for `&str` + = note: required for `&str` to implement `IntoIterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/json-and-color.rs b/src/test/ui/json-and-color.rs deleted file mode 100644 index 6f8326fe2..000000000 --- a/src/test/ui/json-and-color.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: --json=artifacts --error-format=json --color never - -fn main() {} diff --git a/src/test/ui/json-and-color.stderr b/src/test/ui/json-and-color.stderr deleted file mode 100644 index 1cda6af09..000000000 --- a/src/test/ui/json-and-color.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: cannot specify the `--color` option with `--json` - diff --git a/src/test/ui/json-and-error-format.rs b/src/test/ui/json-and-error-format.rs deleted file mode 100644 index 6e2d73c76..000000000 --- a/src/test/ui/json-and-error-format.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: --json=artifacts --error-format=short - -fn main() {} diff --git a/src/test/ui/json-and-error-format.stderr b/src/test/ui/json-and-error-format.stderr deleted file mode 100644 index 80e022137..000000000 --- a/src/test/ui/json-and-error-format.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: using `--json` requires also using `--error-format=json` - diff --git a/src/test/ui/json-bom-plus-crlf-multifile-aux.rs b/src/test/ui/json-bom-plus-crlf-multifile-aux.rs deleted file mode 100644 index 991ea1d85..000000000 --- a/src/test/ui/json-bom-plus-crlf-multifile-aux.rs +++ /dev/null @@ -1,27 +0,0 @@ -// (This line has BOM so it's ignored by compiletest for directives) -// -// ignore-test Not a test. Used by other tests -// ignore-tidy-cr - -// For easier verifying, the byte offsets in this file should match those -// in the json-bom-plus-crlf.rs - given the actual fn is identical (just with -// a different, but equally sized name), the easiest way to do this is to -// ensure the two files are of equal size on disk. -// Padding............................ - -// N.B., this file needs CRLF line endings. The .gitattributes file in -// this directory should enforce it. - -pub fn test() { - - let s : String = 1; // Error in the middle of line. - - let s : String = 1 - ; // Error before the newline. - - let s : String = -1; // Error after the newline. - - let s : String = ( - ); // Error spanning the newline. -} diff --git a/src/test/ui/json-bom-plus-crlf-multifile.rs b/src/test/ui/json-bom-plus-crlf-multifile.rs deleted file mode 100644 index 9290e0104..000000000 --- a/src/test/ui/json-bom-plus-crlf-multifile.rs +++ /dev/null @@ -1,11 +0,0 @@ -// (This line has BOM so it's ignored by compiletest for directives) -// -// compile-flags: --json=diagnostic-short --error-format=json -// ignore-tidy-cr - -#[path = "json-bom-plus-crlf-multifile-aux.rs"] -mod json_bom_plus_crlf_multifile_aux; - -fn main() { - json_bom_plus_crlf_multifile_aux::test(); -} diff --git a/src/test/ui/json-bom-plus-crlf-multifile.stderr b/src/test/ui/json-bom-plus-crlf-multifile.stderr deleted file mode 100644 index 02f3bc687..000000000 --- a/src/test/ui/json-bom-plus-crlf-multifile.stderr +++ /dev/null @@ -1,114 +0,0 @@ -{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. - -Erroneous code examples: - -```compile_fail,E0308 -fn plus_one(x: i32) -> i32 { - x + 1 -} - -plus_one(\"Not a number\"); -// ^^^^^^^^^^^^^^ expected `i32`, found `&str` - -if \"Not a bool\" { -// ^^^^^^^^^^^^ expected `bool`, found `&str` -} - -let x: f32 = \"Not a float\"; -// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` -// | -// expected due to this -``` - -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 -"} -{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. - -Erroneous code examples: - -```compile_fail,E0308 -fn plus_one(x: i32) -> i32 { - x + 1 -} - -plus_one(\"Not a number\"); -// ^^^^^^^^^^^^^^ expected `i32`, found `&str` - -if \"Not a bool\" { -// ^^^^^^^^^^^^ expected `bool`, found `&str` -} - -let x: f32 = \"Not a float\"; -// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` -// | -// expected due to this -``` - -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 -"} -{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. - -Erroneous code examples: - -```compile_fail,E0308 -fn plus_one(x: i32) -> i32 { - x + 1 -} - -plus_one(\"Not a number\"); -// ^^^^^^^^^^^^^^ expected `i32`, found `&str` - -if \"Not a bool\" { -// ^^^^^^^^^^^^ expected `bool`, found `&str` -} - -let x: f32 = \"Not a float\"; -// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` -// | -// expected due to this -``` - -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 -"} -{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. - -Erroneous code examples: - -```compile_fail,E0308 -fn plus_one(x: i32) -> i32 { - x + 1 -} - -plus_one(\"Not a number\"); -// ^^^^^^^^^^^^^^ expected `i32`, found `&str` - -if \"Not a bool\" { -// ^^^^^^^^^^^^ expected `bool`, found `&str` -} - -let x: f32 = \"Not a float\"; -// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` -// | -// expected due to this -``` - -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 -"} -{"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors -"} diff --git a/src/test/ui/json-bom-plus-crlf.rs b/src/test/ui/json-bom-plus-crlf.rs deleted file mode 100644 index be5b7dd2a..000000000 --- a/src/test/ui/json-bom-plus-crlf.rs +++ /dev/null @@ -1,26 +0,0 @@ -// (This line has BOM so it's ignored by compiletest for directives) -// -// compile-flags: --json=diagnostic-short --error-format=json -// ignore-tidy-cr - -// For easier verifying, the byte offsets in this file should match those -// in the json_bom_plus_crlf_multifile_aux.rs - given the actual fn is -// identical (just with a different, but equally sized name), the easiest way -// to do this is to ensure the two files are of equal size on disk. - -// N.B., this file needs CRLF line endings. The .gitattributes file in -// this directory should enforce it. - -fn main() { - - let s : String = 1; // Error in the middle of line. - - let s : String = 1 - ; // Error before the newline. - - let s : String = -1; // Error after the newline. - - let s : String = ( - ); // Error spanning the newline. -} diff --git a/src/test/ui/json-bom-plus-crlf.stderr b/src/test/ui/json-bom-plus-crlf.stderr deleted file mode 100644 index df6bd7286..000000000 --- a/src/test/ui/json-bom-plus-crlf.stderr +++ /dev/null @@ -1,114 +0,0 @@ -{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. - -Erroneous code examples: - -```compile_fail,E0308 -fn plus_one(x: i32) -> i32 { - x + 1 -} - -plus_one(\"Not a number\"); -// ^^^^^^^^^^^^^^ expected `i32`, found `&str` - -if \"Not a bool\" { -// ^^^^^^^^^^^^ expected `bool`, found `&str` -} - -let x: f32 = \"Not a float\"; -// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` -// | -// expected due to this -``` - -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 -"} -{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. - -Erroneous code examples: - -```compile_fail,E0308 -fn plus_one(x: i32) -> i32 { - x + 1 -} - -plus_one(\"Not a number\"); -// ^^^^^^^^^^^^^^ expected `i32`, found `&str` - -if \"Not a bool\" { -// ^^^^^^^^^^^^ expected `bool`, found `&str` -} - -let x: f32 = \"Not a float\"; -// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` -// | -// expected due to this -``` - -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 -"} -{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. - -Erroneous code examples: - -```compile_fail,E0308 -fn plus_one(x: i32) -> i32 { - x + 1 -} - -plus_one(\"Not a number\"); -// ^^^^^^^^^^^^^^ expected `i32`, found `&str` - -if \"Not a bool\" { -// ^^^^^^^^^^^^ expected `bool`, found `&str` -} - -let x: f32 = \"Not a float\"; -// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` -// | -// expected due to this -``` - -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 -"} -{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. - -Erroneous code examples: - -```compile_fail,E0308 -fn plus_one(x: i32) -> i32 { - x + 1 -} - -plus_one(\"Not a number\"); -// ^^^^^^^^^^^^^^ expected `i32`, found `&str` - -if \"Not a bool\" { -// ^^^^^^^^^^^^ expected `bool`, found `&str` -} - -let x: f32 = \"Not a float\"; -// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` -// | -// expected due to this -``` - -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 -"} -{"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors -"} diff --git a/src/test/ui/json-invalid.rs b/src/test/ui/json-invalid.rs deleted file mode 100644 index 54d0dd184..000000000 --- a/src/test/ui/json-invalid.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: --json=foo --error-format=json - -fn main() {} diff --git a/src/test/ui/json-invalid.stderr b/src/test/ui/json-invalid.stderr deleted file mode 100644 index 18bc76ab7..000000000 --- a/src/test/ui/json-invalid.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown `--json` option `foo` - diff --git a/src/test/ui/json-multiple.polonius.stderr b/src/test/ui/json-multiple.polonius.stderr deleted file mode 100644 index 0e4d442f2..000000000 --- a/src/test/ui/json-multiple.polonius.stderr +++ /dev/null @@ -1 +0,0 @@ -{"artifact":"$TEST_BUILD_DIR/json-multiple.polonius/libjson_multiple.rlib","emit":"link"} diff --git a/src/test/ui/json-multiple.rs b/src/test/ui/json-multiple.rs deleted file mode 100644 index fb126339d..000000000 --- a/src/test/ui/json-multiple.rs +++ /dev/null @@ -1,5 +0,0 @@ -// build-pass -// ignore-pass (different metadata emitted in different modes) -// compile-flags: --json=diagnostic-short --json artifacts --error-format=json - -#![crate_type = "lib"] diff --git a/src/test/ui/json-multiple.stderr b/src/test/ui/json-multiple.stderr deleted file mode 100644 index 7ed345113..000000000 --- a/src/test/ui/json-multiple.stderr +++ /dev/null @@ -1 +0,0 @@ -{"artifact":"$TEST_BUILD_DIR/json-multiple/libjson_multiple.rlib","emit":"link"} diff --git a/src/test/ui/json-options.polonius.stderr b/src/test/ui/json-options.polonius.stderr deleted file mode 100644 index e21f6f85d..000000000 --- a/src/test/ui/json-options.polonius.stderr +++ /dev/null @@ -1 +0,0 @@ -{"artifact":"$TEST_BUILD_DIR/json-options.polonius/libjson_options.rlib","emit":"link"} diff --git a/src/test/ui/json-options.rs b/src/test/ui/json-options.rs deleted file mode 100644 index 8b6ba131e..000000000 --- a/src/test/ui/json-options.rs +++ /dev/null @@ -1,5 +0,0 @@ -// build-pass -// ignore-pass (different metadata emitted in different modes) -// compile-flags: --json=diagnostic-short,artifacts --error-format=json - -#![crate_type = "lib"] diff --git a/src/test/ui/json-options.stderr b/src/test/ui/json-options.stderr deleted file mode 100644 index 24977731d..000000000 --- a/src/test/ui/json-options.stderr +++ /dev/null @@ -1 +0,0 @@ -{"artifact":"$TEST_BUILD_DIR/json-options/libjson_options.rlib","emit":"link"} diff --git a/src/test/ui/json-short.rs b/src/test/ui/json-short.rs deleted file mode 100644 index 7414a5586..000000000 --- a/src/test/ui/json-short.rs +++ /dev/null @@ -1 +0,0 @@ -// compile-flags: --json=diagnostic-short --error-format=json diff --git a/src/test/ui/json-short.stderr b/src/test/ui/json-short.stderr deleted file mode 100644 index 3bd85b083..000000000 --- a/src/test/ui/json-short.stderr +++ /dev/null @@ -1,19 +0,0 @@ -{"message":"`main` function not found in crate `json_short`","code":{"code":"E0601","explanation":"No `main` function was found in a binary crate. - -To fix this error, add a `main` function: - -``` -fn main() { - // Your program will start here. - println!(\"Hello world!\"); -} -``` - -If you don't know the basics of Rust, you can look at the -[Rust Book][rust-book] to get started. - -[rust-book]: https://doc.rust-lang.org/book/ -"},"level":"error","spans":[{"file_name":"$DIR/json-short.rs","byte_start":62,"byte_end":62,"line_start":1,"line_end":1,"column_start":63,"column_end":63,"is_primary":true,"text":[{"text":"// compile-flags: --json=diagnostic-short --error-format=json","highlight_start":63,"highlight_end":63}],"label":"consider adding a `main` function to `$DIR/json-short.rs`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-short.rs:1:63: error[E0601]: `main` function not found in crate `json_short` -"} -{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error -"} diff --git a/src/test/ui/json/json-and-color.rs b/src/test/ui/json/json-and-color.rs new file mode 100644 index 000000000..6f8326fe2 --- /dev/null +++ b/src/test/ui/json/json-and-color.rs @@ -0,0 +1,3 @@ +// compile-flags: --json=artifacts --error-format=json --color never + +fn main() {} diff --git a/src/test/ui/json/json-and-color.stderr b/src/test/ui/json/json-and-color.stderr new file mode 100644 index 000000000..1cda6af09 --- /dev/null +++ b/src/test/ui/json/json-and-color.stderr @@ -0,0 +1,2 @@ +error: cannot specify the `--color` option with `--json` + diff --git a/src/test/ui/json/json-and-error-format.rs b/src/test/ui/json/json-and-error-format.rs new file mode 100644 index 000000000..6e2d73c76 --- /dev/null +++ b/src/test/ui/json/json-and-error-format.rs @@ -0,0 +1,3 @@ +// compile-flags: --json=artifacts --error-format=short + +fn main() {} diff --git a/src/test/ui/json/json-and-error-format.stderr b/src/test/ui/json/json-and-error-format.stderr new file mode 100644 index 000000000..80e022137 --- /dev/null +++ b/src/test/ui/json/json-and-error-format.stderr @@ -0,0 +1,2 @@ +error: using `--json` requires also using `--error-format=json` + diff --git a/src/test/ui/json/json-bom-plus-crlf-multifile-aux.rs b/src/test/ui/json/json-bom-plus-crlf-multifile-aux.rs new file mode 100644 index 000000000..991ea1d85 --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf-multifile-aux.rs @@ -0,0 +1,27 @@ +// (This line has BOM so it's ignored by compiletest for directives) +// +// ignore-test Not a test. Used by other tests +// ignore-tidy-cr + +// For easier verifying, the byte offsets in this file should match those +// in the json-bom-plus-crlf.rs - given the actual fn is identical (just with +// a different, but equally sized name), the easiest way to do this is to +// ensure the two files are of equal size on disk. +// Padding............................ + +// N.B., this file needs CRLF line endings. The .gitattributes file in +// this directory should enforce it. + +pub fn test() { + + let s : String = 1; // Error in the middle of line. + + let s : String = 1 + ; // Error before the newline. + + let s : String = +1; // Error after the newline. + + let s : String = ( + ); // Error spanning the newline. +} diff --git a/src/test/ui/json/json-bom-plus-crlf-multifile.rs b/src/test/ui/json/json-bom-plus-crlf-multifile.rs new file mode 100644 index 000000000..9290e0104 --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf-multifile.rs @@ -0,0 +1,11 @@ +// (This line has BOM so it's ignored by compiletest for directives) +// +// compile-flags: --json=diagnostic-short --error-format=json +// ignore-tidy-cr + +#[path = "json-bom-plus-crlf-multifile-aux.rs"] +mod json_bom_plus_crlf_multifile_aux; + +fn main() { + json_bom_plus_crlf_multifile_aux::test(); +} diff --git a/src/test/ui/json/json-bom-plus-crlf-multifile.stderr b/src/test/ui/json/json-bom-plus-crlf-multifile.stderr new file mode 100644 index 000000000..02f3bc687 --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf-multifile.stderr @@ -0,0 +1,114 @@ +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +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 +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +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 +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +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 +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +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 +"} +{"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors +"} diff --git a/src/test/ui/json/json-bom-plus-crlf.rs b/src/test/ui/json/json-bom-plus-crlf.rs new file mode 100644 index 000000000..be5b7dd2a --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf.rs @@ -0,0 +1,26 @@ +// (This line has BOM so it's ignored by compiletest for directives) +// +// compile-flags: --json=diagnostic-short --error-format=json +// ignore-tidy-cr + +// For easier verifying, the byte offsets in this file should match those +// in the json_bom_plus_crlf_multifile_aux.rs - given the actual fn is +// identical (just with a different, but equally sized name), the easiest way +// to do this is to ensure the two files are of equal size on disk. + +// N.B., this file needs CRLF line endings. The .gitattributes file in +// this directory should enforce it. + +fn main() { + + let s : String = 1; // Error in the middle of line. + + let s : String = 1 + ; // Error before the newline. + + let s : String = +1; // Error after the newline. + + let s : String = ( + ); // Error spanning the newline. +} diff --git a/src/test/ui/json/json-bom-plus-crlf.stderr b/src/test/ui/json/json-bom-plus-crlf.stderr new file mode 100644 index 000000000..df6bd7286 --- /dev/null +++ b/src/test/ui/json/json-bom-plus-crlf.stderr @@ -0,0 +1,114 @@ +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +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 +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +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 +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +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 +"} +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +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 +"} +{"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors +"} diff --git a/src/test/ui/json/json-invalid.rs b/src/test/ui/json/json-invalid.rs new file mode 100644 index 000000000..54d0dd184 --- /dev/null +++ b/src/test/ui/json/json-invalid.rs @@ -0,0 +1,3 @@ +// compile-flags: --json=foo --error-format=json + +fn main() {} diff --git a/src/test/ui/json/json-invalid.stderr b/src/test/ui/json/json-invalid.stderr new file mode 100644 index 000000000..18bc76ab7 --- /dev/null +++ b/src/test/ui/json/json-invalid.stderr @@ -0,0 +1,2 @@ +error: unknown `--json` option `foo` + diff --git a/src/test/ui/json/json-multiple.polonius.stderr b/src/test/ui/json/json-multiple.polonius.stderr new file mode 100644 index 000000000..0e4d442f2 --- /dev/null +++ b/src/test/ui/json/json-multiple.polonius.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/json-multiple.polonius/libjson_multiple.rlib","emit":"link"} diff --git a/src/test/ui/json/json-multiple.rs b/src/test/ui/json/json-multiple.rs new file mode 100644 index 000000000..fb126339d --- /dev/null +++ b/src/test/ui/json/json-multiple.rs @@ -0,0 +1,5 @@ +// build-pass +// ignore-pass (different metadata emitted in different modes) +// compile-flags: --json=diagnostic-short --json artifacts --error-format=json + +#![crate_type = "lib"] diff --git a/src/test/ui/json/json-multiple.stderr b/src/test/ui/json/json-multiple.stderr new file mode 100644 index 000000000..55ccfd5fa --- /dev/null +++ b/src/test/ui/json/json-multiple.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/json/json-multiple/libjson_multiple.rlib","emit":"link"} diff --git a/src/test/ui/json/json-options.polonius.stderr b/src/test/ui/json/json-options.polonius.stderr new file mode 100644 index 000000000..e21f6f85d --- /dev/null +++ b/src/test/ui/json/json-options.polonius.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/json-options.polonius/libjson_options.rlib","emit":"link"} diff --git a/src/test/ui/json/json-options.rs b/src/test/ui/json/json-options.rs new file mode 100644 index 000000000..8b6ba131e --- /dev/null +++ b/src/test/ui/json/json-options.rs @@ -0,0 +1,5 @@ +// build-pass +// ignore-pass (different metadata emitted in different modes) +// compile-flags: --json=diagnostic-short,artifacts --error-format=json + +#![crate_type = "lib"] diff --git a/src/test/ui/json/json-options.stderr b/src/test/ui/json/json-options.stderr new file mode 100644 index 000000000..645a26f5a --- /dev/null +++ b/src/test/ui/json/json-options.stderr @@ -0,0 +1 @@ +{"artifact":"$TEST_BUILD_DIR/json/json-options/libjson_options.rlib","emit":"link"} diff --git a/src/test/ui/json/json-short.rs b/src/test/ui/json/json-short.rs new file mode 100644 index 000000000..7414a5586 --- /dev/null +++ b/src/test/ui/json/json-short.rs @@ -0,0 +1 @@ +// compile-flags: --json=diagnostic-short --error-format=json diff --git a/src/test/ui/json/json-short.stderr b/src/test/ui/json/json-short.stderr new file mode 100644 index 000000000..3bd85b083 --- /dev/null +++ b/src/test/ui/json/json-short.stderr @@ -0,0 +1,19 @@ +{"message":"`main` function not found in crate `json_short`","code":{"code":"E0601","explanation":"No `main` function was found in a binary crate. + +To fix this error, add a `main` function: + +``` +fn main() { + // Your program will start here. + println!(\"Hello world!\"); +} +``` + +If you don't know the basics of Rust, you can look at the +[Rust Book][rust-book] to get started. + +[rust-book]: https://doc.rust-lang.org/book/ +"},"level":"error","spans":[{"file_name":"$DIR/json-short.rs","byte_start":62,"byte_end":62,"line_start":1,"line_end":1,"column_start":63,"column_end":63,"is_primary":true,"text":[{"text":"// compile-flags: --json=diagnostic-short --error-format=json","highlight_start":63,"highlight_end":63}],"label":"consider adding a `main` function to `$DIR/json-short.rs`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-short.rs:1:63: error[E0601]: `main` function not found in crate `json_short` +"} +{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error +"} diff --git a/src/test/ui/kindck/kindck-impl-type-params-2.rs b/src/test/ui/kindck/kindck-impl-type-params-2.rs index 8b0771985..8950fc51e 100644 --- a/src/test/ui/kindck/kindck-impl-type-params-2.rs +++ b/src/test/ui/kindck/kindck-impl-type-params-2.rs @@ -11,5 +11,5 @@ fn take_param(foo: &T) { } fn main() { let x: Box<_> = Box::new(3); take_param(&x); - //~^ ERROR the trait bound `Box<{integer}>: Foo` is not satisfied + //~^ ERROR the trait bound `Box<{integer}>: Copy` is not satisfied } diff --git a/src/test/ui/kindck/kindck-impl-type-params-2.stderr b/src/test/ui/kindck/kindck-impl-type-params-2.stderr index 89975e968..930d96375 100644 --- a/src/test/ui/kindck/kindck-impl-type-params-2.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params-2.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied +error[E0277]: the trait bound `Box<{integer}>: Copy` is not satisfied --> $DIR/kindck-impl-type-params-2.rs:13:16 | LL | take_param(&x); @@ -6,7 +6,7 @@ LL | take_param(&x); | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Foo` for `Box<{integer}>` +note: required for `Box<{integer}>` to implement `Foo` --> $DIR/kindck-impl-type-params-2.rs:6:14 | LL | impl Foo for T { diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index 902349135..8dbe0c38c 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -4,7 +4,7 @@ error[E0277]: `T` cannot be sent between threads safely LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | -note: required because of the requirements on the impl of `Gettable` for `S` +note: required for `S` to implement `Gettable` --> $DIR/kindck-impl-type-params.rs:12:32 | LL | impl Gettable for S {} @@ -21,7 +21,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied LL | let a = &t as &dyn Gettable; | ^^ the trait `Copy` is not implemented for `T` | -note: required because of the requirements on the impl of `Gettable` for `S` +note: required for `S` to implement `Gettable` --> $DIR/kindck-impl-type-params.rs:12:32 | LL | impl Gettable for S {} @@ -38,7 +38,7 @@ error[E0277]: `T` cannot be sent between threads safely LL | let a: &dyn Gettable = &t; | ^^ `T` cannot be sent between threads safely | -note: required because of the requirements on the impl of `Gettable` for `S` +note: required for `S` to implement `Gettable` --> $DIR/kindck-impl-type-params.rs:12:32 | LL | impl Gettable for S {} @@ -55,7 +55,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied LL | let a: &dyn Gettable = &t; | ^^ the trait `Copy` is not implemented for `T` | -note: required because of the requirements on the impl of `Gettable` for `S` +note: required for `S` to implement `Gettable` --> $DIR/kindck-impl-type-params.rs:12:32 | LL | impl Gettable for S {} @@ -73,7 +73,7 @@ LL | let a = t as Box>; | ^ the trait `Copy` is not implemented for `String` | = help: the trait `Gettable` is implemented for `S` -note: required because of the requirements on the impl of `Gettable` for `S` +note: required for `S` to implement `Gettable` --> $DIR/kindck-impl-type-params.rs:12:32 | LL | impl Gettable for S {} @@ -87,7 +87,7 @@ LL | let a: Box> = t; | ^ the trait `Copy` is not implemented for `Foo` | = help: the trait `Gettable` is implemented for `S` -note: required because of the requirements on the impl of `Gettable` for `S` +note: required for `S` to implement `Gettable` --> $DIR/kindck-impl-type-params.rs:12:32 | LL | impl Gettable for S {} diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr index 016cd393c..e81d2441e 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied +error[E0277]: the trait bound `Box<{integer}>: Copy` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:21:16 | LL | take_param(&x); @@ -6,7 +6,7 @@ LL | take_param(&x); | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Foo` for `Box<{integer}>` +note: required for `Box<{integer}>` to implement `Foo` --> $DIR/kindck-inherited-copy-bound.rs:14:14 | LL | impl Foo for T { @@ -44,7 +44,7 @@ LL | trait Foo : Copy { | --- ^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Foo>` for `&Box<{integer}>` + = note: required for `&Box<{integer}>` to implement `CoerceUnsized<&dyn Foo>` = note: required by cast to type `&dyn Foo` error: aborting due to 3 previous errors diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr index eaf34dff4..2380533b9 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied +error[E0277]: the trait bound `Box<{integer}>: Copy` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:21:16 | LL | take_param(&x); @@ -6,7 +6,7 @@ LL | take_param(&x); | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Foo` for `Box<{integer}>` +note: required for `Box<{integer}>` to implement `Foo` --> $DIR/kindck-inherited-copy-bound.rs:14:14 | LL | impl Foo for T { @@ -30,7 +30,7 @@ LL | trait Foo : Copy { | --- ^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Foo>` for `&Box` + = note: required for `&Box` to implement `CoerceUnsized<&dyn Foo>` = note: required by cast to type `&dyn Foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/kindck/kindck-nonsendable-1.stderr b/src/test/ui/kindck/kindck-nonsendable-1.stderr index eab003a11..cc6e1f59c 100644 --- a/src/test/ui/kindck/kindck-nonsendable-1.stderr +++ b/src/test/ui/kindck/kindck-nonsendable-1.stderr @@ -1,10 +1,12 @@ error[E0277]: `Rc` cannot be sent between threads safely - --> $DIR/kindck-nonsendable-1.rs:9:5 + --> $DIR/kindck-nonsendable-1.rs:9:9 | LL | bar(move|| foo(x)); - | ^^^ ------ within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]` - | | - | `Rc` cannot be sent between threads safely + | --- ------^^^^^^^ + | | | + | | `Rc` cannot be sent between threads safely + | | within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]` + | required by a bound introduced by this call | = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]`, the trait `Send` is not implemented for `Rc` note: required because it's used within this closure diff --git a/src/test/ui/kindck/kindck-send-object.stderr b/src/test/ui/kindck/kindck-send-object.stderr index f14983a51..e9bbeeacd 100644 --- a/src/test/ui/kindck/kindck-send-object.stderr +++ b/src/test/ui/kindck/kindck-send-object.stderr @@ -1,11 +1,11 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely - --> $DIR/kindck-send-object.rs:12:5 + --> $DIR/kindck-send-object.rs:12:19 | LL | assert_send::<&'static (dyn Dummy + 'static)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` - = note: required because of the requirements on the impl of `Send` for `&'static (dyn Dummy + 'static)` + = note: required for `&'static (dyn Dummy + 'static)` to implement `Send` note: required by a bound in `assert_send` --> $DIR/kindck-send-object.rs:5:18 | @@ -13,13 +13,13 @@ LL | fn assert_send() { } | ^^^^ required by this bound in `assert_send` error[E0277]: `dyn Dummy` cannot be sent between threads safely - --> $DIR/kindck-send-object.rs:17:5 + --> $DIR/kindck-send-object.rs:17:19 | LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely + | ^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dyn Dummy` - = note: required because of the requirements on the impl of `Send` for `Unique` + = note: required for `Unique` to implement `Send` = note: required because it appears within the type `Box` note: required by a bound in `assert_send` --> $DIR/kindck-send-object.rs:5:18 diff --git a/src/test/ui/kindck/kindck-send-object1.stderr b/src/test/ui/kindck/kindck-send-object1.stderr index 1f5e21cbf..11f597fee 100644 --- a/src/test/ui/kindck/kindck-send-object1.stderr +++ b/src/test/ui/kindck/kindck-send-object1.stderr @@ -1,11 +1,11 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely - --> $DIR/kindck-send-object1.rs:10:5 + --> $DIR/kindck-send-object1.rs:10:19 | LL | assert_send::<&'a dyn Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely + | ^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)` - = note: required because of the requirements on the impl of `Send` for `&'a (dyn Dummy + 'a)` + = note: required for `&'a (dyn Dummy + 'a)` to implement `Send` note: required by a bound in `assert_send` --> $DIR/kindck-send-object1.rs:5:18 | @@ -13,13 +13,13 @@ LL | fn assert_send() { } | ^^^^ required by this bound in `assert_send` error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely - --> $DIR/kindck-send-object1.rs:28:5 + --> $DIR/kindck-send-object1.rs:28:19 | LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `(dyn Dummy + 'a)` - = note: required because of the requirements on the impl of `Send` for `Unique<(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 by a bound in `assert_send` --> $DIR/kindck-send-object1.rs:5:18 diff --git a/src/test/ui/kindck/kindck-send-object2.stderr b/src/test/ui/kindck/kindck-send-object2.stderr index 527127e95..b8af33d0d 100644 --- a/src/test/ui/kindck/kindck-send-object2.stderr +++ b/src/test/ui/kindck/kindck-send-object2.stderr @@ -1,11 +1,11 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely - --> $DIR/kindck-send-object2.rs:7:5 + --> $DIR/kindck-send-object2.rs:7:19 | LL | assert_send::<&'static dyn Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely + | ^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` - = note: required because of the requirements on the impl of `Send` for `&'static (dyn Dummy + 'static)` + = note: required for `&'static (dyn Dummy + 'static)` to implement `Send` note: required by a bound in `assert_send` --> $DIR/kindck-send-object2.rs:3:18 | @@ -13,13 +13,13 @@ LL | fn assert_send() { } | ^^^^ required by this bound in `assert_send` error[E0277]: `dyn Dummy` cannot be sent between threads safely - --> $DIR/kindck-send-object2.rs:12:5 + --> $DIR/kindck-send-object2.rs:12:19 | LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely + | ^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dyn Dummy` - = note: required because of the requirements on the impl of `Send` for `Unique` + = note: required for `Unique` to implement `Send` = note: required because it appears within the type `Box` note: required by a bound in `assert_send` --> $DIR/kindck-send-object2.rs:3:18 diff --git a/src/test/ui/kindck/kindck-send-owned.stderr b/src/test/ui/kindck/kindck-send-owned.stderr index 454291aa9..b03f56465 100644 --- a/src/test/ui/kindck/kindck-send-owned.stderr +++ b/src/test/ui/kindck/kindck-send-owned.stderr @@ -1,11 +1,11 @@ error[E0277]: `*mut u8` cannot be sent between threads safely - --> $DIR/kindck-send-owned.rs:12:5 + --> $DIR/kindck-send-owned.rs:12:19 | LL | assert_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely + | ^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `*mut u8` - = note: required because of the requirements on the impl of `Send` for `Unique<*mut u8>` + = note: required for `Unique<*mut u8>` to implement `Send` = note: required because it appears within the type `Box<*mut u8>` note: required by a bound in `assert_send` --> $DIR/kindck-send-owned.rs:3:18 diff --git a/src/test/ui/label/label_break_value_continue.rs b/src/test/ui/label/label_break_value_continue.rs index e0deb30c9..22172f4fd 100644 --- a/src/test/ui/label/label_break_value_continue.rs +++ b/src/test/ui/label/label_break_value_continue.rs @@ -1,4 +1,3 @@ -#![feature(label_break_value)] #![allow(unused_labels)] // Simple continue pointing to an unlabeled break should yield in an error diff --git a/src/test/ui/label/label_break_value_continue.stderr b/src/test/ui/label/label_break_value_continue.stderr index 9b8693dc5..284d213d6 100644 --- a/src/test/ui/label/label_break_value_continue.stderr +++ b/src/test/ui/label/label_break_value_continue.stderr @@ -1,11 +1,11 @@ error[E0695]: unlabeled `continue` inside of a labeled block - --> $DIR/label_break_value_continue.rs:7:9 + --> $DIR/label_break_value_continue.rs:6:9 | LL | continue; | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label error[E0696]: `continue` pointing to a labeled block - --> $DIR/label_break_value_continue.rs:14:9 + --> $DIR/label_break_value_continue.rs:13:9 | LL | / 'b: { LL | | continue 'b; @@ -14,7 +14,7 @@ LL | | } | |_____- labeled block the `continue` points to error[E0695]: unlabeled `continue` inside of a labeled block - --> $DIR/label_break_value_continue.rs:22:13 + --> $DIR/label_break_value_continue.rs:21:13 | LL | continue; | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label diff --git a/src/test/ui/label/label_break_value_desugared_break.rs b/src/test/ui/label/label_break_value_desugared_break.rs index de883b611..70227d869 100644 --- a/src/test/ui/label/label_break_value_desugared_break.rs +++ b/src/test/ui/label/label_break_value_desugared_break.rs @@ -1,5 +1,5 @@ // compile-flags: --edition 2018 -#![feature(label_break_value, try_blocks)] +#![feature(try_blocks)] // run-pass fn main() { @@ -9,4 +9,11 @@ fn main() { break 'foo; } }; + + 'foo: { + let _: Result<(), ()> = try { + Err(())?; + break 'foo; + }; + } } diff --git a/src/test/ui/label/label_break_value_illegal_uses.fixed b/src/test/ui/label/label_break_value_illegal_uses.fixed index c1d2023a2..fb75276b4 100644 --- a/src/test/ui/label/label_break_value_illegal_uses.fixed +++ b/src/test/ui/label/label_break_value_illegal_uses.fixed @@ -1,5 +1,4 @@ // run-rustfix -#![feature(label_break_value)] // These are forbidden occurrences of label-break-value diff --git a/src/test/ui/label/label_break_value_illegal_uses.rs b/src/test/ui/label/label_break_value_illegal_uses.rs index 5b20c95e5..3cbf41380 100644 --- a/src/test/ui/label/label_break_value_illegal_uses.rs +++ b/src/test/ui/label/label_break_value_illegal_uses.rs @@ -1,5 +1,4 @@ // run-rustfix -#![feature(label_break_value)] // These are forbidden occurrences of label-break-value diff --git a/src/test/ui/label/label_break_value_illegal_uses.stderr b/src/test/ui/label/label_break_value_illegal_uses.stderr index 24b733fec..15016ffd5 100644 --- a/src/test/ui/label/label_break_value_illegal_uses.stderr +++ b/src/test/ui/label/label_break_value_illegal_uses.stderr @@ -1,23 +1,23 @@ error: block label not supported here - --> $DIR/label_break_value_illegal_uses.rs:8:12 + --> $DIR/label_break_value_illegal_uses.rs:7:12 | LL | unsafe 'b: {} | ^^^ not supported here error: block label not supported here - --> $DIR/label_break_value_illegal_uses.rs:12:13 + --> $DIR/label_break_value_illegal_uses.rs:11:13 | LL | if true 'b: {} | ^^^ not supported here error: block label not supported here - --> $DIR/label_break_value_illegal_uses.rs:16:21 + --> $DIR/label_break_value_illegal_uses.rs:15:21 | LL | if true {} else 'b: {} | ^^^ not supported here error: block label not supported here - --> $DIR/label_break_value_illegal_uses.rs:20:17 + --> $DIR/label_break_value_illegal_uses.rs:19:17 | LL | match false 'b: { | ^^^ not supported here diff --git a/src/test/ui/label/label_break_value_unlabeled_break.rs b/src/test/ui/label/label_break_value_unlabeled_break.rs index fa0c70edc..2a4f5d574 100644 --- a/src/test/ui/label/label_break_value_unlabeled_break.rs +++ b/src/test/ui/label/label_break_value_unlabeled_break.rs @@ -1,4 +1,3 @@ -#![feature(label_break_value)] #![allow(unused_labels)] // Simple unlabeled break should yield in an error diff --git a/src/test/ui/label/label_break_value_unlabeled_break.stderr b/src/test/ui/label/label_break_value_unlabeled_break.stderr index 0c4f573d2..a2ccd27b8 100644 --- a/src/test/ui/label/label_break_value_unlabeled_break.stderr +++ b/src/test/ui/label/label_break_value_unlabeled_break.stderr @@ -1,11 +1,11 @@ error[E0695]: unlabeled `break` inside of a labeled block - --> $DIR/label_break_value_unlabeled_break.rs:7:9 + --> $DIR/label_break_value_unlabeled_break.rs:6:9 | LL | break; | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label error[E0695]: unlabeled `break` inside of a labeled block - --> $DIR/label_break_value_unlabeled_break.rs:15:13 + --> $DIR/label_break_value_unlabeled_break.rs:14:13 | LL | break; | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label diff --git a/src/test/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/src/test/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr index 6deb1f271..bfabe2d12 100644 --- a/src/test/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr +++ b/src/test/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr @@ -411,7 +411,7 @@ error: layout_of(NicheFirst) = Layout { valid_range: 0..=4, }, tag_encoding: Niche { - dataful_variant: 0, + untagged_variant: 0, niche_variants: 1..=2, niche_start: 3, }, @@ -555,7 +555,7 @@ error: layout_of(NicheSecond) = Layout { valid_range: 0..=4, }, tag_encoding: Niche { - dataful_variant: 0, + untagged_variant: 0, niche_variants: 1..=2, niche_start: 3, }, diff --git a/src/test/ui/layout/zero-sized-array-enum-niche.stderr b/src/test/ui/layout/zero-sized-array-enum-niche.stderr index 56d3a52bb..a3e82070e 100644 --- a/src/test/ui/layout/zero-sized-array-enum-niche.stderr +++ b/src/test/ui/layout/zero-sized-array-enum-niche.stderr @@ -353,7 +353,7 @@ error: layout_of(std::result::Result<[u32; 0], Packed>) = Layout { valid_range: 0..=1, }, tag_encoding: Niche { - dataful_variant: 1, + untagged_variant: 1, niche_variants: 0..=0, niche_start: 1, }, diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr index 6b87da0c0..33f82448d 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr @@ -1,8 +1,10 @@ error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_` - --> $DIR/branches.rs:19:28 + --> $DIR/branches.rs:19:9 | LL | std::iter::empty().collect() - | ^^^^^^^ value of type `Bar` cannot be built from `std::iter::Iterator` + | ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Bar` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<_>` is not implemented for `Bar` note: required by a bound in `collect` diff --git a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr index 42a1f782d..57978edf2 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr @@ -1,8 +1,10 @@ error[E0277]: a value of type `Foo` cannot be built from an iterator over elements of type `_` - --> $DIR/recursion4.rs:10:28 + --> $DIR/recursion4.rs:10:9 | LL | x = std::iter::empty().collect(); - | ^^^^^^^ value of type `Foo` cannot be built from `std::iter::Iterator` + | ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Foo` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<_>` is not implemented for `Foo` note: required by a bound in `collect` @@ -12,10 +14,12 @@ LL | fn collect>(self) -> B | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error[E0277]: a value of type `impl Debug` cannot be built from an iterator over elements of type `_` - --> $DIR/recursion4.rs:19:28 + --> $DIR/recursion4.rs:19:9 | LL | x = std::iter::empty().collect(); - | ^^^^^^^ value of type `impl Debug` cannot be built from `std::iter::Iterator` + | ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `impl Debug` cannot be built from `std::iter::Iterator` | = help: the trait `FromIterator<_>` is not implemented for `impl Debug` note: required by a bound in `collect` diff --git a/src/test/ui/let-else/const-fn.rs b/src/test/ui/let-else/const-fn.rs new file mode 100644 index 000000000..336b0b4b7 --- /dev/null +++ b/src/test/ui/let-else/const-fn.rs @@ -0,0 +1,19 @@ +// run-pass +// issue #101932 + +#![cfg_attr(bootstrap, feature(let_else))] + +const fn foo(a: Option) -> i32 { + let Some(a) = a else { + return 42 + }; + + a + 1 +} + +fn main() { + const A: i32 = foo(None); + const B: i32 = foo(Some(1)); + + println!("{} {}", A, B); +} diff --git a/src/test/ui/let-else/issue-100103.rs b/src/test/ui/let-else/issue-100103.rs new file mode 100644 index 000000000..f5f9b2f5f --- /dev/null +++ b/src/test/ui/let-else/issue-100103.rs @@ -0,0 +1,15 @@ +// edition:2021 +// check-pass + +#![feature(try_blocks)] + + +fn main() { + let _: Result = try { + let Some(x) = Some(0) else { + Err(1)? + }; + + x + }; +} diff --git a/src/test/ui/let-else/issue-102317.rs b/src/test/ui/let-else/issue-102317.rs new file mode 100644 index 000000000..7369b4938 --- /dev/null +++ b/src/test/ui/let-else/issue-102317.rs @@ -0,0 +1,20 @@ +// issue #102317 +// build-pass +// compile-flags: --edition 2021 -C opt-level=3 -Zvalidate-mir + +struct SegmentJob; + +impl Drop for SegmentJob { + fn drop(&mut self) {} +} + +pub async fn run() -> Result<(), ()> { + let jobs = Vec::::new(); + let Some(_job) = jobs.into_iter().next() else { + return Ok(()) + }; + + Ok(()) +} + +fn main() {} diff --git a/src/test/ui/let-else/issue-94176.rs b/src/test/ui/let-else/issue-94176.rs new file mode 100644 index 000000000..f76dfc15b --- /dev/null +++ b/src/test/ui/let-else/issue-94176.rs @@ -0,0 +1,10 @@ +// Issue #94176: wrong span for the error message of a mismatched type error, +// if the function uses a `let else` construct. + + +pub fn test(a: Option) -> Option { //~ ERROR mismatched types + let Some(_) = a else { return None; }; + println!("Foo"); +} + +fn main() {} diff --git a/src/test/ui/let-else/issue-94176.stderr b/src/test/ui/let-else/issue-94176.stderr new file mode 100644 index 000000000..0cb97acee --- /dev/null +++ b/src/test/ui/let-else/issue-94176.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/issue-94176.rs:5:32 + | +LL | pub fn test(a: Option) -> Option { + | ---- ^^^^^^^^^^^ expected enum `Option`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + | + = note: expected enum `Option` + found unit type `()` +help: consider returning the local binding `a` + | +LL ~ println!("Foo"); +LL + a + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/let-else/issue-99975.rs b/src/test/ui/let-else/issue-99975.rs new file mode 100644 index 000000000..5b164f347 --- /dev/null +++ b/src/test/ui/let-else/issue-99975.rs @@ -0,0 +1,20 @@ +// run-pass +// compile-flags: -C opt-level=3 -Zvalidate-mir + + + +fn return_result() -> Option { + Some("ok".to_string()) +} + +fn start() -> String { + let Some(content) = return_result() else { + return "none".to_string() + }; + + content +} + +fn main() { + start(); +} diff --git a/src/test/ui/let-else/let-else-allow-in-expr.rs b/src/test/ui/let-else/let-else-allow-in-expr.rs index 39f4c9060..33acb6c6a 100644 --- a/src/test/ui/let-else/let-else-allow-in-expr.rs +++ b/src/test/ui/let-else/let-else-allow-in-expr.rs @@ -1,5 +1,3 @@ -#![feature(let_else)] - #![deny(unused_variables)] fn main() { diff --git a/src/test/ui/let-else/let-else-allow-in-expr.stderr b/src/test/ui/let-else/let-else-allow-in-expr.stderr index e86bcbc85..3b2b9066c 100644 --- a/src/test/ui/let-else/let-else-allow-in-expr.stderr +++ b/src/test/ui/let-else/let-else-allow-in-expr.stderr @@ -1,17 +1,17 @@ error: unused variable: `x` - --> $DIR/let-else-allow-in-expr.rs:7:13 + --> $DIR/let-else-allow-in-expr.rs:5:13 | LL | let x = 1; | ^ help: if this is intentional, prefix it with an underscore: `_x` | note: the lint level is defined here - --> $DIR/let-else-allow-in-expr.rs:3:9 + --> $DIR/let-else-allow-in-expr.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ error: unused variable: `x` - --> $DIR/let-else-allow-in-expr.rs:29:9 + --> $DIR/let-else-allow-in-expr.rs:27:9 | LL | let x = 1; | ^ help: if this is intentional, prefix it with an underscore: `_x` diff --git a/src/test/ui/let-else/let-else-allow-unused.rs b/src/test/ui/let-else/let-else-allow-unused.rs index 86ebacfa7..bbb1c7bea 100644 --- a/src/test/ui/let-else/let-else-allow-unused.rs +++ b/src/test/ui/let-else/let-else-allow-unused.rs @@ -1,6 +1,6 @@ // issue #89807 -#![feature(let_else)] + #[deny(unused_variables)] diff --git a/src/test/ui/let-else/let-else-binding-explicit-mut-annotated.rs b/src/test/ui/let-else/let-else-binding-explicit-mut-annotated.rs index b65fa13c1..955f33ee1 100644 --- a/src/test/ui/let-else/let-else-binding-explicit-mut-annotated.rs +++ b/src/test/ui/let-else/let-else-binding-explicit-mut-annotated.rs @@ -1,6 +1,6 @@ // from rfc2005 test suite -#![feature(let_else)] + // Verify the binding mode shifts - only when no `&` are auto-dereferenced is the // final default binding mode mutable. diff --git a/src/test/ui/let-else/let-else-binding-explicit-mut-borrow.rs b/src/test/ui/let-else/let-else-binding-explicit-mut-borrow.rs index 63b35df76..1524d0102 100644 --- a/src/test/ui/let-else/let-else-binding-explicit-mut-borrow.rs +++ b/src/test/ui/let-else/let-else-binding-explicit-mut-borrow.rs @@ -1,8 +1,8 @@ -#![feature(let_else)] - // Slightly different from explicit-mut-annotated -- this won't show an error until borrowck. // Should it show a type error instead? + + fn main() { let Some(n): &mut Option = &mut &Some(5i32) else { //~^ ERROR cannot borrow data in a `&` reference as mutable diff --git a/src/test/ui/let-else/let-else-binding-explicit-mut-pass.rs b/src/test/ui/let-else/let-else-binding-explicit-mut-pass.rs index 305be9221..b0a6264a1 100644 --- a/src/test/ui/let-else/let-else-binding-explicit-mut-pass.rs +++ b/src/test/ui/let-else/let-else-binding-explicit-mut-pass.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(let_else)] + fn main() { let Some(n) = &mut &mut Some(5i32) else { return; }; diff --git a/src/test/ui/let-else/let-else-binding-explicit-mut.rs b/src/test/ui/let-else/let-else-binding-explicit-mut.rs index dbe4715b1..a153b3af0 100644 --- a/src/test/ui/let-else/let-else-binding-explicit-mut.rs +++ b/src/test/ui/let-else/let-else-binding-explicit-mut.rs @@ -1,6 +1,6 @@ // from rfc2005 test suite -#![feature(let_else)] + // Verify the binding mode shifts - only when no `&` are auto-dereferenced is the // final default binding mode mutable. diff --git a/src/test/ui/let-else/let-else-binding-immutable.rs b/src/test/ui/let-else/let-else-binding-immutable.rs index 96de0ffe2..ff2d9f240 100644 --- a/src/test/ui/let-else/let-else-binding-immutable.rs +++ b/src/test/ui/let-else/let-else-binding-immutable.rs @@ -1,6 +1,6 @@ // from rfc2005 test suite -#![feature(let_else)] + pub fn main() { let Some(x) = &Some(3) else { diff --git a/src/test/ui/let-else/let-else-bindings.rs b/src/test/ui/let-else/let-else-bindings.rs index d5121e744..7d2cad978 100644 --- a/src/test/ui/let-else/let-else-bindings.rs +++ b/src/test/ui/let-else/let-else-bindings.rs @@ -1,6 +1,6 @@ // run-pass // adapted from src/test/ui/binding/if-let.rs -#![feature(let_else)] + #![allow(dead_code)] fn none() -> bool { diff --git a/src/test/ui/let-else/let-else-bool-binop-init.fixed b/src/test/ui/let-else/let-else-bool-binop-init.fixed index e47f7f23d..20e558ca9 100644 --- a/src/test/ui/let-else/let-else-bool-binop-init.fixed +++ b/src/test/ui/let-else/let-else-bool-binop-init.fixed @@ -1,6 +1,6 @@ // run-rustfix -#![feature(let_else)] + fn main() { let true = (true && false) else { return }; //~ ERROR a `&&` expression cannot be directly assigned in `let...else` diff --git a/src/test/ui/let-else/let-else-bool-binop-init.rs b/src/test/ui/let-else/let-else-bool-binop-init.rs index e443fb0d6..f88179a94 100644 --- a/src/test/ui/let-else/let-else-bool-binop-init.rs +++ b/src/test/ui/let-else/let-else-bool-binop-init.rs @@ -1,6 +1,6 @@ // run-rustfix -#![feature(let_else)] + fn main() { let true = true && false else { return }; //~ ERROR a `&&` expression cannot be directly assigned in `let...else` diff --git a/src/test/ui/let-else/let-else-brace-before-else.fixed b/src/test/ui/let-else/let-else-brace-before-else.fixed index fb4fd7779..a75c770dd 100644 --- a/src/test/ui/let-else/let-else-brace-before-else.fixed +++ b/src/test/ui/let-else/let-else-brace-before-else.fixed @@ -1,6 +1,6 @@ // run-rustfix -#![feature(let_else)] + fn main() { let Some(1) = ({ Some(1) }) else { diff --git a/src/test/ui/let-else/let-else-brace-before-else.rs b/src/test/ui/let-else/let-else-brace-before-else.rs index c4c5a1ca2..5603b946f 100644 --- a/src/test/ui/let-else/let-else-brace-before-else.rs +++ b/src/test/ui/let-else/let-else-brace-before-else.rs @@ -1,6 +1,6 @@ // run-rustfix -#![feature(let_else)] + fn main() { let Some(1) = { Some(1) } else { diff --git a/src/test/ui/let-else/let-else-check.rs b/src/test/ui/let-else/let-else-check.rs index 9e32cbef7..713fd986e 100644 --- a/src/test/ui/let-else/let-else-check.rs +++ b/src/test/ui/let-else/let-else-check.rs @@ -1,5 +1,3 @@ -#![feature(let_else)] - #![deny(unused_variables)] fn main() { diff --git a/src/test/ui/let-else/let-else-check.stderr b/src/test/ui/let-else/let-else-check.stderr index 3d647a4c0..bdecbf708 100644 --- a/src/test/ui/let-else/let-else-check.stderr +++ b/src/test/ui/let-else/let-else-check.stderr @@ -1,17 +1,17 @@ error: unused variable: `x` - --> $DIR/let-else-check.rs:14:13 + --> $DIR/let-else-check.rs:12:13 | LL | let x = 1; | ^ help: if this is intentional, prefix it with an underscore: `_x` | note: the lint level is defined here - --> $DIR/let-else-check.rs:3:9 + --> $DIR/let-else-check.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ error: unused variable: `x` - --> $DIR/let-else-check.rs:18:9 + --> $DIR/let-else-check.rs:16:9 | LL | let x = 1; | ^ help: if this is intentional, prefix it with an underscore: `_x` diff --git a/src/test/ui/let-else/let-else-deref-coercion-annotated.rs b/src/test/ui/let-else/let-else-deref-coercion-annotated.rs index 65d88a6d8..60fdf825a 100644 --- a/src/test/ui/let-else/let-else-deref-coercion-annotated.rs +++ b/src/test/ui/let-else/let-else-deref-coercion-annotated.rs @@ -6,7 +6,7 @@ // Deref/DerefMut to Bar. You can do this with an irrefutable binding, so it should work with // let-else too. -#![feature(let_else)] + use std::ops::{Deref, DerefMut}; struct Foo(Bar); diff --git a/src/test/ui/let-else/let-else-deref-coercion.rs b/src/test/ui/let-else/let-else-deref-coercion.rs index 87489d84b..052a5a8c7 100644 --- a/src/test/ui/let-else/let-else-deref-coercion.rs +++ b/src/test/ui/let-else/let-else-deref-coercion.rs @@ -3,7 +3,7 @@ // We attempt to `let Bar::Present(_) = foo else { ... }` where foo is meant to Deref/DerefMut to // Bar. This fails, you must add a type annotation like `let _: &mut Bar = _ else { ... }` -#![feature(let_else)] + use std::ops::{Deref, DerefMut}; struct Foo(Bar); diff --git a/src/test/ui/let-else/let-else-destructuring.rs b/src/test/ui/let-else/let-else-destructuring.rs index 9a09c414a..d1f1a69bf 100644 --- a/src/test/ui/let-else/let-else-destructuring.rs +++ b/src/test/ui/let-else/let-else-destructuring.rs @@ -1,4 +1,3 @@ -#![feature(let_else)] #[derive(Debug)] enum Foo { Done, diff --git a/src/test/ui/let-else/let-else-destructuring.stderr b/src/test/ui/let-else/let-else-destructuring.stderr index 95efb7116..7d6cb2386 100644 --- a/src/test/ui/let-else/let-else-destructuring.stderr +++ b/src/test/ui/let-else/let-else-destructuring.stderr @@ -1,11 +1,11 @@ error: ... else { ... } is not allowed - --> $DIR/let-else-destructuring.rs:11:9 + --> $DIR/let-else-destructuring.rs:10:9 | LL | &Foo::Nested(Some(value)) = value else { break }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0070]: invalid left-hand side of assignment - --> $DIR/let-else-destructuring.rs:11:35 + --> $DIR/let-else-destructuring.rs:10:35 | LL | &Foo::Nested(Some(value)) = value else { break }; | ------------------------- ^ diff --git a/src/test/ui/let-else/let-else-drop-order.rs b/src/test/ui/let-else/let-else-drop-order.rs new file mode 100644 index 000000000..e91e5de84 --- /dev/null +++ b/src/test/ui/let-else/let-else-drop-order.rs @@ -0,0 +1,270 @@ +// run-pass +// edition:2021 +// check-run-results +// +// Drop order tests for let else +// +// Mostly this ensures two things: +// 1. That let and let else temporary drop order is the same. +// This is a specific design request: https://github.com/rust-lang/rust/pull/93628#issuecomment-1047140316 +// 2. That the else block truly only runs after the +// temporaries have dropped. +// +// We also print some nice tables for an overview by humans. +// Changes in those tables are considered breakages, but the +// important properties 1 and 2 are also enforced by the code. +// This is important as it's easy to update the stdout file +// with a --bless and miss the impact of that change. + + +#![allow(irrefutable_let_patterns)] + +use std::cell::RefCell; +use std::rc::Rc; + +#[derive(Clone)] +struct DropAccountant(Rc>>>); + +impl DropAccountant { + fn new() -> Self { + Self(Default::default()) + } + fn build_droppy(&self, v: u32) -> Droppy { + Droppy(self.clone(), v) + } + fn build_droppy_enum_none(&self, _v: u32) -> ((), DroppyEnum) { + ((), DroppyEnum::None(self.clone())) + } + fn new_list(&self, s: impl ToString) { + self.0.borrow_mut().push(vec![s.to_string()]); + } + fn push(&self, s: impl ToString) { + let s = s.to_string(); + let mut accounts = self.0.borrow_mut(); + accounts.last_mut().unwrap().push(s); + } + fn print_table(&self) { + println!(); + + let accounts = self.0.borrow(); + let before_last = &accounts[accounts.len() - 2]; + let last = &accounts[accounts.len() - 1]; + let before_last = get_comma_list(before_last); + let last = get_comma_list(last); + const LINES: &[&str] = &[ + "vanilla", + "&", + "&mut", + "move", + "fn(this)", + "tuple", + "array", + "ref &", + "ref mut &mut", + ]; + let max_len = LINES.iter().map(|v| v.len()).max().unwrap(); + let max_len_before = before_last.iter().map(|v| v.len()).max().unwrap(); + let max_len_last = last.iter().map(|v| v.len()).max().unwrap(); + + println!( + "| {: Vec { + std::iter::once(sl[0].clone()) + .chain(sl[1..].chunks(2).map(|c| c.join(","))) + .collect::>() +} + +struct Droppy(DropAccountant, T); + +impl Drop for Droppy { + fn drop(&mut self) { + self.0.push("drop"); + } +} + +#[allow(dead_code)] +enum DroppyEnum { + Some(DropAccountant, T), + None(DropAccountant), +} + +impl Drop for DroppyEnum { + fn drop(&mut self) { + match self { + DroppyEnum::Some(acc, _inner) => acc, + DroppyEnum::None(acc) => acc, + } + .push("drop"); + } +} + +macro_rules! nestings_with { + ($construct:ident, $binding:pat, $exp:expr) => { + // vanilla: + $construct!($binding, $exp.1); + + // &: + $construct!(&$binding, &$exp.1); + + // &mut: + $construct!(&mut $binding, &mut ($exp.1)); + + { + // move: + let w = $exp; + $construct!( + $binding, + { + let w = w; + w + } + .1 + ); + } + + // fn(this): + $construct!($binding, std::convert::identity($exp).1); + }; +} + +macro_rules! nestings { + ($construct:ident, $binding:pat, $exp:expr) => { + nestings_with!($construct, $binding, $exp); + + // tuple: + $construct!(($binding, 77), ($exp.1, 77)); + + // array: + $construct!([$binding], [$exp.1]); + }; +} + +macro_rules! let_else { + ($acc:expr, $v:expr, $binding:pat, $build:ident) => { + let acc = $acc; + let v = $v; + + macro_rules! let_else_construct { + ($arg:pat, $exp:expr) => { + loop { + let $arg = $exp else { + acc.push("else"); + break; + }; + acc.push("body"); + break; + } + }; + } + nestings!(let_else_construct, $binding, acc.$build(v)); + // ref &: + let_else_construct!($binding, &acc.$build(v).1); + + // ref mut &mut: + let_else_construct!($binding, &mut acc.$build(v).1); + }; +} + +macro_rules! let_ { + ($acc:expr, $binding:tt) => { + let acc = $acc; + + macro_rules! let_construct { + ($arg:pat, $exp:expr) => {{ + let $arg = $exp; + acc.push("body"); + }}; + } + let v = 0; + { + nestings_with!(let_construct, $binding, acc.build_droppy(v)); + } + acc.push("n/a"); + acc.push("n/a"); + acc.push("n/a"); + acc.push("n/a"); + + // ref &: + let_construct!($binding, &acc.build_droppy(v).1); + + // ref mut &mut: + let_construct!($binding, &mut acc.build_droppy(v).1); + }; +} + +fn main() { + let acc = DropAccountant::new(); + + println!(" --- matching cases ---"); + + // Ensure that let and let else have the same behaviour + acc.new_list("let _"); + let_!(&acc, _); + acc.new_list("let else _"); + let_else!(&acc, 0, _, build_droppy); + acc.assert_equality_last_two_lists(); + acc.print_table(); + + // Ensure that let and let else have the same behaviour + acc.new_list("let _v"); + let_!(&acc, _v); + acc.new_list("let else _v"); + let_else!(&acc, 0, _v, build_droppy); + acc.assert_equality_last_two_lists(); + acc.print_table(); + + println!(); + + println!(" --- mismatching cases ---"); + + acc.new_list("let else _ mismatch"); + let_else!(&acc, 1, DroppyEnum::Some(_, _), build_droppy_enum_none); + acc.new_list("let else _v mismatch"); + let_else!(&acc, 1, DroppyEnum::Some(_, _v), build_droppy_enum_none); + acc.print_table(); + // This ensures that we always drop before visiting the else case + acc.assert_all_equal_to("drop,else"); + + acc.new_list("let else 0 mismatch"); + let_else!(&acc, 1, 0, build_droppy); + acc.new_list("let else 0 mismatch"); + let_else!(&acc, 1, 0, build_droppy); + acc.print_table(); + // This ensures that we always drop before visiting the else case + acc.assert_all_equal_to("drop,else"); +} diff --git a/src/test/ui/let-else/let-else-drop-order.run.stdout b/src/test/ui/let-else/let-else-drop-order.run.stdout new file mode 100644 index 000000000..01cf2f73e --- /dev/null +++ b/src/test/ui/let-else/let-else-drop-order.run.stdout @@ -0,0 +1,51 @@ + --- matching cases --- + +| construct | let _ | let else _ | +| ------------ | --------- | ---------- | +| vanilla | drop,body | drop,body | +| & | body,drop | body,drop | +| &mut | body,drop | body,drop | +| move | drop,body | drop,body | +| fn(this) | drop,body | drop,body | +| tuple | n/a,n/a | drop,body | +| array | n/a,n/a | drop,body | +| ref & | body,drop | body,drop | +| ref mut &mut | body,drop | body,drop | + +| construct | let _v | let else _v | +| ------------ | --------- | ----------- | +| vanilla | drop,body | drop,body | +| & | body,drop | body,drop | +| &mut | body,drop | body,drop | +| move | drop,body | drop,body | +| fn(this) | drop,body | drop,body | +| tuple | n/a,n/a | drop,body | +| array | n/a,n/a | drop,body | +| ref & | body,drop | body,drop | +| ref mut &mut | body,drop | body,drop | + + --- mismatching cases --- + +| construct | let else _ mismatch | let else _v mismatch | +| ------------ | ------------------- | -------------------- | +| vanilla | drop,else | drop,else | +| & | drop,else | drop,else | +| &mut | drop,else | drop,else | +| move | drop,else | drop,else | +| fn(this) | drop,else | drop,else | +| tuple | drop,else | drop,else | +| array | drop,else | drop,else | +| ref & | drop,else | drop,else | +| ref mut &mut | drop,else | drop,else | + +| construct | let else 0 mismatch | let else 0 mismatch | +| ------------ | ------------------- | ------------------- | +| vanilla | drop,else | drop,else | +| & | drop,else | drop,else | +| &mut | drop,else | drop,else | +| move | drop,else | drop,else | +| fn(this) | drop,else | drop,else | +| tuple | drop,else | drop,else | +| array | drop,else | drop,else | +| ref & | drop,else | drop,else | +| ref mut &mut | drop,else | drop,else | diff --git a/src/test/ui/let-else/let-else-if.rs b/src/test/ui/let-else/let-else-if.rs index c3a17330d..e8c54ca7a 100644 --- a/src/test/ui/let-else/let-else-if.rs +++ b/src/test/ui/let-else/let-else-if.rs @@ -1,5 +1,3 @@ -#![feature(let_else)] - fn main() { let Some(_) = Some(()) else if true { //~^ ERROR conditional `else if` is not supported for `let...else` diff --git a/src/test/ui/let-else/let-else-if.stderr b/src/test/ui/let-else/let-else-if.stderr index 746738bbd..c63fd61c5 100644 --- a/src/test/ui/let-else/let-else-if.stderr +++ b/src/test/ui/let-else/let-else-if.stderr @@ -1,5 +1,5 @@ error: conditional `else if` is not supported for `let...else` - --> $DIR/let-else-if.rs:4:33 + --> $DIR/let-else-if.rs:2:33 | LL | let Some(_) = Some(()) else if true { | ^^ expected `{` diff --git a/src/test/ui/let-else/let-else-irrefutable.rs b/src/test/ui/let-else/let-else-irrefutable.rs index b1e09a124..1cb68ecb8 100644 --- a/src/test/ui/let-else/let-else-irrefutable.rs +++ b/src/test/ui/let-else/let-else-irrefutable.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(let_else)] + fn main() { let x = 1 else { return }; //~ WARN irrefutable `let...else` pattern diff --git a/src/test/ui/let-else/let-else-missing-semicolon.rs b/src/test/ui/let-else/let-else-missing-semicolon.rs index ed9d79f1e..d87ac90c1 100644 --- a/src/test/ui/let-else/let-else-missing-semicolon.rs +++ b/src/test/ui/let-else/let-else-missing-semicolon.rs @@ -1,5 +1,3 @@ -#![feature(let_else)] - fn main() { let Some(x) = Some(1) else { return; diff --git a/src/test/ui/let-else/let-else-missing-semicolon.stderr b/src/test/ui/let-else/let-else-missing-semicolon.stderr index 1818a0b12..99029ff33 100644 --- a/src/test/ui/let-else/let-else-missing-semicolon.stderr +++ b/src/test/ui/let-else/let-else-missing-semicolon.stderr @@ -1,5 +1,5 @@ error: expected `;`, found keyword `let` - --> $DIR/let-else-missing-semicolon.rs:6:6 + --> $DIR/let-else-missing-semicolon.rs:4:6 | LL | } | ^ help: add `;` here @@ -7,7 +7,7 @@ LL | let _ = ""; | --- unexpected token error: expected `;`, found `}` - --> $DIR/let-else-missing-semicolon.rs:10:6 + --> $DIR/let-else-missing-semicolon.rs:8:6 | LL | } | ^ help: add `;` here diff --git a/src/test/ui/let-else/let-else-no-double-error.rs b/src/test/ui/let-else/let-else-no-double-error.rs index 35dcdd3f6..91fcc5d7e 100644 --- a/src/test/ui/let-else/let-else-no-double-error.rs +++ b/src/test/ui/let-else/let-else-no-double-error.rs @@ -1,6 +1,6 @@ // from rfc2005 test suite -#![feature(let_else)] + // Without caching type lookups in FnCtxt.resolve_ty_and_def_ufcs // the error below would be reported twice (once when checking diff --git a/src/test/ui/let-else/let-else-non-copy.rs b/src/test/ui/let-else/let-else-non-copy.rs index 79ed82dd1..08c07dd1a 100644 --- a/src/test/ui/let-else/let-else-non-copy.rs +++ b/src/test/ui/let-else/let-else-non-copy.rs @@ -10,7 +10,7 @@ // // The move was due to mir::Place being Copy, but mir::VarDebugInfoContents not being Copy. -#![feature(let_else)] + #[derive(Copy, Clone)] struct Copyable; diff --git a/src/test/ui/let-else/let-else-non-diverging.rs b/src/test/ui/let-else/let-else-non-diverging.rs index a1cee335a..b5bd91ceb 100644 --- a/src/test/ui/let-else/let-else-non-diverging.rs +++ b/src/test/ui/let-else/let-else-non-diverging.rs @@ -1,5 +1,3 @@ -#![feature(let_else)] - fn main() { let Some(x) = Some(1) else { //~ ERROR does not diverge Some(2) diff --git a/src/test/ui/let-else/let-else-non-diverging.stderr b/src/test/ui/let-else/let-else-non-diverging.stderr index 05e45f689..c999a5495 100644 --- a/src/test/ui/let-else/let-else-non-diverging.stderr +++ b/src/test/ui/let-else/let-else-non-diverging.stderr @@ -1,5 +1,5 @@ error[E0308]: `else` clause of `let...else` does not diverge - --> $DIR/let-else-non-diverging.rs:4:32 + --> $DIR/let-else-non-diverging.rs:2:32 | LL | let Some(x) = Some(1) else { | ________________________________^ @@ -13,7 +13,7 @@ LL | | }; = help: ...or use `match` instead of `let...else` error[E0308]: `else` clause of `let...else` does not diverge - --> $DIR/let-else-non-diverging.rs:7:32 + --> $DIR/let-else-non-diverging.rs:5:32 | LL | let Some(x) = Some(1) else { | ________________________________^ @@ -29,7 +29,7 @@ LL | | }; = help: ...or use `match` instead of `let...else` error[E0308]: `else` clause of `let...else` does not diverge - --> $DIR/let-else-non-diverging.rs:12:32 + --> $DIR/let-else-non-diverging.rs:10:32 | LL | let Some(x) = Some(1) else { Some(2) }; | ^^^^^^^^^^^ expected `!`, found enum `Option` diff --git a/src/test/ui/let-else/let-else-ref-bindings-pass.rs b/src/test/ui/let-else/let-else-ref-bindings-pass.rs index f4abd6cc2..62fc65731 100644 --- a/src/test/ui/let-else/let-else-ref-bindings-pass.rs +++ b/src/test/ui/let-else/let-else-ref-bindings-pass.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(let_else)] + #![allow(unused_variables)] fn ref_() { diff --git a/src/test/ui/let-else/let-else-ref-bindings.rs b/src/test/ui/let-else/let-else-ref-bindings.rs index a4cd8e8c4..687e235d4 100644 --- a/src/test/ui/let-else/let-else-ref-bindings.rs +++ b/src/test/ui/let-else/let-else-ref-bindings.rs @@ -1,6 +1,6 @@ -#![feature(let_else)] #![allow(unused_variables)] + fn ref_() { let bytes: Vec = b"Hello"[..].to_vec(); let some = Some(bytes); diff --git a/src/test/ui/let-else/let-else-run-pass.rs b/src/test/ui/let-else/let-else-run-pass.rs index 5d9662323..a0fb6c683 100644 --- a/src/test/ui/let-else/let-else-run-pass.rs +++ b/src/test/ui/let-else/let-else-run-pass.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(let_else)] + fn main() { #[allow(dead_code)] diff --git a/src/test/ui/let-else/let-else-scope.rs b/src/test/ui/let-else/let-else-scope.rs index f17682db4..78a67769e 100644 --- a/src/test/ui/let-else/let-else-scope.rs +++ b/src/test/ui/let-else/let-else-scope.rs @@ -1,5 +1,3 @@ -#![feature(let_else)] - fn main() { let Some(x) = Some(2) else { panic!("{}", x); //~ ERROR cannot find value `x` in this scope diff --git a/src/test/ui/let-else/let-else-scope.stderr b/src/test/ui/let-else/let-else-scope.stderr index 4b3936eac..3b4f09829 100644 --- a/src/test/ui/let-else/let-else-scope.stderr +++ b/src/test/ui/let-else/let-else-scope.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `x` in this scope - --> $DIR/let-else-scope.rs:5:22 + --> $DIR/let-else-scope.rs:3:22 | LL | panic!("{}", x); | ^ not found in this scope diff --git a/src/test/ui/let-else/let-else-slicing-error.rs b/src/test/ui/let-else/let-else-slicing-error.rs index 4022656a8..25770094b 100644 --- a/src/test/ui/let-else/let-else-slicing-error.rs +++ b/src/test/ui/let-else/let-else-slicing-error.rs @@ -1,5 +1,5 @@ // issue #92069 -#![feature(let_else)] + fn main() { let nums = vec![5, 4, 3, 2, 1]; diff --git a/src/test/ui/let-else/let-else-source-expr-nomove-pass.rs b/src/test/ui/let-else/let-else-source-expr-nomove-pass.rs index 2aa17ae8c..ee378abcf 100644 --- a/src/test/ui/let-else/let-else-source-expr-nomove-pass.rs +++ b/src/test/ui/let-else/let-else-source-expr-nomove-pass.rs @@ -1,7 +1,7 @@ // run-pass // issue #89688 -#![feature(let_else)] + fn example_let_else(value: Option) { let Some(inner) = value else { diff --git a/src/test/ui/let-else/let-else-temp-borrowck.rs b/src/test/ui/let-else/let-else-temp-borrowck.rs index 3910d35e7..6b4642d2f 100644 --- a/src/test/ui/let-else/let-else-temp-borrowck.rs +++ b/src/test/ui/let-else/let-else-temp-borrowck.rs @@ -3,7 +3,7 @@ // from issue #93951, where borrowck complained the temporary that `foo(&x)` was stored in was to // be dropped sometime after `x` was. It then suggested adding a semicolon that was already there. -#![feature(let_else)] + use std::fmt::Debug; fn foo<'a>(x: &'a str) -> Result { diff --git a/src/test/ui/let-else/let-else-temporary-lifetime.rs b/src/test/ui/let-else/let-else-temporary-lifetime.rs index 9c86901b9..c23eaa997 100644 --- a/src/test/ui/let-else/let-else-temporary-lifetime.rs +++ b/src/test/ui/let-else/let-else-temporary-lifetime.rs @@ -1,5 +1,5 @@ // run-pass -#![feature(let_else)] +// compile-flags: -Zvalidate-mir use std::fmt::Display; use std::rc::Rc; @@ -74,6 +74,17 @@ fn main() { }; } } + { + fn must_pass() { + let rc = Rc::new(()); + let &None = &Some(Rc::clone(&rc)) else { + Rc::try_unwrap(rc).unwrap(); + return; + }; + unreachable!(); + } + must_pass(); + } { // test let-else drops temps before else block // NOTE: this test has to be the last block in the `main` diff --git a/src/test/ui/let-else/let-else-then-diverge.rs b/src/test/ui/let-else/let-else-then-diverge.rs new file mode 100644 index 000000000..1c8f7d758 --- /dev/null +++ b/src/test/ui/let-else/let-else-then-diverge.rs @@ -0,0 +1,19 @@ +// +// popped up in in #94012, where an alternative desugaring was +// causing unreachable code errors + + +#![deny(unused_variables)] +#![deny(unreachable_code)] + +fn let_else_diverge() -> bool { + let Some(_) = Some("test") else { + let x = 5; //~ ERROR unused variable: `x` + return false; + }; + return true; +} + +fn main() { + let_else_diverge(); +} diff --git a/src/test/ui/let-else/let-else-then-diverge.stderr b/src/test/ui/let-else/let-else-then-diverge.stderr new file mode 100644 index 000000000..ceb61029d --- /dev/null +++ b/src/test/ui/let-else/let-else-then-diverge.stderr @@ -0,0 +1,14 @@ +error: unused variable: `x` + --> $DIR/let-else-then-diverge.rs:11:13 + | +LL | let x = 5; + | ^ help: if this is intentional, prefix it with an underscore: `_x` + | +note: the lint level is defined here + --> $DIR/let-else-then-diverge.rs:6:9 + | +LL | #![deny(unused_variables)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/let-else/let-else.rs b/src/test/ui/let-else/let-else.rs new file mode 100644 index 000000000..3505533e6 --- /dev/null +++ b/src/test/ui/let-else/let-else.rs @@ -0,0 +1,8 @@ +// run-pass + +fn main() { + let Some(x) = Some(1) else { + return; + }; + assert_eq!(x, 1); +} diff --git a/src/test/ui/lexical-scopes.stderr b/src/test/ui/lexical-scopes.stderr index 3b2a062c1..08e4be2c0 100644 --- a/src/test/ui/lexical-scopes.stderr +++ b/src/test/ui/lexical-scopes.stderr @@ -1,6 +1,8 @@ error[E0574]: expected struct, variant or union type, found type parameter `T` --> $DIR/lexical-scopes.rs:3:13 | +LL | fn f() { + | - found this type parameter LL | let t = T { i: 0 }; | ^ not a struct, variant or union type diff --git a/src/test/ui/lifetimes/fullwidth-ampersand.rs b/src/test/ui/lifetimes/fullwidth-ampersand.rs new file mode 100644 index 000000000..7d8948bd8 --- /dev/null +++ b/src/test/ui/lifetimes/fullwidth-ampersand.rs @@ -0,0 +1,7 @@ +// Verify that we do not ICE when the user uses a multubyte ampersand. + +fn f(_: &&()) -> &() { todo!() } +//~^ ERROR unknown start of token: \u{ff06} +//~| ERROR missing lifetime specifier [E0106] + +fn main() {} diff --git a/src/test/ui/lifetimes/fullwidth-ampersand.stderr b/src/test/ui/lifetimes/fullwidth-ampersand.stderr new file mode 100644 index 000000000..4645254f4 --- /dev/null +++ b/src/test/ui/lifetimes/fullwidth-ampersand.stderr @@ -0,0 +1,26 @@ +error: unknown start of token: \u{ff06} + --> $DIR/fullwidth-ampersand.rs:3:10 + | +LL | fn f(_: &&()) -> &() { todo!() } + | ^^ + | +help: Unicode character '&' (Fullwidth Ampersand) looks like '&' (Ampersand), but it is not + | +LL | fn f(_: &&()) -> &() { todo!() } + | ~ + +error[E0106]: missing lifetime specifier + --> $DIR/fullwidth-ampersand.rs:3:18 + | +LL | fn f(_: &&()) -> &() { todo!() } + | ----- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of argument 1's 2 lifetimes it is borrowed from +help: consider introducing a named lifetime parameter + | +LL | fn f<'a>(_: &'a &'a ()) -> &'a () { todo!() } + | ++++ ++ ++ ++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/lifetimes/issue-26638.stderr b/src/test/ui/lifetimes/issue-26638.stderr index f3af5cf5a..98d39d614 100644 --- a/src/test/ui/lifetimes/issue-26638.stderr +++ b/src/test/ui/lifetimes/issue-26638.stderr @@ -54,7 +54,7 @@ LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } help: provide the argument | LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter(/* &u8 */) } - | ~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/issue-26638.rs:5:47 diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs index 7a2eba518..d0a8fe795 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs @@ -42,4 +42,10 @@ fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { panic!() } +fn l<'a>(_: &'a str, _: &'a str) -> &str { "" } +//~^ ERROR missing lifetime specifier + +// This is ok because both `'a` are for the same parameter. +fn m<'a>(_: &'a Foo<'a>) -> &str { "" } + fn main() {} diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr index d07754879..5eee953ef 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -70,6 +70,18 @@ help: consider using the `'a` lifetime LL | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &'a isize { | ++ -error: aborting due to 6 previous errors +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:45:37 + | +LL | fn l<'a>(_: &'a str, _: &'a str) -> &str { "" } + | ------- ------- ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments +help: consider using the `'a` lifetime + | +LL | fn l<'a>(_: &'a str, _: &'a str) -> &'a str { "" } + | ++ + +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/lifetimes/missing-lifetime-in-alias.rs b/src/test/ui/lifetimes/missing-lifetime-in-alias.rs index af7b64127..51c564c01 100644 --- a/src/test/ui/lifetimes/missing-lifetime-in-alias.rs +++ b/src/test/ui/lifetimes/missing-lifetime-in-alias.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - trait Trait<'a> { type Foo; diff --git a/src/test/ui/lifetimes/missing-lifetime-in-alias.stderr b/src/test/ui/lifetimes/missing-lifetime-in-alias.stderr index b8c68a460..428b8f14b 100644 --- a/src/test/ui/lifetimes/missing-lifetime-in-alias.stderr +++ b/src/test/ui/lifetimes/missing-lifetime-in-alias.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetime-in-alias.rs:22:24 + --> $DIR/missing-lifetime-in-alias.rs:20:24 | LL | type B<'a> = as Trait>::Foo; | ^^^^^ expected named lifetime parameter @@ -10,13 +10,13 @@ LL | type B<'a> = as Trait<'a>>::Foo; | ++++ error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetime-in-alias.rs:26:28 + --> $DIR/missing-lifetime-in-alias.rs:24:28 | LL | type C<'a, 'b> = as Trait>::Bar; | ^^^^^ expected named lifetime parameter | note: these named lifetimes are available to use - --> $DIR/missing-lifetime-in-alias.rs:26:8 + --> $DIR/missing-lifetime-in-alias.rs:24:8 | LL | type C<'a, 'b> = as Trait>::Bar; | ^^ ^^ @@ -26,13 +26,13 @@ LL | type C<'a, 'b> = as Trait<'lifetime>>::Bar; | +++++++++++ error[E0107]: missing generics for associated type `Trait::Bar` - --> $DIR/missing-lifetime-in-alias.rs:26:36 + --> $DIR/missing-lifetime-in-alias.rs:24:36 | LL | type C<'a, 'b> = as Trait>::Bar; | ^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'b` - --> $DIR/missing-lifetime-in-alias.rs:6:10 + --> $DIR/missing-lifetime-in-alias.rs:4:10 | LL | type Bar<'b> | ^^^ -- diff --git a/src/test/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.rs b/src/test/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.rs new file mode 100644 index 000000000..645bc7db0 --- /dev/null +++ b/src/test/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.rs @@ -0,0 +1,9 @@ +fn no_restriction(x: &()) -> &() { + with_restriction::(x) //~ ERROR the parameter type `T` may not live long enough +} + +fn with_restriction<'b, T: 'b>(x: &'b ()) -> &'b () { + x +} + +fn main() {} diff --git a/src/test/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr b/src/test/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr new file mode 100644 index 000000000..a8b0996d8 --- /dev/null +++ b/src/test/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr @@ -0,0 +1,23 @@ +error[E0311]: the parameter type `T` may not live long enough + --> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:2:5 + | +LL | with_restriction::(x) + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: the parameter type `T` must be valid for the anonymous lifetime defined here... + --> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:1:25 + | +LL | fn no_restriction(x: &()) -> &() { + | ^^^ +note: ...so that the type `T` will meet its required lifetime bounds + --> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:2:5 + | +LL | with_restriction::(x) + | ^^^^^^^^^^^^^^^^^^^^^ +help: consider adding an explicit lifetime bound... + | +LL | fn no_restriction<'a, T: 'a>(x: &()) -> &() { + | +++ ++++ + +error: aborting due to previous error + diff --git a/src/test/ui/limits/issue-17913.rs b/src/test/ui/limits/issue-17913.rs index ca13b9bd6..8d4cbe201 100644 --- a/src/test/ui/limits/issue-17913.rs +++ b/src/test/ui/limits/issue-17913.rs @@ -6,18 +6,16 @@ // normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" -#![feature(box_syntax)] - #[cfg(target_pointer_width = "64")] fn main() { let n = 0_usize; - let a: Box<_> = box [&n; 0xF000000000000000_usize]; + let a: Box<_> = Box::new([&n; 0xF000000000000000_usize]); println!("{}", a[0xFFFFFF_usize]); } #[cfg(target_pointer_width = "32")] fn main() { let n = 0_usize; - let a: Box<_> = box [&n; 0xFFFFFFFF_usize]; + let a: Box<_> = Box::new([&n; 0xFFFFFFFF_usize]); println!("{}", a[0xFFFFFF_usize]); } diff --git a/src/test/ui/linkage-attr/link-attr-validation-early.stderr b/src/test/ui/linkage-attr/link-attr-validation-early.stderr index d36601ed0..903141e43 100644 --- a/src/test/ui/linkage-attr/link-attr-validation-early.stderr +++ b/src/test/ui/linkage-attr/link-attr-validation-early.stderr @@ -1,4 +1,4 @@ -error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...")]` +error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` --> $DIR/link-attr-validation-early.rs:2:1 | LL | #[link] @@ -8,7 +8,7 @@ LL | #[link] = 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 #57571 -error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...")]` +error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` --> $DIR/link-attr-validation-early.rs:4:1 | LL | #[link = "foo"] diff --git a/src/test/ui/linkage-attr/link-attr-validation-late.stderr b/src/test/ui/linkage-attr/link-attr-validation-late.stderr index bb08f9a4c..dd0f1dba2 100644 --- a/src/test/ui/linkage-attr/link-attr-validation-late.stderr +++ b/src/test/ui/linkage-attr/link-attr-validation-late.stderr @@ -1,10 +1,10 @@ -error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module +error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type --> $DIR/link-attr-validation-late.rs:5:22 | LL | #[link(name = "...", "literal")] | ^^^^^^^^^ -error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module +error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type --> $DIR/link-attr-validation-late.rs:6:22 | LL | #[link(name = "...", unknown)] diff --git a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr index 8d826bd14..94d81c3aa 100644 --- a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr @@ -9,9 +9,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/allowed-group-warn-by-default-lint.rs:10:25 @@ -23,9 +22,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/allowed-group-warn-by-default-lint.rs:10:25 @@ -37,9 +35,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/cap-lints-allow.stderr b/src/test/ui/lint/force-warn/cap-lints-allow.stderr index 978270872..7f0fd8530 100644 --- a/src/test/ui/lint/force-warn/cap-lints-allow.stderr +++ b/src/test/ui/lint/force-warn/cap-lints-allow.stderr @@ -9,9 +9,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/cap-lints-allow.rs:8:25 @@ -23,9 +22,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/cap-lints-allow.rs:8:25 @@ -37,9 +35,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr index 6e67ebf27..eb2bca7b8 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr @@ -9,9 +9,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 @@ -23,9 +22,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 @@ -37,9 +35,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr index c5dea84b8..ed01937a5 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr @@ -9,9 +9,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-lint-group.rs:10:25 @@ -23,9 +22,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-lint-group.rs:10:25 @@ -37,9 +35,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: 3 warnings emitted diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr index acd0c503d..8db7c1275 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr @@ -9,9 +9,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25 @@ -23,9 +22,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/lint-group-allowed-warn-by-default-lint.rs:10:25 @@ -37,9 +35,8 @@ LL | pub fn function(_x: Box) {} = note: for more information, see help: use `dyn` | -LL - pub fn function(_x: Box) {} -LL + pub fn function(_x: Box) {} - | +LL | pub fn function(_x: Box) {} + | +++ warning: 3 warnings emitted diff --git a/src/test/ui/lint/issue-101284.rs b/src/test/ui/lint/issue-101284.rs new file mode 100644 index 000000000..1381d4f17 --- /dev/null +++ b/src/test/ui/lint/issue-101284.rs @@ -0,0 +1,15 @@ +// check-pass +// edition:2021 +#![deny(rust_2021_compatibility)] + +pub struct Warns { + // `Arc` has significant drop + _significant_drop: std::sync::Arc<()>, + field: String, +} + +pub fn test(w: Warns) { + _ = || drop(w.field); +} + +fn main() {} diff --git a/src/test/ui/lint/issue-70819-dont-override-forbid-in-same-scope.rs b/src/test/ui/lint/issue-70819-dont-override-forbid-in-same-scope.rs index c66037e9a..b4fc33174 100644 --- a/src/test/ui/lint/issue-70819-dont-override-forbid-in-same-scope.rs +++ b/src/test/ui/lint/issue-70819-dont-override-forbid-in-same-scope.rs @@ -5,7 +5,7 @@ // If you turn off deduplicate diagnostics (which rustc turns on by default but // compiletest turns off when it runs ui tests), then the errors are // (unfortunately) repeated here because the checking is done as we read in the -// errors, and curretly that happens two or three different times, depending on +// errors, and currently that happens two or three different times, depending on // compiler flags. // // I decided avoiding the redundant output was not worth the time in engineering diff --git a/src/test/ui/lint/let_underscore/let_underscore_drop.rs b/src/test/ui/lint/let_underscore/let_underscore_drop.rs new file mode 100644 index 000000000..f298871f1 --- /dev/null +++ b/src/test/ui/lint/let_underscore/let_underscore_drop.rs @@ -0,0 +1,14 @@ +// check-pass +#![warn(let_underscore_drop)] + +struct NontrivialDrop; + +impl Drop for NontrivialDrop { + fn drop(&mut self) { + println!("Dropping!"); + } +} + +fn main() { + let _ = NontrivialDrop; //~WARNING non-binding let on a type that implements `Drop` +} diff --git a/src/test/ui/lint/let_underscore/let_underscore_drop.stderr b/src/test/ui/lint/let_underscore/let_underscore_drop.stderr new file mode 100644 index 000000000..7b7de202e --- /dev/null +++ b/src/test/ui/lint/let_underscore/let_underscore_drop.stderr @@ -0,0 +1,22 @@ +warning: non-binding let on a type that implements `Drop` + --> $DIR/let_underscore_drop.rs:13:5 + | +LL | let _ = NontrivialDrop; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/let_underscore_drop.rs:2:9 + | +LL | #![warn(let_underscore_drop)] + | ^^^^^^^^^^^^^^^^^^^ +help: consider binding to an unused variable to avoid immediately dropping the value + | +LL | let _unused = NontrivialDrop; + | ~~~~~~~ +help: consider immediately dropping the value + | +LL | drop(NontrivialDrop); + | ~~~~~ + + +warning: 1 warning emitted + diff --git a/src/test/ui/lint/let_underscore/let_underscore_lock.rs b/src/test/ui/lint/let_underscore/let_underscore_lock.rs new file mode 100644 index 000000000..7423862cd --- /dev/null +++ b/src/test/ui/lint/let_underscore/let_underscore_lock.rs @@ -0,0 +1,7 @@ +// check-fail +use std::sync::{Arc, Mutex}; + +fn main() { + let data = Arc::new(Mutex::new(0)); + let _ = data.lock().unwrap(); //~ERROR non-binding let on a synchronization lock +} diff --git a/src/test/ui/lint/let_underscore/let_underscore_lock.stderr b/src/test/ui/lint/let_underscore/let_underscore_lock.stderr new file mode 100644 index 000000000..fb58af0a4 --- /dev/null +++ b/src/test/ui/lint/let_underscore/let_underscore_lock.stderr @@ -0,0 +1,20 @@ +error: non-binding let on a synchronization lock + --> $DIR/let_underscore_lock.rs:6:9 + | +LL | let _ = data.lock().unwrap(); + | ^ ^^^^^^^^^^^^^^^^^^^^ this binding will immediately drop the value assigned to it + | | + | this lock is not assigned to a binding and is immediately dropped + | + = note: `#[deny(let_underscore_lock)]` on by default +help: consider binding to an unused variable to avoid immediately dropping the value + | +LL | let _unused = data.lock().unwrap(); + | ~~~~~~~ +help: consider immediately dropping the value + | +LL | drop(data.lock().unwrap()); + | ~~~~~ + + +error: aborting due to previous error + diff --git a/src/test/ui/lint/lint-attr-everywhere-early.rs b/src/test/ui/lint/lint-attr-everywhere-early.rs new file mode 100644 index 000000000..fd0c4b43e --- /dev/null +++ b/src/test/ui/lint/lint-attr-everywhere-early.rs @@ -0,0 +1,176 @@ +// Tests that lint levels can be set for early lints. +#![allow(non_camel_case_types, unsafe_code, while_true, unused_parens)] + +// The following is a check of the lints used here to verify they do not warn +// when allowed. +fn verify_no_warnings() { + type non_camel_type = i32; // non_camel_case_types + struct NON_CAMEL_IS_ALLOWED; // non_camel_case_types + unsafe {} // unsafe_code + enum Enum { + VARIANT_CAMEL // non_camel_case_types + } + fn generics() {} // non_camel_case_types + while true {} // while_true + type T = (i32); // unused_parens +} + + +// ################## Types + +#[deny(non_camel_case_types)] +type type_outer = i32; //~ ERROR type `type_outer` should have an upper camel case name + +type BareFnPtr = fn(#[deny(unused_parens)](i32)); //~ ERROR unnecessary parentheses around type +// There aren't any early lints that currently apply to the variadic spot. +// type BareFnPtrVariadic = extern "C" fn(i32, #[deny()]...); + +// ################## Items +#[deny(non_camel_case_types)] +struct ITEM_OUTER; //~ ERROR type `ITEM_OUTER` should have an upper camel case name + +mod module_inner { + #![deny(unsafe_code)] + fn f() { + unsafe {} //~ ERROR usage of an `unsafe` block + } +} + +struct Associated; +impl Associated { + #![deny(unsafe_code)] + + fn inherent_denied_from_inner() { unsafe {} } //~ usage of an `unsafe` block + + #[deny(while_true)] + fn inherent_fn() { while true {} } //~ ERROR denote infinite loops with + + #[deny(while_true)] + const INHERENT_CONST: i32 = {while true {} 1}; //~ ERROR denote infinite loops with +} + +trait trait_inner { //~ ERROR trait `trait_inner` should have an upper camel case name + #![deny(non_camel_case_types)] +} + +trait AssociatedTrait { + #![deny(unsafe_code)] + + fn denied_from_inner() { unsafe {} } //~ ERROR usage of an `unsafe` block + + #[deny(while_true)] + fn assoc_fn() { while true {} } //~ ERROR denote infinite loops with + + #[deny(while_true)] + const ASSOC_CONST: i32 = {while true {} 1}; //~ ERROR denote infinite loops with + + #[deny(non_camel_case_types)] + type assoc_type; //~ ERROR associated type `assoc_type` should have an upper camel case name +} + +impl AssociatedTrait for Associated { + #![deny(unsafe_code)] + + fn denied_from_inner() { unsafe {} } //~ ERROR usage of an `unsafe` block + + #[deny(while_true)] + fn assoc_fn() { while true {} } //~ ERROR denote infinite loops with + + #[deny(while_true)] + const ASSOC_CONST: i32 = {while true {} 1}; //~ ERROR denote infinite loops with + + #[deny(unused_parens)] + type assoc_type = (i32); //~ ERROR unnecessary parentheses around type +} + +struct StructFields { + #[deny(unused_parens)]f1: (i32), //~ ERROR unnecessary parentheses around type +} +struct StructTuple(#[deny(unused_parens)](i32)); //~ ERROR unnecessary parentheses around type + +enum Enum { + #[deny(non_camel_case_types)] + VARIANT_CAMEL, //~ ERROR variant `VARIANT_CAMEL` should have an upper camel case name +} + +extern "C" { + #![deny(unused_parens)] + + fn foreign_denied_from_inner(x: (i32)); //~ ERROR unnecessary parentheses around type +} + +extern "C" { + #[deny(unused_parens)] + fn foreign_denied_from_outer(x: (i32)); //~ ERROR unnecessary parentheses around type +} + +fn function(#[deny(unused_parens)] param: (i32)) {} //~ ERROR unnecessary parentheses around type + +fn generics<#[deny(non_camel_case_types)]foo>() {} //~ ERROR type parameter `foo` should have an upper camel case name + + +// ################## Statements +fn statements() { + #[deny(unused_parens)] + let x = (1); //~ ERROR unnecessary parentheses around assigned value +} + + +// ################## Expressions +fn expressions() { + let closure = |#[deny(unused_parens)] param: (i32)| {}; //~ ERROR unnecessary parentheses around type + + struct Match{f1: i32} + // Strangely unused_parens doesn't fire with {f1: (123)} + let f = Match{#[deny(unused_parens)]f1: {(123)}}; //~ ERROR unnecessary parentheses around block return value + + match f { + #![deny(unsafe_code)] + + #[deny(while_true)] + Match{f1} => { + unsafe {} //~ ERROR usage of an `unsafe` block + while true {} //~ ERROR denote infinite loops with + } + } + + // Statement Block + { + #![deny(unsafe_code)] + unsafe {} //~ ERROR usage of an `unsafe` block + } + let block_tail = { + #[deny(unsafe_code)] + unsafe {} //~ ERROR usage of an `unsafe` block + }; + + // Before expression as a statement. + #[deny(unsafe_code)] + unsafe {}; //~ ERROR usage of an `unsafe` block + + [#[deny(unsafe_code)] unsafe {123}]; //~ ERROR usage of an `unsafe` block + (#[deny(unsafe_code)] unsafe {123},); //~ ERROR usage of an `unsafe` block + fn call(p: i32) {} + call(#[deny(unsafe_code)] unsafe {123}); //~ ERROR usage of an `unsafe` block + struct TupleStruct(i32); + TupleStruct(#[deny(unsafe_code)] unsafe {123}); //~ ERROR usage of an `unsafe` block +} + + +// ################## Patterns +fn patterns() { + struct PatField{f1: i32, f2: i32}; + let f = PatField{f1: 1, f2: 2}; + match f { + PatField { + #[deny(ellipsis_inclusive_range_patterns)] + f1: 0...100, + //~^ ERROR range patterns are deprecated + //~| WARNING this is accepted in the current edition + .. + } => {} + _ => {} + } +} + +fn main() {} diff --git a/src/test/ui/lint/lint-attr-everywhere-early.stderr b/src/test/ui/lint/lint-attr-everywhere-early.stderr new file mode 100644 index 000000000..1d6e3cda4 --- /dev/null +++ b/src/test/ui/lint/lint-attr-everywhere-early.stderr @@ -0,0 +1,486 @@ +error: type `type_outer` should have an upper camel case name + --> $DIR/lint-attr-everywhere-early.rs:22:6 + | +LL | type type_outer = i32; + | ^^^^^^^^^^ help: convert the identifier to upper camel case: `TypeOuter` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:21:8 + | +LL | #[deny(non_camel_case_types)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary parentheses around type + --> $DIR/lint-attr-everywhere-early.rs:24:43 + | +LL | type BareFnPtr = fn(#[deny(unused_parens)](i32)); + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:24:28 + | +LL | type BareFnPtr = fn(#[deny(unused_parens)](i32)); + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - type BareFnPtr = fn(#[deny(unused_parens)](i32)); +LL + type BareFnPtr = fn(#[deny(unused_parens)]i32); + | + +error: type `ITEM_OUTER` should have an upper camel case name + --> $DIR/lint-attr-everywhere-early.rs:30:8 + | +LL | struct ITEM_OUTER; + | ^^^^^^^^^^ help: convert the identifier to upper camel case: `ItemOuter` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:29:8 + | +LL | #[deny(non_camel_case_types)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:35:9 + | +LL | unsafe {} + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:33:13 + | +LL | #![deny(unsafe_code)] + | ^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:43:39 + | +LL | fn inherent_denied_from_inner() { unsafe {} } + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:41:13 + | +LL | #![deny(unsafe_code)] + | ^^^^^^^^^^^ + +error: denote infinite loops with `loop { ... }` + --> $DIR/lint-attr-everywhere-early.rs:46:24 + | +LL | fn inherent_fn() { while true {} } + | ^^^^^^^^^^ help: use `loop` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:45:12 + | +LL | #[deny(while_true)] + | ^^^^^^^^^^ + +error: denote infinite loops with `loop { ... }` + --> $DIR/lint-attr-everywhere-early.rs:49:34 + | +LL | const INHERENT_CONST: i32 = {while true {} 1}; + | ^^^^^^^^^^ help: use `loop` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:48:12 + | +LL | #[deny(while_true)] + | ^^^^^^^^^^ + +error: trait `trait_inner` should have an upper camel case name + --> $DIR/lint-attr-everywhere-early.rs:52:7 + | +LL | trait trait_inner { + | ^^^^^^^^^^^ help: convert the identifier to upper camel case: `TraitInner` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:53:13 + | +LL | #![deny(non_camel_case_types)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:59:30 + | +LL | fn denied_from_inner() { unsafe {} } + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:57:13 + | +LL | #![deny(unsafe_code)] + | ^^^^^^^^^^^ + +error: denote infinite loops with `loop { ... }` + --> $DIR/lint-attr-everywhere-early.rs:62:21 + | +LL | fn assoc_fn() { while true {} } + | ^^^^^^^^^^ help: use `loop` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:61:12 + | +LL | #[deny(while_true)] + | ^^^^^^^^^^ + +error: denote infinite loops with `loop { ... }` + --> $DIR/lint-attr-everywhere-early.rs:65:31 + | +LL | const ASSOC_CONST: i32 = {while true {} 1}; + | ^^^^^^^^^^ help: use `loop` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:64:12 + | +LL | #[deny(while_true)] + | ^^^^^^^^^^ + +error: associated type `assoc_type` should have an upper camel case name + --> $DIR/lint-attr-everywhere-early.rs:68:10 + | +LL | type assoc_type; + | ^^^^^^^^^^ help: convert the identifier to upper camel case: `AssocType` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:67:12 + | +LL | #[deny(non_camel_case_types)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:74:30 + | +LL | fn denied_from_inner() { unsafe {} } + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:72:13 + | +LL | #![deny(unsafe_code)] + | ^^^^^^^^^^^ + +error: denote infinite loops with `loop { ... }` + --> $DIR/lint-attr-everywhere-early.rs:77:21 + | +LL | fn assoc_fn() { while true {} } + | ^^^^^^^^^^ help: use `loop` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:76:12 + | +LL | #[deny(while_true)] + | ^^^^^^^^^^ + +error: denote infinite loops with `loop { ... }` + --> $DIR/lint-attr-everywhere-early.rs:80:31 + | +LL | const ASSOC_CONST: i32 = {while true {} 1}; + | ^^^^^^^^^^ help: use `loop` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:79:12 + | +LL | #[deny(while_true)] + | ^^^^^^^^^^ + +error: unnecessary parentheses around type + --> $DIR/lint-attr-everywhere-early.rs:83:23 + | +LL | type assoc_type = (i32); + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:82:12 + | +LL | #[deny(unused_parens)] + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - type assoc_type = (i32); +LL + type assoc_type = i32; + | + +error: unnecessary parentheses around type + --> $DIR/lint-attr-everywhere-early.rs:87:31 + | +LL | #[deny(unused_parens)]f1: (i32), + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:87:12 + | +LL | #[deny(unused_parens)]f1: (i32), + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - #[deny(unused_parens)]f1: (i32), +LL + #[deny(unused_parens)]f1: i32, + | + +error: unnecessary parentheses around type + --> $DIR/lint-attr-everywhere-early.rs:89:42 + | +LL | struct StructTuple(#[deny(unused_parens)](i32)); + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:89:27 + | +LL | struct StructTuple(#[deny(unused_parens)](i32)); + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - struct StructTuple(#[deny(unused_parens)](i32)); +LL + struct StructTuple(#[deny(unused_parens)]i32); + | + +error: variant `VARIANT_CAMEL` should have an upper camel case name + --> $DIR/lint-attr-everywhere-early.rs:93:5 + | +LL | VARIANT_CAMEL, + | ^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `VariantCamel` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:92:12 + | +LL | #[deny(non_camel_case_types)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary parentheses around type + --> $DIR/lint-attr-everywhere-early.rs:99:37 + | +LL | fn foreign_denied_from_inner(x: (i32)); + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:97:13 + | +LL | #![deny(unused_parens)] + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - fn foreign_denied_from_inner(x: (i32)); +LL + fn foreign_denied_from_inner(x: i32); + | + +error: unnecessary parentheses around type + --> $DIR/lint-attr-everywhere-early.rs:104:37 + | +LL | fn foreign_denied_from_outer(x: (i32)); + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:103:12 + | +LL | #[deny(unused_parens)] + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - fn foreign_denied_from_outer(x: (i32)); +LL + fn foreign_denied_from_outer(x: i32); + | + +error: unnecessary parentheses around type + --> $DIR/lint-attr-everywhere-early.rs:107:43 + | +LL | fn function(#[deny(unused_parens)] param: (i32)) {} + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:107:20 + | +LL | fn function(#[deny(unused_parens)] param: (i32)) {} + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - fn function(#[deny(unused_parens)] param: (i32)) {} +LL + fn function(#[deny(unused_parens)] param: i32) {} + | + +error: type parameter `foo` should have an upper camel case name + --> $DIR/lint-attr-everywhere-early.rs:109:42 + | +LL | fn generics<#[deny(non_camel_case_types)]foo>() {} + | ^^^ help: convert the identifier to upper camel case (notice the capitalization): `Foo` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:109:20 + | +LL | fn generics<#[deny(non_camel_case_types)]foo>() {} + | ^^^^^^^^^^^^^^^^^^^^ + +error: unnecessary parentheses around assigned value + --> $DIR/lint-attr-everywhere-early.rs:115:13 + | +LL | let x = (1); + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:114:12 + | +LL | #[deny(unused_parens)] + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - let x = (1); +LL + let x = 1; + | + +error: unnecessary parentheses around type + --> $DIR/lint-attr-everywhere-early.rs:121:50 + | +LL | let closure = |#[deny(unused_parens)] param: (i32)| {}; + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:121:27 + | +LL | let closure = |#[deny(unused_parens)] param: (i32)| {}; + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - let closure = |#[deny(unused_parens)] param: (i32)| {}; +LL + let closure = |#[deny(unused_parens)] param: i32| {}; + | + +error: unnecessary parentheses around block return value + --> $DIR/lint-attr-everywhere-early.rs:125:46 + | +LL | let f = Match{#[deny(unused_parens)]f1: {(123)}}; + | ^ ^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:125:26 + | +LL | let f = Match{#[deny(unused_parens)]f1: {(123)}}; + | ^^^^^^^^^^^^^ +help: remove these parentheses + | +LL - let f = Match{#[deny(unused_parens)]f1: {(123)}}; +LL + let f = Match{#[deny(unused_parens)]f1: {123}}; + | + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:132:13 + | +LL | unsafe {} + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:128:17 + | +LL | #![deny(unsafe_code)] + | ^^^^^^^^^^^ + +error: denote infinite loops with `loop { ... }` + --> $DIR/lint-attr-everywhere-early.rs:133:13 + | +LL | while true {} + | ^^^^^^^^^^ help: use `loop` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:130:16 + | +LL | #[deny(while_true)] + | ^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:140:9 + | +LL | unsafe {} + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:139:17 + | +LL | #![deny(unsafe_code)] + | ^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:144:9 + | +LL | unsafe {} + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:143:16 + | +LL | #[deny(unsafe_code)] + | ^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:149:5 + | +LL | unsafe {}; + | ^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:148:12 + | +LL | #[deny(unsafe_code)] + | ^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:151:27 + | +LL | [#[deny(unsafe_code)] unsafe {123}]; + | ^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:151:13 + | +LL | [#[deny(unsafe_code)] unsafe {123}]; + | ^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:152:27 + | +LL | (#[deny(unsafe_code)] unsafe {123},); + | ^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:152:13 + | +LL | (#[deny(unsafe_code)] unsafe {123},); + | ^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:154:31 + | +LL | call(#[deny(unsafe_code)] unsafe {123}); + | ^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:154:17 + | +LL | call(#[deny(unsafe_code)] unsafe {123}); + | ^^^^^^^^^^^ + +error: usage of an `unsafe` block + --> $DIR/lint-attr-everywhere-early.rs:156:38 + | +LL | TupleStruct(#[deny(unsafe_code)] unsafe {123}); + | ^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:156:24 + | +LL | TupleStruct(#[deny(unsafe_code)] unsafe {123}); + | ^^^^^^^^^^^ + +error: `...` range patterns are deprecated + --> $DIR/lint-attr-everywhere-early.rs:167:18 + | +LL | f1: 0...100, + | ^^^ help: use `..=` for an inclusive range + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-early.rs:166:20 + | +LL | #[deny(ellipsis_inclusive_range_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see + +error: aborting due to 36 previous errors + diff --git a/src/test/ui/lint/lint-attr-everywhere-late.rs b/src/test/ui/lint/lint-attr-everywhere-late.rs new file mode 100644 index 000000000..1055157d6 --- /dev/null +++ b/src/test/ui/lint/lint-attr-everywhere-late.rs @@ -0,0 +1,197 @@ +// Tests that lint levels can be set for late lints. +#![allow( + non_snake_case, + overflowing_literals, + missing_docs, + dyn_drop, + enum_intrinsics_non_enums, + clashing_extern_declarations +)] + +extern crate core; +use core::mem::{Discriminant, discriminant}; + +// The following is a check of the lints used here to verify they do not warn +// when allowed. +pub fn missing_docs_allowed() {} // missing_docs +fn dyn_drop_allowed(_x: Box) {} // dyn_drop +fn verify_no_warnings() { + discriminant::(&123); // enum_intrinsics_non_enums + let x: u8 = 1000; // overflowing_literals + let NON_SNAKE_CASE = 1; // non_snake_case +} +mod clashing_extern_allowed { + extern "C" { + fn extern_allowed(); + } +} +extern "C" { + fn extern_allowed(_: i32); // clashing_extern_declarations +} + +// ################## Types + +#[deny(missing_docs)] +pub type MissingDocType = i32; //~ ERROR missing documentation for a type alias + +// There aren't any late lints that I can find that can be easily used with types. +// type BareFnPtr = fn(#[deny()]i32); +// type BareFnPtrVariadic = extern "C" fn(i32, #[deny()]...); + +// ################## Items +#[deny(missing_docs)] +pub struct ItemOuter; //~ ERROR missing documentation for a struct + +pub mod module_inner { //~ ERROR missing documentation for a module + #![deny(missing_docs)] + pub fn missing_inner() {} //~ ERROR missing documentation for a function +} + +pub struct Associated; +impl Associated { + #![deny(missing_docs)] + + pub fn inherent_denied_from_inner() {} //~ ERROR missing documentation for an associated function +} + +impl Associated { + #[deny(missing_docs)] + pub fn inherent_fn() {} //~ ERROR missing documentation for an associated function + + #[deny(missing_docs)] + pub const INHERENT_CONST: i32 = 1; //~ ERROR missing documentation for an associated constant +} + +pub trait TraitInner { //~ ERROR missing documentation for a trait + #![deny(missing_docs)] +} + +pub trait AssociatedTraitInner { //~ ERROR missing documentation for a trait + #![deny(missing_docs)] + + fn denied_from_inner() {} //~ ERROR missing documentation for an associated function +} + +pub trait AssociatedTrait { + fn denied_from_inner(_x: Box) {} // Used below + + #[deny(missing_docs)] + fn assoc_fn() {} //~ ERROR missing documentation for an associated function + + #[deny(missing_docs)] + const ASSOC_CONST: u8 = 1; //~ ERROR missing documentation for an associated constant + + #[deny(missing_docs)] + type AssocType; //~ ERROR missing documentation for an associated type +} + +struct Foo; + +impl AssociatedTrait for Associated { + #![deny(dyn_drop)] + + fn denied_from_inner(_x: Box) {} //~ ERROR types that do not implement `Drop` + + #[deny(enum_intrinsics_non_enums)] + fn assoc_fn() { discriminant::(&123); } //~ ERROR the return value of + + #[deny(overflowing_literals)] const ASSOC_CONST: u8 = 1000; //~ ERROR literal out of range + type AssocType = i32; +} + + +// There aren't any late lints that can apply to a field that I can find. +// non_snake_case doesn't work on fields +// struct StructFields { +// #[deny()]f1: i32, +// } +// struct StructTuple(#[deny()]i32); + +pub enum Enum { + #[deny(missing_docs)] + Variant1, //~ ERROR missing documentation for a variant +} + +mod clashing_extern { + extern "C" { + fn clashing1(); + fn clashing2(); + } +} +extern "C" { + #![deny(clashing_extern_declarations)] + fn clashing1(_: i32); //~ ERROR `clashing1` redeclared with a different signature +} + +extern "C" { + #[deny(clashing_extern_declarations)] + fn clashing2(_: i32); //~ ERROR `clashing2` redeclared with a different signature +} + +fn function(#[deny(non_snake_case)] PARAM: i32) {} //~ ERROR variable `PARAM` should have a snake case name +// There aren't any late lints that can apply to generics that I can find. +// fn generics<#[deny()]T>() {} + + +// ################## Statements +fn statements() { + #[deny(enum_intrinsics_non_enums)] + let _ = discriminant::(&123); //~ ERROR the return value of +} + + +// ################## Expressions +fn expressions() { + let closure = |#[deny(non_snake_case)] PARAM: i32| {}; //~ ERROR variable `PARAM` should have a snake case name + + struct Match{f1: i32} + // I can't find any late lints for patterns. + // let f = Match{#[deny()]f1: 123}; + + let f = Match{f1: 123}; + match f { + #![deny(enum_intrinsics_non_enums)] + Match{f1} => { + discriminant::(&123); //~ ERROR the return value of + } + } + match f { + #[deny(enum_intrinsics_non_enums)] + Match{f1} => { + discriminant::(&123); //~ ERROR the return value of + } + } + + // Statement Block + { + #![deny(enum_intrinsics_non_enums)] + discriminant::(&123); //~ ERROR the return value of + } + let block_tail = { + #[deny(enum_intrinsics_non_enums)] + discriminant::(&123); //~ ERROR the return value of + }; + + // Before expression as a statement. + #[deny(enum_intrinsics_non_enums)] + discriminant::(&123); //~ ERROR the return value of + + [#[deny(enum_intrinsics_non_enums)] discriminant::(&123)]; //~ ERROR the return value of + (#[deny(enum_intrinsics_non_enums)] discriminant::(&123),); //~ ERROR the return value of + fn call(p: Discriminant) {} + call(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); //~ ERROR the return value of + struct TupleStruct(Discriminant); + TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); //~ ERROR the return value of +} + + +// ################## Patterns +fn patterns() { + // There aren't any late lints that I can find that apply to pattern fields. + // + // struct PatField{f1: i32, f2: i32}; + // let f = PatField{f1: 1, f2: 2}; + // let PatField{#[deny()]f1, #[deny()]..} = f; +} + +fn main() {} diff --git a/src/test/ui/lint/lint-attr-everywhere-late.stderr b/src/test/ui/lint/lint-attr-everywhere-late.stderr new file mode 100644 index 000000000..977843997 --- /dev/null +++ b/src/test/ui/lint/lint-attr-everywhere-late.stderr @@ -0,0 +1,428 @@ +error: missing documentation for a type alias + --> $DIR/lint-attr-everywhere-late.rs:35:1 + | +LL | pub type MissingDocType = i32; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:34:8 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for a struct + --> $DIR/lint-attr-everywhere-late.rs:43:1 + | +LL | pub struct ItemOuter; + | ^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:42:8 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for a module + --> $DIR/lint-attr-everywhere-late.rs:45:1 + | +LL | pub mod module_inner { + | ^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:46:13 + | +LL | #![deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for a function + --> $DIR/lint-attr-everywhere-late.rs:47:5 + | +LL | pub fn missing_inner() {} + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: missing documentation for an associated function + --> $DIR/lint-attr-everywhere-late.rs:54:5 + | +LL | pub fn inherent_denied_from_inner() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:52:13 + | +LL | #![deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for an associated function + --> $DIR/lint-attr-everywhere-late.rs:59:5 + | +LL | pub fn inherent_fn() {} + | ^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:58:12 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for an associated constant + --> $DIR/lint-attr-everywhere-late.rs:62:5 + | +LL | pub const INHERENT_CONST: i32 = 1; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:61:12 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for a trait + --> $DIR/lint-attr-everywhere-late.rs:65:1 + | +LL | pub trait TraitInner { + | ^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:66:13 + | +LL | #![deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for a trait + --> $DIR/lint-attr-everywhere-late.rs:69:1 + | +LL | pub trait AssociatedTraitInner { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:70:13 + | +LL | #![deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for an associated function + --> $DIR/lint-attr-everywhere-late.rs:72:5 + | +LL | fn denied_from_inner() {} + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: missing documentation for an associated function + --> $DIR/lint-attr-everywhere-late.rs:79:5 + | +LL | fn assoc_fn() {} + | ^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:78:12 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for an associated constant + --> $DIR/lint-attr-everywhere-late.rs:82:5 + | +LL | const ASSOC_CONST: u8 = 1; + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:81:12 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for an associated type + --> $DIR/lint-attr-everywhere-late.rs:85:5 + | +LL | type AssocType; + | ^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:84:12 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: missing documentation for a variant + --> $DIR/lint-attr-everywhere-late.rs:112:5 + | +LL | Variant1, + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:111:12 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: `clashing1` redeclared with a different signature + --> $DIR/lint-attr-everywhere-late.rs:123:5 + | +LL | fn clashing1(); + | --------------- `clashing1` previously declared here +... +LL | fn clashing1(_: i32); + | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:122:13 + | +LL | #![deny(clashing_extern_declarations)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `unsafe extern "C" fn()` + found `unsafe extern "C" fn(i32)` + +error: `clashing2` redeclared with a different signature + --> $DIR/lint-attr-everywhere-late.rs:128:5 + | +LL | fn clashing2(); + | --------------- `clashing2` previously declared here +... +LL | fn clashing2(_: i32); + | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:127:12 + | +LL | #[deny(clashing_extern_declarations)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `unsafe extern "C" fn()` + found `unsafe extern "C" fn(i32)` + +error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped + --> $DIR/lint-attr-everywhere-late.rs:93:38 + | +LL | fn denied_from_inner(_x: Box) {} + | ^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:91:13 + | +LL | #![deny(dyn_drop)] + | ^^^^^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:96:21 + | +LL | fn assoc_fn() { discriminant::(&123); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:95:12 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:96:41 + | +LL | fn assoc_fn() { discriminant::(&123); } + | ^^^^ + +error: literal out of range for `u8` + --> $DIR/lint-attr-everywhere-late.rs:98:59 + | +LL | #[deny(overflowing_literals)] const ASSOC_CONST: u8 = 1000; + | ^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:98:12 + | +LL | #[deny(overflowing_literals)] const ASSOC_CONST: u8 = 1000; + | ^^^^^^^^^^^^^^^^^^^^ + = note: the literal `1000` does not fit into the type `u8` whose range is `0..=255` + +error: variable `PARAM` should have a snake case name + --> $DIR/lint-attr-everywhere-late.rs:131:37 + | +LL | fn function(#[deny(non_snake_case)] PARAM: i32) {} + | ^^^^^ help: convert the identifier to snake case: `param` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:131:20 + | +LL | fn function(#[deny(non_snake_case)] PARAM: i32) {} + | ^^^^^^^^^^^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:139:13 + | +LL | let _ = discriminant::(&123); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:138:12 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:139:33 + | +LL | let _ = discriminant::(&123); + | ^^^^ + +error: variable `PARAM` should have a snake case name + --> $DIR/lint-attr-everywhere-late.rs:145:44 + | +LL | let closure = |#[deny(non_snake_case)] PARAM: i32| {}; + | ^^^^^ help: convert the identifier to snake case: `param` + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:145:27 + | +LL | let closure = |#[deny(non_snake_case)] PARAM: i32| {}; + | ^^^^^^^^^^^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:155:13 + | +LL | discriminant::(&123); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:153:17 + | +LL | #![deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:155:33 + | +LL | discriminant::(&123); + | ^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:161:13 + | +LL | discriminant::(&123); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:159:16 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:161:33 + | +LL | discriminant::(&123); + | ^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:168:9 + | +LL | discriminant::(&123); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:167:17 + | +LL | #![deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:168:29 + | +LL | discriminant::(&123); + | ^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:172:9 + | +LL | discriminant::(&123); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:171:16 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:172:29 + | +LL | discriminant::(&123); + | ^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:177:5 + | +LL | discriminant::(&123); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:176:12 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:177:25 + | +LL | discriminant::(&123); + | ^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:179:41 + | +LL | [#[deny(enum_intrinsics_non_enums)] discriminant::(&123)]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:179:13 + | +LL | [#[deny(enum_intrinsics_non_enums)] discriminant::(&123)]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:179:61 + | +LL | [#[deny(enum_intrinsics_non_enums)] discriminant::(&123)]; + | ^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:180:41 + | +LL | (#[deny(enum_intrinsics_non_enums)] discriminant::(&123),); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:180:13 + | +LL | (#[deny(enum_intrinsics_non_enums)] discriminant::(&123),); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:180:61 + | +LL | (#[deny(enum_intrinsics_non_enums)] discriminant::(&123),); + | ^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:182:45 + | +LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:182:17 + | +LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:182:65 + | +LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); + | ^^^^ + +error: the return value of `mem::discriminant` is unspecified when called with a non-enum type + --> $DIR/lint-attr-everywhere-late.rs:184:52 + | +LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:184:24 + | +LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. + --> $DIR/lint-attr-everywhere-late.rs:184:72 + | +LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::(&123)); + | ^^^^ + +error: aborting due to 31 previous errors + diff --git a/src/test/ui/lint/must_not_suspend/ref-drop-tracking.rs b/src/test/ui/lint/must_not_suspend/ref-drop-tracking.rs new file mode 100644 index 000000000..1bc4a3812 --- /dev/null +++ b/src/test/ui/lint/must_not_suspend/ref-drop-tracking.rs @@ -0,0 +1,30 @@ +// edition:2018 +// compile-flags: -Zdrop-tracking +#![feature(must_not_suspend)] +#![deny(must_not_suspend)] + +#[must_not_suspend = "You gotta use Umm's, ya know?"] +struct Umm { + i: i64 +} + +struct Bar { + u: Umm, +} + +async fn other() {} + +impl Bar { + async fn uhoh(&mut self) { + let guard = &mut self.u; //~ ERROR `Umm` held across + + other().await; + + *guard = Umm { + i: 2 + } + } +} + +fn main() { +} diff --git a/src/test/ui/lint/must_not_suspend/ref-drop-tracking.stderr b/src/test/ui/lint/must_not_suspend/ref-drop-tracking.stderr new file mode 100644 index 000000000..c49d27128 --- /dev/null +++ b/src/test/ui/lint/must_not_suspend/ref-drop-tracking.stderr @@ -0,0 +1,27 @@ +error: reference to `Umm` held across a suspend point, but should not be + --> $DIR/ref-drop-tracking.rs:19:13 + | +LL | let guard = &mut self.u; + | ^^^^^ +LL | +LL | other().await; + | ------ the value is held across this suspend point + | +note: the lint level is defined here + --> $DIR/ref-drop-tracking.rs:4:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ +note: You gotta use Umm's, ya know? + --> $DIR/ref-drop-tracking.rs:19:13 + | +LL | let guard = &mut self.u; + | ^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/ref-drop-tracking.rs:19:13 + | +LL | let guard = &mut self.u; + | ^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr b/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr new file mode 100644 index 000000000..0157c8b7f --- /dev/null +++ b/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr @@ -0,0 +1,27 @@ +error: reference to `Umm` held across a suspend point, but should not be + --> $DIR/ref.rs:21:13 + | +LL | let guard = &mut self.u; + | ^^^^^ +LL | +LL | other().await; + | ------ the value is held across this suspend point + | +note: the lint level is defined here + --> $DIR/ref.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ +note: You gotta use Umm's, ya know? + --> $DIR/ref.rs:21: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 + | +LL | let guard = &mut self.u; + | ^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr b/src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr new file mode 100644 index 000000000..438e6489e --- /dev/null +++ b/src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr @@ -0,0 +1,27 @@ +error: `Umm` held across a suspend point, but should not be + --> $DIR/ref.rs:21:26 + | +LL | let guard = &mut self.u; + | ^^^^^^ +LL | +LL | other().await; + | ------ the value is held across this suspend point + | +note: the lint level is defined here + --> $DIR/ref.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ +note: You gotta use Umm's, ya know? + --> $DIR/ref.rs:21: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 + | +LL | let guard = &mut self.u; + | ^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/lint/must_not_suspend/ref.rs b/src/test/ui/lint/must_not_suspend/ref.rs index 738dd9e04..f6b23746f 100644 --- a/src/test/ui/lint/must_not_suspend/ref.rs +++ b/src/test/ui/lint/must_not_suspend/ref.rs @@ -1,10 +1,13 @@ // edition:2018 +// revisions: no_drop_tracking drop_tracking +// [drop_tracking] compile-flags: -Zdrop-tracking=yes +// [no_drop_tracking] compile-flags: -Zdrop-tracking=no #![feature(must_not_suspend)] #![deny(must_not_suspend)] #[must_not_suspend = "You gotta use Umm's, ya know?"] struct Umm { - i: i64 + i: i64, } struct Bar { @@ -19,11 +22,8 @@ impl Bar { other().await; - *guard = Umm { - i: 2 - } + *guard = Umm { i: 2 } } } -fn main() { -} +fn main() {} diff --git a/src/test/ui/lint/must_not_suspend/ref.stderr b/src/test/ui/lint/must_not_suspend/ref.stderr deleted file mode 100644 index 5f000014c..000000000 --- a/src/test/ui/lint/must_not_suspend/ref.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: `Umm` held across a suspend point, but should not be - --> $DIR/ref.rs:18:26 - | -LL | let guard = &mut self.u; - | ^^^^^^ -LL | -LL | other().await; - | ------ the value is held across this suspend point - | -note: the lint level is defined here - --> $DIR/ref.rs:3:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ -note: You gotta use Umm's, ya know? - --> $DIR/ref.rs:18: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:18:26 - | -LL | let guard = &mut self.u; - | ^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/lint/uninitialized-zeroed.rs b/src/test/ui/lint/uninitialized-zeroed.rs index 5cd323c01..dae258407 100644 --- a/src/test/ui/lint/uninitialized-zeroed.rs +++ b/src/test/ui/lint/uninitialized-zeroed.rs @@ -100,6 +100,18 @@ fn main() { let _val: [bool; 2] = mem::zeroed(); let _val: [bool; 2] = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + let _val: i32 = mem::zeroed(); + let _val: i32 = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + + let _val: f32 = mem::zeroed(); + let _val: f32 = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + + let _val: *const () = mem::zeroed(); + let _val: *const () = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + + let _val: *const [()] = mem::zeroed(); + let _val: *const [()] = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + // Transmute-from-0 let _val: &'static i32 = mem::transmute(0usize); //~ ERROR: does not permit zero-initialization let _val: &'static [i32] = mem::transmute((0usize, 0usize)); //~ ERROR: does not permit zero-initialization @@ -114,13 +126,12 @@ fn main() { let _val: Option<&'static i32> = mem::zeroed(); let _val: Option = mem::zeroed(); let _val: MaybeUninit<&'static i32> = mem::zeroed(); - let _val: i32 = mem::zeroed(); let _val: bool = MaybeUninit::zeroed().assume_init(); let _val: [bool; 0] = MaybeUninit::uninit().assume_init(); let _val: [!; 0] = MaybeUninit::zeroed().assume_init(); + // Some things that happen to work due to rustc implementation details, // but are not guaranteed to keep working. - let _val: i32 = mem::uninitialized(); let _val: OneFruit = mem::uninitialized(); } } diff --git a/src/test/ui/lint/uninitialized-zeroed.stderr b/src/test/ui/lint/uninitialized-zeroed.stderr index 88121a183..b46042e7b 100644 --- a/src/test/ui/lint/uninitialized-zeroed.stderr +++ b/src/test/ui/lint/uninitialized-zeroed.stderr @@ -97,7 +97,7 @@ 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 | - = note: the `!` type has no valid value + = note: integers must not be uninitialized error: the type `Void` does not permit zero-initialization --> $DIR/uninitialized-zeroed.rs:57:26 @@ -414,8 +414,52 @@ LL | let _val: [bool; 2] = mem::uninitialized(); | = note: booleans must be either `true` or `false` +error: the type `i32` does not permit being left uninitialized + --> $DIR/uninitialized-zeroed.rs:104:25 + | +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 + | + = note: integers must not be uninitialized + +error: the type `f32` does not permit being left uninitialized + --> $DIR/uninitialized-zeroed.rs:107:25 + | +LL | let _val: f32 = mem::uninitialized(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | + = note: floats must not be uninitialized + +error: the type `*const ()` does not permit being left uninitialized + --> $DIR/uninitialized-zeroed.rs:110:31 + | +LL | let _val: *const () = mem::uninitialized(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | + = note: raw pointers must not be uninitialized + +error: the type `*const [()]` does not permit being left uninitialized + --> $DIR/uninitialized-zeroed.rs:113:33 + | +LL | let _val: *const [()] = mem::uninitialized(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit` instead, and only call `assume_init` after initialization is done + | + = note: raw pointers must not be uninitialized + error: the type `&i32` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:104:34 + --> $DIR/uninitialized-zeroed.rs:116:34 | LL | let _val: &'static i32 = mem::transmute(0usize); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -426,7 +470,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize); = note: references must be non-null error: the type `&[i32]` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:105:36 + --> $DIR/uninitialized-zeroed.rs:117:36 | LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -437,7 +481,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize)); = note: references must be non-null error: the type `NonZeroU32` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:106:32 + --> $DIR/uninitialized-zeroed.rs:118:32 | LL | let _val: NonZeroU32 = mem::transmute(0); | ^^^^^^^^^^^^^^^^^ @@ -448,7 +492,7 @@ LL | let _val: NonZeroU32 = mem::transmute(0); = note: `std::num::NonZeroU32` must be non-null error: the type `NonNull` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:109:34 + --> $DIR/uninitialized-zeroed.rs:121:34 | LL | let _val: NonNull = MaybeUninit::zeroed().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -459,7 +503,7 @@ LL | let _val: NonNull = MaybeUninit::zeroed().assume_init(); = note: `std::ptr::NonNull` must be non-null error: the type `NonNull` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:110:34 + --> $DIR/uninitialized-zeroed.rs:122:34 | LL | let _val: NonNull = MaybeUninit::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -470,7 +514,7 @@ LL | let _val: NonNull = MaybeUninit::uninit().assume_init(); = note: `std::ptr::NonNull` must be non-null error: the type `bool` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:111:26 + --> $DIR/uninitialized-zeroed.rs:123:26 | LL | let _val: bool = MaybeUninit::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -480,5 +524,5 @@ LL | let _val: bool = MaybeUninit::uninit().assume_init(); | = note: booleans must be either `true` or `false` -error: aborting due to 39 previous errors +error: aborting due to 43 previous errors diff --git a/src/test/ui/lint/unused/issue-54180-unused-ref-field.stderr b/src/test/ui/lint/unused/issue-54180-unused-ref-field.stderr index c501aa25f..f2e616899 100644 --- a/src/test/ui/lint/unused/issue-54180-unused-ref-field.stderr +++ b/src/test/ui/lint/unused/issue-54180-unused-ref-field.stderr @@ -11,12 +11,6 @@ LL | #![deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` -error: unused variable: `x` - --> $DIR/issue-54180-unused-ref-field.rs:29:45 - | -LL | let _: i32 = points.iter().map(|Point { x, y }| y).sum(); - | ^ help: try ignoring the field: `x: _` - error: unused variable: `f1` --> $DIR/issue-54180-unused-ref-field.rs:26:13 | @@ -29,5 +23,11 @@ error: unused variable: `x` LL | Point { y, ref mut x } => y, | ^^^^^^^^^ help: try ignoring the field: `x: _` +error: unused variable: `x` + --> $DIR/issue-54180-unused-ref-field.rs:29:45 + | +LL | let _: i32 = points.iter().map(|Point { x, y }| y).sum(); + | ^ help: try ignoring the field: `x: _` + error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/unused/lint-unused-variables.stderr b/src/test/ui/lint/unused/lint-unused-variables.stderr index d6e684e83..fd9a5bcbf 100644 --- a/src/test/ui/lint/unused/lint-unused-variables.stderr +++ b/src/test/ui/lint/unused/lint-unused-variables.stderr @@ -17,55 +17,55 @@ LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `a` - --> $DIR/lint-unused-variables.rs:68:9 + --> $DIR/lint-unused-variables.rs:22:9 | LL | a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:74:9 + --> $DIR/lint-unused-variables.rs:29:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:42:9 + --> $DIR/lint-unused-variables.rs:34:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:47:9 + --> $DIR/lint-unused-variables.rs:42:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` -error: unused variable: `a` - --> $DIR/lint-unused-variables.rs:22:9 - | -LL | a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` - error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:29:9 + --> $DIR/lint-unused-variables.rs:47:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:34:9 + --> $DIR/lint-unused-variables.rs:55:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:55:9 + --> $DIR/lint-unused-variables.rs:60:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` +error: unused variable: `a` + --> $DIR/lint-unused-variables.rs:68:9 + | +LL | a: i32, + | ^ help: if this is intentional, prefix it with an underscore: `_a` + error: unused variable: `b` - --> $DIR/lint-unused-variables.rs:60:9 + --> $DIR/lint-unused-variables.rs:74:9 | LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` diff --git a/src/test/ui/lint/unused/unused_attributes-must_use.rs b/src/test/ui/lint/unused/unused_attributes-must_use.rs index 1c4abb949..51f868706 100644 --- a/src/test/ui/lint/unused/unused_attributes-must_use.rs +++ b/src/test/ui/lint/unused/unused_attributes-must_use.rs @@ -122,4 +122,10 @@ fn main() { Some(res) => res, None => 0, }; + + struct PatternField { + foo: i32, + } + let s = PatternField { #[must_use] foo: 123 }; //~ ERROR `#[must_use]` has no effect + let PatternField { #[must_use] foo } = s; //~ ERROR `#[must_use]` has no effect } diff --git a/src/test/ui/lint/unused/unused_attributes-must_use.stderr b/src/test/ui/lint/unused/unused_attributes-must_use.stderr index 317d81c59..dd112c23e 100644 --- a/src/test/ui/lint/unused/unused_attributes-must_use.stderr +++ b/src/test/ui/lint/unused/unused_attributes-must_use.stderr @@ -105,6 +105,18 @@ error: `#[must_use]` has no effect when applied to an match arm LL | #[must_use] | ^^^^^^^^^^^ +error: `#[must_use]` has no effect when applied to a struct field + --> $DIR/unused_attributes-must_use.rs:129:28 + | +LL | let s = PatternField { #[must_use] foo: 123 }; + | ^^^^^^^^^^^ + +error: `#[must_use]` has no effect when applied to a pattern field + --> $DIR/unused_attributes-must_use.rs:130:24 + | +LL | let PatternField { #[must_use] foo } = s; + | ^^^^^^^^^^^ + error: `#[must_use]` has no effect when applied to an associated const --> $DIR/unused_attributes-must_use.rs:68:5 | @@ -171,5 +183,5 @@ error: unused return value of `Use::get_four` that must be used LL | ().get_four(); | ^^^^^^^^^^^^^^ -error: aborting due to 26 previous errors +error: aborting due to 28 previous errors diff --git a/src/test/ui/lint/unused_labels.rs b/src/test/ui/lint/unused_labels.rs index 8a3568f65..87a5392fd 100644 --- a/src/test/ui/lint/unused_labels.rs +++ b/src/test/ui/lint/unused_labels.rs @@ -4,7 +4,6 @@ // check-pass -#![feature(label_break_value)] #![warn(unused_labels)] fn main() { diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr index 85adc9ab3..846da792b 100644 --- a/src/test/ui/lint/unused_labels.stderr +++ b/src/test/ui/lint/unused_labels.stderr @@ -1,5 +1,5 @@ warning: label name `'many_used_shadowed` shadows a label name that is already in scope - --> $DIR/unused_labels.rs:62:9 + --> $DIR/unused_labels.rs:61:9 | LL | 'many_used_shadowed: for _ in 0..10 { | ------------------- first declared here @@ -8,55 +8,55 @@ LL | 'many_used_shadowed: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^ label `'many_used_shadowed` already in scope warning: unused label - --> $DIR/unused_labels.rs:11:5 + --> $DIR/unused_labels.rs:10:5 | LL | 'unused_while_label: while 0 == 0 { | ^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/unused_labels.rs:8:9 + --> $DIR/unused_labels.rs:7:9 | LL | #![warn(unused_labels)] | ^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:16:5 + --> $DIR/unused_labels.rs:15:5 | LL | 'unused_while_let_label: while let Some(_) = opt { | ^^^^^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:20:5 + --> $DIR/unused_labels.rs:19:5 | LL | 'unused_for_label: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:36:9 + --> $DIR/unused_labels.rs:35:9 | LL | 'unused_loop_label_inner_2: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:42:5 + --> $DIR/unused_labels.rs:41:5 | LL | 'unused_loop_label_outer_3: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:60:5 + --> $DIR/unused_labels.rs:59:5 | LL | 'many_used_shadowed: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:72:5 + --> $DIR/unused_labels.rs:71:5 | LL | 'unused_loop_label: loop { | ^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:78:5 + --> $DIR/unused_labels.rs:77:5 | LL | 'unused_block_label: { | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/unused_parens_multibyte_recovery.rs b/src/test/ui/lint/unused_parens_multibyte_recovery.rs new file mode 100644 index 000000000..8fcfae22a --- /dev/null +++ b/src/test/ui/lint/unused_parens_multibyte_recovery.rs @@ -0,0 +1,11 @@ +// ignore-tidy-trailing-newlines +// +// 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. + +fn f(){(print!(á \ No newline at end of file diff --git a/src/test/ui/lint/unused_parens_multibyte_recovery.stderr b/src/test/ui/lint/unused_parens_multibyte_recovery.stderr new file mode 100644 index 000000000..a0302b17e --- /dev/null +++ b/src/test/ui/lint/unused_parens_multibyte_recovery.stderr @@ -0,0 +1,43 @@ +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: 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 + diff --git a/src/test/ui/liveness/liveness-consts.stderr b/src/test/ui/liveness/liveness-consts.stderr index adaf54316..16209d16c 100644 --- a/src/test/ui/liveness/liveness-consts.stderr +++ b/src/test/ui/liveness/liveness-consts.stderr @@ -39,12 +39,6 @@ warning: unused variable: `z` LL | pub fn f(x: [u8; { let s = 17; 100 }]) -> [u8; { let z = 18; 100 }] { | ^ help: if this is intentional, prefix it with an underscore: `_z` -warning: unused variable: `z` - --> $DIR/liveness-consts.rs:60:13 - | -LL | let z = 42; - | ^ help: if this is intentional, prefix it with an underscore: `_z` - warning: value assigned to `t` is never read --> $DIR/liveness-consts.rs:42:9 | @@ -59,5 +53,11 @@ warning: unused variable: `w` LL | let w = 10; | ^ help: if this is intentional, prefix it with an underscore: `_w` +warning: unused variable: `z` + --> $DIR/liveness-consts.rs:60:13 + | +LL | let z = 42; + | ^ help: if this is intentional, prefix it with an underscore: `_z` + warning: 8 warnings emitted diff --git a/src/test/ui/lowering/issue-96847.rs b/src/test/ui/lowering/issue-96847.rs new file mode 100644 index 000000000..2aa34c8b3 --- /dev/null +++ b/src/test/ui/lowering/issue-96847.rs @@ -0,0 +1,14 @@ +// run-pass + +// Test that this doesn't abort during AST lowering. In #96847 it did abort +// because the attribute was being lowered twice. + +#![feature(stmt_expr_attributes)] +#![feature(lang_items)] + +fn main() { + for _ in [1,2,3] { + #![lang="foo"] + println!("foo"); + } +} diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr deleted file mode 100644 index 217392aa3..000000000 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown debugging option: `borrowck` - diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr deleted file mode 100644 index 217392aa3..000000000 --- a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown debugging option: `borrowck` - diff --git a/src/test/ui/macros/auxiliary/issue-100199.rs b/src/test/ui/macros/auxiliary/issue-100199.rs new file mode 100644 index 000000000..9e190b542 --- /dev/null +++ b/src/test/ui/macros/auxiliary/issue-100199.rs @@ -0,0 +1,18 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_quote)] + +extern crate proc_macro; + +use proc_macro::{quote, Ident, Span, TokenStream, TokenTree}; + +#[proc_macro_attribute] +pub fn struct_with_bound(_: TokenStream, _: TokenStream) -> TokenStream { + let crate_ident = TokenTree::Ident(Ident::new("crate", Span::call_site())); + let trait_ident = TokenTree::Ident(Ident::new("MyTrait", Span::call_site())); + quote!( + struct Foo {} + ) +} diff --git a/src/test/ui/macros/issue-100199.rs b/src/test/ui/macros/issue-100199.rs new file mode 100644 index 000000000..6e50afa07 --- /dev/null +++ b/src/test/ui/macros/issue-100199.rs @@ -0,0 +1,16 @@ +#[issue_100199::struct_with_bound] //~ ERROR cannot find trait `MyTrait` in the crate root +struct Foo {} +// The above must be on the first line so that it's span points to pos 0. +// This used to trigger an ICE because the diagnostic emitter would get +// an unexpected dummy span (lo == 0 == hi) while attempting to print a +// suggestion. + +// aux-build: issue-100199.rs + +extern crate issue_100199; + +mod traits { + pub trait MyTrait {} +} + +fn main() {} diff --git a/src/test/ui/macros/issue-100199.stderr b/src/test/ui/macros/issue-100199.stderr new file mode 100644 index 000000000..2cb45dc12 --- /dev/null +++ b/src/test/ui/macros/issue-100199.stderr @@ -0,0 +1,15 @@ +error[E0405]: cannot find trait `MyTrait` in the crate root + --> $DIR/issue-100199.rs:1:1 + | +LL | #[issue_100199::struct_with_bound] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in the crate root + | + = note: this error originates in the attribute macro `issue_100199::struct_with_bound` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider importing this trait + | +LL | use traits::MyTrait; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0405`. diff --git a/src/test/ui/macros/stringify.rs b/src/test/ui/macros/stringify.rs index f246aa26a..dd159cb5b 100644 --- a/src/test/ui/macros/stringify.rs +++ b/src/test/ui/macros/stringify.rs @@ -3,11 +3,17 @@ // compile-flags: --test #![feature(async_closure)] +#![feature(box_patterns)] +#![feature(box_syntax)] #![feature(const_trait_impl)] +#![feature(decl_macro)] #![feature(generators)] #![feature(half_open_range_patterns)] #![feature(more_qualified_paths)] #![feature(raw_ref_op)] +#![feature(trait_alias)] +#![feature(try_blocks)] +#![feature(type_ascription)] #![deny(unused_macros)] macro_rules! stringify_block { @@ -865,8 +871,9 @@ fn test_vis() { assert_eq!(stringify_vis!(pub(crate)), "pub(crate) "); assert_eq!(stringify_vis!(pub(self)), "pub(self) "); assert_eq!(stringify_vis!(pub(super)), "pub(super) "); - assert_eq!(stringify_vis!(pub(in self)), "pub(self) "); - assert_eq!(stringify_vis!(pub(in super)), "pub(super) "); + assert_eq!(stringify_vis!(pub(in crate)), "pub(in crate) "); + assert_eq!(stringify_vis!(pub(in self)), "pub(in self) "); + assert_eq!(stringify_vis!(pub(in super)), "pub(in super) "); assert_eq!(stringify_vis!(pub(in path::to)), "pub(in path::to) "); assert_eq!(stringify_vis!(pub(in ::path::to)), "pub(in ::path::to) "); assert_eq!(stringify_vis!(pub(in self::path::to)), "pub(in self::path::to) "); diff --git a/src/test/ui/malformed/malformed-regressions.stderr b/src/test/ui/malformed/malformed-regressions.stderr index 13c12ff72..8c2625bdf 100644 --- a/src/test/ui/malformed/malformed-regressions.stderr +++ b/src/test/ui/malformed/malformed-regressions.stderr @@ -26,7 +26,7 @@ LL | #[inline = ""] = 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 #57571 -error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...")]` +error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` --> $DIR/malformed-regressions.rs:7:1 | LL | #[link] @@ -35,7 +35,7 @@ LL | #[link] = 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 #57571 -error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...")]` +error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` --> $DIR/malformed-regressions.rs:9:1 | LL | #[link = ""] diff --git a/src/test/ui/match/issue-42679.rs b/src/test/ui/match/issue-42679.rs index 596309f25..46a0bd35d 100644 --- a/src/test/ui/match/issue-42679.rs +++ b/src/test/ui/match/issue-42679.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] #![feature(box_patterns)] #[derive(Debug, PartialEq)] @@ -9,13 +8,13 @@ enum Test { } fn main() { - let a = box Test::Foo(10); - let b = box Test::Bar(-20); + let a = Box::new(Test::Foo(10)); + let b = Box::new(Test::Bar(-20)); match (a, b) { (_, box Test::Foo(_)) => unreachable!(), (box Test::Foo(x), b) => { assert_eq!(x, 10); - assert_eq!(b, box Test::Bar(-20)); + assert_eq!(b, Box::new(Test::Bar(-20))); }, _ => unreachable!(), } diff --git a/src/test/ui/match/match_non_exhaustive.rs b/src/test/ui/match/match_non_exhaustive.rs index 8219f0eb1..f162dd60f 100644 --- a/src/test/ui/match/match_non_exhaustive.rs +++ b/src/test/ui/match/match_non_exhaustive.rs @@ -21,7 +21,7 @@ fn main() { match l { L::A => (), L::B => () }; // (except if the match is already non-exhaustive) match l { L::A => () }; - //~^ ERROR: non-exhaustive patterns: `B` not covered [E0004] + //~^ ERROR: non-exhaustive patterns: `L::B` not covered [E0004] // E1 is not visibly uninhabited from here let (e1, e2) = bar(); diff --git a/src/test/ui/match/match_non_exhaustive.stderr b/src/test/ui/match/match_non_exhaustive.stderr index 9d92f8fdb..46ee8d517 100644 --- a/src/test/ui/match/match_non_exhaustive.stderr +++ b/src/test/ui/match/match_non_exhaustive.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `B` not covered +error[E0004]: non-exhaustive patterns: `L::B` not covered --> $DIR/match_non_exhaustive.rs:23:11 | LL | match l { L::A => () }; - | ^ pattern `B` not covered + | ^ pattern `L::B` not covered | note: `L` defined here --> $DIR/match_non_exhaustive.rs:10:13 @@ -12,8 +12,8 @@ LL | enum L { A, B } = note: the matched value is of type `L` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL | match l { L::A => (), B => todo!() }; - | ++++++++++++++ +LL | match l { L::A => (), L::B => todo!() }; + | +++++++++++++++++ error[E0004]: non-exhaustive patterns: type `E1` is non-empty --> $DIR/match_non_exhaustive.rs:28:11 diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index 690fe8fa7..a4ffb864d 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -8,11 +8,11 @@ note: associated function 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 function takes 1 argument but 0 arguments were supplied --> $DIR/method-call-err-msg.rs:14:7 @@ -24,11 +24,11 @@ note: associated function defined here --> $DIR/method-call-err-msg.rs:6:8 | LL | fn one(self, _: isize) -> Foo { self } - | ^^^ ---- -------- + | ^^^ -------- help: provide the argument | LL | .one(/* isize */) - | ~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/method-call-err-msg.rs:15:7 @@ -40,11 +40,11 @@ note: associated function defined here --> $DIR/method-call-err-msg.rs:7:8 | LL | fn two(self, _: isize, _: isize) -> Foo { self } - | ^^^ ---- -------- -------- + | ^^^ -------- -------- help: provide the argument | LL | .two(0, /* isize */); - | ~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~ error[E0599]: `Foo` is not an iterator --> $DIR/method-call-err-msg.rs:19:7 @@ -80,11 +80,11 @@ note: associated function defined here --> $DIR/method-call-err-msg.rs:8:8 | LL | fn three(self, _: T, _: T, _: T) -> Foo { self } - | ^^^^^ ---- ---- ---- ---- + | ^^^^^ ---- ---- ---- help: provide the arguments | LL | y.three::(/* usize */, /* usize */, /* usize */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr index 0af58bc61..917334116 100644 --- a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -18,7 +18,7 @@ LL | let x = y.neg(); help: you must specify a type for this binding, like `f32` | LL | let y: f32 = 2.0; - | ~~~~~~ + | +++++ error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` --> $DIR/method-on-ambiguous-numeric-type.rs:19:26 @@ -37,7 +37,7 @@ LL | local_bar.pow(2); help: you must specify a type for this binding, like `i32` | LL | ($ident:ident) => { let $ident: i32 = 42; } - | ~~~~~~~~~~~ + | +++++ error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` --> $DIR/method-on-ambiguous-numeric-type.rs:30:9 @@ -46,10 +46,10 @@ LL | bar.pow(2); | ^^^ | help: you must specify a type for this binding, like `i32` - --> $DIR/auxiliary/macro-in-other-crate.rs:3:29 + --> $DIR/auxiliary/macro-in-other-crate.rs:3:35 | LL | ($ident:ident) => { let $ident: i32 = 42; } - | ~~~~~~~~~~~ + | +++++ error: aborting due to 5 previous errors diff --git a/src/test/ui/mir/issue-100476-recursion-check-blewup.rs b/src/test/ui/mir/issue-100476-recursion-check-blewup.rs deleted file mode 100644 index bc2f32f4c..000000000 --- a/src/test/ui/mir/issue-100476-recursion-check-blewup.rs +++ /dev/null @@ -1,42 +0,0 @@ -// check-pass - -// compile-flags: --emit=mir,link -O - -// At one point the MIR inlining, when guarding against infinitely (or even just -// excessive) recursion, was using `ty::Instance` as the basis for its history -// check. The problem is that when you have polymorphic recursion, you can have -// distinct instances of the same code (because you're inlining the same code -// with differing substitutions), causing the amount of inlining to blow up -// exponentially. -// -// This test illustrates an example of that filed in issue rust#100476. - -#![allow(unconditional_recursion)] -#![feature(decl_macro)] - -macro emit($($m:ident)*) {$( - // Randomize `def_path_hash` by defining them under a module with - // different names - pub mod $m { - pub trait Tr { - type Next: Tr; - } - - pub fn hoge() { - inner::(); - } - - #[inline(always)] - fn inner() { - inner::(); - } - } -)*} - -// Increase the chance of triggering the bug -emit!( - m00 m01 m02 m03 m04 m05 m06 m07 m08 m09 - m10 m11 m12 m13 m14 m15 m16 m17 m18 m19 -); - -fn main() { } diff --git a/src/test/ui/mir/issue-101844.rs b/src/test/ui/mir/issue-101844.rs new file mode 100644 index 000000000..da8a25f5f --- /dev/null +++ b/src/test/ui/mir/issue-101844.rs @@ -0,0 +1,73 @@ +// check-pass + +pub trait FirstTrait { + type Item; + type Extra: Extra<(), Error = Self::Item>; +} + +trait SecondTrait { + type Item2; +} + +trait ThirdTrait: SecondTrait { + type Item3; +} + +trait FourthTrait { + type Item4; +} + +impl SecondTrait for First +where + First: FirstTrait, +{ + type Item2 = First::Extra; +} + +impl ThirdTrait for Second +where + Second: SecondTrait, +{ + type Item3 = T; +} + +impl FourthTrait for Third +where + Third: ThirdTrait, +{ + type Item4 = S; +} + +pub trait Extra { + type Error; +} + +struct ImplShoulExist { + _gen: (D, Req), +} + +impl ImplShoulExist +where + D: FourthTrait, + D::Item4: Extra, + >::Error: Into<()>, +{ + fn access_fn(_: D) { + todo!() + } +} + +impl Extra for ImplShoulExist { + type Error = (); +} + +pub fn broken(ms: MS) +where + MS: FirstTrait, + MS::Item: Into<()>, +{ + // Error: Apparently Balance::new doesn't exist during MIR validation + let _ = ImplShoulExist::::access_fn(ms); +} + +fn main() {} diff --git a/src/test/ui/mir/issue-102389.rs b/src/test/ui/mir/issue-102389.rs new file mode 100644 index 000000000..8b27d5e55 --- /dev/null +++ b/src/test/ui/mir/issue-102389.rs @@ -0,0 +1,8 @@ +enum Enum { A, B, C } + +fn func(inbounds: &Enum, array: &[i16; 3]) -> i16 { + array[*inbounds as usize] + //~^ ERROR [E0507] +} + +fn main() {} diff --git a/src/test/ui/mir/issue-102389.stderr b/src/test/ui/mir/issue-102389.stderr new file mode 100644 index 000000000..925dc258a --- /dev/null +++ b/src/test/ui/mir/issue-102389.stderr @@ -0,0 +1,9 @@ +error[E0507]: cannot move out of `*inbounds` which is behind a shared reference + --> $DIR/issue-102389.rs:4:11 + | +LL | array[*inbounds as usize] + | ^^^^^^^^^ move occurs because `*inbounds` has type `Enum`, which does not implement the `Copy` trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/mir/issue-99852.rs b/src/test/ui/mir/issue-99852.rs new file mode 100644 index 000000000..1c675788e --- /dev/null +++ b/src/test/ui/mir/issue-99852.rs @@ -0,0 +1,24 @@ +// check-pass +// compile-flags: -Z validate-mir +#![feature(let_chains)] + +fn lambda() -> U +where + T: Default, + U: Default, +{ + let foo: Result = Ok(T::default()); + let baz: U = U::default(); + + if let Ok(foo) = foo && let Ok(bar) = transform(foo) { + bar + } else { + baz + } +} + +fn transform(input: T) -> Result { + todo!() +} + +fn main() {} diff --git a/src/test/ui/mir/issue-99866.rs b/src/test/ui/mir/issue-99866.rs new file mode 100644 index 000000000..d39ae6ebf --- /dev/null +++ b/src/test/ui/mir/issue-99866.rs @@ -0,0 +1,25 @@ +// check-pass +pub trait Backend { + type DescriptorSetLayout; +} + +pub struct Back; + +impl Backend for Back { + type DescriptorSetLayout = u32; +} + +pub struct HalSetLayouts { + vertex_layout: ::DescriptorSetLayout, +} + +impl HalSetLayouts { + pub fn iter(self) -> DSL + where + Back: Backend, + { + self.vertex_layout + } +} + +fn main() {} diff --git a/src/test/ui/mir/mir-inlining/ice-issue-100550-unnormalized-projection.rs b/src/test/ui/mir/mir-inlining/ice-issue-100550-unnormalized-projection.rs new file mode 100644 index 000000000..f67b07354 --- /dev/null +++ b/src/test/ui/mir/mir-inlining/ice-issue-100550-unnormalized-projection.rs @@ -0,0 +1,30 @@ +// This test verifies that we do not ICE due to MIR inlining in case of normalization failure +// in a projection. +// +// compile-flags: --crate-type lib -C opt-level=3 +// build-pass + +pub trait Trait { + type Associated; +} +impl Trait for T { + type Associated = T; +} + +pub struct Struct(::Associated); + +pub fn foo() -> Struct +where + T: Trait, +{ + bar() +} + +#[inline] +fn bar() -> Struct { + Struct(baz()) +} + +fn baz() -> T { + unimplemented!() +} diff --git a/src/test/ui/mir/mir_codegen_calls_diverging_drops.rs b/src/test/ui/mir/mir_codegen_calls_diverging_drops.rs index 796d74477..3d2156105 100644 --- a/src/test/ui/mir/mir_codegen_calls_diverging_drops.rs +++ b/src/test/ui/mir/mir_codegen_calls_diverging_drops.rs @@ -2,6 +2,7 @@ // error-pattern:diverging_fn called // error-pattern:0 dropped // ignore-emscripten no processes +// needs-unwind this test checks that a destructor is called after panicking struct Droppable(u8); impl Drop for Droppable { diff --git a/src/test/ui/mismatched_types/E0409.stderr b/src/test/ui/mismatched_types/E0409.stderr index ef03b67b1..7fec6ecd7 100644 --- a/src/test/ui/mismatched_types/E0409.stderr +++ b/src/test/ui/mismatched_types/E0409.stderr @@ -17,6 +17,10 @@ LL | (0, ref y) | (y, 0) => {} | first introduced with type `&{integer}` here | = note: in the same arm, a binding must have the same type in all alternatives +help: consider adding `ref` + | +LL | (0, ref y) | (ref y, 0) => {} + | +++ error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/E0631.rs b/src/test/ui/mismatched_types/E0631.rs index a29394658..83dbdb77a 100644 --- a/src/test/ui/mismatched_types/E0631.rs +++ b/src/test/ui/mismatched_types/E0631.rs @@ -1,7 +1,7 @@ #![feature(unboxed_closures)] fn foo(_: F) {} -fn bar>(_: F) {} +fn bar>(_: F) {} fn main() { fn f(_: u64) {} foo(|_: isize| {}); //~ ERROR type mismatch diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index 4d673d455..410ea4b0b 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -27,8 +27,8 @@ LL | bar(|_: isize| {}); note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | -LL | fn bar>(_: F) {} - | ^^^^^^^^^ required by this bound in `bar` +LL | fn bar>(_: F) {} + | ^^^^^^^^^^^^ required by this bound in `bar` error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:9:9 @@ -65,8 +65,8 @@ LL | bar(f); note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | -LL | fn bar>(_: F) {} - | ^^^^^^^^^ required by this bound in `bar` +LL | fn bar>(_: F) {} + | ^^^^^^^^^^^^ required by this bound in `bar` error: aborting due to 4 previous errors diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs index e817631ad..65c8d6a7e 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.rs +++ b/src/test/ui/mismatched_types/closure-arg-count.rs @@ -1,6 +1,6 @@ #![feature(unboxed_closures)] -fn f>(_: F) {} +fn f>(_: F) {} fn main() { [1, 2, 3].sort_by(|| panic!()); //~^ ERROR closure is expected to take diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index 3968774e3..a02ec8198 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -56,8 +56,8 @@ LL | f(|| panic!()); note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 | -LL | fn f>(_: F) {} - | ^^^^^^^^^ required by this bound in `f` +LL | fn f>(_: F) {} + | ^^^^^^^^^^^^ required by this bound in `f` help: consider changing the closure to take and ignore the expected argument | LL | f(|_| panic!()); @@ -74,8 +74,8 @@ LL | f( move || panic!()); note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 | -LL | fn f>(_: F) {} - | ^^^^^^^^^ required by this bound in `f` +LL | fn f>(_: F) {} + | ^^^^^^^^^^^^ required by this bound in `f` help: consider changing the closure to take and ignore the expected argument | LL | f( move |_| panic!()); diff --git a/src/test/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.rs b/src/test/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.rs new file mode 100644 index 000000000..d302dc99b --- /dev/null +++ b/src/test/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.rs @@ -0,0 +1,23 @@ +struct S; +struct Y; + +trait Trait {} + +impl Trait for Y {} + +fn foo() -> impl Trait { + if true { + S + } else { + Y //~ ERROR `if` and `else` have incompatible types + } +} + +fn bar() -> impl Trait { + match true { + true => S, + false => Y, //~ ERROR `match` arms have incompatible types + } +} + +fn main() {} diff --git a/src/test/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr b/src/test/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr new file mode 100644 index 000000000..2f814445b --- /dev/null +++ b/src/test/ui/mismatched_types/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.stderr @@ -0,0 +1,26 @@ +error[E0308]: `if` and `else` have incompatible types + --> $DIR/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.rs:12:9 + | +LL | / if true { +LL | | S + | | - expected because of this +LL | | } else { +LL | | Y + | | ^ expected struct `S`, found struct `Y` +LL | | } + | |_____- `if` and `else` have incompatible types + +error[E0308]: `match` arms have incompatible types + --> $DIR/do-not-suggest-boxed-trait-objects-instead-of-impl-trait.rs:19:18 + | +LL | / match true { +LL | | true => S, + | | - this is found to be of type `S` +LL | | false => Y, + | | ^ expected struct `S`, found struct `Y` +LL | | } + | |_____- `match` arms have incompatible types + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/mismatched_types/dont-point-return-on-E0308.rs b/src/test/ui/mismatched_types/dont-point-return-on-E0308.rs new file mode 100644 index 000000000..f2ba610e2 --- /dev/null +++ b/src/test/ui/mismatched_types/dont-point-return-on-E0308.rs @@ -0,0 +1,18 @@ +// edition:2021 + +async fn f(_: &()) {} +//~^ NOTE function defined here +//~| NOTE +// Second note is the span of the underlined argument, I think... + +fn main() { + (|| async { + Err::<(), ()>(())?; + f(()); + //~^ ERROR mismatched types + //~| NOTE arguments to this function are incorrect + //~| NOTE expected `&()`, found `()` + //~| HELP consider borrowing here + Ok::<(), ()>(()) + })(); +} diff --git a/src/test/ui/mismatched_types/dont-point-return-on-E0308.stderr b/src/test/ui/mismatched_types/dont-point-return-on-E0308.stderr new file mode 100644 index 000000000..13942682d --- /dev/null +++ b/src/test/ui/mismatched_types/dont-point-return-on-E0308.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/dont-point-return-on-E0308.rs:11:11 + | +LL | f(()); + | - ^^ + | | | + | | expected `&()`, found `()` + | | help: consider borrowing here: `&()` + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/dont-point-return-on-E0308.rs:3:10 + | +LL | async fn f(_: &()) {} + | ^ ------ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/mismatched_types/issue-19109.stderr b/src/test/ui/mismatched_types/issue-19109.stderr index c25e2687b..5cef64bb1 100644 --- a/src/test/ui/mismatched_types/issue-19109.stderr +++ b/src/test/ui/mismatched_types/issue-19109.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn function(t: &mut dyn Trait) { | - help: try adding a return type: `-> *mut dyn Trait` LL | t as *mut dyn Trait - | ^^^^^^^^^^^^^^^^^^^ expected `()`, found *-ptr + | ^^^^^^^^^^^^^^^^^^^ expected `()`, found `*mut dyn Trait` | = note: expected unit type `()` found raw pointer `*mut dyn Trait` diff --git a/src/test/ui/mismatched_types/issue-84976.stderr b/src/test/ui/mismatched_types/issue-84976.stderr index f8f2b1f0f..9157566e3 100644 --- a/src/test/ui/mismatched_types/issue-84976.stderr +++ b/src/test/ui/mismatched_types/issue-84976.stderr @@ -3,6 +3,11 @@ error[E0308]: mismatched types | LL | length = { foo(&length) }; | ^^^^^^^^^^^^ expected `u32`, found `i32` + | +help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit + | +LL | length = { foo(&length).try_into().unwrap() }; + | ++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/issue-84976.rs:17:14 diff --git a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr index c2515c40b..36748fae1 100644 --- a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr +++ b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr @@ -1,8 +1,10 @@ error[E0277]: `Foo` doesn't implement `Debug` - --> $DIR/method-help-unsatisfied-bound.rs:5:7 + --> $DIR/method-help-unsatisfied-bound.rs:5:5 | LL | a.unwrap(); - | ^^^^^^ `Foo` cannot be formatted using `{:?}` + | ^ ------ required by a bound introduced by this call + | | + | `Foo` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `Foo` = note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo` diff --git a/src/test/ui/mismatched_types/normalize-fn-sig.rs b/src/test/ui/mismatched_types/normalize-fn-sig.rs new file mode 100644 index 000000000..1a2093c44 --- /dev/null +++ b/src/test/ui/mismatched_types/normalize-fn-sig.rs @@ -0,0 +1,16 @@ +trait Foo { + type Bar; +} + +impl Foo for T { + type Bar = i32; +} + +fn foo(_: ::Bar, _: &'static ::Bar) {} + +fn needs_i32_ref_fn(_: fn(&'static i32, i32)) {} + +fn main() { + needs_i32_ref_fn(foo::<()>); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/mismatched_types/normalize-fn-sig.stderr b/src/test/ui/mismatched_types/normalize-fn-sig.stderr new file mode 100644 index 000000000..6c55f29c5 --- /dev/null +++ b/src/test/ui/mismatched_types/normalize-fn-sig.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/normalize-fn-sig.rs:14:22 + | +LL | needs_i32_ref_fn(foo::<()>); + | ---------------- ^^^^^^^^^ expected `&i32`, found `i32` + | | + | arguments to this function are incorrect + | + = note: expected fn pointer `fn(&'static i32, i32)` + found fn item `fn(i32, &'static i32) {foo::<()>}` +note: function defined here + --> $DIR/normalize-fn-sig.rs:11:4 + | +LL | fn needs_i32_ref_fn(_: fn(&'static i32, i32)) {} + | ^^^^^^^^^^^^^^^^ ------------------------ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index 475ea9dfa..fb3597aa8 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -26,7 +26,7 @@ LL | impl FnMut<(isize,)> for S { help: provide the argument | LL | let ans = s(/* isize */); - | ~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~ error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/overloaded-calls-bad.rs:31:15 @@ -44,7 +44,7 @@ LL | impl FnMut<(isize,)> for S { help: remove the extra argument | LL | let ans = s(/* isize */); - | ~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.fixed b/src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.fixed new file mode 100644 index 000000000..56f93cfbf --- /dev/null +++ b/src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.fixed @@ -0,0 +1,21 @@ +// run-rustfix +#![allow(dead_code, unused_variables)] + +fn main() { + enum Blah { + A(isize, isize, usize), + B(isize, usize), + } + + match Blah::A(1, 1, 2) { + Blah::A(_, x, ref y) | Blah::B(x, ref y) => {} + //~^ ERROR mismatched types + //~| ERROR variable `y` is bound inconsistently across alternatives separated by `|` + } + + match Blah::A(1, 1, 2) { + Blah::A(_, x, y) | Blah::B(x, y) => {} + //~^ ERROR mismatched types + //~| variable `y` is bound inconsistently across alternatives separated by `|` + } +} diff --git a/src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.rs b/src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.rs new file mode 100644 index 000000000..0c33f99a4 --- /dev/null +++ b/src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.rs @@ -0,0 +1,21 @@ +// run-rustfix +#![allow(dead_code, unused_variables)] + +fn main() { + enum Blah { + A(isize, isize, usize), + B(isize, usize), + } + + match Blah::A(1, 1, 2) { + Blah::A(_, x, ref y) | Blah::B(x, y) => {} + //~^ ERROR mismatched types + //~| ERROR variable `y` is bound inconsistently across alternatives separated by `|` + } + + match Blah::A(1, 1, 2) { + Blah::A(_, x, y) | Blah::B(x, ref y) => {} + //~^ ERROR mismatched types + //~| variable `y` is bound inconsistently across alternatives separated by `|` + } +} diff --git a/src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.stderr b/src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.stderr new file mode 100644 index 000000000..e8357f9a3 --- /dev/null +++ b/src/test/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.stderr @@ -0,0 +1,49 @@ +error[E0409]: variable `y` is bound inconsistently across alternatives separated by `|` + --> $DIR/suggest-adding-or-removing-ref-for-binding-pattern.rs:11:43 + | +LL | Blah::A(_, x, ref y) | Blah::B(x, y) => {} + | - first binding ^ bound in different ways + +error[E0409]: variable `y` is bound inconsistently across alternatives separated by `|` + --> $DIR/suggest-adding-or-removing-ref-for-binding-pattern.rs:17:43 + | +LL | Blah::A(_, x, y) | Blah::B(x, ref y) => {} + | - first binding ^ bound in different ways + +error[E0308]: mismatched types + --> $DIR/suggest-adding-or-removing-ref-for-binding-pattern.rs:11:43 + | +LL | match Blah::A(1, 1, 2) { + | ---------------- this expression has type `Blah` +LL | Blah::A(_, x, ref y) | Blah::B(x, y) => {} + | ----- ^ expected `&usize`, found `usize` + | | + | first introduced with type `&usize` here + | + = note: in the same arm, a binding must have the same type in all alternatives +help: consider adding `ref` + | +LL | Blah::A(_, x, ref y) | Blah::B(x, ref y) => {} + | +++ + +error[E0308]: mismatched types + --> $DIR/suggest-adding-or-removing-ref-for-binding-pattern.rs:17:39 + | +LL | match Blah::A(1, 1, 2) { + | ---------------- this expression has type `Blah` +LL | Blah::A(_, x, y) | Blah::B(x, ref y) => {} + | - ^^^^^ expected `usize`, found `&usize` + | | + | first introduced with type `usize` here + | + = note: in the same arm, a binding must have the same type in all alternatives +help: consider removing `ref` + | +LL - Blah::A(_, x, y) | Blah::B(x, ref y) => {} +LL + Blah::A(_, x, y) | Blah::B(x, y) => {} + | + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0308, E0409. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.fixed b/src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.fixed new file mode 100644 index 000000000..f30feaed0 --- /dev/null +++ b/src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.fixed @@ -0,0 +1,28 @@ +// run-rustfix + +#![allow(dead_code)] + +struct S; +struct Y; + +trait Trait {} + +impl Trait for S {} +impl Trait for Y {} + +fn foo() -> Box { + if true { + Box::new(S) + } else { + Box::new(Y) //~ ERROR `if` and `else` have incompatible types + } +} + +fn bar() -> Box { + match true { + true => Box::new(S), + false => Box::new(Y), //~ ERROR `match` arms have incompatible types + } +} + +fn main() {} diff --git a/src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.rs b/src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.rs new file mode 100644 index 000000000..2bd8146e2 --- /dev/null +++ b/src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.rs @@ -0,0 +1,28 @@ +// run-rustfix + +#![allow(dead_code)] + +struct S; +struct Y; + +trait Trait {} + +impl Trait for S {} +impl Trait for Y {} + +fn foo() -> impl Trait { + if true { + S + } else { + Y //~ ERROR `if` and `else` have incompatible types + } +} + +fn bar() -> impl Trait { + match true { + true => S, + false => Y, //~ ERROR `match` arms have incompatible types + } +} + +fn main() {} diff --git a/src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr b/src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr new file mode 100644 index 000000000..f58b9c3ec --- /dev/null +++ b/src/test/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr @@ -0,0 +1,47 @@ +error[E0308]: `if` and `else` have incompatible types + --> $DIR/suggest-boxed-trait-objects-instead-of-impl-trait.rs:17:9 + | +LL | / if true { +LL | | S + | | - expected because of this +LL | | } else { +LL | | Y + | | ^ expected struct `S`, found struct `Y` +LL | | } + | |_____- `if` and `else` have incompatible types + | +help: you could change the return type to be a boxed trait object + | +LL | fn foo() -> Box { + | ~~~~~~~ + +help: if you change the return type to expect trait objects, box the returned expressions + | +LL ~ Box::new(S) +LL | } else { +LL ~ Box::new(Y) + | + +error[E0308]: `match` arms have incompatible types + --> $DIR/suggest-boxed-trait-objects-instead-of-impl-trait.rs:24:18 + | +LL | / match true { +LL | | true => S, + | | - this is found to be of type `S` +LL | | false => Y, + | | ^ expected struct `S`, found struct `Y` +LL | | } + | |_____- `match` arms have incompatible types + | +help: you could change the return type to be a boxed trait object + | +LL | fn bar() -> Box { + | ~~~~~~~ + +help: if you change the return type to expect trait objects, box the returned expressions + | +LL ~ true => Box::new(S), +LL ~ false => Box::new(Y), + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/modules/auxiliary/dummy_lib.rs b/src/test/ui/modules/auxiliary/dummy_lib.rs new file mode 100644 index 000000000..ef805c1f0 --- /dev/null +++ b/src/test/ui/modules/auxiliary/dummy_lib.rs @@ -0,0 +1,2 @@ +#[allow(dead_code)] +pub struct Dummy; diff --git a/src/test/ui/modules/special_module_name.rs b/src/test/ui/modules/special_module_name.rs new file mode 100644 index 000000000..15c59b2da --- /dev/null +++ b/src/test/ui/modules/special_module_name.rs @@ -0,0 +1,8 @@ +mod lib; +//~^ WARN found module declaration for lib.rs +//~| ERROR file not found for module `lib` +mod main; +//~^ WARN found module declaration for main.rs +//~| ERROR file not found for module `main` + +fn main() {} diff --git a/src/test/ui/modules/special_module_name.stderr b/src/test/ui/modules/special_module_name.stderr new file mode 100644 index 000000000..8b3da2938 --- /dev/null +++ b/src/test/ui/modules/special_module_name.stderr @@ -0,0 +1,37 @@ +error[E0583]: file not found for module `lib` + --> $DIR/special_module_name.rs:1:1 + | +LL | mod lib; + | ^^^^^^^^ + | + = help: to create the module `lib`, create file "$DIR/lib.rs" or "$DIR/lib/mod.rs" + +error[E0583]: file not found for module `main` + --> $DIR/special_module_name.rs:4:1 + | +LL | mod main; + | ^^^^^^^^^ + | + = help: to create the module `main`, create file "$DIR/main.rs" or "$DIR/main/mod.rs" + +warning: found module declaration for lib.rs + --> $DIR/special_module_name.rs:1:1 + | +LL | mod lib; + | ^^^^^^^^ + | + = note: `#[warn(special_module_name)]` on by default + = note: lib.rs is the root of this crate's library target + = help: to refer to it from other targets, use the library's name as the path + +warning: found module declaration for main.rs + --> $DIR/special_module_name.rs:4:1 + | +LL | mod main; + | ^^^^^^^^^ + | + = note: a binary crate cannot be used as library + +error: aborting due to 2 previous errors; 2 warnings emitted + +For more information about this error, try `rustc --explain E0583`. diff --git a/src/test/ui/modules/special_module_name_ignore.rs b/src/test/ui/modules/special_module_name_ignore.rs new file mode 100644 index 000000000..07cea9b2b --- /dev/null +++ b/src/test/ui/modules/special_module_name_ignore.rs @@ -0,0 +1,9 @@ +// run-pass + +#[path = "auxiliary/dummy_lib.rs"] +mod lib; + +#[path = "auxiliary/dummy_lib.rs"] +mod main; + +fn main() {} diff --git a/src/test/ui/moves/move-out-of-array-ref.stderr b/src/test/ui/moves/move-out-of-array-ref.stderr index fd682e56a..0caa0b83a 100644 --- a/src/test/ui/moves/move-out-of-array-ref.stderr +++ b/src/test/ui/moves/move-out-of-array-ref.stderr @@ -13,7 +13,7 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-ref.rs:13:27 | LL | let [_, s @ .. , _] = *a; - | ------ ^^ + | - ^^ | | | | | cannot move out of here | | help: consider borrowing here: `&*a` @@ -35,7 +35,7 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-ref.rs:23:27 | LL | let [_, s @ .. , _] = *a; - | ------ ^^ + | - ^^ | | | | | cannot move out of here | | help: consider borrowing here: `&*a` diff --git a/src/test/ui/moves/move-out-of-slice-2.stderr b/src/test/ui/moves/move-out-of-slice-2.stderr index 9a863bf31..93b0dcfc2 100644 --- a/src/test/ui/moves/move-out-of-slice-2.stderr +++ b/src/test/ui/moves/move-out-of-slice-2.stderr @@ -14,7 +14,7 @@ LL | match *a { | ^^ cannot move out of here LL | LL | [a @ ..] => {} - | ------ + | - | | | data moved here | move occurs because `a` has type `[A]`, which does not implement the `Copy` trait @@ -26,7 +26,7 @@ LL | match *b { | ^^ cannot move out of here LL | LL | [_, _, b @ .., _] => {} - | ------ + | - | | | data moved here | move occurs because `b` has type `[A]`, which does not implement the `Copy` trait @@ -38,7 +38,7 @@ LL | match *c { | ^^ cannot move out of here LL | LL | [c @ ..] => {} - | ------ + | - | | | data moved here | move occurs because `c` has type `[C]`, which does not implement the `Copy` trait @@ -50,7 +50,7 @@ LL | match *d { | ^^ cannot move out of here LL | LL | [_, _, d @ .., _] => {} - | ------ + | - | | | data moved here | move occurs because `d` has type `[C]`, which does not implement the `Copy` trait diff --git a/src/test/ui/mutexguard-sync.stderr b/src/test/ui/mutexguard-sync.stderr index b3c77b13e..3fbb2ddf1 100644 --- a/src/test/ui/mutexguard-sync.stderr +++ b/src/test/ui/mutexguard-sync.stderr @@ -7,7 +7,7 @@ LL | test_sync(guard); | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `Cell` - = note: required because of the requirements on the impl of `Sync` for `MutexGuard<'_, Cell>` + = note: required for `MutexGuard<'_, Cell>` to implement `Sync` note: required by a bound in `test_sync` --> $DIR/mutexguard-sync.rs:5:17 | diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index b04ea14d1..c07914df7 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -218,7 +218,7 @@ error[E0277]: the trait bound `fn() -> c::TS {c::TS}: Impossible` is not satisfi --> $DIR/namespace-mix.rs:56:11 | LL | check(m3::TS); - | ----- ^^^^^^ the trait `Impossible` is not implemented for `fn() -> c::TS {c::TS}` + | ----- ^^^^^^ the trait `Impossible` is not implemented for fn item `fn() -> c::TS {c::TS}` | | | required by a bound introduced by this call | @@ -274,7 +274,7 @@ error[E0277]: the trait bound `fn() -> namespace_mix::c::TS {namespace_mix::c::T --> $DIR/namespace-mix.rs:62:11 | LL | check(xm3::TS); - | ----- ^^^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}` + | ----- ^^^^^^^ the trait `Impossible` is not implemented for fn item `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}` | | | required by a bound introduced by this call | @@ -526,7 +526,7 @@ error[E0277]: the trait bound `fn() -> c::E {c::E::TV}: Impossible` is not satis --> $DIR/namespace-mix.rs:122:11 | LL | check(m9::TV); - | ----- ^^^^^^ the trait `Impossible` is not implemented for `fn() -> c::E {c::E::TV}` + | ----- ^^^^^^ the trait `Impossible` is not implemented for fn item `fn() -> c::E {c::E::TV}` | | | required by a bound introduced by this call | @@ -582,7 +582,7 @@ error[E0277]: the trait bound `fn() -> namespace_mix::c::E {namespace_mix::xm7:: --> $DIR/namespace-mix.rs:128:11 | LL | check(xm9::TV); - | ----- ^^^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::E {namespace_mix::xm7::TV}` + | ----- ^^^^^^^ the trait `Impossible` is not implemented for fn item `fn() -> namespace_mix::c::E {namespace_mix::xm7::TV}` | | | required by a bound introduced by this call | diff --git a/src/test/ui/nested-ty-params.stderr b/src/test/ui/nested-ty-params.stderr index f6741b5e5..8f4746f5e 100644 --- a/src/test/ui/nested-ty-params.stderr +++ b/src/test/ui/nested-ty-params.stderr @@ -4,9 +4,9 @@ error[E0401]: can't use generic parameters from outer function LL | fn hd(v: Vec ) -> U { | - type parameter from outer function LL | fn hd1(w: [U]) -> U { return w[0]; } - | --- ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `hd1` + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `` error[E0401]: can't use generic parameters from outer function --> $DIR/nested-ty-params.rs:3:23 @@ -14,9 +14,9 @@ error[E0401]: can't use generic parameters from outer function LL | fn hd(v: Vec ) -> U { | - type parameter from outer function LL | fn hd1(w: [U]) -> U { return w[0]; } - | --- ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `hd1` + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `` error: aborting due to 2 previous errors diff --git a/src/test/ui/never_type/defaulted-never-note.fallback.stderr b/src/test/ui/never_type/defaulted-never-note.fallback.stderr index 4c8b49224..283aca1b0 100644 --- a/src/test/ui/never_type/defaulted-never-note.fallback.stderr +++ b/src/test/ui/never_type/defaulted-never-note.fallback.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `!: ImplementedForUnitButNotNever` is not satisfied - --> $DIR/defaulted-never-note.rs:30:5 + --> $DIR/defaulted-never-note.rs:30:9 | LL | foo(_x); - | ^^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!` + | --- ^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!` + | | + | required by a bound introduced by this call | = help: the trait `ImplementedForUnitButNotNever` is implemented for `()` = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 for more information) diff --git a/src/test/ui/never_type/defaulted-never-note.rs b/src/test/ui/never_type/defaulted-never-note.rs index aefc739a0..d30ffcd38 100644 --- a/src/test/ui/never_type/defaulted-never-note.rs +++ b/src/test/ui/never_type/defaulted-never-note.rs @@ -32,6 +32,7 @@ fn smeg() { //[fallback]~| NOTE the trait `ImplementedForUnitButNotNever` is not implemented //[fallback]~| HELP trait `ImplementedForUnitButNotNever` is implemented for `()` //[fallback]~| NOTE this error might have been caused + //[fallback]~| NOTE required by a bound introduced by this call //[fallback]~| HELP did you intend } diff --git a/src/test/ui/never_type/diverging-fallback-no-leak.fallback.stderr b/src/test/ui/never_type/diverging-fallback-no-leak.fallback.stderr index dee2b1d70..3215c4669 100644 --- a/src/test/ui/never_type/diverging-fallback-no-leak.fallback.stderr +++ b/src/test/ui/never_type/diverging-fallback-no-leak.fallback.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `!: Test` is not satisfied - --> $DIR/diverging-fallback-no-leak.rs:17:5 + --> $DIR/diverging-fallback-no-leak.rs:17:23 | LL | unconstrained_arg(return); - | ^^^^^^^^^^^^^^^^^ the trait `Test` is not implemented for `!` + | ----------------- ^^^^^^ the trait `Test` is not implemented for `!` + | | + | required by a bound introduced by this call | = help: the following other types implement trait `Test`: () diff --git a/src/test/ui/never_type/fallback-closure-wrap.fallback.stderr b/src/test/ui/never_type/fallback-closure-wrap.fallback.stderr index 2acf44432..45cf37234 100644 --- a/src/test/ui/never_type/fallback-closure-wrap.fallback.stderr +++ b/src/test/ui/never_type/fallback-closure-wrap.fallback.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving `<[closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47] as FnOnce<()>>::Output == ()` +error[E0271]: expected `[closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47]` to be a closure that returns `()`, but it returns `!` --> $DIR/fallback-closure-wrap.rs:18:31 | LL | let error = Closure::wrap(Box::new(move || { diff --git a/src/test/ui/never_type/fallback-closure-wrap.rs b/src/test/ui/never_type/fallback-closure-wrap.rs index af0577ac0..f88355bb2 100644 --- a/src/test/ui/never_type/fallback-closure-wrap.rs +++ b/src/test/ui/never_type/fallback-closure-wrap.rs @@ -3,7 +3,7 @@ // // This particular test case currently fails as the inference to `()` rather // than `!` happens as a result of an `as` cast, which is not currently tracked. -// Crater did not find many cases of this occuring, but it is included for +// Crater did not find many cases of this occurring, but it is included for // awareness. // // revisions: nofallback fallback @@ -16,7 +16,7 @@ use std::marker::PhantomData; fn main() { let error = Closure::wrap(Box::new(move || { - //[fallback]~^ ERROR type mismatch resolving + //[fallback]~^ to be a closure that returns `()`, but it returns `!` panic!("Can't connect to server."); }) as Box); } diff --git a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr index 54abed383..6dc039fc3 100644 --- a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr +++ b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr @@ -1,8 +1,12 @@ error[E0277]: the trait bound `(): T` is not satisfied - --> $DIR/feature-gate-never_type_fallback.rs:10:5 + --> $DIR/feature-gate-never_type_fallback.rs:10:9 | LL | foo(panic!()) - | ^^^ the trait `T` is not implemented for `()` + | --- ^^^^^^^^ + | | | + | | the trait `T` is not implemented for `()` + | | this tail expression is of type `_` + | required by a bound introduced by this call | note: required by a bound in `foo` --> $DIR/feature-gate-never_type_fallback.rs:13:16 diff --git a/src/test/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr b/src/test/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr index e20455913..06e902bca 100644 --- a/src/test/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr +++ b/src/test/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied - --> $DIR/never-value-fallback-issue-66757.rs:28:5 + --> $DIR/never-value-fallback-issue-66757.rs:28:26 | LL | >::from(never); - | ^^^^^^^^^^^^^^^^^^^^ the trait `From<()>` is not implemented for `E` + | -------------------- ^^^^^ the trait `From<()>` is not implemented for `E` + | | + | required by a bound introduced by this call | = help: the trait `From` is implemented for `E` diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr index f86a19fff..59b848ea8 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -22,14 +22,8 @@ LL | let mut closure = expect_sig(|p, y| *p = y); note: no external requirements --> $DIR/escape-argument-callee.rs:20:1 | -LL | / fn test() { -LL | | let x = 44; -LL | | let mut p = &x; -LL | | -... | -LL | | deref(p); -LL | | } - | |_^ +LL | fn test() { + | ^^^^^^^^^ | = note: defining type: test diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr index 8cd8b43ca..ff4e8e590 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -13,14 +13,8 @@ LL | let mut closure = expect_sig(|p, y| *p = y); note: no external requirements --> $DIR/escape-argument.rs:20:1 | -LL | / fn test() { -LL | | let x = 44; -LL | | let mut p = &x; -LL | | -... | -LL | | deref(p); -LL | | } - | |_^ +LL | fn test() { + | ^^^^^^^^^ | = note: defining type: test diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr index abf80e039..4fbd5eb19 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -29,14 +29,8 @@ LL | let mut closure = || { note: no external requirements --> $DIR/escape-upvar-nested.rs:13:1 | -LL | / fn test() { -LL | | let x = 44; -LL | | let mut p = &x; -LL | | -... | -LL | | deref(p); -LL | | } - | |_^ +LL | fn test() { + | ^^^^^^^^^ | = note: defining type: test diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr index bc7546421..bc1ceac5b 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -15,14 +15,8 @@ LL | let mut closure = || p = &y; note: no external requirements --> $DIR/escape-upvar-ref.rs:17:1 | -LL | / fn test() { -LL | | let x = 44; -LL | | let mut p = &x; -LL | | -... | -LL | | deref(p); -LL | | } - | |_^ +LL | fn test() { + | ^^^^^^^^^ | = note: defining type: test diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index b9b0f3ad2..0d94fca28 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -27,14 +27,8 @@ LL | demand_y(x, y, p) note: no external requirements --> $DIR/propagate-approximated-fail-no-postdom.rs:38:1 | -LL | / fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell<&'c u32>) { -LL | | establish_relationships( -LL | | cell_a, -LL | | cell_b, -... | -LL | | ); -LL | | } - | |_^ +LL | fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell<&'c u32>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index a2371ee31..435a53533 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -17,14 +17,8 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y note: no external requirements --> $DIR/propagate-approximated-ref.rs:42:1 | -LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | // Only works if 'x: 'y: -LL | | demand_y(x, y, x.get()) -LL | | -LL | | }); -LL | | } - | |_^ +LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index e53ae167f..6aafbe42c 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -23,14 +23,8 @@ LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure note: no external requirements --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:18:1 | -LL | / fn case1() { -LL | | let a = 0; -LL | | let cell = Cell::new(&a); -LL | | foo(cell, |cell_a, cell_x| { -... | -LL | | }) -LL | | } - | |_^ +LL | fn case1() { + | ^^^^^^^^^^ | = note: defining type: case1 @@ -51,14 +45,8 @@ LL | foo(cell, |cell_a, cell_x| { note: no external requirements --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1 | -LL | / fn case2() { -LL | | let a = 0; -LL | | let cell = Cell::new(&a); -LL | | -... | -LL | | }) -LL | | } - | |_^ +LL | fn case2() { + | ^^^^^^^^^^ | = note: defining type: case2 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index c3c7eb1bd..c95907ea7 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -17,14 +17,8 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { note: no external requirements --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:31:1 | -LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -LL | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { -LL | | -LL | | -... | -LL | | }); -LL | | } - | |_^ +LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply @@ -46,7 +40,7 @@ LL | | }); | |______`cell_a` escapes the function body here | argument requires that `'a` must outlive `'static` | - = note: requirement occurs because of the type `Cell<&'_#10r u32>`, which makes the generic argument `&'_#10r u32` invariant + = note: requirement occurs because of the type `Cell<&'_#9r u32>`, which makes the generic argument `&'_#9r u32` invariant = note: the struct `Cell` is invariant over the parameter `T` = help: see for more information about variance diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 846e5aedb..db58d9d6f 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -17,14 +17,8 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y note: no external requirements --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:34:1 | -LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | -LL | | -... | -LL | | }); -LL | | } - | |_^ +LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply @@ -46,7 +40,7 @@ LL | | }); | |______`cell_a` escapes the function body here | argument requires that `'a` must outlive `'static` | - = note: requirement occurs because of the type `Cell<&'_#11r u32>`, which makes the generic argument `&'_#11r u32` invariant + = note: requirement occurs because of the type `Cell<&'_#10r u32>`, which makes the generic argument `&'_#10r u32` invariant = note: the struct `Cell` is invariant over the parameter `T` = help: see for more information about variance diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index a570932ed..be5f1e5ef 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -17,14 +17,8 @@ LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { note: no external requirements --> $DIR/propagate-approximated-val.rs:35:1 | -LL | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -LL | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { -LL | | // Only works if 'x: 'y: -LL | | demand_y(outlives1, outlives2, x.get()) -LL | | -LL | | }); -LL | | } - | |_^ +LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: test diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr index 407bc6764..d18db97be 100644 --- a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -16,14 +16,8 @@ LL | |_outlives1, _outlives2, x, y| { note: no external requirements --> $DIR/propagate-despite-same-free-region.rs:39:1 | -LL | / fn supply<'a>(cell_a: Cell<&'a u32>) { -LL | | establish_relationships( -LL | | cell_a, -LL | | |_outlives1, _outlives2, x, y| { -... | -LL | | ); -LL | | } - | |_^ +LL | fn supply<'a>(cell_a: Cell<&'a u32>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index fcb55d37f..e6f88de4e 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -26,14 +26,8 @@ LL | demand_y(x, y, x.get()) note: no external requirements --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:34:1 | -LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -LL | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { -LL | | // Only works if 'x: 'y: -LL | | demand_y(x, y, x.get()) -LL | | -LL | | }); -LL | | } - | |_^ +LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index 75beae39e..5f5fce771 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -26,14 +26,8 @@ LL | demand_y(x, y, x.get()) note: no external requirements --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:38:1 | -LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | // Only works if 'x: 'y: -LL | | demand_y(x, y, x.get()) -LL | | -LL | | }); -LL | | } - | |_^ +LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: supply diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr index 58aced2bf..750b08bbe 100644 --- a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -18,11 +18,7 @@ note: no external requirements LL | / fn supply<'a, T>(value: T) LL | | where LL | | T: Trait<'a>, -LL | | { -... | -LL | | }); -LL | | } - | |_^ + | |_________________^ | = note: defining type: supply::<'_#1r, T> diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr index 1c9d0c835..da89071ea 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -22,11 +22,8 @@ LL | expect_sig(|a, b| b); // ought to return `a` note: no external requirements --> $DIR/return-wrong-bound-region.rs:10:1 | -LL | / fn test() { -LL | | expect_sig(|a, b| b); // ought to return `a` -LL | | -LL | | } - | |_^ +LL | fn test() { + | ^^^^^^^^^ | = note: defining type: test diff --git a/src/test/ui/nll/issue-21232-partial-init-and-use.rs b/src/test/ui/nll/issue-21232-partial-init-and-use.rs index 4cd1e406f..ad3eb2483 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-use.rs +++ b/src/test/ui/nll/issue-21232-partial-init-and-use.rs @@ -53,7 +53,7 @@ impl R { fn new(f: F) -> Self { R { w: 0, f } } } // * local/field: Is the structure in a local or a field // * fully/partial/void: Are we fully initializing it before using any part? // Is whole type empty due to a void component? -// * init/reinit: First initialization, or did we previously inititalize and then move out? +// * init/reinit: First initialization, or did we previously initialize and then move out? // * struct/tuple: Is this a struct or a (X, Y). // // As a shorthand for the cases above, adding a numeric summary to diff --git a/src/test/ui/nll/issue-51244.stderr b/src/test/ui/nll/issue-51244.stderr index 19f0223a3..dcb6f9fec 100644 --- a/src/test/ui/nll/issue-51244.stderr +++ b/src/test/ui/nll/issue-51244.stderr @@ -2,7 +2,7 @@ error[E0594]: cannot assign to `*my_ref`, which is behind a `&` reference --> $DIR/issue-51244.rs:3:5 | LL | let ref my_ref @ _ = 0; - | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _` + | ---------- help: consider changing this to be a mutable reference: `ref mut my_ref` LL | *my_ref = 0; | ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/nll/local-outlives-static-via-hrtb.stderr b/src/test/ui/nll/local-outlives-static-via-hrtb.stderr index 61009da49..f5c10f3dd 100644 --- a/src/test/ui/nll/local-outlives-static-via-hrtb.stderr +++ b/src/test/ui/nll/local-outlives-static-via-hrtb.stderr @@ -9,6 +9,12 @@ LL | assert_static_via_hrtb(&local); LL | assert_static_via_hrtb_with_assoc_type(&&local); LL | } | - `local` dropped here while still borrowed + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/local-outlives-static-via-hrtb.rs:15:53 + | +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 @@ -20,6 +26,12 @@ LL | assert_static_via_hrtb_with_assoc_type(&&local); | argument requires that `local` is borrowed for `'static` LL | } | - `local` dropped here while still borrowed + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/local-outlives-static-via-hrtb.rs:19:20 + | +LL | for<'a> &'a T: Reference, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/normalization-bounds-error.stderr b/src/test/ui/nll/normalization-bounds-error.stderr index 6da3d5d96..6abe53127 100644 --- a/src/test/ui/nll/normalization-bounds-error.stderr +++ b/src/test/ui/nll/normalization-bounds-error.stderr @@ -1,8 +1,8 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'d` due to conflicting requirements - --> $DIR/normalization-bounds-error.rs:12:4 + --> $DIR/normalization-bounds-error.rs:12:1 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'d` as defined here... --> $DIR/normalization-bounds-error.rs:12:14 @@ -15,10 +15,10 @@ note: ...but the lifetime must also be valid for the lifetime `'a` as defined he LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^ note: ...so that the types are compatible - --> $DIR/normalization-bounds-error.rs:12:4 + --> $DIR/normalization-bounds-error.rs:12:1 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: expected `Visitor<'d>` found `Visitor<'_>` diff --git a/src/test/ui/nll/polonius/assignment-kills-loans.rs b/src/test/ui/nll/polonius/assignment-kills-loans.rs index c4cf20389..696bf61ce 100644 --- a/src/test/ui/nll/polonius/assignment-kills-loans.rs +++ b/src/test/ui/nll/polonius/assignment-kills-loans.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] // This tests the various kinds of assignments there are. Polonius used to generate `killed` -// facts only on simple assigments, but not projections, incorrectly causing errors to be emitted +// facts only on simple assignments, but not projections, incorrectly causing errors to be emitted // for code accepted by NLL. They are all variations from example code in the NLL RFC. // check-pass diff --git a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs index c4db6fc97..05e2ea047 100644 --- a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs +++ b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.rs @@ -30,4 +30,5 @@ fn main() { let _x = ::make_f(); //~^ ERROR implementation of `Y` is not general enough //~| ERROR implementation of `Y` is not general enough + //~| ERROR implementation of `Y` is not general enough } diff --git a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr index 51adfca3e..8c4737988 100644 --- a/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr +++ b/src/test/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr @@ -16,5 +16,14 @@ LL | let _x = ::make_f(); = note: `Y` would have to be implemented for the type `for<'r> fn(&'r ())` = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` -error: aborting due to 2 previous errors +error: implementation of `Y` is not general enough + --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14 + | +LL | let _x = ::make_f(); + | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Y` would have to be implemented for the type `for<'r> fn(&'r ())` + = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` + +error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index feab24769..ee1f7b64b 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -18,11 +18,7 @@ note: no external requirements LL | / fn no_region<'a, T>(x: Box) -> Box LL | | where LL | | T: Iterator, -LL | | { -LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | -LL | | } - | |_^ + | |________________^ | = note: defining type: no_region::<'_#1r, T> @@ -55,10 +51,7 @@ note: no external requirements LL | / fn correct_region<'a, T>(x: Box) -> Box LL | | where LL | | T: 'a + Iterator, -LL | | { -LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | } - | |_^ + | |_____________________^ | = note: defining type: correct_region::<'_#1r, T> @@ -82,11 +75,7 @@ note: no external requirements LL | / fn wrong_region<'a, 'b, T>(x: Box) -> Box LL | | where LL | | T: 'b + Iterator, -LL | | { -LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | -LL | | } - | |_^ + | |_____________________^ | = note: defining type: wrong_region::<'_#1r, '_#2r, T> @@ -120,10 +109,7 @@ LL | / fn outlives_region<'a, 'b, T>(x: Box) -> Box LL | | where LL | | T: 'b + Iterator, LL | | 'b: 'a, -LL | | { -LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | } - | |_^ + | |___________^ | = note: defining type: outlives_region::<'_#1r, '_#2r, T> diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index 98063bd0a..4e57dfad7 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -20,11 +20,7 @@ note: no external requirements LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, -LL | | { -... | -LL | | -LL | | } - | |_^ + | |____________________^ | = note: defining type: no_relationships_late::<'_#1r, T> @@ -74,10 +70,7 @@ LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, -... | -LL | | -LL | | } - | |_^ + | |___________^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> @@ -126,10 +119,7 @@ LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | T::AssocType: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |_____________________^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, T> @@ -155,10 +145,8 @@ LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | T: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ +LL | | 'b: 'a, + | |___________^ | = note: defining type: elements_outlive::<'_#1r, '_#2r, T> diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 45e61bcbd..250c796e2 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -19,11 +19,7 @@ note: no external requirements LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | -LL | | } - | |_^ + | |____________________^ | = note: defining type: no_relationships_late::<'_#1r, T> @@ -61,10 +57,7 @@ LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, -... | -LL | | -LL | | } - | |_^ + | |___________^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> @@ -102,10 +95,7 @@ LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | T::AssocType: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |_____________________^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, T> @@ -130,10 +120,7 @@ LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'b: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: elements_outlive::<'_#1r, '_#2r, T> @@ -157,11 +144,7 @@ note: no external requirements LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'a>, -LL | | { -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |____________________^ | = note: defining type: one_region::<'_#1r, T> diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr index f2549205b..b27186b05 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr @@ -17,10 +17,7 @@ note: no external requirements LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |____________________^ | = note: defining type: no_relationships_late::<'_#1r, T> @@ -43,10 +40,7 @@ LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> @@ -69,10 +63,7 @@ LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | T::AssocType: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |_____________________^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, T> @@ -95,10 +86,7 @@ LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'b: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: elements_outlive::<'_#1r, '_#2r, T> @@ -120,11 +108,7 @@ note: no external requirements LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'a>, -LL | | { -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |____________________^ | = note: defining type: one_region::<'_#1r, T> diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 8e1b6fa2e..0195a693e 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -19,11 +19,7 @@ note: no external requirements LL | / fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | -LL | | } - | |_^ + | |________________________^ | = note: defining type: no_relationships_late::<'_#1r, '_#2r, T> @@ -57,10 +53,7 @@ LL | / fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, LL | | 'a: 'a, -... | -LL | | -LL | | } - | |_^ + | |___________^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T> @@ -94,10 +87,7 @@ LL | / fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, LL | | T::AssocType: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |_____________________^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, '_#3r, T> @@ -122,10 +112,7 @@ LL | / fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, LL | | 'b: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: elements_outlive1::<'_#1r, '_#2r, '_#3r, T> @@ -150,10 +137,7 @@ LL | / fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, LL | | 'c: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: elements_outlive2::<'_#1r, '_#2r, '_#3r, T> @@ -178,11 +162,7 @@ note: no external requirements LL | / fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'b>, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | -LL | | } - | |_^ + | |________________________^ | = note: defining type: two_regions::<'_#1r, T> @@ -220,10 +200,7 @@ LL | / fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'b>, LL | | 'b: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: two_regions_outlive::<'_#1r, '_#2r, T> @@ -247,11 +224,7 @@ note: no external requirements LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'a, 'a>, -LL | | { -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |________________________^ | = note: defining type: one_region::<'_#1r, T> diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index 12c76d198..5d9a044d1 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -15,11 +15,8 @@ LL | twice(cell, value, |a, b| invoke(a, b)); note: no external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:22:1 | -LL | / fn generic(value: T) { -LL | | let cell = Cell::new(&()); -LL | | twice(cell, value, |a, b| invoke(a, b)); -LL | | } - | |_^ +LL | fn generic(value: T) { + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: generic:: @@ -41,11 +38,8 @@ LL | twice(cell, value, |a, b| invoke(a, b)); note: no external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:28:1 | -LL | / fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { -LL | | twice(cell, value, |a, b| invoke(a, b)); -LL | | -LL | | } - | |_^ +LL | fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: generic_fail:: diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 35741859d..50d9e3aab 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -18,11 +18,7 @@ note: no external requirements LL | / fn no_region<'a, T>(x: Box) -> Box LL | | where LL | | T: Debug, -LL | | { -... | -LL | | -LL | | } - | |_^ + | |_____________^ | = note: defining type: no_region::<'_#1r, T> diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index 0261bc39e..14c55e32a 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -16,14 +16,8 @@ LL | with_signature(a, b, |x, y| { note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:26:1 | -LL | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { -LL | | with_signature(a, b, |x, y| { -LL | | -LL | | // -... | -LL | | }) -LL | | } - | |_^ +LL | fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: no_region:: @@ -65,11 +59,7 @@ note: no external requirements LL | / fn correct_region<'a, T>(a: Cell<&'a ()>, b: T) LL | | where LL | | T: 'a, -LL | | { -... | -LL | | }) -LL | | } - | |_^ + | |__________^ | = note: defining type: correct_region::<'_#1r, T> @@ -94,11 +84,7 @@ note: no external requirements LL | / fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) LL | | where LL | | T: 'b, -LL | | { -... | -LL | | }) -LL | | } - | |_^ + | |__________^ | = note: defining type: wrong_region::<'_#1r, T> @@ -139,10 +125,7 @@ LL | / fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) LL | | where LL | | T: 'b, LL | | 'b: 'a, -... | -LL | | }) -LL | | } - | |_^ + | |___________^ | = note: defining type: outlives_region::<'_#1r, '_#2r, T> diff --git a/src/test/ui/nll/type-test-universe.stderr b/src/test/ui/nll/type-test-universe.stderr index 242486c36..31e17d64b 100644 --- a/src/test/ui/nll/type-test-universe.stderr +++ b/src/test/ui/nll/type-test-universe.stderr @@ -11,6 +11,12 @@ LL | fn test2<'a>() { | -- lifetime `'a` defined here LL | outlives_forall::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/type-test-universe.rs:6:16 + | +LL | for<'u> T: 'u, + | ^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr index ee332278c..3326fa521 100644 --- a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr @@ -30,14 +30,15 @@ error[E0597]: `c` does not live long enough | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here -LL | let _closure = || { - | - `c` dropped here while still borrowed ... LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- | | | | | borrowed value does not live long enough | argument requires that `c` is borrowed for `'a` +... +LL | }; + | - `c` dropped here while still borrowed error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.stderr b/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.stderr index 95bbd62c4..9664fb9f5 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.stderr +++ b/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.stderr @@ -28,28 +28,28 @@ error[E0597]: `c` does not live long enough | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here -LL | let _closure = || { - | - `c` dropped here while still borrowed ... LL | f(&c); | --^^- | | | | | borrowed value does not live long enough | argument requires that `c` is borrowed for `'a` +LL | }; + | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-struct-calls.rs:53:11 | LL | let f = SomeStruct::<&'a u32>; | - lifetime `'1` appears in the type of `f` -LL | let _closure = || { - | - `c` dropped here while still borrowed -LL | let c = 66; +... LL | f(&c); | --^^- | | | | | borrowed value does not live long enough | argument requires that `c` is borrowed for `'1` +LL | }; + | - `c` dropped here while still borrowed error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/user-annotations/fns.stderr b/src/test/ui/nll/user-annotations/fns.stderr index bd4d121d5..e0640da39 100644 --- a/src/test/ui/nll/user-annotations/fns.stderr +++ b/src/test/ui/nll/user-annotations/fns.stderr @@ -28,14 +28,14 @@ error[E0597]: `c` does not live long enough | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here -LL | let _closure = || { - | - `c` dropped here while still borrowed -LL | let c = 66; +... LL | some_fn::<&'a u32>(&c); | -------------------^^- | | | | | borrowed value does not live long enough | argument requires that `c` is borrowed for `'a` +LL | }; + | - `c` dropped here while still borrowed error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/user-annotations/method-call.stderr b/src/test/ui/nll/user-annotations/method-call.stderr index fcaeb465d..10447e45a 100644 --- a/src/test/ui/nll/user-annotations/method-call.stderr +++ b/src/test/ui/nll/user-annotations/method-call.stderr @@ -29,14 +29,13 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | let _closure = || { - | - `c` dropped here while still borrowed -LL | let c = 66; LL | a.method::<&'a u32>(b, &c); | ------------------------^^- | | | | | borrowed value does not live long enough | argument requires that `c` is borrowed for `'a` +LL | }; + | - `c` dropped here while still borrowed error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr index 328dde980..e7851833e 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr @@ -29,14 +29,13 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | let _closure = || { - | - `c` dropped here while still borrowed -LL | let c = 66; LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); | -------------------------------------------^^- | | | | | borrowed value does not live long enough | argument requires that `c` is borrowed for `'a` +LL | }; + | - `c` dropped here while still borrowed error: aborting due to 3 previous errors diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr index 249c2fe2f..c864b93db 100644 --- a/src/test/ui/no-send-res-ports.stderr +++ b/src/test/ui/no-send-res-ports.stderr @@ -1,10 +1,17 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely - --> $DIR/no-send-res-ports.rs:25:5 + --> $DIR/no-send-res-ports.rs:25:19 | -LL | thread::spawn(move|| { - | ^^^^^^^^^^^^^ ------ within this `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]` - | | - | `Rc<()>` cannot be sent between threads safely +LL | thread::spawn(move|| { + | ------------- ^----- + | | | + | _____|_____________within this `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]` + | | | + | | required by a bound introduced by this call +LL | | +LL | | let y = x; +LL | | println!("{:?}", y); +LL | | }); + | |_____^ `Rc<()>` cannot be sent between threads safely | = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]`, the trait `Send` is not implemented for `Rc<()>` note: required because it appears within the type `Port<()>` diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr index 37d94cf0e..f61ee661b 100644 --- a/src/test/ui/not-clone-closure.stderr +++ b/src/test/ui/not-clone-closure.stderr @@ -1,11 +1,13 @@ error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]` - --> $DIR/not-clone-closure.rs:11:23 + --> $DIR/not-clone-closure.rs:11:17 | LL | let hello = move || { | ------- within this `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]` ... LL | let hello = hello.clone(); - | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S` + | ^^^^^ ----- required by a bound introduced by this call + | | + | within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S` | note: required because it's used within this closure --> $DIR/not-clone-closure.rs:7:17 diff --git a/src/test/ui/not-enough-arguments.stderr b/src/test/ui/not-enough-arguments.stderr index b1df578ea..8b2dafb4e 100644 --- a/src/test/ui/not-enough-arguments.stderr +++ b/src/test/ui/not-enough-arguments.stderr @@ -12,7 +12,7 @@ LL | fn foo(a: isize, b: isize, c: isize, d:isize) { help: provide the argument | LL | foo(1, 2, 3, /* isize */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0061]: this function takes 6 arguments but 3 arguments were supplied --> $DIR/not-enough-arguments.rs:29:3 @@ -40,7 +40,7 @@ LL | f: i32, help: provide the arguments | LL | bar(1, 2, 3, /* i32 */, /* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/src/test/ui/not-panic/not-panic-safe-2.stderr b/src/test/ui/not-panic/not-panic-safe-2.stderr index 65594702b..3b0f83b3b 100644 --- a/src/test/ui/not-panic/not-panic-safe-2.stderr +++ b/src/test/ui/not-panic/not-panic-safe-2.stderr @@ -1,12 +1,12 @@ error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-2.rs:10:5 + --> $DIR/not-panic-safe-2.rs:10:14 | LL | assert::>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` = note: required because it appears within the type `RefCell` - = note: required because of the requirements on the impl of `UnwindSafe` for `Rc>` + = note: required for `Rc>` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-2.rs:7:14 | @@ -14,15 +14,15 @@ LL | fn assert() {} | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-2.rs:10:5 + --> $DIR/not-panic-safe-2.rs:10:14 | LL | assert::>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` = note: required because it appears within the type `Cell` = note: required because it appears within the type `RefCell` - = note: required because of the requirements on the impl of `UnwindSafe` for `Rc>` + = note: required for `Rc>` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-2.rs:7:14 | diff --git a/src/test/ui/not-panic/not-panic-safe-3.stderr b/src/test/ui/not-panic/not-panic-safe-3.stderr index db3fdb253..9e9a12764 100644 --- a/src/test/ui/not-panic/not-panic-safe-3.stderr +++ b/src/test/ui/not-panic/not-panic-safe-3.stderr @@ -1,12 +1,12 @@ error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-3.rs:10:5 + --> $DIR/not-panic-safe-3.rs:10:14 | LL | assert::>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` = note: required because it appears within the type `RefCell` - = note: required because of the requirements on the impl of `UnwindSafe` for `Arc>` + = note: required for `Arc>` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-3.rs:7:14 | @@ -14,15 +14,15 @@ LL | fn assert() {} | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-3.rs:10:5 + --> $DIR/not-panic-safe-3.rs:10:14 | LL | assert::>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` = note: required because it appears within the type `Cell` = note: required because it appears within the type `RefCell` - = note: required because of the requirements on the impl of `UnwindSafe` for `Arc>` + = note: required for `Arc>` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-3.rs:7:14 | diff --git a/src/test/ui/not-panic/not-panic-safe-4.stderr b/src/test/ui/not-panic/not-panic-safe-4.stderr index 079601b39..fc1c594d0 100644 --- a/src/test/ui/not-panic/not-panic-safe-4.stderr +++ b/src/test/ui/not-panic/not-panic-safe-4.stderr @@ -1,12 +1,12 @@ error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-4.rs:9:5 + --> $DIR/not-panic-safe-4.rs:9:14 | LL | assert::<&RefCell>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` = note: required because it appears within the type `RefCell` - = note: required because of the requirements on the impl of `UnwindSafe` for `&RefCell` + = note: required for `&RefCell` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-4.rs:6:14 | @@ -14,15 +14,15 @@ LL | fn assert() {} | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-4.rs:9:5 + --> $DIR/not-panic-safe-4.rs:9:14 | LL | assert::<&RefCell>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` = note: required because it appears within the type `Cell` = note: required because it appears within the type `RefCell` - = note: required because of the requirements on the impl of `UnwindSafe` for `&RefCell` + = note: required for `&RefCell` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-4.rs:6:14 | diff --git a/src/test/ui/not-panic/not-panic-safe-5.stderr b/src/test/ui/not-panic/not-panic-safe-5.stderr index edd0f72dd..cb78370b4 100644 --- a/src/test/ui/not-panic/not-panic-safe-5.stderr +++ b/src/test/ui/not-panic/not-panic-safe-5.stderr @@ -1,11 +1,11 @@ error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-5.rs:9:5 + --> $DIR/not-panic-safe-5.rs:9:14 | LL | assert::<*const UnsafeCell>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: the trait `RefUnwindSafe` is not implemented for `UnsafeCell` - = note: required because of the requirements on the impl of `UnwindSafe` for `*const UnsafeCell` + = note: required for `*const UnsafeCell` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-5.rs:6:14 | diff --git a/src/test/ui/not-panic/not-panic-safe-6.stderr b/src/test/ui/not-panic/not-panic-safe-6.stderr index f3b784a29..7986e341e 100644 --- a/src/test/ui/not-panic/not-panic-safe-6.stderr +++ b/src/test/ui/not-panic/not-panic-safe-6.stderr @@ -1,12 +1,12 @@ error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-6.rs:9:5 + --> $DIR/not-panic-safe-6.rs:9:14 | LL | assert::<*mut RefCell>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` = note: required because it appears within the type `RefCell` - = note: required because of the requirements on the impl of `UnwindSafe` for `*mut RefCell` + = note: required for `*mut RefCell` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-6.rs:6:14 | @@ -14,15 +14,15 @@ LL | fn assert() {} | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-6.rs:9:5 + --> $DIR/not-panic-safe-6.rs:9:14 | LL | assert::<*mut RefCell>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^ `UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell` = note: required because it appears within the type `Cell` = note: required because it appears within the type `RefCell` - = note: required because of the requirements on the impl of `UnwindSafe` for `*mut RefCell` + = note: required for `*mut RefCell` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-6.rs:6:14 | diff --git a/src/test/ui/object-lifetime/object-lifetime-default.rs b/src/test/ui/object-lifetime/object-lifetime-default.rs index 60b6629e6..74f5bb7dd 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default.rs @@ -1,24 +1,50 @@ #![feature(rustc_attrs)] #[rustc_object_lifetime_default] -struct A(T); //~ ERROR BaseDefault +struct A< + T, //~ ERROR BaseDefault +>(T); #[rustc_object_lifetime_default] -struct B<'a,T>(&'a (), T); //~ ERROR BaseDefault +struct B< + 'a, + T, //~ ERROR BaseDefault +>(&'a (), T); #[rustc_object_lifetime_default] -struct C<'a,T:'a>(&'a T); //~ ERROR 'a +struct C< + 'a, + T: 'a, //~ ERROR 'a +>(&'a T); #[rustc_object_lifetime_default] -struct D<'a,'b,T:'a+'b>(&'a T, &'b T); //~ ERROR Ambiguous +struct D< + 'a, + 'b, + T: 'a + 'b, //~ ERROR Ambiguous +>(&'a T, &'b T); #[rustc_object_lifetime_default] -struct E<'a,'b:'a,T:'b>(&'a T, &'b T); //~ ERROR 'b +struct E< + 'a, + 'b: 'a, + T: 'b, //~ ERROR 'b +>(&'a T, &'b T); #[rustc_object_lifetime_default] -struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); //~ ERROR 'a,'b +struct F< + 'a, + 'b, + T: 'a, //~ ERROR 'a + U: 'b, //~ ERROR 'b +>(&'a T, &'b U); #[rustc_object_lifetime_default] -struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); //~ ERROR 'a,Ambiguous - -fn main() { } +struct G< + 'a, + 'b, + T: 'a, //~ ERROR 'a + U: 'a + 'b, //~ ERROR Ambiguous +>(&'a T, &'b U); + +fn main() {} diff --git a/src/test/ui/object-lifetime/object-lifetime-default.stderr b/src/test/ui/object-lifetime/object-lifetime-default.stderr index 60cb98c8f..a58afad3e 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default.stderr @@ -1,44 +1,56 @@ error: BaseDefault - --> $DIR/object-lifetime-default.rs:4:1 + --> $DIR/object-lifetime-default.rs:5:5 | -LL | struct A(T); - | ^^^^^^^^^^^^^^^ +LL | T, + | ^ error: BaseDefault - --> $DIR/object-lifetime-default.rs:7:1 + --> $DIR/object-lifetime-default.rs:11:5 | -LL | struct B<'a,T>(&'a (), T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | T, + | ^ error: 'a - --> $DIR/object-lifetime-default.rs:10:1 + --> $DIR/object-lifetime-default.rs:17:5 | -LL | struct C<'a,T:'a>(&'a T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | T: 'a, + | ^ error: Ambiguous - --> $DIR/object-lifetime-default.rs:13:1 + --> $DIR/object-lifetime-default.rs:24:5 | -LL | struct D<'a,'b,T:'a+'b>(&'a T, &'b T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | T: 'a + 'b, + | ^ error: 'b - --> $DIR/object-lifetime-default.rs:16:1 + --> $DIR/object-lifetime-default.rs:31:5 | -LL | struct E<'a,'b:'a,T:'b>(&'a T, &'b T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | T: 'b, + | ^ -error: 'a,'b - --> $DIR/object-lifetime-default.rs:19:1 +error: 'a + --> $DIR/object-lifetime-default.rs:38:5 + | +LL | T: 'a, + | ^ + +error: 'b + --> $DIR/object-lifetime-default.rs:39:5 | -LL | struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | U: 'b, + | ^ -error: 'a,Ambiguous - --> $DIR/object-lifetime-default.rs:22:1 +error: 'a + --> $DIR/object-lifetime-default.rs:46:5 + | +LL | T: 'a, + | ^ + +error: Ambiguous + --> $DIR/object-lifetime-default.rs:47:5 | -LL | struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | U: 'a + 'b, + | ^ -error: aborting due to 7 previous errors +error: aborting due to 9 previous errors diff --git a/src/test/ui/object-safety/issue-19538.stderr b/src/test/ui/object-safety/issue-19538.stderr index 7b37e1f95..8420637b3 100644 --- a/src/test/ui/object-safety/issue-19538.stderr +++ b/src/test/ui/object-safety/issue-19538.stderr @@ -29,7 +29,7 @@ LL | fn foo(&self, val: T); LL | trait Bar: Foo { } | --- this trait cannot be made into an object... = help: consider moving `foo` to another trait - = note: required because of the requirements on the impl of `CoerceUnsized<&mut dyn Bar>` for `&mut Thing` + = note: required for `&mut Thing` to implement `CoerceUnsized<&mut dyn Bar>` = note: required by cast to type `&mut dyn Bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/object-safety/object-safety-associated-consts.curr.stderr b/src/test/ui/object-safety/object-safety-associated-consts.curr.stderr index 9dd144fee..5f94c9284 100644 --- a/src/test/ui/object-safety/object-safety-associated-consts.curr.stderr +++ b/src/test/ui/object-safety/object-safety-associated-consts.curr.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-associated-consts.rs:12:30 + --> $DIR/object-safety-associated-consts.rs:12:31 | LL | fn make_bar(t: &T) -> &dyn Bar { - | ^^^^^^^^ `Bar` cannot be made into an object + | ^^^^^^^ `Bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-safety-associated-consts.rs:9:11 diff --git a/src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr index 9ba3b251e..f44de07d5 100644 --- a/src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr +++ b/src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr @@ -12,7 +12,7 @@ LL | trait Bar { LL | const X: usize; | ^ ...because it contains this associated `const` = help: consider moving `X` to another trait - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` + = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>` = note: required by cast to type `&dyn Bar` error: aborting due to previous error diff --git a/src/test/ui/object-safety/object-safety-bounds.stderr b/src/test/ui/object-safety/object-safety-bounds.stderr index 89c4f8ced..29ffb5448 100644 --- a/src/test/ui/object-safety/object-safety-bounds.stderr +++ b/src/test/ui/object-safety/object-safety-bounds.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `X` cannot be made into an object - --> $DIR/object-safety-bounds.rs:7:11 + --> $DIR/object-safety-bounds.rs:7:15 | LL | fn f() -> Box> { - | ^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object + | ^^^^^^^^^^^^^^ `X` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-safety-bounds.rs:4:13 diff --git a/src/test/ui/object-safety/object-safety-generics.curr.stderr b/src/test/ui/object-safety/object-safety-generics.curr.stderr index 345950f1a..458103752 100644 --- a/src/test/ui/object-safety/object-safety-generics.curr.stderr +++ b/src/test/ui/object-safety/object-safety-generics.curr.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-generics.rs:18:30 + --> $DIR/object-safety-generics.rs:18:31 | LL | fn make_bar(t: &T) -> &dyn Bar { - | ^^^^^^^^ `Bar` cannot be made into an object + | ^^^^^^^ `Bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-safety-generics.rs:10:8 @@ -14,10 +14,10 @@ LL | fn bar(&self, t: T); = help: consider moving `bar` to another trait error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-generics.rs:24:39 + --> $DIR/object-safety-generics.rs:24:40 | LL | fn make_bar_explicit(t: &T) -> &dyn Bar { - | ^^^^^^^^ `Bar` cannot be made into an object + | ^^^^^^^ `Bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-safety-generics.rs:10:8 diff --git a/src/test/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr index 86355627c..9a2d472d5 100644 --- a/src/test/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr +++ b/src/test/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr @@ -12,7 +12,7 @@ LL | trait Bar { LL | fn bar(&self, t: T); | ^^^ ...because method `bar` has generic type parameters = help: consider moving `bar` to another trait - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` + = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>` = note: required by cast to type `&dyn Bar` error[E0038]: the trait `Bar` cannot be made into an object @@ -29,7 +29,7 @@ LL | trait Bar { LL | fn bar(&self, t: T); | ^^^ ...because method `bar` has generic type parameters = help: consider moving `bar` to another trait - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` + = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>` = note: required by cast to type `&dyn Bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.curr.stderr b/src/test/ui/object-safety/object-safety-mentions-Self.curr.stderr index f91c9b985..de430a89b 100644 --- a/src/test/ui/object-safety/object-safety-mentions-Self.curr.stderr +++ b/src/test/ui/object-safety/object-safety-mentions-Self.curr.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-mentions-Self.rs:22:30 + --> $DIR/object-safety-mentions-Self.rs:22:31 | LL | fn make_bar(t: &T) -> &dyn Bar { - | ^^^^^^^^ `Bar` cannot be made into an object + | ^^^^^^^ `Bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-safety-mentions-Self.rs:11:22 @@ -14,10 +14,10 @@ LL | fn bar(&self, x: &Self); = help: consider moving `bar` to another trait error[E0038]: the trait `Baz` cannot be made into an object - --> $DIR/object-safety-mentions-Self.rs:28:30 + --> $DIR/object-safety-mentions-Self.rs:28:31 | LL | fn make_baz(t: &T) -> &dyn Baz { - | ^^^^^^^^ `Baz` cannot be made into an object + | ^^^^^^^ `Baz` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-safety-mentions-Self.rs:15:22 diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr index f48628c9d..40a298bd1 100644 --- a/src/test/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr +++ b/src/test/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr @@ -12,7 +12,7 @@ LL | trait Bar { LL | fn bar(&self, x: &Self); | ^^^^^ ...because method `bar` references the `Self` type in this parameter = help: consider moving `bar` to another trait - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` + = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>` = note: required by cast to type `&dyn Bar` error[E0038]: the trait `Baz` cannot be made into an object @@ -29,7 +29,7 @@ LL | trait Baz { LL | fn baz(&self) -> Self; | ^^^^ ...because method `baz` references the `Self` type in its return type = help: consider moving `baz` to another trait - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Baz>` for `&T` + = note: required for `&T` to implement `CoerceUnsized<&dyn Baz>` = note: required by cast to type `&dyn Baz` error: aborting due to 2 previous errors diff --git a/src/test/ui/object-safety/object-safety-no-static.curr.stderr b/src/test/ui/object-safety/object-safety-no-static.curr.stderr index bd8cf4e30..1b025229e 100644 --- a/src/test/ui/object-safety/object-safety-no-static.curr.stderr +++ b/src/test/ui/object-safety/object-safety-no-static.curr.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety-no-static.rs:12:18 + --> $DIR/object-safety-no-static.rs:12:22 | LL | fn diverges() -> Box { - | ^^^^^^^^^^^^ `Foo` cannot be made into an object + | ^^^^^^^ `Foo` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-safety-no-static.rs:9:8 diff --git a/src/test/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr index ea1c575ff..da87b58c9 100644 --- a/src/test/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr +++ b/src/test/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr @@ -11,7 +11,7 @@ LL | trait Foo { | --- this trait cannot be made into an object... LL | fn foo() {} | ^^^ ...because associated function `foo` has no `self` parameter - = note: required because of the requirements on the impl of `CoerceUnsized>` for `Box` + = note: required for `Box` to implement `CoerceUnsized>` = note: required by cast to type `Box` help: consider turning `foo` into a method by giving it a `&self` argument | diff --git a/src/test/ui/object-safety/object-safety-sized-2.curr.stderr b/src/test/ui/object-safety/object-safety-sized-2.curr.stderr index 71236c8e3..b01926412 100644 --- a/src/test/ui/object-safety/object-safety-sized-2.curr.stderr +++ b/src/test/ui/object-safety/object-safety-sized-2.curr.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-sized-2.rs:14:30 + --> $DIR/object-safety-sized-2.rs:14:31 | LL | fn make_bar(t: &T) -> &dyn Bar { - | ^^^^^^^^ `Bar` cannot be made into an object + | ^^^^^^^ `Bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-safety-sized-2.rs:9:18 diff --git a/src/test/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr index b6e4903b0..6c29c8d5f 100644 --- a/src/test/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr +++ b/src/test/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr @@ -11,7 +11,7 @@ LL | trait Bar | --- this trait cannot be made into an object... LL | where Self : Sized | ^^^^^ ...because it requires `Self: Sized` - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` + = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>` = note: required by cast to type `&dyn Bar` error: aborting due to previous error diff --git a/src/test/ui/object-safety/object-safety-sized.curr.stderr b/src/test/ui/object-safety/object-safety-sized.curr.stderr index 94b06ee93..974813121 100644 --- a/src/test/ui/object-safety/object-safety-sized.curr.stderr +++ b/src/test/ui/object-safety/object-safety-sized.curr.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-sized.rs:12:30 + --> $DIR/object-safety-sized.rs:12:31 | LL | fn make_bar(t: &T) -> &dyn Bar { - | ^^^^^^^^ `Bar` cannot be made into an object + | ^^^^^^^ `Bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/object-safety-sized.rs:8:13 diff --git a/src/test/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr index 645852c7e..70a44ed61 100644 --- a/src/test/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr +++ b/src/test/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr @@ -11,7 +11,7 @@ LL | trait Bar : Sized { | --- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... - = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Bar>` for `&T` + = note: required for `&T` to implement `CoerceUnsized<&dyn Bar>` = note: required by cast to type `&dyn Bar` error: aborting due to previous error diff --git a/src/test/ui/on-unimplemented/enclosing-scope.rs b/src/test/ui/on-unimplemented/enclosing-scope.rs deleted file mode 100644 index 881bff63f..000000000 --- a/src/test/ui/on-unimplemented/enclosing-scope.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Test scope annotations from `enclosing_scope` parameter - -#![feature(rustc_attrs)] - -#[rustc_on_unimplemented(enclosing_scope="in this scope")] -trait Trait{} - -struct Foo; - -fn f(x: T) {} - -fn main() { - let x = || { - f(Foo{}); //~ ERROR the trait bound `Foo: Trait` is not satisfied - let y = || { - f(Foo{}); //~ ERROR the trait bound `Foo: Trait` is not satisfied - }; - }; - - { - { - f(Foo{}); //~ ERROR the trait bound `Foo: Trait` is not satisfied - } - } - - f(Foo{}); //~ ERROR the trait bound `Foo: Trait` is not satisfied -} diff --git a/src/test/ui/on-unimplemented/enclosing-scope.stderr b/src/test/ui/on-unimplemented/enclosing-scope.stderr deleted file mode 100644 index 67759d02a..000000000 --- a/src/test/ui/on-unimplemented/enclosing-scope.stderr +++ /dev/null @@ -1,86 +0,0 @@ -error[E0277]: the trait bound `Foo: Trait` is not satisfied - --> $DIR/enclosing-scope.rs:14:11 - | -LL | let x = || { - | _____________- -LL | | f(Foo{}); - | | - ^^^^^ the trait `Trait` is not implemented for `Foo` - | | | - | | required by a bound introduced by this call -LL | | let y = || { -LL | | f(Foo{}); -LL | | }; -LL | | }; - | |_____- in this scope - | -note: required by a bound in `f` - --> $DIR/enclosing-scope.rs:10:9 - | -LL | fn f(x: T) {} - | ^^^^^ required by this bound in `f` - -error[E0277]: the trait bound `Foo: Trait` is not satisfied - --> $DIR/enclosing-scope.rs:16:15 - | -LL | let y = || { - | _________________- -LL | | f(Foo{}); - | | - ^^^^^ the trait `Trait` is not implemented for `Foo` - | | | - | | required by a bound introduced by this call -LL | | }; - | |_________- in this scope - | -note: required by a bound in `f` - --> $DIR/enclosing-scope.rs:10:9 - | -LL | fn f(x: T) {} - | ^^^^^ required by this bound in `f` - -error[E0277]: the trait bound `Foo: Trait` is not satisfied - --> $DIR/enclosing-scope.rs:22:15 - | -LL | / fn main() { -LL | | let x = || { -LL | | f(Foo{}); -LL | | let y = || { -... | -LL | | f(Foo{}); - | | - ^^^^^ the trait `Trait` is not implemented for `Foo` - | | | - | | required by a bound introduced by this call -... | -LL | | f(Foo{}); -LL | | } - | |_- in this scope - | -note: required by a bound in `f` - --> $DIR/enclosing-scope.rs:10:9 - | -LL | fn f(x: T) {} - | ^^^^^ required by this bound in `f` - -error[E0277]: the trait bound `Foo: Trait` is not satisfied - --> $DIR/enclosing-scope.rs:26:7 - | -LL | / fn main() { -LL | | let x = || { -LL | | f(Foo{}); -LL | | let y = || { -... | -LL | | f(Foo{}); - | | - ^^^^^ the trait `Trait` is not implemented for `Foo` - | | | - | | required by a bound introduced by this call -LL | | } - | |_- in this scope - | -note: required by a bound in `f` - --> $DIR/enclosing-scope.rs:10:9 - | -LL | fn f(x: T) {} - | ^^^^^ required by this bound in `f` - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/on-unimplemented/multiple-impls.rs b/src/test/ui/on-unimplemented/multiple-impls.rs index b74957ebc..a32fd4566 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.rs +++ b/src/test/ui/on-unimplemented/multiple-impls.rs @@ -33,10 +33,13 @@ fn main() { Index::index(&[] as &[i32], 2u32); //~^ ERROR E0277 //~| ERROR E0277 + //~| ERROR E0277 Index::index(&[] as &[i32], Foo(2u32)); //~^ ERROR E0277 //~| ERROR E0277 + //~| ERROR E0277 Index::index(&[] as &[i32], Bar(2u32)); //~^ ERROR E0277 //~| ERROR E0277 + //~| ERROR E0277 } diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr index 06e1a222a..d628b159a 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.stderr +++ b/src/test/ui/on-unimplemented/multiple-impls.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `[i32]: Index` is not satisfied - --> $DIR/multiple-impls.rs:33:18 + --> $DIR/multiple-impls.rs:33:33 | LL | Index::index(&[] as &[i32], 2u32); - | ------------ ^^^^^^^^^^^^^ trait message + | ------------ ^^^^ trait message | | | required by a bound introduced by this call | @@ -11,11 +11,22 @@ LL | Index::index(&[] as &[i32], 2u32); <[i32] as Index>> <[i32] as Index>> +error[E0277]: the trait bound `[i32]: Index` is not satisfied + --> $DIR/multiple-impls.rs:33:5 + | +LL | Index::index(&[] as &[i32], 2u32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait message + | + = help: the trait `Index` is not implemented for `[i32]` + = help: the following other types implement trait `Index`: + <[i32] as Index>> + <[i32] as Index>> + error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:36:18 + --> $DIR/multiple-impls.rs:37:33 | LL | Index::index(&[] as &[i32], Foo(2u32)); - | ------------ ^^^^^^^^^^^^^ on impl for Foo + | ------------ ^^^^^^^^^ on impl for Foo | | | required by a bound introduced by this call | @@ -24,11 +35,22 @@ LL | Index::index(&[] as &[i32], Foo(2u32)); <[i32] as Index>> <[i32] as Index>> +error[E0277]: the trait bound `[i32]: Index>` is not satisfied + --> $DIR/multiple-impls.rs:37:5 + | +LL | Index::index(&[] as &[i32], Foo(2u32)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Foo + | + = help: the trait `Index>` is not implemented for `[i32]` + = help: the following other types implement trait `Index`: + <[i32] as Index>> + <[i32] as Index>> + error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:39:18 + --> $DIR/multiple-impls.rs:41:33 | LL | Index::index(&[] as &[i32], Bar(2u32)); - | ------------ ^^^^^^^^^^^^^ on impl for Bar + | ------------ ^^^^^^^^^ on impl for Bar | | | required by a bound introduced by this call | @@ -37,6 +59,17 @@ LL | Index::index(&[] as &[i32], Bar(2u32)); <[i32] as Index>> <[i32] as Index>> +error[E0277]: the trait bound `[i32]: Index>` is not satisfied + --> $DIR/multiple-impls.rs:41:5 + | +LL | Index::index(&[] as &[i32], Bar(2u32)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Bar + | + = help: the trait `Index>` is not implemented for `[i32]` + = help: the following other types implement trait `Index`: + <[i32] as Index>> + <[i32] as Index>> + error[E0277]: the trait bound `[i32]: Index` is not satisfied --> $DIR/multiple-impls.rs:33:5 | @@ -49,7 +82,7 @@ LL | Index::index(&[] as &[i32], 2u32); <[i32] as Index>> error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:36:5 + --> $DIR/multiple-impls.rs:37:5 | LL | Index::index(&[] as &[i32], Foo(2u32)); | ^^^^^^^^^^^^ on impl for Foo @@ -60,7 +93,7 @@ LL | Index::index(&[] as &[i32], Foo(2u32)); <[i32] as Index>> error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:39:5 + --> $DIR/multiple-impls.rs:41:5 | LL | Index::index(&[] as &[i32], Bar(2u32)); | ^^^^^^^^^^^^ on impl for Bar @@ -70,6 +103,6 @@ LL | Index::index(&[] as &[i32], Bar(2u32)); <[i32] as Index>> <[i32] as Index>> -error: aborting due to 6 previous errors +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/on-unimplemented/on-impl.rs b/src/test/ui/on-unimplemented/on-impl.rs index ab3e67d01..d0537810c 100644 --- a/src/test/ui/on-unimplemented/on-impl.rs +++ b/src/test/ui/on-unimplemented/on-impl.rs @@ -22,4 +22,5 @@ fn main() { Index::::index(&[1, 2, 3] as &[i32], 2u32); //~^ ERROR E0277 //~| ERROR E0277 + //~| ERROR E0277 } diff --git a/src/test/ui/on-unimplemented/on-impl.stderr b/src/test/ui/on-unimplemented/on-impl.stderr index 769a3d77a..2253c5992 100644 --- a/src/test/ui/on-unimplemented/on-impl.stderr +++ b/src/test/ui/on-unimplemented/on-impl.stderr @@ -1,14 +1,23 @@ error[E0277]: the trait bound `[i32]: Index` is not satisfied - --> $DIR/on-impl.rs:22:25 + --> $DIR/on-impl.rs:22:47 | LL | Index::::index(&[1, 2, 3] as &[i32], 2u32); - | ------------------- ^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice + | ------------------- ^^^^ a usize is required to index into a slice | | | required by a bound introduced by this call | = help: the trait `Index` is not implemented for `[i32]` = help: the trait `Index` is implemented for `[i32]` +error[E0277]: the trait bound `[i32]: Index` is not satisfied + --> $DIR/on-impl.rs:22:5 + | +LL | Index::::index(&[1, 2, 3] as &[i32], 2u32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice + | + = help: the trait `Index` is not implemented for `[i32]` + = help: the trait `Index` is implemented for `[i32]` + error[E0277]: the trait bound `[i32]: Index` is not satisfied --> $DIR/on-impl.rs:22:5 | @@ -18,6 +27,6 @@ LL | Index::::index(&[1, 2, 3] as &[i32], 2u32); = help: the trait `Index` is not implemented for `[i32]` = help: the trait `Index` is implemented for `[i32]` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/on-unimplemented/parent-label.rs b/src/test/ui/on-unimplemented/parent-label.rs new file mode 100644 index 000000000..b65f64968 --- /dev/null +++ b/src/test/ui/on-unimplemented/parent-label.rs @@ -0,0 +1,27 @@ +// Test scope annotations from `parent_label` parameter + +#![feature(rustc_attrs)] + +#[rustc_on_unimplemented(parent_label = "in this scope")] +trait Trait {} + +struct Foo; + +fn f(x: T) {} + +fn main() { + let x = || { + f(Foo {}); //~ ERROR the trait bound `Foo: Trait` is not satisfied + let y = || { + f(Foo {}); //~ ERROR the trait bound `Foo: Trait` is not satisfied + }; + }; + + { + { + f(Foo {}); //~ ERROR the trait bound `Foo: Trait` is not satisfied + } + } + + f(Foo {}); //~ ERROR the trait bound `Foo: Trait` is not satisfied +} diff --git a/src/test/ui/on-unimplemented/parent-label.stderr b/src/test/ui/on-unimplemented/parent-label.stderr new file mode 100644 index 000000000..8cd7412fd --- /dev/null +++ b/src/test/ui/on-unimplemented/parent-label.stderr @@ -0,0 +1,69 @@ +error[E0277]: the trait bound `Foo: Trait` is not satisfied + --> $DIR/parent-label.rs:14:11 + | +LL | let x = || { + | -- in this scope +LL | f(Foo {}); + | - ^^^^^^ the trait `Trait` is not implemented for `Foo` + | | + | required by a bound introduced by this call + | +note: required by a bound in `f` + --> $DIR/parent-label.rs:10:9 + | +LL | fn f(x: T) {} + | ^^^^^ required by this bound in `f` + +error[E0277]: the trait bound `Foo: Trait` is not satisfied + --> $DIR/parent-label.rs:16:15 + | +LL | let y = || { + | -- in this scope +LL | f(Foo {}); + | - ^^^^^^ the trait `Trait` is not implemented for `Foo` + | | + | required by a bound introduced by this call + | +note: required by a bound in `f` + --> $DIR/parent-label.rs:10:9 + | +LL | fn f(x: T) {} + | ^^^^^ required by this bound in `f` + +error[E0277]: the trait bound `Foo: Trait` is not satisfied + --> $DIR/parent-label.rs:22:15 + | +LL | fn main() { + | --------- in this scope +... +LL | f(Foo {}); + | - ^^^^^^ the trait `Trait` is not implemented for `Foo` + | | + | required by a bound introduced by this call + | +note: required by a bound in `f` + --> $DIR/parent-label.rs:10:9 + | +LL | fn f(x: T) {} + | ^^^^^ required by this bound in `f` + +error[E0277]: the trait bound `Foo: Trait` is not satisfied + --> $DIR/parent-label.rs:26:7 + | +LL | fn main() { + | --------- in this scope +... +LL | f(Foo {}); + | - ^^^^^^ the trait `Trait` is not implemented for `Foo` + | | + | required by a bound introduced by this call + | +note: required by a bound in `f` + --> $DIR/parent-label.rs:10:9 + | +LL | fn f(x: T) {} + | ^^^^^ required by this bound in `f` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr index 72f67a685..a7ec3bda8 100644 --- a/src/test/ui/on-unimplemented/slice-index.stderr +++ b/src/test/ui/on-unimplemented/slice-index.stderr @@ -6,7 +6,7 @@ LL | x[1i32]; | = help: the trait `SliceIndex<[i32]>` is not implemented for `i32` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `[i32]` + = note: required for `[i32]` to implement `Index` error[E0277]: the type `[i32]` cannot be indexed by `RangeTo` --> $DIR/slice-index.rs:9:7 @@ -18,7 +18,7 @@ LL | x[..1i32]; = help: the following other types implement trait `SliceIndex`: as SliceIndex<[T]>> as SliceIndex> - = note: required because of the requirements on the impl of `Index>` for `[i32]` + = note: required for `[i32]` to implement `Index>` error: aborting due to 2 previous errors diff --git a/src/test/ui/or-patterns/inner-or-pat.or3.stderr b/src/test/ui/or-patterns/inner-or-pat.or3.stderr new file mode 100644 index 000000000..2236a38c3 --- /dev/null +++ b/src/test/ui/or-patterns/inner-or-pat.or3.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/inner-or-pat.rs:38:54 + | +LL | match x { + | - this expression has type `&str` +LL | x @ ((("h" | "ho" | "yo" | ("dude" | "w")) | () | "nop") | ("hey" | "gg")) | + | ^^ expected `str`, found `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/or-patterns/inner-or-pat.or4.stderr b/src/test/ui/or-patterns/inner-or-pat.or4.stderr new file mode 100644 index 000000000..058873ff5 --- /dev/null +++ b/src/test/ui/or-patterns/inner-or-pat.or4.stderr @@ -0,0 +1,11 @@ +error[E0408]: variable `x` is not bound in all patterns + --> $DIR/inner-or-pat.rs:53:37 + | +LL | (x @ "red" | (x @ "blue" | "red")) => { + | - ^^^^^ pattern doesn't bind `x` + | | + | variable not in all patterns + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0408`. diff --git a/src/test/ui/or-patterns/inner-or-pat.rs b/src/test/ui/or-patterns/inner-or-pat.rs new file mode 100644 index 000000000..f4cf4b0c1 --- /dev/null +++ b/src/test/ui/or-patterns/inner-or-pat.rs @@ -0,0 +1,73 @@ +// revisions: or1 or2 or3 or4 or5 +// [or1] run-pass +// [or2] run-pass +// [or5] run-pass + +#![allow(unreachable_patterns)] +#![allow(unused_variables)] +#![allow(unused_parens)] +#![allow(dead_code)] + + + +fn foo() { + let x = "foo"; + match x { + x @ ((("h" | "ho" | "yo" | ("dude" | "w")) | "no" | "nop") | ("hey" | "gg")) | + x @ ("black" | "pink") | + x @ ("red" | "blue") => { + } + _ => (), + } +} + +fn bar() { + let x = "foo"; + match x { + x @ ("foo" | "bar") | + (x @ "red" | (x @ "blue" | x @ "red")) => { + } + _ => (), + } +} + +#[cfg(or3)] +fn zot() { + let x = "foo"; + match x { + x @ ((("h" | "ho" | "yo" | ("dude" | "w")) | () | "nop") | ("hey" | "gg")) | + //[or3]~^ ERROR mismatched types + x @ ("black" | "pink") | + x @ ("red" | "blue") => { + } + _ => (), + } +} + + +#[cfg(or4)] +fn hey() { + let x = "foo"; + match x { + x @ ("foo" | "bar") | + (x @ "red" | (x @ "blue" | "red")) => { + //[or4]~^ variable `x` is not bound in all patterns + } + _ => (), + } +} + +fn don() { + enum Foo { + A, + B, + C, + } + + match Foo::A { + | _foo @ (Foo::A | Foo::B) => {} + Foo::C => {} + }; +} + +fn main(){} diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs b/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs index 6f9a631b0..dda5c0bb5 100644 --- a/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs +++ b/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs @@ -7,7 +7,7 @@ fn main() {} // Test the `pat` macro fragment parser: macro_rules! accept_pat { - ($p:pat) => {} + ($p:pat) => {}; } accept_pat!((p | q)); @@ -21,28 +21,28 @@ accept_pat!([p | q]); #[cfg(FALSE)] fn or_patterns() { // Top level of `let`: - let (| A | B); + let (A | B); let (A | B); let (A | B): u8; let (A | B) = 0; let (A | B): u8 = 0; // Top level of `for`: - for | A | B in 0 {} + for A | B in 0 {} for A | B in 0 {} // Top level of `while`: - while let | A | B = 0 {} + while let A | B = 0 {} while let A | B = 0 {} // Top level of `if`: - if let | A | B = 0 {} + if let A | B = 0 {} if let A | B = 0 {} // Top level of `match` arms: match 0 { - | A | B => {}, - A | B => {}, + A | B => {} + A | B => {} } // Functions: @@ -68,6 +68,8 @@ fn or_patterns() { // These bind as `(prefix p) | q` as opposed to `prefix (p | q)`: let (box 0 | 1); // Unstable; we *can* change the precedence if we want. + //~^ WARN box pattern syntax is experimental + //~| WARN unstable syntax let (&0 | 1); let (&mut 0 | 1); let (x @ 0 | 1); diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-pass.stderr b/src/test/ui/or-patterns/or-patterns-syntactic-pass.stderr new file mode 100644 index 000000000..c43fe192a --- /dev/null +++ b/src/test/ui/or-patterns/or-patterns-syntactic-pass.stderr @@ -0,0 +1,13 @@ +warning: box pattern syntax is experimental + --> $DIR/or-patterns-syntactic-pass.rs:70:10 + | +LL | let (box 0 | 1); // Unstable; we *can* change the precedence if we want. + | ^^^^^ + | + = note: see issue #29641 for more information + = help: add `#![feature(box_patterns)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: 1 warning emitted + diff --git a/src/test/ui/parser/bad-interpolated-block.rs b/src/test/ui/parser/bad-interpolated-block.rs index 38d53a14b..c6d7ae383 100644 --- a/src/test/ui/parser/bad-interpolated-block.rs +++ b/src/test/ui/parser/bad-interpolated-block.rs @@ -1,5 +1,3 @@ -#![feature(label_break_value)] - fn main() {} macro_rules! m { diff --git a/src/test/ui/parser/bad-interpolated-block.stderr b/src/test/ui/parser/bad-interpolated-block.stderr index 77933b1bc..2a0999afd 100644 --- a/src/test/ui/parser/bad-interpolated-block.stderr +++ b/src/test/ui/parser/bad-interpolated-block.stderr @@ -1,5 +1,5 @@ error: cannot use a `block` macro fragment here - --> $DIR/bad-interpolated-block.rs:7:15 + --> $DIR/bad-interpolated-block.rs:5:15 | LL | 'lab: $b; | ------^^ @@ -12,7 +12,7 @@ LL | m!({}); = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot use a `block` macro fragment here - --> $DIR/bad-interpolated-block.rs:8:16 + --> $DIR/bad-interpolated-block.rs:6:16 | LL | unsafe $b; | -------^^ @@ -25,7 +25,7 @@ LL | m!({}); = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot use a `block` macro fragment here - --> $DIR/bad-interpolated-block.rs:9:23 + --> $DIR/bad-interpolated-block.rs:7:23 | LL | |x: u8| -> () $b; | ^^ the `block` fragment is within this context diff --git a/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.rs b/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.rs index afbd13e6f..d8346653c 100644 --- a/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.rs +++ b/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.rs @@ -3,7 +3,11 @@ #[cfg(FALSE)] fn syntax() { foo::(); + //~^ WARN associated type bounds are unstable + //~| WARN unstable syntax foo::(); + //~^ WARN associated type bounds are unstable + //~| WARN unstable syntax } fn main() {} diff --git a/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.stderr b/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.stderr new file mode 100644 index 000000000..7e843c7f4 --- /dev/null +++ b/src/test/ui/parser/constraints-before-generic-args-syntactic-pass.stderr @@ -0,0 +1,24 @@ +warning: associated type bounds are unstable + --> $DIR/constraints-before-generic-args-syntactic-pass.rs:5:19 + | +LL | foo::(); + | ^^^^^^ + | + = note: see issue #52662 for more information + = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: associated type bounds are unstable + --> $DIR/constraints-before-generic-args-syntactic-pass.rs:8:23 + | +LL | foo::(); + | ^^^^^^ + | + = note: see issue #52662 for more information + = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: 2 warnings emitted + diff --git a/src/test/ui/parser/do-not-suggest-semicolon-before-array.rs b/src/test/ui/parser/do-not-suggest-semicolon-before-array.rs new file mode 100644 index 000000000..7ebf3f6b0 --- /dev/null +++ b/src/test/ui/parser/do-not-suggest-semicolon-before-array.rs @@ -0,0 +1,8 @@ +fn foo() {} + +fn bar() -> [u8; 2] { + foo() + [1, 3) //~ ERROR expected one of `.`, `?`, `]`, or an operator, found `,` +} + +fn main() {} diff --git a/src/test/ui/parser/do-not-suggest-semicolon-before-array.stderr b/src/test/ui/parser/do-not-suggest-semicolon-before-array.stderr new file mode 100644 index 000000000..a9dd52632 --- /dev/null +++ b/src/test/ui/parser/do-not-suggest-semicolon-before-array.stderr @@ -0,0 +1,10 @@ +error: expected one of `.`, `?`, `]`, or an operator, found `,` + --> $DIR/do-not-suggest-semicolon-before-array.rs:5:5 + | +LL | [1, 3) + | ^ ^ help: `]` may belong here + | | + | unclosed delimiter + +error: aborting due to previous error + diff --git a/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs b/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs new file mode 100644 index 000000000..d6f798181 --- /dev/null +++ b/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs @@ -0,0 +1,3 @@ +fn main() { + let _x = vec[1, 2, 3]; //~ ERROR expected one of `.`, `?`, `]`, or an operator +} diff --git a/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr b/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr new file mode 100644 index 000000000..2fe6a28ee --- /dev/null +++ b/src/test/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr @@ -0,0 +1,8 @@ +error: expected one of `.`, `?`, `]`, or an operator, found `,` + --> $DIR/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs:2:19 + | +LL | let _x = vec[1, 2, 3]; + | ^ expected one of `.`, `?`, `]`, or an operator + +error: aborting due to previous error + diff --git a/src/test/ui/parser/fn-defined-using-def.rs b/src/test/ui/parser/fn-defined-using-def.rs new file mode 100644 index 000000000..21da34c47 --- /dev/null +++ b/src/test/ui/parser/fn-defined-using-def.rs @@ -0,0 +1,10 @@ +// Check what happens when `def` is used to define a function, instead of `fn` +// edition:2021 + +#![allow(dead_code)] + +def foo() {} +//~^ ERROR expected one of `!` or `::`, found `foo` +//~^^ HELP write `fn` instead of `def` to declare a function + +fn main() {} diff --git a/src/test/ui/parser/fn-defined-using-def.stderr b/src/test/ui/parser/fn-defined-using-def.stderr new file mode 100644 index 000000000..f34329012 --- /dev/null +++ b/src/test/ui/parser/fn-defined-using-def.stderr @@ -0,0 +1,10 @@ +error: expected one of `!` or `::`, found `foo` + --> $DIR/fn-defined-using-def.rs:6:5 + | +LL | def foo() {} + | --- ^^^ expected one of `!` or `::` + | | + | help: write `fn` instead of `def` to declare a function + +error: aborting due to previous error + diff --git a/src/test/ui/parser/fn-defined-using-fun.rs b/src/test/ui/parser/fn-defined-using-fun.rs new file mode 100644 index 000000000..4f7460504 --- /dev/null +++ b/src/test/ui/parser/fn-defined-using-fun.rs @@ -0,0 +1,10 @@ +// Check what happens when `fun` is used to define a function, instead of `fn` +// edition:2021 + +#![allow(dead_code)] + +fun foo() {} +//~^ ERROR expected one of `!` or `::`, found `foo` +//~^^ HELP write `fn` instead of `fun` to declare a function + +fn main() {} diff --git a/src/test/ui/parser/fn-defined-using-fun.stderr b/src/test/ui/parser/fn-defined-using-fun.stderr new file mode 100644 index 000000000..2f6cfff35 --- /dev/null +++ b/src/test/ui/parser/fn-defined-using-fun.stderr @@ -0,0 +1,10 @@ +error: expected one of `!` or `::`, found `foo` + --> $DIR/fn-defined-using-fun.rs:6:5 + | +LL | fun foo() {} + | --- ^^^ expected one of `!` or `::` + | | + | help: write `fn` instead of `fun` to declare a function + +error: aborting due to previous error + diff --git a/src/test/ui/parser/fn-defined-using-func.rs b/src/test/ui/parser/fn-defined-using-func.rs new file mode 100644 index 000000000..2dce96fdc --- /dev/null +++ b/src/test/ui/parser/fn-defined-using-func.rs @@ -0,0 +1,10 @@ +// Check what happens when `func` is used to define a function, instead of `fn` +// edition:2021 + +#![allow(dead_code)] + +func foo() {} +//~^ ERROR expected one of `!` or `::`, found `foo` +//~^^ HELP write `fn` instead of `func` to declare a function + +fn main() {} diff --git a/src/test/ui/parser/fn-defined-using-func.stderr b/src/test/ui/parser/fn-defined-using-func.stderr new file mode 100644 index 000000000..355741e89 --- /dev/null +++ b/src/test/ui/parser/fn-defined-using-func.stderr @@ -0,0 +1,10 @@ +error: expected one of `!` or `::`, found `foo` + --> $DIR/fn-defined-using-func.rs:6:6 + | +LL | func foo() {} + | ---- ^^^ expected one of `!` or `::` + | | + | help: write `fn` instead of `func` to declare a function + +error: aborting due to previous error + diff --git a/src/test/ui/parser/fn-defined-using-function.rs b/src/test/ui/parser/fn-defined-using-function.rs new file mode 100644 index 000000000..fd8782728 --- /dev/null +++ b/src/test/ui/parser/fn-defined-using-function.rs @@ -0,0 +1,10 @@ +// Check what happens when `function` is used to define a function, instead of `fn` +// edition:2021 + +#![allow(dead_code)] + +function foo() {} +//~^ ERROR expected one of `!` or `::`, found `foo` +//~^^ HELP write `fn` instead of `function` to declare a function + +fn main() {} diff --git a/src/test/ui/parser/fn-defined-using-function.stderr b/src/test/ui/parser/fn-defined-using-function.stderr new file mode 100644 index 000000000..43c33a2cd --- /dev/null +++ b/src/test/ui/parser/fn-defined-using-function.stderr @@ -0,0 +1,10 @@ +error: expected one of `!` or `::`, found `foo` + --> $DIR/fn-defined-using-function.rs:6:10 + | +LL | function foo() {} + | -------- ^^^ expected one of `!` or `::` + | | + | help: write `fn` instead of `function` to declare a function + +error: aborting due to previous error + diff --git a/src/test/ui/parser/fn-header-semantic-fail.rs b/src/test/ui/parser/fn-header-semantic-fail.rs index 8ff14fb1f..cf5d3dab4 100644 --- a/src/test/ui/parser/fn-header-semantic-fail.rs +++ b/src/test/ui/parser/fn-header-semantic-fail.rs @@ -27,7 +27,6 @@ fn main() { struct Y; impl X for Y { async fn ft1() {} //~ ERROR functions in traits cannot be declared `async` - //~^ ERROR has an incompatible type for trait unsafe fn ft2() {} // OK. const fn ft3() {} //~ ERROR functions in traits cannot be declared const extern "C" fn ft4() {} @@ -36,7 +35,6 @@ fn main() { //~| ERROR functions in traits cannot be declared const //~| ERROR functions cannot be both `const` and `async` //~| ERROR cycle detected - //~| ERROR has an incompatible type for trait } impl Y { diff --git a/src/test/ui/parser/fn-header-semantic-fail.stderr b/src/test/ui/parser/fn-header-semantic-fail.stderr index bc51ba8b8..36304779d 100644 --- a/src/test/ui/parser/fn-header-semantic-fail.stderr +++ b/src/test/ui/parser/fn-header-semantic-fail.stderr @@ -7,17 +7,6 @@ LL | const async unsafe extern "C" fn ff5() {} | | `async` because of this | `const` because of this -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:17:9 - | -LL | async fn ft1(); - | -----^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - error[E0379]: functions in traits cannot be declared const --> $DIR/fn-header-semantic-fail.rs:19:9 | @@ -30,17 +19,6 @@ error[E0379]: functions in traits cannot be declared const LL | const async unsafe extern "C" fn ft5(); | ^^^^^ functions in traits cannot be const -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:21:9 - | -LL | const async unsafe extern "C" fn ft5(); - | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - error: functions cannot be both `const` and `async` --> $DIR/fn-header-semantic-fail.rs:21:9 | @@ -50,42 +28,20 @@ LL | const async unsafe extern "C" fn ft5(); | | `async` because of this | `const` because of this -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:29:9 - | -LL | async fn ft1() {} - | -----^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:32:9 + --> $DIR/fn-header-semantic-fail.rs:31:9 | LL | const fn ft3() {} | ^^^^^ functions in traits cannot be const error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:34:9 + --> $DIR/fn-header-semantic-fail.rs:33:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^ functions in traits cannot be const -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:34:9 - | -LL | const async unsafe extern "C" fn ft5() {} - | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:34:9 + --> $DIR/fn-header-semantic-fail.rs:33:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^-^^^^^------------------------------ @@ -94,7 +50,7 @@ LL | const async unsafe extern "C" fn ft5() {} | `const` because of this error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:47:9 + --> $DIR/fn-header-semantic-fail.rs:45:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^-^^^^^------------------------------ @@ -103,7 +59,7 @@ LL | const async unsafe extern "C" fn fi5() {} | `const` because of this error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:53:18 + --> $DIR/fn-header-semantic-fail.rs:51:18 | LL | extern "C" { | ---------- in this `extern` block @@ -116,7 +72,7 @@ LL | fn fe1(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:54:19 + --> $DIR/fn-header-semantic-fail.rs:52:19 | LL | extern "C" { | ---------- in this `extern` block @@ -130,7 +86,7 @@ LL | fn fe2(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:55:18 + --> $DIR/fn-header-semantic-fail.rs:53:18 | LL | extern "C" { | ---------- in this `extern` block @@ -144,7 +100,7 @@ LL | fn fe3(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:56:23 + --> $DIR/fn-header-semantic-fail.rs:54:23 | LL | extern "C" { | ---------- in this `extern` block @@ -158,7 +114,7 @@ LL | fn fe4(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:57:42 + --> $DIR/fn-header-semantic-fail.rs:55:42 | LL | extern "C" { | ---------- in this `extern` block @@ -172,7 +128,7 @@ LL | fn fe5(); | ~~ error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:57:9 + --> $DIR/fn-header-semantic-fail.rs:55:9 | LL | const async unsafe extern "C" fn fe5(); | ^^^^^-^^^^^---------------------------- @@ -180,6 +136,58 @@ LL | const async unsafe extern "C" fn fe5(); | | `async` because of this | `const` because of this +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/fn-header-semantic-fail.rs:17:9 + | +LL | async fn ft1(); + | -----^^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/fn-header-semantic-fail.rs:21:9 + | +LL | const async unsafe extern "C" fn ft5(); + | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/fn-header-semantic-fail.rs:29:9 + | +LL | async fn ft1() {} + | -----^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/fn-header-semantic-fail.rs:33:9 + | +LL | const async unsafe extern "C" fn ft5() {} + | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | `async` because of this + | + = note: `async` trait functions are not currently supported + = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait + = note: see issue #91611 for more information + = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + error[E0391]: cycle detected when computing type of `main::ff5::{opaque#0}` --> $DIR/fn-header-semantic-fail.rs:12:44 | @@ -216,60 +224,24 @@ LL | | } LL | | } | |_^ -error[E0053]: method `ft1` has an incompatible type for trait - --> $DIR/fn-header-semantic-fail.rs:29:24 - | -LL | async fn ft1() {} - | ^ - | | - | checked the `Output` of this `async fn`, found opaque type - | expected `()`, found opaque type - | - = note: while checking the return type of the `async fn` -note: type in trait - --> $DIR/fn-header-semantic-fail.rs:17:23 - | -LL | async fn ft1(); - | ^ - = note: expected fn pointer `fn()` - found fn pointer `fn() -> impl Future` - -error[E0053]: method `ft5` has an incompatible type for trait - --> $DIR/fn-header-semantic-fail.rs:34:48 - | -LL | const async unsafe extern "C" fn ft5() {} - | ^ - | | - | checked the `Output` of this `async fn`, found opaque type - | expected `()`, found opaque type - | - = note: while checking the return type of the `async fn` -note: type in trait - --> $DIR/fn-header-semantic-fail.rs:21:47 - | -LL | const async unsafe extern "C" fn ft5(); - | ^ - = note: expected fn pointer `unsafe extern "C" fn()` - found fn pointer `unsafe extern "C" fn() -> impl Future` - error[E0391]: cycle detected when computing type of `main::::ft5::{opaque#0}` - --> $DIR/fn-header-semantic-fail.rs:34:48 + --> $DIR/fn-header-semantic-fail.rs:33:48 | LL | const async unsafe extern "C" fn ft5() {} | ^ | note: ...which requires borrow-checking `main::::ft5`... - --> $DIR/fn-header-semantic-fail.rs:34:9 + --> $DIR/fn-header-semantic-fail.rs:33:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires processing `main::::ft5`... - --> $DIR/fn-header-semantic-fail.rs:34:9 + --> $DIR/fn-header-semantic-fail.rs:33:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires const checking `main::::ft5`... - --> $DIR/fn-header-semantic-fail.rs:34:9 + --> $DIR/fn-header-semantic-fail.rs:33:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -288,30 +260,30 @@ LL | | } LL | | } | |_^ -error[E0391]: cycle detected when computing type of `main::::fi5::{opaque#0}` - --> $DIR/fn-header-semantic-fail.rs:47:48 +error[E0391]: cycle detected when computing type of `main::::fi5::{opaque#0}` + --> $DIR/fn-header-semantic-fail.rs:45:48 | LL | const async unsafe extern "C" fn fi5() {} | ^ | -note: ...which requires borrow-checking `main::::fi5`... - --> $DIR/fn-header-semantic-fail.rs:47:9 +note: ...which requires borrow-checking `main::::fi5`... + --> $DIR/fn-header-semantic-fail.rs:45:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing `main::::fi5`... - --> $DIR/fn-header-semantic-fail.rs:47:9 +note: ...which requires processing `main::::fi5`... + --> $DIR/fn-header-semantic-fail.rs:45:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `main::::fi5`... - --> $DIR/fn-header-semantic-fail.rs:47:9 +note: ...which requires const checking `main::::fi5`... + --> $DIR/fn-header-semantic-fail.rs:45:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing whether `impl core::future::future::Future` is freeze... = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future: core::marker::Freeze`... - = note: ...which again requires computing type of `main::::fi5::{opaque#0}`, completing the cycle + = 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 | @@ -324,7 +296,7 @@ LL | | } LL | | } | |_^ -error: aborting due to 23 previous errors +error: aborting due to 21 previous errors -Some errors have detailed explanations: E0053, E0379, E0391, E0706. -For more information about an error, try `rustc --explain E0053`. +Some errors have detailed explanations: E0379, E0391, E0706. +For more information about an error, try `rustc --explain E0379`. diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs index 9871cb8fe..1291a021b 100644 --- a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs +++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs @@ -1,5 +1,3 @@ -#![feature(generic_associated_types)] - fn main() {} struct X; diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr index 4b398d791..3856754e0 100644 --- a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr +++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr @@ -1,5 +1,5 @@ error: associated type in `impl` without body - --> $DIR/impl-item-type-no-body-semantic-fail.rs:8:5 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:6:5 | LL | type Y; | ^^^^^^- @@ -7,7 +7,7 @@ LL | type Y; | help: provide a definition for the type: `= ;` error: associated type in `impl` without body - --> $DIR/impl-item-type-no-body-semantic-fail.rs:11:5 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:5 | LL | type Z: Ord; | ^^^^^^^^^^^- @@ -15,13 +15,13 @@ LL | type Z: Ord; | help: provide a definition for the type: `= ;` error: bounds on `type`s in `impl`s have no effect - --> $DIR/impl-item-type-no-body-semantic-fail.rs:11:13 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:13 | LL | type Z: Ord; | ^^^ error: associated type in `impl` without body - --> $DIR/impl-item-type-no-body-semantic-fail.rs:15:5 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:13:5 | LL | type W: Ord where Self: Eq; | ^^^^^^^^^^^^^^^^^^^^^^^^^^- @@ -29,13 +29,13 @@ LL | type W: Ord where Self: Eq; | help: provide a definition for the type: `= ;` error: bounds on `type`s in `impl`s have no effect - --> $DIR/impl-item-type-no-body-semantic-fail.rs:15:13 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:13:13 | LL | type W: Ord where Self: Eq; | ^^^ error: associated type in `impl` without body - --> $DIR/impl-item-type-no-body-semantic-fail.rs:19:5 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:17:5 | LL | type W where Self: Eq; | ^^^^^^^^^^^^^^^^^^^^^- @@ -43,7 +43,7 @@ LL | type W where Self: Eq; | help: provide a definition for the type: `= ;` error[E0658]: inherent associated types are unstable - --> $DIR/impl-item-type-no-body-semantic-fail.rs:8:5 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:6:5 | LL | type Y; | ^^^^^^^ @@ -52,7 +52,7 @@ LL | type Y; = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable error[E0658]: inherent associated types are unstable - --> $DIR/impl-item-type-no-body-semantic-fail.rs:11:5 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:5 | LL | type Z: Ord; | ^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL | type Z: Ord; = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable error[E0658]: inherent associated types are unstable - --> $DIR/impl-item-type-no-body-semantic-fail.rs:15:5 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:13:5 | LL | type W: Ord where Self: Eq; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -70,7 +70,7 @@ LL | type W: Ord where Self: Eq; = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable error[E0658]: inherent associated types are unstable - --> $DIR/impl-item-type-no-body-semantic-fail.rs:19:5 + --> $DIR/impl-item-type-no-body-semantic-fail.rs:17:5 | LL | type W where Self: Eq; | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/increment-notfixed.stderr b/src/test/ui/parser/increment-notfixed.stderr index 352d98cf8..ae55ae067 100644 --- a/src/test/ui/parser/increment-notfixed.stderr +++ b/src/test/ui/parser/increment-notfixed.stderr @@ -8,9 +8,8 @@ help: use `+= 1` instead | LL | { let tmp = i; i += 1; tmp }; | +++++++++++ ~~~~~~~~~~~~~~~ -LL - i++; -LL + i += 1; - | +LL | i += 1; + | ~~~~ error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:17:12 @@ -24,9 +23,8 @@ help: use `+= 1` instead | LL | while { let tmp = i; i += 1; tmp } < 5 { | +++++++++++ ~~~~~~~~~~~~~~~ -LL - while i++ < 5 { -LL + while i += 1 < 5 { - | +LL | while i += 1 < 5 { + | ~~~~ error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:25:8 @@ -38,9 +36,8 @@ help: use `+= 1` instead | LL | { let tmp_ = tmp; tmp += 1; tmp_ }; | ++++++++++++ ~~~~~~~~~~~~~~~~~~ -LL - tmp++; -LL + tmp += 1; - | +LL | tmp += 1; + | ~~~~ error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:31:14 @@ -54,9 +51,8 @@ help: use `+= 1` instead | LL | while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 { | ++++++++++++ ~~~~~~~~~~~~~~~~~~ -LL - while tmp++ < 5 { -LL + while tmp += 1 < 5 { - | +LL | while tmp += 1 < 5 { + | ~~~~ error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:39:16 @@ -68,9 +64,8 @@ help: use `+= 1` instead | LL | { let tmp = foo.bar.qux; foo.bar.qux += 1; tmp }; | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ -LL - foo.bar.qux++; -LL + foo.bar.qux += 1; - | +LL | foo.bar.qux += 1; + | ~~~~ error: Rust has no postfix increment operator --> $DIR/increment-notfixed.rs:49:10 @@ -82,9 +77,8 @@ help: use `+= 1` instead | LL | { let tmp = s.tmp; s.tmp += 1; tmp }; | +++++++++++ ~~~~~~~~~~~~~~~~~~~ -LL - s.tmp++; -LL + s.tmp += 1; - | +LL | s.tmp += 1; + | ~~~~ error: Rust has no prefix increment operator --> $DIR/increment-notfixed.rs:56:5 diff --git a/src/test/ui/parser/issue-100197-mut-let.fixed b/src/test/ui/parser/issue-100197-mut-let.fixed new file mode 100644 index 000000000..5a8956222 --- /dev/null +++ b/src/test/ui/parser/issue-100197-mut-let.fixed @@ -0,0 +1,6 @@ +// run-rustfix + +fn main() { + let mut _x = 123; + //~^ ERROR invalid variable declaration +} diff --git a/src/test/ui/parser/issue-100197-mut-let.rs b/src/test/ui/parser/issue-100197-mut-let.rs new file mode 100644 index 000000000..71103813a --- /dev/null +++ b/src/test/ui/parser/issue-100197-mut-let.rs @@ -0,0 +1,6 @@ +// run-rustfix + +fn main() { + mut let _x = 123; + //~^ ERROR invalid variable declaration +} diff --git a/src/test/ui/parser/issue-100197-mut-let.stderr b/src/test/ui/parser/issue-100197-mut-let.stderr new file mode 100644 index 000000000..86658e4f3 --- /dev/null +++ b/src/test/ui/parser/issue-100197-mut-let.stderr @@ -0,0 +1,8 @@ +error: invalid variable declaration + --> $DIR/issue-100197-mut-let.rs:4:5 + | +LL | mut let _x = 123; + | ^^^^^^^ help: switch the order of `mut` and `let`: `let mut` + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issue-101477-enum.fixed b/src/test/ui/parser/issue-101477-enum.fixed new file mode 100644 index 000000000..1dfeae22a --- /dev/null +++ b/src/test/ui/parser/issue-101477-enum.fixed @@ -0,0 +1,10 @@ +// run-rustfix + +#[allow(dead_code)] +enum Demo { + A = 1, + B = 2 //~ ERROR unexpected `==` + //~^ expected item, found `==` +} + +fn main() {} diff --git a/src/test/ui/parser/issue-101477-enum.rs b/src/test/ui/parser/issue-101477-enum.rs new file mode 100644 index 000000000..ea7051d69 --- /dev/null +++ b/src/test/ui/parser/issue-101477-enum.rs @@ -0,0 +1,10 @@ +// run-rustfix + +#[allow(dead_code)] +enum Demo { + A = 1, + B == 2 //~ ERROR unexpected `==` + //~^ expected item, found `==` +} + +fn main() {} diff --git a/src/test/ui/parser/issue-101477-enum.stderr b/src/test/ui/parser/issue-101477-enum.stderr new file mode 100644 index 000000000..bffc881bd --- /dev/null +++ b/src/test/ui/parser/issue-101477-enum.stderr @@ -0,0 +1,14 @@ +error: unexpected `==` + --> $DIR/issue-101477-enum.rs:6:7 + | +LL | B == 2 + | ^^ help: try using `=` instead + +error: expected item, found `==` + --> $DIR/issue-101477-enum.rs:6:7 + | +LL | B == 2 + | ^^ expected item + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/parser/issue-101477-let.fixed b/src/test/ui/parser/issue-101477-let.fixed new file mode 100644 index 000000000..9989ad815 --- /dev/null +++ b/src/test/ui/parser/issue-101477-let.fixed @@ -0,0 +1,6 @@ +// run-rustfix + +fn main() { + let x = 2; //~ ERROR unexpected `==` + println!("x: {}", x) +} diff --git a/src/test/ui/parser/issue-101477-let.rs b/src/test/ui/parser/issue-101477-let.rs new file mode 100644 index 000000000..8b0e8bee1 --- /dev/null +++ b/src/test/ui/parser/issue-101477-let.rs @@ -0,0 +1,6 @@ +// run-rustfix + +fn main() { + let x == 2; //~ ERROR unexpected `==` + println!("x: {}", x) +} diff --git a/src/test/ui/parser/issue-101477-let.stderr b/src/test/ui/parser/issue-101477-let.stderr new file mode 100644 index 000000000..1b30d4b17 --- /dev/null +++ b/src/test/ui/parser/issue-101477-let.stderr @@ -0,0 +1,8 @@ +error: unexpected `==` + --> $DIR/issue-101477-let.rs:4:11 + | +LL | let x == 2; + | ^^ help: try using `=` instead + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.fixed b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.fixed new file mode 100644 index 000000000..64ab6f62b --- /dev/null +++ b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.fixed @@ -0,0 +1,8 @@ +// run-rustfix + +fn main() { + const _FOO: i32 = 123; + //~^ ERROR const` and `let` are mutually exclusive + const _BAR: i32 = 123; + //~^ ERROR `const` and `let` are mutually exclusive +} diff --git a/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.rs b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.rs new file mode 100644 index 000000000..50520971f --- /dev/null +++ b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.rs @@ -0,0 +1,8 @@ +// run-rustfix + +fn main() { + const let _FOO: i32 = 123; + //~^ ERROR const` and `let` are mutually exclusive + let const _BAR: i32 = 123; + //~^ ERROR `const` and `let` are mutually exclusive +} diff --git a/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.stderr b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.stderr new file mode 100644 index 000000000..72377fc37 --- /dev/null +++ b/src/test/ui/parser/issue-99910-const-let-mutually-exclusive.stderr @@ -0,0 +1,14 @@ +error: `const` and `let` are mutually exclusive + --> $DIR/issue-99910-const-let-mutually-exclusive.rs:4:5 + | +LL | const let _FOO: i32 = 123; + | ^^^^^^^^^ help: remove `let`: `const` + +error: `const` and `let` are mutually exclusive + --> $DIR/issue-99910-const-let-mutually-exclusive.rs:6:5 + | +LL | let const _BAR: i32 = 123; + | ^^^^^^^^^ help: remove `let`: `const` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/parser/issues/issue-14303-enum.rs b/src/test/ui/parser/issues/issue-14303-enum.rs deleted file mode 100644 index a61061598..000000000 --- a/src/test/ui/parser/issues/issue-14303-enum.rs +++ /dev/null @@ -1,6 +0,0 @@ -enum X<'a, T, 'b> { -//~^ ERROR lifetime parameters must be declared prior to type parameters - A(&'a &'b T) -} - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-enum.stderr b/src/test/ui/parser/issues/issue-14303-enum.stderr deleted file mode 100644 index 55cef4cab..000000000 --- a/src/test/ui/parser/issues/issue-14303-enum.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-enum.rs:1:15 - | -LL | enum X<'a, T, 'b> { - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303-fn-def.rs b/src/test/ui/parser/issues/issue-14303-fn-def.rs deleted file mode 100644 index 221bd311e..000000000 --- a/src/test/ui/parser/issues/issue-14303-fn-def.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn foo<'a, T, 'b>(x: &'a T) {} -//~^ ERROR lifetime parameters must be declared prior to type parameters - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-fn-def.stderr b/src/test/ui/parser/issues/issue-14303-fn-def.stderr deleted file mode 100644 index bacc92296..000000000 --- a/src/test/ui/parser/issues/issue-14303-fn-def.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-fn-def.rs:1:15 - | -LL | fn foo<'a, T, 'b>(x: &'a T) {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303-impl.rs b/src/test/ui/parser/issues/issue-14303-impl.rs deleted file mode 100644 index 4dc2c6660..000000000 --- a/src/test/ui/parser/issues/issue-14303-impl.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct X(T); - -impl<'a, T, 'b> X {} -//~^ ERROR lifetime parameters must be declared prior to type parameters - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-impl.stderr b/src/test/ui/parser/issues/issue-14303-impl.stderr deleted file mode 100644 index d6be02f70..000000000 --- a/src/test/ui/parser/issues/issue-14303-impl.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-impl.rs:3:13 - | -LL | impl<'a, T, 'b> X {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303-path.rs b/src/test/ui/parser/issues/issue-14303-path.rs deleted file mode 100644 index 89ef914ab..000000000 --- a/src/test/ui/parser/issues/issue-14303-path.rs +++ /dev/null @@ -1,13 +0,0 @@ -mod foo { - pub struct X<'a, 'b, 'c, T> { - a: &'a str, - b: &'b str, - c: &'c str, - t: T, - } -} - -fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {} -//~^ ERROR type provided when a lifetime was expected - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-path.stderr b/src/test/ui/parser/issues/issue-14303-path.stderr deleted file mode 100644 index 841e63ecb..000000000 --- a/src/test/ui/parser/issues/issue-14303-path.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0747]: type provided when a lifetime was expected - --> $DIR/issue-14303-path.rs:10:37 - | -LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {} - | ^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0747`. diff --git a/src/test/ui/parser/issues/issue-14303-struct.rs b/src/test/ui/parser/issues/issue-14303-struct.rs deleted file mode 100644 index 0bd10b4d0..000000000 --- a/src/test/ui/parser/issues/issue-14303-struct.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct X<'a, T, 'b> { -//~^ ERROR lifetime parameters must be declared prior to type parameters - x: &'a &'b T -} - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-struct.stderr b/src/test/ui/parser/issues/issue-14303-struct.stderr deleted file mode 100644 index fa62a39f2..000000000 --- a/src/test/ui/parser/issues/issue-14303-struct.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-struct.rs:1:17 - | -LL | struct X<'a, T, 'b> { - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303-trait.rs b/src/test/ui/parser/issues/issue-14303-trait.rs deleted file mode 100644 index f253de92d..000000000 --- a/src/test/ui/parser/issues/issue-14303-trait.rs +++ /dev/null @@ -1,4 +0,0 @@ -trait Foo<'a, T, 'b> {} -//~^ ERROR lifetime parameters must be declared prior to type parameters - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303-trait.stderr b/src/test/ui/parser/issues/issue-14303-trait.stderr deleted file mode 100644 index 75cd67a9d..000000000 --- a/src/test/ui/parser/issues/issue-14303-trait.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-trait.rs:1:18 - | -LL | trait Foo<'a, T, 'b> {} - | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` - -error: aborting due to previous error - diff --git a/src/test/ui/parser/issues/issue-14303.rs b/src/test/ui/parser/issues/issue-14303.rs new file mode 100644 index 000000000..82850d77a --- /dev/null +++ b/src/test/ui/parser/issues/issue-14303.rs @@ -0,0 +1,33 @@ +enum Enum<'a, T, 'b> { +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + A(&'a &'b T) +} + +struct Struct<'a, T, 'b> { +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + x: &'a &'b T +} + +trait Trait<'a, T, 'b> {} +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + +fn foo<'a, T, 'b>(x: &'a T) {} +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + +struct Y(T); +impl<'a, T, 'b> Y {} +//~^ ERROR lifetime parameters must be declared prior to type and const parameters + +mod bar { + pub struct X<'a, 'b, 'c, T> { + a: &'a str, + b: &'b str, + c: &'c str, + t: T, + } +} + +fn bar<'a, 'b, 'c, T>(x: bar::X<'a, T, 'b, 'c>) {} +//~^ ERROR type provided when a lifetime was expected + +fn main() {} diff --git a/src/test/ui/parser/issues/issue-14303.stderr b/src/test/ui/parser/issues/issue-14303.stderr new file mode 100644 index 000000000..f121107c0 --- /dev/null +++ b/src/test/ui/parser/issues/issue-14303.stderr @@ -0,0 +1,39 @@ +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:1:18 + | +LL | enum Enum<'a, T, 'b> { + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:6:22 + | +LL | struct Struct<'a, T, 'b> { + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:11:20 + | +LL | trait Trait<'a, T, 'b> {} + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:14:15 + | +LL | fn foo<'a, T, 'b>(x: &'a T) {} + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error: lifetime parameters must be declared prior to type and const parameters + --> $DIR/issue-14303.rs:18:13 + | +LL | impl<'a, T, 'b> Y {} + | --------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, T>` + +error[E0747]: type provided when a lifetime was expected + --> $DIR/issue-14303.rs:30:37 + | +LL | fn bar<'a, 'b, 'c, T>(x: bar::X<'a, T, 'b, 'c>) {} + | ^ + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0747`. diff --git a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr index 85c9fe409..a00f37ed6 100644 --- a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr +++ b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr @@ -107,10 +107,10 @@ LL | V = [Vec::new; { [0].len() ].len() as isize, | closing delimiter possibly meant for this error[E0282]: type annotations needed - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:29 + --> $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` + | ^^ cannot infer type for type parameter `T` error[E0282]: type annotations needed --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14 diff --git a/src/test/ui/parser/issues/issue-89574.stderr b/src/test/ui/parser/issues/issue-89574.stderr index cbee3d351..fb1312c78 100644 --- a/src/test/ui/parser/issues/issue-89574.stderr +++ b/src/test/ui/parser/issues/issue-89574.stderr @@ -1,8 +1,8 @@ error: missing type for `const` item - --> $DIR/issue-89574.rs:2:11 + --> $DIR/issue-89574.rs:2:22 | LL | const EMPTY_ARRAY = []; - | ^^^^^^^^^^^ help: provide a type for the item: `EMPTY_ARRAY: ` + | ^ help: provide a type for the item: `: ` error: aborting due to previous error diff --git a/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr b/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr index c340e958e..5365b0a1f 100644 --- a/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr +++ b/src/test/ui/parser/item-free-const-no-body-semantic-fail.stderr @@ -15,10 +15,10 @@ LL | const B; | help: provide a definition for the constant: `= ;` error: missing type for `const` item - --> $DIR/item-free-const-no-body-semantic-fail.rs:6:7 + --> $DIR/item-free-const-no-body-semantic-fail.rs:6:8 | LL | const B; - | ^ help: provide a type for the item: `B: ` + | ^ help: provide a type for the item: `: ` error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr b/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr index 4d542b798..1b61e4305 100644 --- a/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr +++ b/src/test/ui/parser/item-free-static-no-body-semantic-fail.stderr @@ -31,16 +31,16 @@ LL | static mut D; | help: provide a definition for the static: `= ;` error: missing type for `static` item - --> $DIR/item-free-static-no-body-semantic-fail.rs:6:8 + --> $DIR/item-free-static-no-body-semantic-fail.rs:6:9 | LL | static B; - | ^ help: provide a type for the item: `B: ` + | ^ help: provide a type for the item: `: ` error: missing type for `static mut` item - --> $DIR/item-free-static-no-body-semantic-fail.rs:10:12 + --> $DIR/item-free-static-no-body-semantic-fail.rs:10:13 | LL | static mut D; - | ^ help: provide a type for the item: `D: ` + | ^ help: provide a type for the item: `: ` error: aborting due to 6 previous errors diff --git a/src/test/ui/parser/kw-in-trait-bounds.rs b/src/test/ui/parser/kw-in-trait-bounds.rs new file mode 100644 index 000000000..fa037e593 --- /dev/null +++ b/src/test/ui/parser/kw-in-trait-bounds.rs @@ -0,0 +1,47 @@ +// edition:2018 + +fn _f(_: impl fn(), _: &dyn fn()) +//~^ ERROR expected identifier, found keyword `fn` +//~| ERROR expected identifier, found keyword `fn` +//~| ERROR expected identifier, found keyword `fn` +//~| ERROR cannot find trait `r#fn` in this scope +//~| ERROR cannot find trait `r#fn` in this scope +//~| ERROR cannot find trait `r#fn` in this scope +//~| HELP a trait with a similar name exists +//~| HELP a trait with a similar name exists +//~| HELP a trait with a similar name exists +//~| HELP escape `fn` to use it as an identifier +//~| HELP escape `fn` to use it as an identifier +//~| HELP escape `fn` to use it as an identifier +where +G: fn(), + //~^ ERROR expected identifier, found keyword `fn` + //~| ERROR cannot find trait `r#fn` in this scope + //~| HELP a trait with a similar name exists + //~| HELP escape `fn` to use it as an identifier +{} + +fn _g(_: impl struct, _: &dyn struct) +//~^ ERROR expected identifier, found keyword `struct` +//~| ERROR expected identifier, found keyword `struct` +//~| ERROR expected identifier, found keyword `struct` +//~| ERROR cannot find trait `r#struct` in this scope +//~| ERROR cannot find trait `r#struct` in this scope +//~| ERROR cannot find trait `r#struct` in this scope +//~| HELP a trait with a similar name exists +//~| HELP a trait with a similar name exists +//~| HELP a trait with a similar name exists +//~| HELP escape `struct` to use it as an identifier +//~| HELP escape `struct` to use it as an identifier +//~| HELP escape `struct` to use it as an identifier +where + B: struct, + //~^ ERROR expected identifier, found keyword `struct` + //~| ERROR cannot find trait `r#struct` in this scope + //~| HELP a trait with a similar name exists + //~| HELP escape `struct` to use it as an identifier +{} + +trait Struct {} + +fn main() {} diff --git a/src/test/ui/parser/kw-in-trait-bounds.stderr b/src/test/ui/parser/kw-in-trait-bounds.stderr new file mode 100644 index 000000000..28196c7ce --- /dev/null +++ b/src/test/ui/parser/kw-in-trait-bounds.stderr @@ -0,0 +1,171 @@ +error: expected identifier, found keyword `fn` + --> $DIR/kw-in-trait-bounds.rs:3:10 + | +LL | fn _f(_: impl fn(), _: &dyn fn()) + | ^^ expected identifier, found keyword + | +help: escape `fn` to use it as an identifier + | +LL | fn _f(_: impl fn(), _: &dyn fn()) + | ++ + +error: expected identifier, found keyword `fn` + --> $DIR/kw-in-trait-bounds.rs:3:27 + | +LL | fn _f(_: impl fn(), _: &dyn fn()) + | ^^ expected identifier, found keyword + | +help: escape `fn` to use it as an identifier + | +LL | fn _f(_: impl r#fn(), _: &dyn fn()) + | ++ + +error: expected identifier, found keyword `fn` + --> $DIR/kw-in-trait-bounds.rs:3:41 + | +LL | fn _f(_: impl fn(), _: &dyn fn()) + | ^^ expected identifier, found keyword + | +help: escape `fn` to use it as an identifier + | +LL | fn _f(_: impl fn(), _: &dyn r#fn()) + | ++ + +error: expected identifier, found keyword `fn` + --> $DIR/kw-in-trait-bounds.rs:17:4 + | +LL | G: fn(), + | ^^ expected identifier, found keyword + | +help: escape `fn` to use it as an identifier + | +LL | G: r#fn(), + | ++ + +error: expected identifier, found keyword `struct` + --> $DIR/kw-in-trait-bounds.rs:24:10 + | +LL | fn _g(_: impl struct, _: &dyn struct) + | ^^^^^^ expected identifier, found keyword + | +help: escape `struct` to use it as an identifier + | +LL | fn _g(_: impl struct, _: &dyn struct) + | ++ + +error: expected identifier, found keyword `struct` + --> $DIR/kw-in-trait-bounds.rs:24:29 + | +LL | fn _g(_: impl struct, _: &dyn struct) + | ^^^^^^ expected identifier, found keyword + | +help: escape `struct` to use it as an identifier + | +LL | fn _g(_: impl r#struct, _: &dyn struct) + | ++ + +error: expected identifier, found keyword `struct` + --> $DIR/kw-in-trait-bounds.rs:24:45 + | +LL | fn _g(_: impl struct, _: &dyn struct) + | ^^^^^^ expected identifier, found keyword + | +help: escape `struct` to use it as an identifier + | +LL | fn _g(_: impl struct, _: &dyn r#struct) + | ++ + +error: expected identifier, found keyword `struct` + --> $DIR/kw-in-trait-bounds.rs:38:8 + | +LL | B: struct, + | ^^^^^^ expected identifier, found keyword + | +help: escape `struct` to use it as an identifier + | +LL | B: r#struct, + | ++ + +error[E0405]: cannot find trait `r#fn` in this scope + --> $DIR/kw-in-trait-bounds.rs:3:10 + | +LL | fn _f(_: impl fn(), _: &dyn fn()) + | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn` + | + ::: $SRC_DIR/core/src/ops/function.rs:LL:COL + | +LL | pub trait Fn: FnMut { + | ------------------------------- similarly named trait `Fn` defined here + +error[E0405]: cannot find trait `r#fn` in this scope + --> $DIR/kw-in-trait-bounds.rs:17:4 + | +LL | G: fn(), + | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn` + | + ::: $SRC_DIR/core/src/ops/function.rs:LL:COL + | +LL | pub trait Fn: FnMut { + | ------------------------------- similarly named trait `Fn` defined here + +error[E0405]: cannot find trait `r#fn` in this scope + --> $DIR/kw-in-trait-bounds.rs:3:27 + | +LL | fn _f(_: impl fn(), _: &dyn fn()) + | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn` + | + ::: $SRC_DIR/core/src/ops/function.rs:LL:COL + | +LL | pub trait Fn: FnMut { + | ------------------------------- similarly named trait `Fn` defined here + +error[E0405]: cannot find trait `r#fn` in this scope + --> $DIR/kw-in-trait-bounds.rs:3:41 + | +LL | fn _f(_: impl fn(), _: &dyn fn()) + | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn` + | + ::: $SRC_DIR/core/src/ops/function.rs:LL:COL + | +LL | pub trait Fn: FnMut { + | ------------------------------- similarly named trait `Fn` defined here + +error[E0405]: cannot find trait `r#struct` in this scope + --> $DIR/kw-in-trait-bounds.rs:24:10 + | +LL | fn _g(_: impl struct, _: &dyn struct) + | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` +... +LL | trait Struct {} + | ------------ similarly named trait `Struct` defined here + +error[E0405]: cannot find trait `r#struct` in this scope + --> $DIR/kw-in-trait-bounds.rs:38:8 + | +LL | B: struct, + | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` +... +LL | trait Struct {} + | ------------ similarly named trait `Struct` defined here + +error[E0405]: cannot find trait `r#struct` in this scope + --> $DIR/kw-in-trait-bounds.rs:24:29 + | +LL | fn _g(_: impl struct, _: &dyn struct) + | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` +... +LL | trait Struct {} + | ------------ similarly named trait `Struct` defined here + +error[E0405]: cannot find trait `r#struct` in this scope + --> $DIR/kw-in-trait-bounds.rs:24:45 + | +LL | fn _g(_: impl struct, _: &dyn struct) + | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` +... +LL | trait Struct {} + | ------------ similarly named trait `Struct` defined here + +error: aborting due to 16 previous errors + +For more information about this error, try `rustc --explain E0405`. diff --git a/src/test/ui/parser/labeled-no-colon-expr.rs b/src/test/ui/parser/labeled-no-colon-expr.rs index db9ef52c1..d9ebd7473 100644 --- a/src/test/ui/parser/labeled-no-colon-expr.rs +++ b/src/test/ui/parser/labeled-no-colon-expr.rs @@ -1,5 +1,3 @@ -#![feature(label_break_value)] - fn main() { 'l0 while false {} //~ ERROR labeled expression must be followed by `:` 'l1 for _ in 0..1 {} //~ ERROR labeled expression must be followed by `:` diff --git a/src/test/ui/parser/labeled-no-colon-expr.stderr b/src/test/ui/parser/labeled-no-colon-expr.stderr index a258bd3cc..62288fe15 100644 --- a/src/test/ui/parser/labeled-no-colon-expr.stderr +++ b/src/test/ui/parser/labeled-no-colon-expr.stderr @@ -1,5 +1,5 @@ error: labeled expression must be followed by `:` - --> $DIR/labeled-no-colon-expr.rs:4:5 + --> $DIR/labeled-no-colon-expr.rs:2:5 | LL | 'l0 while false {} | ----^^^^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | 'l0 while false {} = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them error: labeled expression must be followed by `:` - --> $DIR/labeled-no-colon-expr.rs:5:5 + --> $DIR/labeled-no-colon-expr.rs:3:5 | LL | 'l1 for _ in 0..1 {} | ----^^^^^^^^^^^^^^^^ @@ -21,7 +21,7 @@ LL | 'l1 for _ in 0..1 {} = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them error: labeled expression must be followed by `:` - --> $DIR/labeled-no-colon-expr.rs:6:5 + --> $DIR/labeled-no-colon-expr.rs:4:5 | LL | 'l2 loop {} | ----^^^^^^^ @@ -32,7 +32,7 @@ LL | 'l2 loop {} = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them error: labeled expression must be followed by `:` - --> $DIR/labeled-no-colon-expr.rs:7:5 + --> $DIR/labeled-no-colon-expr.rs:5:5 | LL | 'l3 {} | ----^^ @@ -43,7 +43,7 @@ LL | 'l3 {} = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them error: expected `while`, `for`, `loop` or `{` after a label - --> $DIR/labeled-no-colon-expr.rs:8:9 + --> $DIR/labeled-no-colon-expr.rs:6:9 | LL | 'l4 0; | ^ expected `while`, `for`, `loop` or `{` after a label @@ -55,7 +55,7 @@ LL + 0; | error: labeled expression must be followed by `:` - --> $DIR/labeled-no-colon-expr.rs:8:9 + --> $DIR/labeled-no-colon-expr.rs:6:9 | LL | 'l4 0; | ----^ @@ -66,7 +66,7 @@ LL | 'l4 0; = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them error: cannot use a `block` macro fragment here - --> $DIR/labeled-no-colon-expr.rs:13:17 + --> $DIR/labeled-no-colon-expr.rs:11:17 | LL | 'l5 $b; | ----^^ @@ -79,7 +79,7 @@ LL | m!({}); = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: labeled expression must be followed by `:` - --> $DIR/labeled-no-colon-expr.rs:16:8 + --> $DIR/labeled-no-colon-expr.rs:14:8 | LL | 'l5 $b; | ---- help: add `:` after the label diff --git a/src/test/ui/parser/public-instead-of-pub-1.fixed b/src/test/ui/parser/public-instead-of-pub-1.fixed new file mode 100644 index 000000000..a4fa68ba5 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-1.fixed @@ -0,0 +1,11 @@ +// Checks what happens when `public` is used instead of the correct, `pub` +// run-rustfix + +pub enum Test { + //~^ ERROR expected one of `!` or `::`, found keyword `enum` + //~^^ HELP write `pub` instead of `public` to make the item public + A, + B, +} + +fn main() { } diff --git a/src/test/ui/parser/public-instead-of-pub-1.rs b/src/test/ui/parser/public-instead-of-pub-1.rs new file mode 100644 index 000000000..43565c9b1 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-1.rs @@ -0,0 +1,11 @@ +// Checks what happens when `public` is used instead of the correct, `pub` +// run-rustfix + +public enum Test { + //~^ ERROR expected one of `!` or `::`, found keyword `enum` + //~^^ HELP write `pub` instead of `public` to make the item public + A, + B, +} + +fn main() { } diff --git a/src/test/ui/parser/public-instead-of-pub-1.stderr b/src/test/ui/parser/public-instead-of-pub-1.stderr new file mode 100644 index 000000000..795a5bcf5 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-1.stderr @@ -0,0 +1,13 @@ +error: expected one of `!` or `::`, found keyword `enum` + --> $DIR/public-instead-of-pub-1.rs:4:8 + | +LL | public enum Test { + | ^^^^ expected one of `!` or `::` + | +help: write `pub` instead of `public` to make the item public + | +LL | pub enum Test { + | ~~~ + +error: aborting due to previous error + diff --git a/src/test/ui/parser/public-instead-of-pub-2.rs b/src/test/ui/parser/public-instead-of-pub-2.rs new file mode 100644 index 000000000..8a43c361e --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-2.rs @@ -0,0 +1,7 @@ +// Checks what happens when `public` is used instead of the correct, `pub` +// Won't give help message for this case + +public let x = 1; +//~^ ERROR expected one of `!` or `::`, found keyword `let` + +fn main() { } diff --git a/src/test/ui/parser/public-instead-of-pub-2.stderr b/src/test/ui/parser/public-instead-of-pub-2.stderr new file mode 100644 index 000000000..efe225656 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-2.stderr @@ -0,0 +1,8 @@ +error: expected one of `!` or `::`, found keyword `let` + --> $DIR/public-instead-of-pub-2.rs:4:8 + | +LL | public let x = 1; + | ^^^ expected one of `!` or `::` + +error: aborting due to previous error + diff --git a/src/test/ui/parser/public-instead-of-pub-3.fixed b/src/test/ui/parser/public-instead-of-pub-3.fixed new file mode 100644 index 000000000..14f620f41 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-3.fixed @@ -0,0 +1,9 @@ +// run-rustfix +mod test { + pub const X: i32 = 123; + //~^ ERROR expected one of `!` or `::`, found keyword `const` +} + +fn main() { + println!("{}", test::X); +} diff --git a/src/test/ui/parser/public-instead-of-pub-3.rs b/src/test/ui/parser/public-instead-of-pub-3.rs new file mode 100644 index 000000000..ee27cb1a1 --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-3.rs @@ -0,0 +1,9 @@ +// run-rustfix +mod test { + public const X: i32 = 123; + //~^ ERROR expected one of `!` or `::`, found keyword `const` +} + +fn main() { + println!("{}", test::X); +} diff --git a/src/test/ui/parser/public-instead-of-pub-3.stderr b/src/test/ui/parser/public-instead-of-pub-3.stderr new file mode 100644 index 000000000..72efae08d --- /dev/null +++ b/src/test/ui/parser/public-instead-of-pub-3.stderr @@ -0,0 +1,13 @@ +error: expected one of `!` or `::`, found keyword `const` + --> $DIR/public-instead-of-pub-3.rs:3:12 + | +LL | public const X: i32 = 123; + | ^^^^^ expected one of `!` or `::` + | +help: write `pub` instead of `public` to make the item public + | +LL | pub const X: i32 = 123; + | ~~~ + +error: aborting due to previous error + diff --git a/src/test/ui/parser/recover-field-semi.rs b/src/test/ui/parser/recover-field-semi.rs new file mode 100644 index 000000000..b70357886 --- /dev/null +++ b/src/test/ui/parser/recover-field-semi.rs @@ -0,0 +1,16 @@ +struct Foo { + foo: i32; + //~^ ERROR struct fields are separated by `,` +} + +union Bar { //~ ERROR + foo: i32; + //~^ ERROR union fields are separated by `,` +} + +enum Baz { + Qux { foo: i32; } + //~^ ERROR struct fields are separated by `,` +} + +fn main() {} diff --git a/src/test/ui/parser/recover-field-semi.stderr b/src/test/ui/parser/recover-field-semi.stderr new file mode 100644 index 000000000..657366db9 --- /dev/null +++ b/src/test/ui/parser/recover-field-semi.stderr @@ -0,0 +1,29 @@ +error: struct fields are separated by `,` + --> $DIR/recover-field-semi.rs:2:13 + | +LL | foo: i32; + | ^ help: replace `;` with `,` + +error: union fields are separated by `,` + --> $DIR/recover-field-semi.rs:7:13 + | +LL | foo: i32; + | ^ help: replace `;` with `,` + +error: struct fields are separated by `,` + --> $DIR/recover-field-semi.rs:12:19 + | +LL | Qux { foo: i32; } + | ^ help: replace `;` with `,` + +error: unions cannot have zero fields + --> $DIR/recover-field-semi.rs:6:1 + | +LL | / union Bar { +LL | | foo: i32; +LL | | +LL | | } + | |_^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/parser/recover-labeled-non-block-expr.fixed b/src/test/ui/parser/recover-labeled-non-block-expr.fixed index fe546a719..c2e76444d 100644 --- a/src/test/ui/parser/recover-labeled-non-block-expr.fixed +++ b/src/test/ui/parser/recover-labeled-non-block-expr.fixed @@ -1,5 +1,4 @@ // run-rustfix -#![feature(label_break_value)] fn main() { let _ = 1 + 1; //~ ERROR expected `while`, `for`, `loop` or `{` after a label diff --git a/src/test/ui/parser/recover-labeled-non-block-expr.rs b/src/test/ui/parser/recover-labeled-non-block-expr.rs index 35862e2ee..fc11c646a 100644 --- a/src/test/ui/parser/recover-labeled-non-block-expr.rs +++ b/src/test/ui/parser/recover-labeled-non-block-expr.rs @@ -1,5 +1,4 @@ // run-rustfix -#![feature(label_break_value)] fn main() { let _ = 'label: 1 + 1; //~ ERROR expected `while`, `for`, `loop` or `{` after a label diff --git a/src/test/ui/parser/recover-labeled-non-block-expr.stderr b/src/test/ui/parser/recover-labeled-non-block-expr.stderr index 04fc1203e..d66ce6950 100644 --- a/src/test/ui/parser/recover-labeled-non-block-expr.stderr +++ b/src/test/ui/parser/recover-labeled-non-block-expr.stderr @@ -1,5 +1,5 @@ error: expected `while`, `for`, `loop` or `{` after a label - --> $DIR/recover-labeled-non-block-expr.rs:4:21 + --> $DIR/recover-labeled-non-block-expr.rs:3:21 | LL | let _ = 'label: 1 + 1; | ^ expected `while`, `for`, `loop` or `{` after a label @@ -11,7 +11,7 @@ LL + let _ = 1 + 1; | error: expected `while`, `for`, `loop` or `{` after a label - --> $DIR/recover-labeled-non-block-expr.rs:6:13 + --> $DIR/recover-labeled-non-block-expr.rs:5:13 | LL | 'label: match () { () => {}, }; | ^^^^^ expected `while`, `for`, `loop` or `{` after a label @@ -23,7 +23,7 @@ LL + match () { () => {}, }; | error: expected `while`, `for`, `loop` or `{` after a label - --> $DIR/recover-labeled-non-block-expr.rs:7:13 + --> $DIR/recover-labeled-non-block-expr.rs:6:13 | LL | 'label: match () { () => break 'label, }; | ^^^^^ expected `while`, `for`, `loop` or `{` after a label @@ -34,7 +34,7 @@ LL | 'label: { match () { () => break 'label, } }; | + + error: expected `while`, `for`, `loop` or `{` after a label - --> $DIR/recover-labeled-non-block-expr.rs:9:13 + --> $DIR/recover-labeled-non-block-expr.rs:8:13 | LL | 'label: match () { () => 'lp: loop { break 'lp 0 }, }; | ^^^^^ expected `while`, `for`, `loop` or `{` after a label @@ -45,7 +45,7 @@ LL | 'label: { match () { () => 'lp: loop { break 'lp 0 }, } }; | + + error: expected `while`, `for`, `loop` or `{` after a label - --> $DIR/recover-labeled-non-block-expr.rs:12:22 + --> $DIR/recover-labeled-non-block-expr.rs:11:22 | LL | let _i = 'label: match x { | ^^^^^ expected `while`, `for`, `loop` or `{` after a label @@ -60,7 +60,7 @@ LL ~ } }; | error: expected `while`, `for`, `loop` or `{` after a label - --> $DIR/recover-labeled-non-block-expr.rs:26:24 + --> $DIR/recover-labeled-non-block-expr.rs:25:24 | LL | let _val = 'label: (1, if other == 3 { break 'label (2, 3) } else { other }); | ^ expected `while`, `for`, `loop` or `{` after a label diff --git a/src/test/ui/parser/recover-missing-semi-before-item.fixed b/src/test/ui/parser/recover-missing-semi-before-item.fixed new file mode 100644 index 000000000..0be17e69e --- /dev/null +++ b/src/test/ui/parser/recover-missing-semi-before-item.fixed @@ -0,0 +1,61 @@ +// run-rustfix + +#![allow(unused_variables, dead_code)] + +fn for_struct() { + let foo = 3; //~ ERROR expected `;`, found keyword `struct` + struct Foo; +} + +fn for_union() { + let foo = 3; //~ ERROR expected `;`, found `union` + union Foo { + foo: usize, + } +} + +fn for_enum() { + let foo = 3; //~ ERROR expected `;`, found keyword `enum` + enum Foo { + Bar, + } +} + +fn for_fn() { + let foo = 3; //~ ERROR expected `;`, found keyword `fn` + fn foo() {} +} + +fn for_extern() { + let foo = 3; //~ ERROR expected `;`, found keyword `extern` + extern fn foo() {} +} + +fn for_impl() { + struct Foo; + let foo = 3; //~ ERROR expected `;`, found keyword `impl` + impl Foo {} +} + +fn for_use() { + let foo = 3; //~ ERROR expected `;`, found keyword `pub` + pub use bar::Bar; +} + +fn for_mod() { + let foo = 3; //~ ERROR expected `;`, found keyword `mod` + mod foo {} +} + +fn for_type() { + let foo = 3; //~ ERROR expected `;`, found keyword `type` + type Foo = usize; +} + +mod bar { + pub struct Bar; +} + +const X: i32 = 123; //~ ERROR expected `;`, found keyword `fn` + +fn main() {} diff --git a/src/test/ui/parser/recover-missing-semi-before-item.rs b/src/test/ui/parser/recover-missing-semi-before-item.rs new file mode 100644 index 000000000..867b7b749 --- /dev/null +++ b/src/test/ui/parser/recover-missing-semi-before-item.rs @@ -0,0 +1,61 @@ +// run-rustfix + +#![allow(unused_variables, dead_code)] + +fn for_struct() { + let foo = 3 //~ ERROR expected `;`, found keyword `struct` + struct Foo; +} + +fn for_union() { + let foo = 3 //~ ERROR expected `;`, found `union` + union Foo { + foo: usize, + } +} + +fn for_enum() { + let foo = 3 //~ ERROR expected `;`, found keyword `enum` + enum Foo { + Bar, + } +} + +fn for_fn() { + let foo = 3 //~ ERROR expected `;`, found keyword `fn` + fn foo() {} +} + +fn for_extern() { + let foo = 3 //~ ERROR expected `;`, found keyword `extern` + extern fn foo() {} +} + +fn for_impl() { + struct Foo; + let foo = 3 //~ ERROR expected `;`, found keyword `impl` + impl Foo {} +} + +fn for_use() { + let foo = 3 //~ ERROR expected `;`, found keyword `pub` + pub use bar::Bar; +} + +fn for_mod() { + let foo = 3 //~ ERROR expected `;`, found keyword `mod` + mod foo {} +} + +fn for_type() { + let foo = 3 //~ ERROR expected `;`, found keyword `type` + type Foo = usize; +} + +mod bar { + pub struct Bar; +} + +const X: i32 = 123 //~ ERROR expected `;`, found keyword `fn` + +fn main() {} diff --git a/src/test/ui/parser/recover-missing-semi-before-item.stderr b/src/test/ui/parser/recover-missing-semi-before-item.stderr new file mode 100644 index 000000000..61c43f2f1 --- /dev/null +++ b/src/test/ui/parser/recover-missing-semi-before-item.stderr @@ -0,0 +1,83 @@ +error: expected `;`, found keyword `struct` + --> $DIR/recover-missing-semi-before-item.rs:6:16 + | +LL | let foo = 3 + | ^ help: add `;` here +LL | struct Foo; + | ------ unexpected token + +error: expected `;`, found `union` + --> $DIR/recover-missing-semi-before-item.rs:11:16 + | +LL | let foo = 3 + | ^ help: add `;` here +LL | union Foo { + | ----- unexpected token + +error: expected `;`, found keyword `enum` + --> $DIR/recover-missing-semi-before-item.rs:18:16 + | +LL | let foo = 3 + | ^ help: add `;` here +LL | enum Foo { + | ---- unexpected token + +error: expected `;`, found keyword `fn` + --> $DIR/recover-missing-semi-before-item.rs:25:16 + | +LL | let foo = 3 + | ^ help: add `;` here +LL | fn foo() {} + | -- unexpected token + +error: expected `;`, found keyword `extern` + --> $DIR/recover-missing-semi-before-item.rs:30:16 + | +LL | let foo = 3 + | ^ help: add `;` here +LL | extern fn foo() {} + | ------ unexpected token + +error: expected `;`, found keyword `impl` + --> $DIR/recover-missing-semi-before-item.rs:36:16 + | +LL | let foo = 3 + | ^ help: add `;` here +LL | impl Foo {} + | ---- unexpected token + +error: expected `;`, found keyword `pub` + --> $DIR/recover-missing-semi-before-item.rs:41:16 + | +LL | let foo = 3 + | ^ help: add `;` here +LL | pub use bar::Bar; + | --- unexpected token + +error: expected `;`, found keyword `mod` + --> $DIR/recover-missing-semi-before-item.rs:46:16 + | +LL | let foo = 3 + | ^ help: add `;` here +LL | mod foo {} + | --- unexpected token + +error: expected `;`, found keyword `type` + --> $DIR/recover-missing-semi-before-item.rs:51:16 + | +LL | let foo = 3 + | ^ help: add `;` here +LL | type Foo = usize; + | ---- unexpected token + +error: expected `;`, found keyword `fn` + --> $DIR/recover-missing-semi-before-item.rs:59:19 + | +LL | const X: i32 = 123 + | ^ help: add `;` here +LL | +LL | fn main() {} + | -- unexpected token + +error: aborting due to 10 previous errors + diff --git a/src/test/ui/parser/removed-syntax-field-semicolon.rs b/src/test/ui/parser/removed-syntax-field-semicolon.rs index ac28e21ae..808f2a5cc 100644 --- a/src/test/ui/parser/removed-syntax-field-semicolon.rs +++ b/src/test/ui/parser/removed-syntax-field-semicolon.rs @@ -1,6 +1,6 @@ struct S { bar: (); - //~^ ERROR expected `,`, or `}`, found `;` + //~^ ERROR struct fields are separated by `,` } fn main() {} diff --git a/src/test/ui/parser/removed-syntax-field-semicolon.stderr b/src/test/ui/parser/removed-syntax-field-semicolon.stderr index fbefeb26a..e4f75f672 100644 --- a/src/test/ui/parser/removed-syntax-field-semicolon.stderr +++ b/src/test/ui/parser/removed-syntax-field-semicolon.stderr @@ -1,8 +1,8 @@ -error: expected `,`, or `}`, found `;` +error: struct fields are separated by `,` --> $DIR/removed-syntax-field-semicolon.rs:2:12 | LL | bar: (); - | ^ + | ^ help: replace `;` with `,` error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-static-fn.stderr b/src/test/ui/parser/removed-syntax-static-fn.stderr index 04e34dc16..52e065894 100644 --- a/src/test/ui/parser/removed-syntax-static-fn.stderr +++ b/src/test/ui/parser/removed-syntax-static-fn.stderr @@ -16,10 +16,10 @@ LL | } | - the item list ends here error: missing type for `static` item - --> $DIR/removed-syntax-static-fn.rs:4:12 + --> $DIR/removed-syntax-static-fn.rs:4:14 | LL | static fn f() {} - | ^^ help: provide a type for the item: `r#fn: ` + | ^ help: provide a type for the item: `: ` error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/struct-filed-with-attr.fixed b/src/test/ui/parser/struct-filed-with-attr.fixed new file mode 100644 index 000000000..a799ec8ca --- /dev/null +++ b/src/test/ui/parser/struct-filed-with-attr.fixed @@ -0,0 +1,18 @@ +// Issue: 100461, Try to give a helpful diagnostic even when the next struct field has an attribute. +// run-rustfix + +struct Feelings { + owo: bool, + //~^ ERROR expected `,`, or `}`, found `#` + #[allow(unused)] + uwu: bool, +} + +impl Feelings { + #[allow(unused)] + fn hmm(&self) -> bool { + self.owo + } +} + +fn main() { } diff --git a/src/test/ui/parser/struct-filed-with-attr.rs b/src/test/ui/parser/struct-filed-with-attr.rs new file mode 100644 index 000000000..bfc78e15b --- /dev/null +++ b/src/test/ui/parser/struct-filed-with-attr.rs @@ -0,0 +1,18 @@ +// Issue: 100461, Try to give a helpful diagnostic even when the next struct field has an attribute. +// run-rustfix + +struct Feelings { + owo: bool + //~^ ERROR expected `,`, or `}`, found `#` + #[allow(unused)] + uwu: bool, +} + +impl Feelings { + #[allow(unused)] + fn hmm(&self) -> bool { + self.owo + } +} + +fn main() { } diff --git a/src/test/ui/parser/struct-filed-with-attr.stderr b/src/test/ui/parser/struct-filed-with-attr.stderr new file mode 100644 index 000000000..c2cd7e82e --- /dev/null +++ b/src/test/ui/parser/struct-filed-with-attr.stderr @@ -0,0 +1,8 @@ +error: expected `,`, or `}`, found `#` + --> $DIR/struct-filed-with-attr.rs:5:14 + | +LL | owo: bool + | ^ help: try adding a comma: `,` + +error: aborting due to previous error + diff --git a/src/test/ui/parser/struct-literal-in-for.stderr b/src/test/ui/parser/struct-literal-in-for.stderr index 4b191710c..1c91eba68 100644 --- a/src/test/ui/parser/struct-literal-in-for.stderr +++ b/src/test/ui/parser/struct-literal-in-for.stderr @@ -24,7 +24,7 @@ LL | | }.hi() { | |__________^ `bool` is not an iterator | = help: the trait `Iterator` is not implemented for `bool` - = note: required because of the requirements on the impl of `IntoIterator` for `bool` + = note: required for `bool` to implement `IntoIterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/suggest-assoc-const.fixed b/src/test/ui/parser/suggest-assoc-const.fixed new file mode 100644 index 000000000..259f37b23 --- /dev/null +++ b/src/test/ui/parser/suggest-assoc-const.fixed @@ -0,0 +1,10 @@ +// Issue: 101797, Suggest associated const for incorrect use of let in traits +// run-rustfix +trait Trait { + const _X: i32; + //~^ ERROR non-item in item list +} + +fn main() { + +} diff --git a/src/test/ui/parser/suggest-assoc-const.rs b/src/test/ui/parser/suggest-assoc-const.rs new file mode 100644 index 000000000..c7be712ec --- /dev/null +++ b/src/test/ui/parser/suggest-assoc-const.rs @@ -0,0 +1,10 @@ +// Issue: 101797, Suggest associated const for incorrect use of let in traits +// run-rustfix +trait Trait { + let _X: i32; + //~^ ERROR non-item in item list +} + +fn main() { + +} diff --git a/src/test/ui/parser/suggest-assoc-const.stderr b/src/test/ui/parser/suggest-assoc-const.stderr new file mode 100644 index 000000000..2ddfa07c5 --- /dev/null +++ b/src/test/ui/parser/suggest-assoc-const.stderr @@ -0,0 +1,8 @@ +error: non-item in item list + --> $DIR/suggest-assoc-const.rs:4:5 + | +LL | let _X: i32; + | ^^^ help: consider using `const` instead of `let` for associated const: `const` + +error: aborting due to previous error + diff --git a/src/test/ui/parser/suggest-const-for-global-var.rs b/src/test/ui/parser/suggest-const-for-global-var.rs new file mode 100644 index 000000000..d6216cb7a --- /dev/null +++ b/src/test/ui/parser/suggest-const-for-global-var.rs @@ -0,0 +1,6 @@ +let X: i32 = 12; +//~^ ERROR expected item, found keyword `let` + +fn main() { + println!("{}", X); +} diff --git a/src/test/ui/parser/suggest-const-for-global-var.stderr b/src/test/ui/parser/suggest-const-for-global-var.stderr new file mode 100644 index 000000000..94e44ec7f --- /dev/null +++ b/src/test/ui/parser/suggest-const-for-global-var.stderr @@ -0,0 +1,8 @@ +error: expected item, found keyword `let` + --> $DIR/suggest-const-for-global-var.rs:1:1 + | +LL | let X: i32 = 12; + | ^^^ consider using `const` or `static` instead of `let` for global variables + +error: aborting due to previous error + diff --git a/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.fixed b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.fixed new file mode 100644 index 000000000..637047354 --- /dev/null +++ b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.fixed @@ -0,0 +1,7 @@ +// run-rustfix + +trait Foo { + fn bar() {} //~ ERROR non-item in item list +} + +fn main() {} diff --git a/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.rs b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.rs new file mode 100644 index 000000000..4650b05e2 --- /dev/null +++ b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.rs @@ -0,0 +1,7 @@ +// run-rustfix + +trait Foo { + fn bar() {}; //~ ERROR non-item in item list +} + +fn main() {} diff --git a/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr new file mode 100644 index 000000000..396e0c130 --- /dev/null +++ b/src/test/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr @@ -0,0 +1,15 @@ +error: non-item in item list + --> $DIR/suggest-removing-semicolon-after-impl-trait-items.rs:4:16 + | +LL | trait Foo { + | - item list starts here +LL | fn bar() {}; + | ^ + | | + | non-item starts here + | help: consider removing this semicolon +LL | } + | - item list ends here + +error: aborting due to previous error + diff --git a/src/test/ui/parser/suggest-semicolon-before-array.fixed b/src/test/ui/parser/suggest-semicolon-before-array.fixed new file mode 100644 index 000000000..a06b58b27 --- /dev/null +++ b/src/test/ui/parser/suggest-semicolon-before-array.fixed @@ -0,0 +1,11 @@ +// run-rustfix +#![allow(dead_code)] + +fn foo() {} + +fn bar() -> [u8; 2] { + foo(); + [1, 3] //~ ERROR expected `;`, found `[` +} + +fn main() {} diff --git a/src/test/ui/parser/suggest-semicolon-before-array.rs b/src/test/ui/parser/suggest-semicolon-before-array.rs new file mode 100644 index 000000000..f601ca2ae --- /dev/null +++ b/src/test/ui/parser/suggest-semicolon-before-array.rs @@ -0,0 +1,11 @@ +// run-rustfix +#![allow(dead_code)] + +fn foo() {} + +fn bar() -> [u8; 2] { + foo() + [1, 3] //~ ERROR expected `;`, found `[` +} + +fn main() {} diff --git a/src/test/ui/parser/suggest-semicolon-before-array.stderr b/src/test/ui/parser/suggest-semicolon-before-array.stderr new file mode 100644 index 000000000..8a33321fb --- /dev/null +++ b/src/test/ui/parser/suggest-semicolon-before-array.stderr @@ -0,0 +1,13 @@ +error: expected `;`, found `[` + --> $DIR/suggest-semicolon-before-array.rs:8:5 + | +LL | [1, 3] + | ^ + | +help: consider adding `;` here + | +LL | foo(); + | + + +error: aborting due to previous error + diff --git a/src/test/ui/parser/trait-object-delimiters.rs b/src/test/ui/parser/trait-object-delimiters.rs index b5258eebb..cc04ac052 100644 --- a/src/test/ui/parser/trait-object-delimiters.rs +++ b/src/test/ui/parser/trait-object-delimiters.rs @@ -6,7 +6,7 @@ fn foo1(_: &dyn Drop + AsRef) {} //~ ERROR ambiguous `+` in a type fn foo2(_: &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 expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{` //~| ERROR at least one trait is required for an object type fn foo4(_: &dyn >) {} //~ ERROR expected identifier, found `<` diff --git a/src/test/ui/parser/trait-object-delimiters.stderr b/src/test/ui/parser/trait-object-delimiters.stderr index 6eb9c7238..99c451545 100644 --- a/src/test/ui/parser/trait-object-delimiters.stderr +++ b/src/test/ui/parser/trait-object-delimiters.stderr @@ -22,11 +22,11 @@ error: expected parameter name, found `{` LL | fn foo3(_: &dyn {Drop + AsRef}) {} | ^ expected parameter name -error: expected one of `!`, `(`, `)`, `,`, `?`, `for`, `~`, lifetime, or path, found `{` +error: expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{` --> $DIR/trait-object-delimiters.rs:8:17 | LL | fn foo3(_: &dyn {Drop + AsRef}) {} - | -^ expected one of 9 possible tokens + | -^ expected one of 10 possible tokens | | | help: missing `,` diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr index 7ee965bd2..823f75bfa 100644 --- a/src/test/ui/parser/trait-object-trait-parens.stderr +++ b/src/test/ui/parser/trait-object-trait-parens.stderr @@ -27,9 +27,8 @@ LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; = note: for more information, see help: use `dyn` | -LL - let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; -LL + let _: Box Trait<'a>)>; - | +LL | let _: Box Trait<'a>)>; + | +++ error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:8:35 @@ -52,9 +51,8 @@ LL | let _: Box Trait<'a>) + (Obj)>; = note: for more information, see help: use `dyn` | -LL - let _: Box Trait<'a>) + (Obj)>; -LL + let _: Box Trait<'a>) + (Obj)>; - | +LL | let _: Box Trait<'a>) + (Obj)>; + | +++ error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:13:47 @@ -77,9 +75,8 @@ LL | let _: Box Trait<'a> + (Obj) + (?Sized)>; = note: for more information, see help: use `dyn` | -LL - let _: Box Trait<'a> + (Obj) + (?Sized)>; -LL + let _: Box Trait<'a> + (Obj) + (?Sized)>; - | +LL | let _: Box Trait<'a> + (Obj) + (?Sized)>; + | +++ error[E0225]: only auto traits can be used as additional traits in a trait object --> $DIR/trait-object-trait-parens.rs:18:36 diff --git a/src/test/ui/parser/type-alias-where-fixable.fixed b/src/test/ui/parser/type-alias-where-fixable.fixed index 41dd10676..2f47c0d91 100644 --- a/src/test/ui/parser/type-alias-where-fixable.fixed +++ b/src/test/ui/parser/type-alias-where-fixable.fixed @@ -1,8 +1,6 @@ // check-pass // run-rustfix -#![feature(generic_associated_types)] - trait Trait { // Fine. type Assoc where u32: Copy; diff --git a/src/test/ui/parser/type-alias-where-fixable.rs b/src/test/ui/parser/type-alias-where-fixable.rs index 562a530a7..b20aa9398 100644 --- a/src/test/ui/parser/type-alias-where-fixable.rs +++ b/src/test/ui/parser/type-alias-where-fixable.rs @@ -1,8 +1,6 @@ // check-pass // run-rustfix -#![feature(generic_associated_types)] - trait Trait { // Fine. type Assoc where u32: Copy; diff --git a/src/test/ui/parser/type-alias-where-fixable.stderr b/src/test/ui/parser/type-alias-where-fixable.stderr index abfeb62fc..2e516d5c4 100644 --- a/src/test/ui/parser/type-alias-where-fixable.stderr +++ b/src/test/ui/parser/type-alias-where-fixable.stderr @@ -1,5 +1,5 @@ warning: where clause not allowed here - --> $DIR/type-alias-where-fixable.rs:15:16 + --> $DIR/type-alias-where-fixable.rs:13:16 | LL | type Assoc where u32: Copy = (); | ^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + type Assoc = () where u32: Copy; | warning: where clause not allowed here - --> $DIR/type-alias-where-fixable.rs:18:17 + --> $DIR/type-alias-where-fixable.rs:16:17 | LL | type Assoc2 where u32: Copy = () where i32: Copy; | ^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL + type Assoc2 = () where i32: Copy, u32: Copy; | warning: where clause not allowed here - --> $DIR/type-alias-where-fixable.rs:26:17 + --> $DIR/type-alias-where-fixable.rs:24:17 | LL | type Assoc2 where u32: Copy, i32: Copy = (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/type-alias-where.rs b/src/test/ui/parser/type-alias-where.rs index f6e7dfb7b..62e301cb4 100644 --- a/src/test/ui/parser/type-alias-where.rs +++ b/src/test/ui/parser/type-alias-where.rs @@ -1,7 +1,5 @@ // check-fail -#![feature(generic_associated_types)] - // Fine, but lints as unused type Foo where u32: Copy = (); // Not fine. diff --git a/src/test/ui/parser/type-alias-where.stderr b/src/test/ui/parser/type-alias-where.stderr index 8789d2665..fb8381792 100644 --- a/src/test/ui/parser/type-alias-where.stderr +++ b/src/test/ui/parser/type-alias-where.stderr @@ -1,5 +1,5 @@ error: where clauses are not allowed after the type for type aliases - --> $DIR/type-alias-where.rs:8:15 + --> $DIR/type-alias-where.rs:6:15 | LL | type Bar = () where u32: Copy; | ^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | type Bar = () where u32: Copy; = note: see issue #89122 for more information error: where clauses are not allowed after the type for type aliases - --> $DIR/type-alias-where.rs:10:15 + --> $DIR/type-alias-where.rs:8:15 | LL | type Baz = () where; | ^^^^^ diff --git a/src/test/ui/parser/unnecessary-let.rs b/src/test/ui/parser/unnecessary-let.rs new file mode 100644 index 000000000..627910962 --- /dev/null +++ b/src/test/ui/parser/unnecessary-let.rs @@ -0,0 +1,11 @@ +fn main() { + for let x of [1, 2, 3] {} + //~^ ERROR expected pattern, found `let` + //~| ERROR missing `in` in `for` loop + + match 1 { + let 1 => {} + //~^ ERROR expected pattern, found `let` + _ => {} + } +} diff --git a/src/test/ui/parser/unnecessary-let.stderr b/src/test/ui/parser/unnecessary-let.stderr new file mode 100644 index 000000000..952119cae --- /dev/null +++ b/src/test/ui/parser/unnecessary-let.stderr @@ -0,0 +1,20 @@ +error: expected pattern, found `let` + --> $DIR/unnecessary-let.rs:2:9 + | +LL | for let x of [1, 2, 3] {} + | ^^^ help: remove the unnecessary `let` keyword + +error: missing `in` in `for` loop + --> $DIR/unnecessary-let.rs:2:15 + | +LL | for let x of [1, 2, 3] {} + | ^^ help: try using `in` here instead + +error: expected pattern, found `let` + --> $DIR/unnecessary-let.rs:7:9 + | +LL | let 1 => {} + | ^^^ help: remove the unnecessary `let` keyword + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr b/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr index 4249a74b3..fad84dda0 100644 --- a/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr +++ b/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr @@ -40,9 +40,8 @@ error[E0382]: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14 | LL | Some(ref _y @ _z) => {} - | ^^^^^^^^^-- - | | | - | | value moved here + | ^^^^^^ -- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `X`, which does not implement the `Copy` trait @@ -55,9 +54,8 @@ error[E0382]: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14 | LL | Some(ref mut _y @ _z) => {} - | ^^^^^^^^^^^^^-- - | | | - | | value moved here + | ^^^^^^^^^^ -- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `X`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/bind-by-move-no-subbindings-fun-param.stderr b/src/test/ui/pattern/bindings-after-at/bind-by-move-no-subbindings-fun-param.stderr index ee0885a01..a481ca468 100644 --- a/src/test/ui/pattern/bindings-after-at/bind-by-move-no-subbindings-fun-param.stderr +++ b/src/test/ui/pattern/bindings-after-at/bind-by-move-no-subbindings-fun-param.stderr @@ -2,9 +2,8 @@ error[E0382]: use of partially moved value --> $DIR/bind-by-move-no-subbindings-fun-param.rs:7:6 | LL | fn f(a @ A(u): A) -> Box { - | ^^^^^^-^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr index 8e00bf5c3..a227cc583 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr @@ -2,7 +2,7 @@ error[E0382]: use of moved value --> $DIR/borrowck-move-and-move.rs:11:9 | LL | let a @ b = U; - | ^^^^- - move occurs because value has type `U`, which does not implement the `Copy` trait + | ^ - - move occurs because value has type `U`, which does not implement the `Copy` trait | | | | | value moved here | value used here after move @@ -11,9 +11,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-move-and-move.rs:13:9 | LL | let a @ (b, c) = (U, U); - | ^^^^^^^^-^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -22,9 +21,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-move-and-move.rs:15:9 | LL | let a @ (b, c) = (u(), u()); - | ^^^^^^^^-^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -35,9 +33,8 @@ error[E0382]: use of moved value LL | match Ok(U) { | ----- move occurs because value has type `Result`, which does not implement the `Copy` trait LL | a @ Ok(b) | a @ Err(b) => {} - | -------^- - | | | - | | value used here after move + | - ^ value used here after move + | | | value moved here error[E0382]: use of moved value @@ -46,18 +43,16 @@ error[E0382]: use of moved value LL | match Ok(U) { | ----- move occurs because value has type `Result`, which does not implement the `Copy` trait LL | a @ Ok(b) | a @ Err(b) => {} - | --------^- - | | | - | | value used here after move + | - ^ value used here after move + | | | value moved here error[E0382]: use of partially moved value --> $DIR/borrowck-move-and-move.rs:25:9 | LL | xs @ [a, .., b] => {} - | ^^^^^^^^^^^^^-^ - | | | - | | value partially moved here + | ^^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -66,9 +61,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-move-and-move.rs:29:9 | LL | xs @ [_, ys @ .., _] => {} - | ^^^^^^^^^-------^^^^ - | | | - | | value partially moved here + | ^^ -- value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -77,9 +71,8 @@ error[E0382]: use of moved value --> $DIR/borrowck-move-and-move.rs:22:12 | LL | fn fun(a @ b: U) {} - | ^^^^- - | | | - | | value moved here + | ^ - value moved here + | | | value used here after move | move occurs because value has type `U`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr index 4b2048855..002c7609f 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr @@ -74,9 +74,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-at-and-box.rs:31:9 | LL | let ref a @ box b = Box::new(NC); - | ^^^^^^^^^^^^- - | | | - | | value moved here + | ^^^^^ - value moved here + | | | value borrowed here after move | = note: move occurs because value has type `NC`, which does not implement the `Copy` trait @@ -85,9 +84,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-at-and-box.rs:38:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | ^^^^^^^^^^^^--------- - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = NC; @@ -97,9 +95,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-at-and-box.rs:42:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | ^^^^^^^^^^^^--------- - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = NC; @@ -109,9 +106,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-at-and-box.rs:48:9 | LL | let ref mut a @ box ref b = Box::new(NC); - | ^^^^^^^^^^^^^^^^----- - | | | - | | immutable borrow occurs here + | ^^^^^^^^^ ----- immutable borrow occurs here + | | | mutable borrow occurs here ... LL | drop(b); @@ -121,9 +117,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-at-and-box.rs:62:9 | LL | ref mut a @ box ref b => { - | ^^^^^^^^^^^^^^^^----- - | | | - | | immutable borrow occurs here + | ^^^^^^^^^ ----- immutable borrow occurs here + | | | mutable borrow occurs here ... LL | drop(b); @@ -133,9 +128,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-at-and-box.rs:54:11 | LL | fn f5(ref mut a @ box ref b: Box) { - | ^^^^^^^^^^^^^^^^----- - | | | - | | immutable borrow occurs here + | ^^^^^^^^^ ----- immutable borrow occurs here + | | | mutable borrow occurs here ... LL | drop(b); diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr index bc2c1625f..a9e66de08 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr @@ -262,9 +262,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); - | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -273,9 +272,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); - | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -286,10 +284,7 @@ error[E0382]: use of moved value LL | match Some((U, U)) { | ------------ move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -----------------------------^^^^^^^^^-- - | | | - | | value used here after move - | value moved here + | - value moved here ^ value used here after move error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:30 @@ -297,9 +292,8 @@ error[E0382]: borrow of moved value LL | match Some([U, U]) { | ------------ move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait LL | mut a @ Some([ref b, ref mut c]) => {} - | ---------------------^^^^^^^^^-- - | | | - | | value borrowed here after move + | ----- ^^^^^^^^^ value borrowed here after move + | | | value moved here error[E0382]: borrow of moved value @@ -308,9 +302,8 @@ error[E0382]: borrow of moved value LL | match Some(u()) { | --------- move occurs because value has type `Option`, which does not implement the `Copy` trait LL | a @ Some(ref b) => {} - | ---------^^^^^- - | | | - | | value borrowed here after move + | - ^^^^^ value borrowed here after move + | | | value moved here error[E0382]: use of moved value @@ -319,10 +312,7 @@ error[E0382]: use of moved value LL | match Some((u(), u())) { | ---------------- move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -----------------------------^^^^^^^^^-- - | | | - | | value used here after move - | value moved here + | - value moved here ^ value used here after move error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:30 @@ -330,18 +320,16 @@ error[E0382]: borrow of moved value LL | match Some([u(), u()]) { | ---------------- move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait LL | mut a @ Some([ref b, ref mut c]) => {} - | ---------------------^^^^^^^^^-- - | | | - | | value borrowed here after move + | ----- ^^^^^^^^^ value borrowed here after move + | | | value moved here error[E0382]: use of partially moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} - | ^^^^^^^^^^^^^^^^^^^^-------------^ - | | | - | | value partially moved here + | ^^^^^ ----- value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr index c019aae3d..b2f22fe86 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr @@ -237,9 +237,8 @@ error[E0382]: borrow of partially moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:30:9 | LL | let ref mut a @ [b, mut c] = [U, U]; - | ^^^^^^^^^^^^^^^^-----^ - | | | - | | value partially moved here + | ^^^^^^^^^ ----- value partially moved here + | | | value borrowed here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -248,7 +247,7 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:33:9 | LL | let ref a @ b = u(); - | ^^^^^^^^- --- move occurs because value has type `U`, which does not implement the `Copy` trait + | ^^^^^ - --- move occurs because value has type `U`, which does not implement the `Copy` trait | | | | | value moved here | value borrowed here after move @@ -257,9 +256,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:36:18 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | ^^^^^^^^----- - | | | - | | value moved here + | ^^^^^ ----- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -268,9 +266,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:36:33 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | ^^^^^^^^- - | | | - | | value moved here + | ^^^^^ - value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -279,9 +276,8 @@ error[E0382]: borrow of partially moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:42:9 | LL | let ref mut a @ [b, mut c] = [u(), u()]; - | ^^^^^^^^^^^^^^^^-----^ - | | | - | | value partially moved here + | ^^^^^^^^^ ----- value partially moved here + | | | value borrowed here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -290,9 +286,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:69:23 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | ^^^^^^^^----- - | | | - | | value moved here + | ^^^^^ ----- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -305,9 +300,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:69:38 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | ^^^^^^^^- - | | | - | | value moved here + | ^^^^^ - value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -320,9 +314,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:11:11 | LL | fn f1(ref a @ b: U) {} - | ^^^^^^^^- - | | | - | | value moved here + | ^^^^^ - value moved here + | | | value borrowed here after move | move occurs because value has type `U`, which does not implement the `Copy` trait @@ -330,9 +323,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:14:20 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | ^^^^^^^^----- - | | | - | | value moved here + | ^^^^^ ----- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -341,9 +333,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:14:35 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | ^^^^^^^^- - | | | - | | value moved here + | ^^^^^ - value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -352,9 +343,8 @@ error[E0382]: borrow of partially moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:20:11 | LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {} - | ^^^^^^^^^^^^^^^^-----^ - | | | - | | value partially moved here + | ^^^^^^^^^ ----- value partially moved here + | | | value borrowed here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr index 2ae78d108..8546b4bb4 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr @@ -298,9 +298,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:31 | LL | ref mut z @ &mut Some(ref a) => { - | ----------------------^^^^^- - | | | - | | immutable borrow occurs here + | --------- ^^^^^ immutable borrow occurs here + | | | mutable borrow occurs here ... LL | **z = None; @@ -310,9 +309,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9 | LL | let ref mut a @ ref b = u(); - | ^^^^^^^^^^^^----- - | | | - | | immutable borrow occurs here + | ^^^^^^^^^ ----- immutable borrow occurs here + | | | mutable borrow occurs here ... LL | drop(b); @@ -322,9 +320,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9 | LL | let ref a @ ref mut b = u(); - | ^^^^^^^^--------- - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = u(); @@ -334,9 +331,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:20 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { - | -----------^^^^^^^^^- - | | | - | | mutable borrow occurs here + | ----- ^^^^^^^^^ mutable borrow occurs here + | | | immutable borrow occurs here ... LL | drop(a); @@ -346,9 +342,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:45 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { - | ------------^^^^^^^^^- - | | | - | | mutable borrow occurs here + | ----- ^^^^^^^^^ mutable borrow occurs here + | | | immutable borrow occurs here ... LL | drop(a); @@ -406,9 +401,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | ^^^^^^^^^---------^^^^^^^^^^^^ - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = U; @@ -418,9 +412,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | ^^^^^^^^^---------^^^^^^^^^^^^ - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = U; @@ -430,9 +423,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | ^^^^^^^^^---------^^^^^^^^^^^^ - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here LL | LL | *b = U; @@ -442,9 +434,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30 | LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} - | --------^^^^^^^^^^^^- - | | | | - | | | value moved here + | ----- ^^^^^^^^^ - value moved here + | | | | | value borrowed here after move | move occurs because value has type `U`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr index aa0223041..384a57b2e 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr @@ -262,9 +262,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:29:9 | LL | let ref mut a @ ref mut b = U; - | ^^^^^^^^^^^^--------- - | | | - | | first mutable borrow occurs here + | ^^^^^^^^^ --------- first mutable borrow occurs here + | | | second mutable borrow occurs here ... LL | drop(b); @@ -274,9 +273,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:39:9 | LL | let ref mut a @ ref mut b = U; - | ^^^^^^^^^^^^--------- - | | | - | | first mutable borrow occurs here + | ^^^^^^^^^ --------- first mutable borrow occurs here + | | | second mutable borrow occurs here ... LL | *b = U; @@ -286,9 +284,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:24 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------------^^^^^^^^^- - | | | - | | second mutable borrow occurs here + | --------- ^^^^^^^^^ second mutable borrow occurs here + | | | first mutable borrow occurs here ... LL | *a = Err(U); @@ -298,9 +295,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:53 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ----------------^^^^^^^^^- - | | | - | | second mutable borrow occurs here + | --------- ^^^^^^^^^ second mutable borrow occurs here + | | | first mutable borrow occurs here ... LL | *a = Err(U); @@ -310,9 +306,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:24 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------------^^^^^^^^^- - | | | - | | second mutable borrow occurs here + | --------- ^^^^^^^^^ second mutable borrow occurs here + | | | first mutable borrow occurs here ... LL | drop(a); @@ -322,9 +317,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:53 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ----------------^^^^^^^^^- - | | | - | | second mutable borrow occurs here + | --------- ^^^^^^^^^ second mutable borrow occurs here + | | | first mutable borrow occurs here ... LL | drop(a); @@ -334,9 +328,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:21:34 | LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} - | ------------^^^^^^^^^^^^- - | | | | - | | | value moved here + | --------- ^^^^^^^^^ - value moved here + | | | | | value borrowed here after move | move occurs because value has type `U`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/copy-and-move-mixed.stderr b/src/test/ui/pattern/bindings-after-at/copy-and-move-mixed.stderr index d290144b6..cd3234952 100644 --- a/src/test/ui/pattern/bindings-after-at/copy-and-move-mixed.stderr +++ b/src/test/ui/pattern/bindings-after-at/copy-and-move-mixed.stderr @@ -2,9 +2,8 @@ error[E0382]: use of partially moved value --> $DIR/copy-and-move-mixed.rs:12:9 | LL | let a @ NC(b, c @ NC(d, e)) = NC(C, NC(C, C)); - | ^^^^^^^^^^------------^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `NC`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr b/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr index d78faa682..840a513d6 100644 --- a/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr +++ b/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr @@ -48,7 +48,7 @@ error[E0382]: borrow of moved value --> $DIR/default-binding-modes-both-sides-independent.rs:29:9 | LL | let ref mut a @ b = NotCopy; - | ^^^^^^^^^^^^- ------- move occurs because value has type `NotCopy`, which does not implement the `Copy` trait + | ^^^^^^^^^ - ------- move occurs because value has type `NotCopy`, which does not implement the `Copy` trait | | | | | value moved here | value borrowed here after move diff --git a/src/test/ui/pattern/bindings-after-at/nested-binding-modes-mut.stderr b/src/test/ui/pattern/bindings-after-at/nested-binding-modes-mut.stderr index 3180bd0af..70beb5d42 100644 --- a/src/test/ui/pattern/bindings-after-at/nested-binding-modes-mut.stderr +++ b/src/test/ui/pattern/bindings-after-at/nested-binding-modes-mut.stderr @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `not_mut` as mutable, as it is not declared as mutab --> $DIR/nested-binding-modes-mut.rs:9:5 | LL | let not_mut @ mut is_mut = 42; - | -------------------- help: consider changing this to be mutable: `mut not_mut` + | ------- help: consider changing this to be mutable: `mut not_mut` LL | &mut is_mut; LL | &mut not_mut; | ^^^^^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr b/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr index 5beca04d2..bac2db6ce 100644 --- a/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr +++ b/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr @@ -35,7 +35,7 @@ error[E0502]: cannot borrow `arr[..]` as mutable because it is also borrowed as --> $DIR/borrowck-move-ref-pattern.rs:13:16 | LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; - | ---------------- immutable borrow occurs here + | ----------- immutable borrow occurs here ... LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; | ^^^^^^^^^^^ mutable borrow occurs here @@ -47,7 +47,7 @@ error[E0505]: cannot move out of `arr[..]` because it is borrowed --> $DIR/borrowck-move-ref-pattern.rs:13:29 | LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; - | ---------------- borrow of `arr[..]` occurs here + | ----------- borrow of `arr[..]` occurs here ... LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; | ^^^ move out of `arr[..]` occurs here @@ -59,7 +59,7 @@ error[E0505]: cannot move out of `arr[..]` because it is borrowed --> $DIR/borrowck-move-ref-pattern.rs:13:34 | LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; - | ---------------- borrow of `arr[..]` occurs here + | ----------- borrow of `arr[..]` occurs here ... LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; | ^^^^^^^ move out of `arr[..]` occurs here diff --git a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr index d96e86393..eba65a618 100644 --- a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr +++ b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr @@ -8,7 +8,15 @@ LL | drop::(_x1); | --- closure is `FnOnce` because it moves the variable `_x1` out of its environment ... LL | accept_fn_mut(&c1); - | ------------- the requirement to implement `FnMut` derives from here + | ------------- --- the requirement to implement `FnMut` derives from here + | | + | required by a bound introduced by this call + | +note: required by a bound in `accept_fn_mut` + --> $DIR/move-ref-patterns-closure-captures.rs:4:31 + | +LL | fn accept_fn_mut(_: &impl FnMut()) {} + | ^^^^^^^ required by this bound in `accept_fn_mut` error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/move-ref-patterns-closure-captures.rs:9:14 @@ -20,7 +28,15 @@ LL | drop::(_x1); | --- closure is `FnOnce` because it moves the variable `_x1` out of its environment ... LL | accept_fn(&c1); - | --------- the requirement to implement `Fn` derives from here + | --------- --- the requirement to implement `Fn` derives from here + | | + | required by a bound introduced by this call + | +note: required by a bound in `accept_fn` + --> $DIR/move-ref-patterns-closure-captures.rs:5:27 + | +LL | fn accept_fn(_: &impl Fn()) {} + | ^^^^ required by this bound in `accept_fn` error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` --> $DIR/move-ref-patterns-closure-captures.rs:20:14 @@ -32,7 +48,15 @@ LL | drop::<&mut U>(_x2); | --- closure is `FnMut` because it mutates the variable `_x2` here ... LL | accept_fn(&c2); - | --------- the requirement to implement `Fn` derives from here + | --------- --- the requirement to implement `Fn` derives from here + | | + | required by a bound introduced by this call + | +note: required by a bound in `accept_fn` + --> $DIR/move-ref-patterns-closure-captures.rs:5:27 + | +LL | fn accept_fn(_: &impl Fn()) {} + | ^^^^ required by this bound in `accept_fn` error: aborting due to 3 previous errors diff --git a/src/test/ui/pattern/rest-pat-semantic-disallowed.rs b/src/test/ui/pattern/rest-pat-semantic-disallowed.rs index 84552f2e7..156285e0f 100644 --- a/src/test/ui/pattern/rest-pat-semantic-disallowed.rs +++ b/src/test/ui/pattern/rest-pat-semantic-disallowed.rs @@ -1,5 +1,5 @@ // Here we test that rest patterns, i.e. `..`, are not allowed -// outside of slice (+ ident patterns witin those), tuple, +// outside of slice (+ ident patterns within those), tuple, // and tuple struct patterns and that duplicates are caught in these contexts. #![feature(box_patterns)] diff --git a/src/test/ui/pattern/rest-pat-syntactic.rs b/src/test/ui/pattern/rest-pat-syntactic.rs index 9656a0b5d..4da5a2db7 100644 --- a/src/test/ui/pattern/rest-pat-syntactic.rs +++ b/src/test/ui/pattern/rest-pat-syntactic.rs @@ -19,6 +19,8 @@ fn rest_patterns() { // Box patterns: let box ..; + //~^ WARN box pattern syntax is experimental + //~| WARN unstable syntax // In or-patterns: match x { @@ -57,7 +59,7 @@ fn rest_patterns() { .. | [ ( - box .., + box .., //~ WARN box pattern syntax is experimental &(..), &mut .., x @ .. @@ -67,4 +69,5 @@ fn rest_patterns() { ref mut x @ .. => {} } + //~| WARN unstable syntax } diff --git a/src/test/ui/pattern/rest-pat-syntactic.stderr b/src/test/ui/pattern/rest-pat-syntactic.stderr new file mode 100644 index 000000000..37019b7d5 --- /dev/null +++ b/src/test/ui/pattern/rest-pat-syntactic.stderr @@ -0,0 +1,24 @@ +warning: box pattern syntax is experimental + --> $DIR/rest-pat-syntactic.rs:21:9 + | +LL | let box ..; + | ^^^^^^ + | + = note: see issue #29641 for more information + = help: add `#![feature(box_patterns)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: box pattern syntax is experimental + --> $DIR/rest-pat-syntactic.rs:62:17 + | +LL | box .., + | ^^^^^^ + | + = note: see issue #29641 for more information + = help: add `#![feature(box_patterns)]` to the crate attributes to enable + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: 2 warnings emitted + diff --git a/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed new file mode 100644 index 000000000..b28dce881 --- /dev/null +++ b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed @@ -0,0 +1,10 @@ +// run-rustfix + +fn main() { + match Some(1) { //~ ERROR non-exhaustive patterns: `None` not covered + Some(1) => {} + // hello + Some(_) => {} + None => todo!() + } +} diff --git a/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.rs b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.rs new file mode 100644 index 000000000..42493a632 --- /dev/null +++ b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.rs @@ -0,0 +1,9 @@ +// run-rustfix + +fn main() { + match Some(1) { //~ ERROR non-exhaustive patterns: `None` not covered + Some(1) => {} + // hello + Some(_) => {} + } +} diff --git a/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr new file mode 100644 index 000000000..f3dca9bcb --- /dev/null +++ b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr @@ -0,0 +1,24 @@ +error[E0004]: non-exhaustive patterns: `None` not covered + --> $DIR/suggest-adding-appropriate-missing-pattern-excluding-comments.rs:4:11 + | +LL | match Some(1) { + | ^^^^^^^ pattern `None` not covered + | +note: `Option` defined here + --> $SRC_DIR/core/src/option.rs:LL:COL + | +LL | pub enum Option { + | ------------------ +... +LL | None, + | ^^^^ not covered + = note: the matched value is of type `Option` +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown + | +LL ~ Some(_) => {} +LL + None => todo!() + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs index d968c48fb..5d4181a30 100644 --- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs +++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs @@ -22,22 +22,22 @@ fn main() { HiddenEnum::A => {} HiddenEnum::C => {} } - //~^^^^ non-exhaustive patterns: `B` not covered + //~^^^^ non-exhaustive patterns: `HiddenEnum::B` not covered match HiddenEnum::A { HiddenEnum::A => {} } - //~^^^ non-exhaustive patterns: `B` and `_` not covered + //~^^^ non-exhaustive patterns: `HiddenEnum::B` and `_` not covered match None { None => {} Some(HiddenEnum::A) => {} } - //~^^^^ non-exhaustive patterns: `Some(B)` and `Some(_)` not covered + //~^^^^ non-exhaustive patterns: `Some(HiddenEnum::B)` and `Some(_)` not covered match InCrate::A { InCrate::A => {} InCrate::B => {} } - //~^^^^ non-exhaustive patterns: `C` not covered + //~^^^^ non-exhaustive patterns: `InCrate::C` not covered } diff --git a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 643e734f9..b450a9aed 100644 --- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -16,11 +16,11 @@ LL ~ HiddenEnum::B => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `B` not covered +error[E0004]: non-exhaustive patterns: `HiddenEnum::B` not covered --> $DIR/doc-hidden-non-exhaustive.rs:21:11 | LL | match HiddenEnum::A { - | ^^^^^^^^^^^^^ pattern `B` not covered + | ^^^^^^^^^^^^^ pattern `HiddenEnum::B` not covered | note: `HiddenEnum` defined here --> $DIR/auxiliary/hidden.rs:3:5 @@ -34,14 +34,14 @@ LL | B, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ HiddenEnum::C => {} -LL + B => todo!() +LL + HiddenEnum::B => todo!() | -error[E0004]: non-exhaustive patterns: `B` and `_` not covered +error[E0004]: non-exhaustive patterns: `HiddenEnum::B` and `_` not covered --> $DIR/doc-hidden-non-exhaustive.rs:27:11 | LL | match HiddenEnum::A { - | ^^^^^^^^^^^^^ patterns `B` and `_` not covered + | ^^^^^^^^^^^^^ patterns `HiddenEnum::B` and `_` not covered | note: `HiddenEnum` defined here --> $DIR/auxiliary/hidden.rs:3:5 @@ -55,14 +55,14 @@ LL | B, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ HiddenEnum::A => {} -LL + B | _ => todo!() +LL + HiddenEnum::B | _ => todo!() | -error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered +error[E0004]: non-exhaustive patterns: `Some(HiddenEnum::B)` and `Some(_)` not covered --> $DIR/doc-hidden-non-exhaustive.rs:32:11 | LL | match None { - | ^^^^ patterns `Some(B)` and `Some(_)` not covered + | ^^^^ patterns `Some(HiddenEnum::B)` and `Some(_)` not covered | note: `Option` defined here --> $SRC_DIR/core/src/option.rs:LL:COL @@ -76,14 +76,14 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ Some(HiddenEnum::A) => {} -LL + Some(B) | Some(_) => todo!() +LL + Some(HiddenEnum::B) | Some(_) => todo!() | -error[E0004]: non-exhaustive patterns: `C` not covered +error[E0004]: non-exhaustive patterns: `InCrate::C` not covered --> $DIR/doc-hidden-non-exhaustive.rs:38:11 | LL | match InCrate::A { - | ^^^^^^^^^^ pattern `C` not covered + | ^^^^^^^^^^ pattern `InCrate::C` not covered | note: `InCrate` defined here --> $DIR/doc-hidden-non-exhaustive.rs:11:5 @@ -97,7 +97,7 @@ LL | C, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ InCrate::B => {} -LL + C => todo!() +LL + InCrate::C => todo!() | error: aborting due to 5 previous errors diff --git a/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index d31ee0dbd..5e12bc1d2 100644 --- a/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -105,11 +105,11 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern -error[E0004]: non-exhaustive patterns: `Foo(_)` not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered --> $DIR/empty-match.rs:83:20 | LL | match_no_arms!(NonEmptyEnum1::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here --> $DIR/empty-match.rs:24:5 @@ -121,11 +121,11 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern -error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered --> $DIR/empty-match.rs:84:20 | LL | match_no_arms!(NonEmptyEnum2::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here --> $DIR/empty-match.rs:27:5 @@ -139,11 +139,11 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms -error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered --> $DIR/empty-match.rs:85:20 | LL | match_no_arms!(NonEmptyEnum5::V1); - | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered + | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered | note: `NonEmptyEnum5` defined here --> $DIR/empty-match.rs:30:6 @@ -238,11 +238,11 @@ LL ~ _ if false => {} LL + NonEmptyUnion2 { .. } => todo!() | -error[E0004]: non-exhaustive patterns: `Foo(_)` not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered --> $DIR/empty-match.rs:92:24 | LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here --> $DIR/empty-match.rs:24:5 @@ -255,14 +255,14 @@ LL | Foo(bool), help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} -LL + Foo(_) => todo!() +LL + NonEmptyEnum1::Foo(_) => todo!() | -error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered --> $DIR/empty-match.rs:93:24 | LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here --> $DIR/empty-match.rs:27:5 @@ -277,14 +277,14 @@ LL | Bar, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ _ if false => {} -LL + Foo(_) | Bar => todo!() +LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | -error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered --> $DIR/empty-match.rs:94:24 | LL | match_guarded_arm!(NonEmptyEnum5::V1); - | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered + | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered | note: `NonEmptyEnum5` defined here --> $DIR/empty-match.rs:30:6 diff --git a/src/test/ui/pattern/usefulness/empty-match.normal.stderr b/src/test/ui/pattern/usefulness/empty-match.normal.stderr index d31ee0dbd..5e12bc1d2 100644 --- a/src/test/ui/pattern/usefulness/empty-match.normal.stderr +++ b/src/test/ui/pattern/usefulness/empty-match.normal.stderr @@ -105,11 +105,11 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern -error[E0004]: non-exhaustive patterns: `Foo(_)` not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered --> $DIR/empty-match.rs:83:20 | LL | match_no_arms!(NonEmptyEnum1::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here --> $DIR/empty-match.rs:24:5 @@ -121,11 +121,11 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern -error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered --> $DIR/empty-match.rs:84:20 | LL | match_no_arms!(NonEmptyEnum2::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here --> $DIR/empty-match.rs:27:5 @@ -139,11 +139,11 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` = help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms -error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered --> $DIR/empty-match.rs:85:20 | LL | match_no_arms!(NonEmptyEnum5::V1); - | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered + | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered | note: `NonEmptyEnum5` defined here --> $DIR/empty-match.rs:30:6 @@ -238,11 +238,11 @@ LL ~ _ if false => {} LL + NonEmptyUnion2 { .. } => todo!() | -error[E0004]: non-exhaustive patterns: `Foo(_)` not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered --> $DIR/empty-match.rs:92:24 | LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered | note: `NonEmptyEnum1` defined here --> $DIR/empty-match.rs:24:5 @@ -255,14 +255,14 @@ LL | Foo(bool), help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {} -LL + Foo(_) => todo!() +LL + NonEmptyEnum1::Foo(_) => todo!() | -error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered --> $DIR/empty-match.rs:93:24 | LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered | note: `NonEmptyEnum2` defined here --> $DIR/empty-match.rs:27:5 @@ -277,14 +277,14 @@ LL | Bar, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ _ if false => {} -LL + Foo(_) | Bar => todo!() +LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | -error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered +error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered --> $DIR/empty-match.rs:94:24 | LL | match_guarded_arm!(NonEmptyEnum5::V1); - | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered + | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered | note: `NonEmptyEnum5` defined here --> $DIR/empty-match.rs:30:6 diff --git a/src/test/ui/pattern/usefulness/empty-match.rs b/src/test/ui/pattern/usefulness/empty-match.rs index 8110ec013..9cdc0413b 100644 --- a/src/test/ui/pattern/usefulness/empty-match.rs +++ b/src/test/ui/pattern/usefulness/empty-match.rs @@ -80,16 +80,16 @@ fn main() { match_no_arms!(NonEmptyStruct2(true)); //~ ERROR type `NonEmptyStruct2` is non-empty match_no_arms!((NonEmptyUnion1 { foo: () })); //~ ERROR type `NonEmptyUnion1` is non-empty match_no_arms!((NonEmptyUnion2 { foo: () })); //~ ERROR type `NonEmptyUnion2` is non-empty - match_no_arms!(NonEmptyEnum1::Foo(true)); //~ ERROR `Foo(_)` not covered - match_no_arms!(NonEmptyEnum2::Foo(true)); //~ ERROR `Foo(_)` and `Bar` not covered - match_no_arms!(NonEmptyEnum5::V1); //~ ERROR `V1`, `V2`, `V3` and 2 more not covered + match_no_arms!(NonEmptyEnum1::Foo(true)); //~ ERROR `NonEmptyEnum1::Foo(_)` not covered + match_no_arms!(NonEmptyEnum2::Foo(true)); //~ ERROR `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered + match_no_arms!(NonEmptyEnum5::V1); //~ ERROR `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered match_guarded_arm!(0u8); //~ ERROR `_` not covered match_guarded_arm!(NonEmptyStruct1); //~ ERROR `NonEmptyStruct1` not covered match_guarded_arm!(NonEmptyStruct2(true)); //~ ERROR `NonEmptyStruct2(_)` not covered match_guarded_arm!((NonEmptyUnion1 { foo: () })); //~ ERROR `NonEmptyUnion1 { .. }` not covered match_guarded_arm!((NonEmptyUnion2 { foo: () })); //~ ERROR `NonEmptyUnion2 { .. }` not covered - match_guarded_arm!(NonEmptyEnum1::Foo(true)); //~ ERROR `Foo(_)` not covered - match_guarded_arm!(NonEmptyEnum2::Foo(true)); //~ ERROR `Foo(_)` and `Bar` not covered - match_guarded_arm!(NonEmptyEnum5::V1); //~ ERROR `V1`, `V2`, `V3` and 2 more not covered + match_guarded_arm!(NonEmptyEnum1::Foo(true)); //~ ERROR `NonEmptyEnum1::Foo(_)` not covered + match_guarded_arm!(NonEmptyEnum2::Foo(true)); //~ ERROR `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered + match_guarded_arm!(NonEmptyEnum5::V1); //~ ERROR `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered } diff --git a/src/test/ui/pattern/usefulness/issue-15129.rs b/src/test/ui/pattern/usefulness/issue-15129.rs index d2b72a86b..f02e5c0c6 100644 --- a/src/test/ui/pattern/usefulness/issue-15129.rs +++ b/src/test/ui/pattern/usefulness/issue-15129.rs @@ -10,7 +10,7 @@ pub enum V { fn main() { match (T::T1(()), V::V2(true)) { - //~^ ERROR non-exhaustive patterns: `(T1(()), V2(_))` and `(T2(()), V1(_))` not covered + //~^ ERROR non-exhaustive patterns: `(T::T1(()), V::V2(_))` and `(T::T2(()), V::V1(_))` not covered (T::T1(()), V::V1(i)) => (), (T::T2(()), V::V2(b)) => (), } diff --git a/src/test/ui/pattern/usefulness/issue-15129.stderr b/src/test/ui/pattern/usefulness/issue-15129.stderr index af60f3ff5..ee8410b76 100644 --- a/src/test/ui/pattern/usefulness/issue-15129.stderr +++ b/src/test/ui/pattern/usefulness/issue-15129.stderr @@ -1,14 +1,14 @@ -error[E0004]: non-exhaustive patterns: `(T1(()), V2(_))` and `(T2(()), V1(_))` not covered +error[E0004]: non-exhaustive patterns: `(T::T1(()), V::V2(_))` and `(T::T2(()), V::V1(_))` not covered --> $DIR/issue-15129.rs:12:11 | LL | match (T::T1(()), V::V2(true)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `(T1(()), V2(_))` and `(T2(()), V1(_))` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `(T::T1(()), V::V2(_))` and `(T::T2(()), V::V1(_))` not covered | = note: the matched value is of type `(T, V)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ (T::T2(()), V::V2(b)) => (), -LL ~ (T1(()), V2(_)) | (T2(()), V1(_)) => todo!(), +LL ~ (T::T1(()), V::V2(_)) | (T::T2(()), V::V1(_)) => todo!(), | error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/issue-31561.rs b/src/test/ui/pattern/usefulness/issue-31561.rs index 813b2409c..5b878851a 100644 --- a/src/test/ui/pattern/usefulness/issue-31561.rs +++ b/src/test/ui/pattern/usefulness/issue-31561.rs @@ -6,5 +6,5 @@ enum Thing { fn main() { let Thing::Foo(y) = Thing::Foo(1); - //~^ ERROR refutable pattern in local binding: `Bar` and `Baz` not covered + //~^ ERROR refutable pattern in local binding: `Thing::Bar` and `Thing::Baz` not covered } diff --git a/src/test/ui/pattern/usefulness/issue-31561.stderr b/src/test/ui/pattern/usefulness/issue-31561.stderr index 9da6b5eee..20f2f0950 100644 --- a/src/test/ui/pattern/usefulness/issue-31561.stderr +++ b/src/test/ui/pattern/usefulness/issue-31561.stderr @@ -1,8 +1,8 @@ -error[E0005]: refutable pattern in local binding: `Bar` and `Baz` not covered +error[E0005]: refutable pattern in local binding: `Thing::Bar` and `Thing::Baz` not covered --> $DIR/issue-31561.rs:8:9 | LL | let Thing::Foo(y) = Thing::Foo(1); - | ^^^^^^^^^^^^^ patterns `Bar` and `Baz` not covered + | ^^^^^^^^^^^^^ patterns `Thing::Bar` and `Thing::Baz` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html @@ -21,7 +21,7 @@ help: you might want to use `if let` to ignore the variants that aren't matched | LL | let y = if let Thing::Foo(y) = Thing::Foo(1) { y } else { todo!() }; | ++++++++++ ++++++++++++++++++++++ -help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variants that aren't matched +help: alternatively, you might want to use let else to handle the variants that aren't matched | LL | let Thing::Foo(y) = Thing::Foo(1) else { todo!() }; | ++++++++++++++++ diff --git a/src/test/ui/pattern/usefulness/issue-35609.stderr b/src/test/ui/pattern/usefulness/issue-35609.stderr index 2247b818d..c9781d52e 100644 --- a/src/test/ui/pattern/usefulness/issue-35609.stderr +++ b/src/test/ui/pattern/usefulness/issue-35609.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered +error[E0004]: non-exhaustive patterns: `(Enum::B, _)`, `(Enum::C, _)`, `(Enum::D, _)` and 2 more not covered --> $DIR/issue-35609.rs:10:11 | LL | match (A, ()) { - | ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered + | ^^^^^^^ patterns `(Enum::B, _)`, `(Enum::C, _)`, `(Enum::D, _)` and 2 more not covered | = note: the matched value is of type `(Enum, ())` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms @@ -11,11 +11,11 @@ LL ~ (A, _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered +error[E0004]: non-exhaustive patterns: `(_, Enum::B)`, `(_, Enum::C)`, `(_, Enum::D)` and 2 more not covered --> $DIR/issue-35609.rs:14:11 | LL | match (A, A) { - | ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered + | ^^^^^^ patterns `(_, Enum::B)`, `(_, Enum::C)`, `(_, Enum::D)` and 2 more not covered | = note: the matched value is of type `(Enum, Enum)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms @@ -24,11 +24,11 @@ LL ~ (_, A) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered +error[E0004]: non-exhaustive patterns: `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:18:11 | LL | match ((A, ()), ()) { - | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered + | ^^^^^^^^^^^^^ patterns `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered | = note: the matched value is of type `((Enum, ()), ())` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms @@ -37,11 +37,11 @@ LL ~ ((A, ()), _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered +error[E0004]: non-exhaustive patterns: `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:22:11 | LL | match ((A, ()), A) { - | ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered + | ^^^^^^^^^^^^ patterns `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered | = note: the matched value is of type `((Enum, ()), Enum)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms @@ -50,11 +50,11 @@ LL ~ ((A, ()), _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered +error[E0004]: non-exhaustive patterns: `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:26:11 | LL | match ((A, ()), ()) { - | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered + | ^^^^^^^^^^^^^ patterns `((Enum::B, _), _)`, `((Enum::C, _), _)`, `((Enum::D, _), _)` and 2 more not covered | = note: the matched value is of type `((Enum, ()), ())` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms @@ -63,11 +63,11 @@ LL ~ ((A, _), _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered +error[E0004]: non-exhaustive patterns: `S(Enum::B, _)`, `S(Enum::C, _)`, `S(Enum::D, _)` and 2 more not covered --> $DIR/issue-35609.rs:31:11 | LL | match S(A, ()) { - | ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered + | ^^^^^^^^ patterns `S(Enum::B, _)`, `S(Enum::C, _)`, `S(Enum::D, _)` and 2 more not covered | note: `S` defined here --> $DIR/issue-35609.rs:6:8 @@ -81,11 +81,11 @@ LL ~ S(A, _) => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered +error[E0004]: non-exhaustive patterns: `Sd { x: Enum::B, .. }`, `Sd { x: Enum::C, .. }`, `Sd { x: Enum::D, .. }` and 2 more not covered --> $DIR/issue-35609.rs:35:11 | LL | match (Sd { x: A, y: () }) { - | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered + | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: Enum::B, .. }`, `Sd { x: Enum::C, .. }`, `Sd { x: Enum::D, .. }` and 2 more not covered | note: `Sd` defined here --> $DIR/issue-35609.rs:7:8 @@ -99,11 +99,11 @@ LL ~ Sd { x: A, y: _ } => {} LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered +error[E0004]: non-exhaustive patterns: `Some(Enum::B)`, `Some(Enum::C)`, `Some(Enum::D)` and 2 more not covered --> $DIR/issue-35609.rs:39:11 | LL | match Some(A) { - | ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered + | ^^^^^^^ patterns `Some(Enum::B)`, `Some(Enum::C)`, `Some(Enum::D)` and 2 more not covered | note: `Option` defined here --> $SRC_DIR/core/src/option.rs:LL:COL diff --git a/src/test/ui/pattern/usefulness/issue-39362.stderr b/src/test/ui/pattern/usefulness/issue-39362.stderr index ca37af6fb..b8b17918a 100644 --- a/src/test/ui/pattern/usefulness/issue-39362.stderr +++ b/src/test/ui/pattern/usefulness/issue-39362.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered +error[E0004]: non-exhaustive patterns: `Foo::Bar { bar: Bar::C, .. }`, `Foo::Bar { bar: Bar::D, .. }`, `Foo::Bar { bar: Bar::E, .. }` and 1 more not covered --> $DIR/issue-39362.rs:10:11 | LL | match f { - | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered + | ^ patterns `Foo::Bar { bar: Bar::C, .. }`, `Foo::Bar { bar: Bar::D, .. }`, `Foo::Bar { bar: Bar::E, .. }` and 1 more not covered | note: `Foo` defined here --> $DIR/issue-39362.rs:2:5 diff --git a/src/test/ui/pattern/usefulness/issue-40221.stderr b/src/test/ui/pattern/usefulness/issue-40221.stderr index c477e4353..4973e42b0 100644 --- a/src/test/ui/pattern/usefulness/issue-40221.stderr +++ b/src/test/ui/pattern/usefulness/issue-40221.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `C(QA)` not covered +error[E0004]: non-exhaustive patterns: `P::C(PC::QA)` not covered --> $DIR/issue-40221.rs:11:11 | LL | match proto { - | ^^^^^ pattern `C(QA)` not covered + | ^^^^^ pattern `P::C(PC::QA)` not covered | note: `P` defined here --> $DIR/issue-40221.rs:2:5 @@ -15,7 +15,7 @@ LL | C(PC), help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ P::C(PC::Q) => (), -LL ~ C(QA) => todo!(), +LL ~ P::C(PC::QA) => todo!(), | error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/issue-50900.rs b/src/test/ui/pattern/usefulness/issue-50900.rs index 27135af95..9cc760e9a 100644 --- a/src/test/ui/pattern/usefulness/issue-50900.rs +++ b/src/test/ui/pattern/usefulness/issue-50900.rs @@ -13,7 +13,7 @@ impl Tag { fn main() { match Tag::ExifIFDPointer { - //~^ ERROR: non-exhaustive patterns: `Tag(Exif, _)` not covered + //~^ ERROR: non-exhaustive patterns: `Tag(Context::Exif, _)` not covered Tag::ExifIFDPointer => {} } } diff --git a/src/test/ui/pattern/usefulness/issue-50900.stderr b/src/test/ui/pattern/usefulness/issue-50900.stderr index 2bdbecabb..348246d28 100644 --- a/src/test/ui/pattern/usefulness/issue-50900.stderr +++ b/src/test/ui/pattern/usefulness/issue-50900.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `Tag(Exif, _)` not covered +error[E0004]: non-exhaustive patterns: `Tag(Context::Exif, _)` not covered --> $DIR/issue-50900.rs:15:11 | LL | match Tag::ExifIFDPointer { - | ^^^^^^^^^^^^^^^^^^^ pattern `Tag(Exif, _)` not covered + | ^^^^^^^^^^^^^^^^^^^ pattern `Tag(Context::Exif, _)` not covered | note: `Tag` defined here --> $DIR/issue-50900.rs:2:12 @@ -13,7 +13,7 @@ LL | pub struct Tag(pub Context, pub u16); help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Tag::ExifIFDPointer => {} -LL + Tag(Exif, _) => todo!() +LL + Tag(Context::Exif, _) => todo!() | error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/issue-56379.rs b/src/test/ui/pattern/usefulness/issue-56379.rs index 9bccccca9..097cf98d0 100644 --- a/src/test/ui/pattern/usefulness/issue-56379.rs +++ b/src/test/ui/pattern/usefulness/issue-56379.rs @@ -6,7 +6,7 @@ enum Foo { fn main() { match Foo::A(true) { - //~^ ERROR non-exhaustive patterns: `A(false)`, `B(false)` and `C(false)` not covered + //~^ ERROR non-exhaustive patterns: `Foo::A(false)`, `Foo::B(false)` and `Foo::C(false)` not covered Foo::A(true) => {} Foo::B(true) => {} Foo::C(true) => {} diff --git a/src/test/ui/pattern/usefulness/issue-56379.stderr b/src/test/ui/pattern/usefulness/issue-56379.stderr index f6261001c..6eed6bfae 100644 --- a/src/test/ui/pattern/usefulness/issue-56379.stderr +++ b/src/test/ui/pattern/usefulness/issue-56379.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `A(false)`, `B(false)` and `C(false)` not covered +error[E0004]: non-exhaustive patterns: `Foo::A(false)`, `Foo::B(false)` and `Foo::C(false)` not covered --> $DIR/issue-56379.rs:8:11 | LL | match Foo::A(true) { - | ^^^^^^^^^^^^ patterns `A(false)`, `B(false)` and `C(false)` not covered + | ^^^^^^^^^^^^ patterns `Foo::A(false)`, `Foo::B(false)` and `Foo::C(false)` not covered | note: `Foo` defined here --> $DIR/issue-56379.rs:2:5 @@ -19,7 +19,7 @@ LL | C(bool), help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ Foo::C(true) => {} -LL + A(false) | B(false) | C(false) => todo!() +LL + Foo::A(false) | Foo::B(false) | Foo::C(false) => todo!() | error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/issue-72377.rs b/src/test/ui/pattern/usefulness/issue-72377.rs index b0d8a53ed..b5ad3075c 100644 --- a/src/test/ui/pattern/usefulness/issue-72377.rs +++ b/src/test/ui/pattern/usefulness/issue-72377.rs @@ -6,7 +6,7 @@ fn main() { let y = Some(X::A); match (x, y) { - //~^ ERROR non-exhaustive patterns: `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 + //~^ ERROR non-exhaustive patterns: `(X::A, Some(X::A))`, `(X::A, Some(X::B))`, `(X::B, Some(X::B))` and 2 //~| more not covered (_, None) => false, (v, Some(w)) if v == w => true, diff --git a/src/test/ui/pattern/usefulness/issue-72377.stderr b/src/test/ui/pattern/usefulness/issue-72377.stderr index 20f002dd3..123dd051d 100644 --- a/src/test/ui/pattern/usefulness/issue-72377.stderr +++ b/src/test/ui/pattern/usefulness/issue-72377.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 more not covered +error[E0004]: non-exhaustive patterns: `(X::A, Some(X::A))`, `(X::A, Some(X::B))`, `(X::B, Some(X::B))` and 2 more not covered --> $DIR/issue-72377.rs:8:11 | LL | match (x, y) { - | ^^^^^^ patterns `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 more not covered + | ^^^^^^ patterns `(X::A, Some(X::A))`, `(X::A, Some(X::B))`, `(X::B, Some(X::B))` and 2 more not covered | = note: the matched value is of type `(X, Option)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms diff --git a/src/test/ui/pattern/usefulness/match-arm-statics-2.rs b/src/test/ui/pattern/usefulness/match-arm-statics-2.rs index 4c5f2d356..3c9c16561 100644 --- a/src/test/ui/pattern/usefulness/match-arm-statics-2.rs +++ b/src/test/ui/pattern/usefulness/match-arm-statics-2.rs @@ -27,7 +27,7 @@ const EAST: Direction = East; fn nonexhaustive_2() { match Some(Some(North)) { - //~^ ERROR non-exhaustive patterns: `Some(Some(West))` not covered + //~^ ERROR non-exhaustive patterns: `Some(Some(Direction::West))` not covered Some(NONE) => (), Some(Some(North)) => (), Some(Some(EAST)) => (), @@ -46,7 +46,7 @@ const STATIC_FOO: Foo = Foo { bar: None, baz: NEW_FALSE }; fn nonexhaustive_3() { match (Foo { bar: Some(North), baz: NewBool(true) }) { - //~^ ERROR non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` + //~^ ERROR non-exhaustive patterns: `Foo { bar: Some(Direction::North), baz: NewBool(true) }` Foo { bar: None, baz: NewBool(true) } => (), Foo { bar: _, baz: NEW_FALSE } => (), Foo { bar: Some(West), baz: NewBool(true) } => (), diff --git a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr index a2b66f5ed..b0d7fe5eb 100644 --- a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -11,11 +11,11 @@ LL ~ (false, true) => (), LL + (true, false) => todo!() | -error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered +error[E0004]: non-exhaustive patterns: `Some(Some(Direction::West))` not covered --> $DIR/match-arm-statics-2.rs:29:11 | LL | match Some(Some(North)) { - | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered + | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(Direction::West))` not covered | note: `Option>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL @@ -32,14 +32,14 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ None => (), -LL + Some(Some(West)) => todo!() +LL + Some(Some(Direction::West)) => todo!() | -error[E0004]: non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` not covered +error[E0004]: non-exhaustive patterns: `Foo { bar: Some(Direction::North), baz: NewBool(true) }` not covered --> $DIR/match-arm-statics-2.rs:48:11 | LL | match (Foo { bar: Some(North), baz: NewBool(true) }) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(Direction::North), baz: NewBool(true) }` not covered | note: `Foo` defined here --> $DIR/match-arm-statics-2.rs:40:8 @@ -50,7 +50,7 @@ LL | struct Foo { help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Foo { bar: Some(EAST), .. } => (), -LL + Foo { bar: Some(North), baz: NewBool(true) } => todo!() +LL + Foo { bar: Some(Direction::North), baz: NewBool(true) } => todo!() | error: aborting due to 3 previous errors diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs index 2e15bc2d2..af42fc1ae 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs +++ b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.rs @@ -35,43 +35,43 @@ enum E { fn by_val(e: E) { let e1 = e.clone(); - match e1 { //~ ERROR non-exhaustive patterns: `B` and `C` not covered - //~^ NOTE patterns `B` and `C` not covered + match e1 { //~ ERROR non-exhaustive patterns: `E::B` and `E::C` not covered + //~^ NOTE patterns `E::B` and `E::C` not covered //~| NOTE the matched value is of type `E` E::A => {} } - let E::A = e; //~ ERROR refutable pattern in local binding: `B` and `C` not covered - //~^ NOTE patterns `B` and `C` not covered + let E::A = e; //~ ERROR refutable pattern in local binding: `E::B` and `E::C` not covered + //~^ NOTE patterns `E::B` and `E::C` not covered //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html //~| NOTE the matched value is of type `E` } fn by_ref_once(e: &E) { - match e { //~ ERROR non-exhaustive patterns: `&B` and `&C` not covered - //~^ NOTE patterns `&B` and `&C` not covered + match e { //~ ERROR non-exhaustive patterns: `&E::B` and `&E::C` not covered + //~^ NOTE patterns `&E::B` and `&E::C` not covered //~| NOTE the matched value is of type `&E` E::A => {} } - let E::A = e; //~ ERROR refutable pattern in local binding: `&B` and `&C` not covered - //~^ NOTE patterns `&B` and `&C` not covered + let E::A = e; //~ ERROR refutable pattern in local binding: `&E::B` and `&E::C` not covered + //~^ NOTE patterns `&E::B` and `&E::C` not covered //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html //~| NOTE the matched value is of type `&E` } fn by_ref_thrice(e: & &mut &E) { - match e { //~ ERROR non-exhaustive patterns: `&&mut &B` and `&&mut &C` not covered - //~^ NOTE patterns `&&mut &B` and `&&mut &C` not covered + match e { //~ ERROR non-exhaustive patterns: `&&mut &E::B` and `&&mut &E::C` not covered + //~^ NOTE patterns `&&mut &E::B` and `&&mut &E::C` not covered //~| NOTE the matched value is of type `&&mut &E` E::A => {} } let E::A = e; - //~^ ERROR refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered - //~| NOTE patterns `&&mut &B` and `&&mut &C` not covered + //~^ ERROR refutable pattern in local binding: `&&mut &E::B` and `&&mut &E::C` not covered + //~| NOTE patterns `&&mut &E::B` and `&&mut &E::C` not covered //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html //~| NOTE the matched value is of type `&&mut &E` @@ -89,15 +89,15 @@ enum Opt { } fn ref_pat(e: Opt) { - match e {//~ ERROR non-exhaustive patterns: `None` not covered - //~^ NOTE pattern `None` not covered + match e {//~ ERROR non-exhaustive patterns: `Opt::None` not covered + //~^ NOTE pattern `Opt::None` not covered //~| NOTE the matched value is of type `Opt` Opt::Some(ref _x) => {} } - let Opt::Some(ref _x) = e; //~ ERROR refutable pattern in local binding: `None` not covered + let Opt::Some(ref _x) = e; //~ ERROR refutable pattern in local binding: `Opt::None` not covered //~^ NOTE the matched value is of type `Opt` - //~| NOTE pattern `None` not covered + //~| NOTE pattern `Opt::None` not covered //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html } diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index 0f06c31c4..678c9b2ab 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `B` and `C` not covered +error[E0004]: non-exhaustive patterns: `E::B` and `E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:38:11 | LL | match e1 { - | ^^ patterns `B` and `C` not covered + | ^^ patterns `E::B` and `E::C` not covered | note: `E` defined here --> $DIR/non-exhaustive-defined-here.rs:14:5 @@ -19,14 +19,14 @@ LL | C help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ E::A => {} -LL + B | C => todo!() +LL + E::B | E::C => todo!() | -error[E0005]: refutable pattern in local binding: `B` and `C` not covered +error[E0005]: refutable pattern in local binding: `E::B` and `E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:44:9 | LL | let E::A = e; - | ^^^^ patterns `B` and `C` not covered + | ^^^^ patterns `E::B` and `E::C` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html @@ -47,11 +47,11 @@ help: you might want to use `if let` to ignore the variants that aren't matched LL | if let E::A = e { todo!() } | ++ ~~~~~~~~~~~ -error[E0004]: non-exhaustive patterns: `&B` and `&C` not covered +error[E0004]: non-exhaustive patterns: `&E::B` and `&E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:52:11 | LL | match e { - | ^ patterns `&B` and `&C` not covered + | ^ patterns `&E::B` and `&E::C` not covered | note: `E` defined here --> $DIR/non-exhaustive-defined-here.rs:14:5 @@ -68,14 +68,14 @@ LL | C help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ E::A => {} -LL + &B | &C => todo!() +LL + &E::B | &E::C => todo!() | -error[E0005]: refutable pattern in local binding: `&B` and `&C` not covered +error[E0005]: refutable pattern in local binding: `&E::B` and `&E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:58:9 | LL | let E::A = e; - | ^^^^ patterns `&B` and `&C` not covered + | ^^^^ patterns `&E::B` and `&E::C` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html @@ -96,11 +96,11 @@ help: you might want to use `if let` to ignore the variants that aren't matched LL | if let E::A = e { todo!() } | ++ ~~~~~~~~~~~ -error[E0004]: non-exhaustive patterns: `&&mut &B` and `&&mut &C` not covered +error[E0004]: non-exhaustive patterns: `&&mut &E::B` and `&&mut &E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:66:11 | LL | match e { - | ^ patterns `&&mut &B` and `&&mut &C` not covered + | ^ patterns `&&mut &E::B` and `&&mut &E::C` not covered | note: `E` defined here --> $DIR/non-exhaustive-defined-here.rs:14:5 @@ -117,14 +117,14 @@ LL | C help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ E::A => {} -LL + &&mut &B | &&mut &C => todo!() +LL + &&mut &E::B | &&mut &E::C => todo!() | -error[E0005]: refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered +error[E0005]: refutable pattern in local binding: `&&mut &E::B` and `&&mut &E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:72:9 | LL | let E::A = e; - | ^^^^ patterns `&&mut &B` and `&&mut &C` not covered + | ^^^^ patterns `&&mut &E::B` and `&&mut &E::C` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html @@ -145,11 +145,11 @@ help: you might want to use `if let` to ignore the variants that aren't matched LL | if let E::A = e { todo!() } | ++ ~~~~~~~~~~~ -error[E0004]: non-exhaustive patterns: `None` not covered +error[E0004]: non-exhaustive patterns: `Opt::None` not covered --> $DIR/non-exhaustive-defined-here.rs:92:11 | LL | match e { - | ^ pattern `None` not covered + | ^ pattern `Opt::None` not covered | note: `Opt` defined here --> $DIR/non-exhaustive-defined-here.rs:84:5 @@ -163,14 +163,14 @@ LL | None, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Opt::Some(ref _x) => {} -LL + None => todo!() +LL + Opt::None => todo!() | -error[E0005]: refutable pattern in local binding: `None` not covered +error[E0005]: refutable pattern in local binding: `Opt::None` not covered --> $DIR/non-exhaustive-defined-here.rs:98:9 | LL | let Opt::Some(ref _x) = e; - | ^^^^^^^^^^^^^^^^^ pattern `None` not covered + | ^^^^^^^^^^^^^^^^^ pattern `Opt::None` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html @@ -187,7 +187,7 @@ help: you might want to use `if let` to ignore the variant that isn't matched | LL | let _x = if let Opt::Some(ref _x) = e { _x } else { todo!() }; | +++++++++++ +++++++++++++++++++++++ -help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched +help: alternatively, you might want to use let else to handle the variant that isn't matched | LL | let Opt::Some(ref _x) = e else { todo!() }; | ++++++++++++++++ diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs index d19814479..69c3c7658 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs @@ -12,7 +12,7 @@ fn match_nested_vecs<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'s fn main() { let x = T::A(U::C); - match x { //~ ERROR non-exhaustive patterns: `A(C)` not covered + match x { //~ ERROR non-exhaustive patterns: `T::A(U::C)` not covered T::A(U::D) => { panic!("hello"); } T::B => { panic!("goodbye"); } } diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index cbbd544f9..44f327421 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -11,11 +11,11 @@ LL ~ (None, Ok(&[_, _, ..])) => "None, Ok(at least two elements)", LL + (Some(&[]), Err(_)) => todo!() | -error[E0004]: non-exhaustive patterns: `A(C)` not covered +error[E0004]: non-exhaustive patterns: `T::A(U::C)` not covered --> $DIR/non-exhaustive-match-nested.rs:15:11 | LL | match x { - | ^ pattern `A(C)` not covered + | ^ pattern `T::A(U::C)` not covered | note: `T` defined here --> $DIR/non-exhaustive-match-nested.rs:1:10 @@ -26,7 +26,7 @@ LL | enum T { A(U), B } help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ T::B => { panic!("goodbye"); } -LL + A(C) => todo!() +LL + T::A(U::C) => todo!() | error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.rs b/src/test/ui/pattern/usefulness/non-exhaustive-match.rs index 4ff12aa2f..1cb58b8ce 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.rs +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.rs @@ -4,7 +4,7 @@ enum T { A, B } fn main() { let x = T::A; - match x { T::B => { } } //~ ERROR non-exhaustive patterns: `A` not covered + match x { T::B => { } } //~ ERROR non-exhaustive patterns: `T::A` not covered match true { //~ ERROR non-exhaustive patterns: `false` not covered true => {} } @@ -15,11 +15,11 @@ fn main() { // and `(_, _, 5_i32..=i32::MAX)` not covered (_, _, 4) => {} } - match (T::A, T::A) { //~ ERROR non-exhaustive patterns: `(A, A)` and `(B, B)` not covered + match (T::A, T::A) { //~ ERROR non-exhaustive patterns: `(T::A, T::A)` and `(T::B, T::B)` not covered (T::A, T::B) => {} (T::B, T::A) => {} } - match T::A { //~ ERROR non-exhaustive patterns: `B` not covered + match T::A { //~ ERROR non-exhaustive patterns: `T::B` not covered T::A => {} } // This is exhaustive, though the algorithm got it wrong at one point diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr index f2362c316..4234600d0 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `A` not covered +error[E0004]: non-exhaustive patterns: `T::A` not covered --> $DIR/non-exhaustive-match.rs:7:11 | LL | match x { T::B => { } } - | ^ pattern `A` not covered + | ^ pattern `T::A` not covered | note: `T` defined here --> $DIR/non-exhaustive-match.rs:3:10 @@ -12,8 +12,8 @@ LL | enum T { A, B } = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL | match x { T::B => { }, A => todo!() } - | ++++++++++++++ +LL | match x { T::B => { }, T::A => todo!() } + | +++++++++++++++++ error[E0004]: non-exhaustive patterns: `false` not covered --> $DIR/non-exhaustive-match.rs:8:11 @@ -62,24 +62,24 @@ LL ~ (_, _, 4) => {} LL + (_, _, i32::MIN..=3_i32) | (_, _, 5_i32..=i32::MAX) => todo!() | -error[E0004]: non-exhaustive patterns: `(A, A)` and `(B, B)` not covered +error[E0004]: non-exhaustive patterns: `(T::A, T::A)` and `(T::B, T::B)` not covered --> $DIR/non-exhaustive-match.rs:18:11 | LL | match (T::A, T::A) { - | ^^^^^^^^^^^^ patterns `(A, A)` and `(B, B)` not covered + | ^^^^^^^^^^^^ patterns `(T::A, T::A)` and `(T::B, T::B)` not covered | = note: the matched value is of type `(T, T)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ (T::B, T::A) => {} -LL + (A, A) | (B, B) => todo!() +LL + (T::A, T::A) | (T::B, T::B) => todo!() | -error[E0004]: non-exhaustive patterns: `B` not covered +error[E0004]: non-exhaustive patterns: `T::B` not covered --> $DIR/non-exhaustive-match.rs:22:11 | LL | match T::A { - | ^^^^ pattern `B` not covered + | ^^^^ pattern `T::B` not covered | note: `T` defined here --> $DIR/non-exhaustive-match.rs:3:13 @@ -90,7 +90,7 @@ LL | enum T { A, B } help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ T::A => {} -LL + B => todo!() +LL + T::B => todo!() | error[E0004]: non-exhaustive patterns: `[]` not covered diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs index abb4ea8da..4bd344219 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs @@ -21,7 +21,7 @@ enum Color { fn enum_with_single_missing_variant() { match Color::Red { - //~^ ERROR non-exhaustive patterns: `Red` not covered + //~^ ERROR non-exhaustive patterns: `Color::Red` not covered Color::CustomRGBA { .. } => (), Color::Green => () } @@ -33,7 +33,7 @@ enum Direction { fn enum_with_multiple_missing_variants() { match Direction::North { - //~^ ERROR non-exhaustive patterns: `East`, `South` and `West` not covered + //~^ ERROR non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered Direction::North => () } } @@ -44,7 +44,7 @@ enum ExcessiveEnum { fn enum_with_excessive_missing_variants() { match ExcessiveEnum::First { - //~^ ERROR `Second`, `Third`, `Fourth` and 8 more not covered + //~^ ERROR `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered ExcessiveEnum::First => () } @@ -52,7 +52,7 @@ fn enum_with_excessive_missing_variants() { fn enum_struct_variant() { match Color::Red { - //~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered + //~^ ERROR non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered Color::Red => (), Color::Green => (), Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (), @@ -68,7 +68,7 @@ enum Enum { fn vectors_with_nested_enums() { let x: &'static [Enum] = &[Enum::First, Enum::Second(false)]; match *x { - //~^ ERROR non-exhaustive patterns: `[Second(true), Second(false)]` not covered + //~^ ERROR non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered [] => (), [_] => (), [Enum::First, _] => (), diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr index b0cfd631f..b8af566de 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -16,11 +16,11 @@ LL ~ Foo { first: false, second: Some([1, 2, 3, 4]) } => (), LL + Foo { first: false, second: Some([_, _, _, _]) } => todo!() | -error[E0004]: non-exhaustive patterns: `Red` not covered +error[E0004]: non-exhaustive patterns: `Color::Red` not covered --> $DIR/non-exhaustive-pattern-witness.rs:23:11 | LL | match Color::Red { - | ^^^^^^^^^^ pattern `Red` not covered + | ^^^^^^^^^^ pattern `Color::Red` not covered | note: `Color` defined here --> $DIR/non-exhaustive-pattern-witness.rs:17:5 @@ -33,14 +33,14 @@ LL | Red, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Color::Green => (), -LL + Red => todo!() +LL + Color::Red => todo!() | -error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered +error[E0004]: non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered --> $DIR/non-exhaustive-pattern-witness.rs:35:11 | LL | match Direction::North { - | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered + | ^^^^^^^^^^^^^^^^ patterns `Direction::East`, `Direction::South` and `Direction::West` not covered | note: `Direction` defined here --> $DIR/non-exhaustive-pattern-witness.rs:31:12 @@ -56,14 +56,14 @@ LL | North, East, South, West help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ Direction::North => (), -LL + East | South | West => todo!() +LL + Direction::East | Direction::South | Direction::West => todo!() | -error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered +error[E0004]: non-exhaustive patterns: `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered --> $DIR/non-exhaustive-pattern-witness.rs:46:11 | LL | match ExcessiveEnum::First { - | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered + | ^^^^^^^^^^^^^^^^^^^^ patterns `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered | note: `ExcessiveEnum` defined here --> $DIR/non-exhaustive-pattern-witness.rs:41:6 @@ -77,11 +77,11 @@ LL ~ ExcessiveEnum::First => (), LL + _ => todo!() | -error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered +error[E0004]: non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered --> $DIR/non-exhaustive-pattern-witness.rs:54:11 | LL | match Color::Red { - | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered + | ^^^^^^^^^^ pattern `Color::CustomRGBA { a: true, .. }` not covered | note: `Color` defined here --> $DIR/non-exhaustive-pattern-witness.rs:19:5 @@ -95,20 +95,20 @@ LL | CustomRGBA { a: bool, r: u8, g: u8, b: u8 } help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ Color::CustomRGBA { a: false, r: _, g: _, b: _ } => (), -LL + CustomRGBA { a: true, .. } => todo!() +LL + Color::CustomRGBA { a: true, .. } => todo!() | -error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered +error[E0004]: non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered --> $DIR/non-exhaustive-pattern-witness.rs:70:11 | LL | match *x { - | ^^ pattern `[Second(true), Second(false)]` not covered + | ^^ pattern `[Enum::Second(true), Enum::Second(false)]` not covered | = note: the matched value is of type `[Enum]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ [_, _, ref tail @ .., _] => (), -LL + [Second(true), Second(false)] => todo!() +LL + [Enum::Second(true), Enum::Second(false)] => todo!() | error[E0004]: non-exhaustive patterns: `((), false)` not covered diff --git a/src/test/ui/pattern/usefulness/stable-gated-patterns.rs b/src/test/ui/pattern/usefulness/stable-gated-patterns.rs index ff1c472e2..03db01160 100644 --- a/src/test/ui/pattern/usefulness/stable-gated-patterns.rs +++ b/src/test/ui/pattern/usefulness/stable-gated-patterns.rs @@ -8,7 +8,7 @@ fn main() { match UnstableEnum::Stable { UnstableEnum::Stable => {} } - //~^^^ non-exhaustive patterns: `Stable2` and `_` not covered + //~^^^ non-exhaustive patterns: `UnstableEnum::Stable2` and `_` not covered match UnstableEnum::Stable { UnstableEnum::Stable => {} diff --git a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr index 98c75953a..7b8588a3c 100644 --- a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `Stable2` and `_` not covered +error[E0004]: non-exhaustive patterns: `UnstableEnum::Stable2` and `_` not covered --> $DIR/stable-gated-patterns.rs:8:11 | LL | match UnstableEnum::Stable { - | ^^^^^^^^^^^^^^^^^^^^ patterns `Stable2` and `_` not covered + | ^^^^^^^^^^^^^^^^^^^^ patterns `UnstableEnum::Stable2` and `_` not covered | note: `UnstableEnum` defined here --> $DIR/auxiliary/unstable.rs:9:5 @@ -16,7 +16,7 @@ LL | Stable2, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ UnstableEnum::Stable => {} -LL + Stable2 | _ => todo!() +LL + UnstableEnum::Stable2 | _ => todo!() | error[E0004]: non-exhaustive patterns: `_` not covered diff --git a/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index 6127fad3f..85c97be29 100644 --- a/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `B { x: Some(_) }` not covered +error[E0004]: non-exhaustive patterns: `A::B { x: Some(_) }` not covered --> $DIR/struct-like-enum-nonexhaustive.rs:8:11 | LL | match x { - | ^ pattern `B { x: Some(_) }` not covered + | ^ pattern `A::B { x: Some(_) }` not covered | note: `A` defined here --> $DIR/struct-like-enum-nonexhaustive.rs:2:5 @@ -15,7 +15,7 @@ LL | B { x: Option }, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ A::B { x: None } => {} -LL + B { x: Some(_) } => todo!() +LL + A::B { x: Some(_) } => todo!() | error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/top-level-alternation.rs b/src/test/ui/pattern/usefulness/top-level-alternation.rs index 076de8461..e8cd12ea4 100644 --- a/src/test/ui/pattern/usefulness/top-level-alternation.rs +++ b/src/test/ui/pattern/usefulness/top-level-alternation.rs @@ -1,5 +1,3 @@ -#![feature(let_else)] - #![deny(unreachable_patterns)] fn main() { diff --git a/src/test/ui/pattern/usefulness/top-level-alternation.stderr b/src/test/ui/pattern/usefulness/top-level-alternation.stderr index dd5936fdc..17fa951c5 100644 --- a/src/test/ui/pattern/usefulness/top-level-alternation.stderr +++ b/src/test/ui/pattern/usefulness/top-level-alternation.stderr @@ -1,71 +1,71 @@ error: unreachable pattern - --> $DIR/top-level-alternation.rs:6:23 + --> $DIR/top-level-alternation.rs:4:23 | LL | while let 0..=2 | 1 = 0 {} | ^ | note: the lint level is defined here - --> $DIR/top-level-alternation.rs:3:9 + --> $DIR/top-level-alternation.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:7:20 + --> $DIR/top-level-alternation.rs:5:20 | LL | if let 0..=2 | 1 = 0 {} | ^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:11:15 + --> $DIR/top-level-alternation.rs:9:15 | LL | | 0 => {} | ^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:16:15 + --> $DIR/top-level-alternation.rs:14:15 | LL | | Some(0) => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:21:9 + --> $DIR/top-level-alternation.rs:19:9 | LL | (0, 0) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:41:9 + --> $DIR/top-level-alternation.rs:39:9 | LL | _ => {} | ^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:45:9 + --> $DIR/top-level-alternation.rs:43:9 | LL | Some(_) => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:46:9 + --> $DIR/top-level-alternation.rs:44:9 | LL | None => {} | ^^^^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:51:9 + --> $DIR/top-level-alternation.rs:49:9 | LL | None | Some(_) => {} | ^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:55:9 + --> $DIR/top-level-alternation.rs:53:9 | LL | 1..=2 => {}, | ^^^^^ error: unreachable pattern - --> $DIR/top-level-alternation.rs:58:14 + --> $DIR/top-level-alternation.rs:56:14 | LL | let (0 | 0) = 0 else { return }; | ^ diff --git a/src/test/ui/pattern/usefulness/unstable-gated-patterns.rs b/src/test/ui/pattern/usefulness/unstable-gated-patterns.rs index bdab327fd..7046555e0 100644 --- a/src/test/ui/pattern/usefulness/unstable-gated-patterns.rs +++ b/src/test/ui/pattern/usefulness/unstable-gated-patterns.rs @@ -11,7 +11,7 @@ fn main() { UnstableEnum::Stable => {} UnstableEnum::Stable2 => {} } - //~^^^^ non-exhaustive patterns: `Unstable` not covered + //~^^^^ non-exhaustive patterns: `UnstableEnum::Unstable` not covered // Ok: all variants are explicitly matched match UnstableEnum::Stable { diff --git a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr index f07a25ca8..6dc9a4058 100644 --- a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `Unstable` not covered +error[E0004]: non-exhaustive patterns: `UnstableEnum::Unstable` not covered --> $DIR/unstable-gated-patterns.rs:10:11 | LL | match UnstableEnum::Stable { - | ^^^^^^^^^^^^^^^^^^^^ pattern `Unstable` not covered + | ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Unstable` not covered | note: `UnstableEnum` defined here --> $DIR/auxiliary/unstable.rs:11:5 @@ -16,7 +16,7 @@ LL | Unstable, help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ UnstableEnum::Stable2 => {} -LL + Unstable => todo!() +LL + UnstableEnum::Unstable => todo!() | error: aborting due to previous error diff --git a/src/test/ui/phantom-auto-trait.stderr b/src/test/ui/phantom-auto-trait.stderr index 1cc653c51..015c8fa4c 100644 --- a/src/test/ui/phantom-auto-trait.stderr +++ b/src/test/ui/phantom-auto-trait.stderr @@ -6,7 +6,7 @@ LL | is_zen(x) | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Zen` for `&T` +note: required for `&T` to implement `Zen` --> $DIR/phantom-auto-trait.rs:10:24 | LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {} @@ -35,7 +35,7 @@ LL | is_zen(x) | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Zen` for `&T` +note: required for `&T` to implement `Zen` --> $DIR/phantom-auto-trait.rs:10:24 | LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {} diff --git a/src/test/ui/privacy/access_levels.rs b/src/test/ui/privacy/access_levels.rs new file mode 100644 index 000000000..d51d2b572 --- /dev/null +++ b/src/test/ui/privacy/access_levels.rs @@ -0,0 +1,49 @@ +#![feature(rustc_attrs)] + +#[rustc_access_level] mod outer { //~ ERROR None + #[rustc_access_level] pub mod inner { //~ ERROR Some(Exported) + #[rustc_access_level] + extern "C" { //~ ERROR Some(Exported) + #[rustc_access_level] static a: u8; //~ ERROR None + #[rustc_access_level] pub fn b(); //~ ERROR Some(Exported) + } + #[rustc_access_level] + pub trait Trait { //~ ERROR Some(Exported) + #[rustc_access_level] const A: i32; //~ ERROR Some(Exported) + #[rustc_access_level] type B; //~ ERROR Some(Exported) + } + + #[rustc_access_level] + pub struct Struct { //~ ERROR Some(Exported) + #[rustc_access_level] a: u8, //~ ERROR None + #[rustc_access_level] pub b: u8, //~ ERROR Some(Exported) + } + + #[rustc_access_level] + pub union Union { //~ ERROR Some(Exported) + #[rustc_access_level] a: u8, //~ ERROR None + #[rustc_access_level] pub b: u8, //~ ERROR Some(Exported) + } + + #[rustc_access_level] + pub enum Enum { //~ ERROR Some(Exported) + #[rustc_access_level] A( //~ ERROR Some(Exported) + #[rustc_access_level] Struct, //~ ERROR Some(Exported) + #[rustc_access_level] Union, //~ ERROR Some(Exported) + ), + } + } + + #[rustc_access_level] macro_rules! none_macro { //~ ERROR None + () => {}; + } + + #[macro_export] + #[rustc_access_level] macro_rules! public_macro { //~ ERROR Some(Public) + () => {}; + } +} + +pub use outer::inner; + +fn main() {} diff --git a/src/test/ui/privacy/access_levels.stderr b/src/test/ui/privacy/access_levels.stderr new file mode 100644 index 000000000..f326293c3 --- /dev/null +++ b/src/test/ui/privacy/access_levels.stderr @@ -0,0 +1,125 @@ +error: None + --> $DIR/access_levels.rs:3:23 + | +LL | #[rustc_access_level] mod outer { + | ^^^^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:4:27 + | +LL | #[rustc_access_level] pub mod inner { + | ^^^^^^^^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:6:9 + | +LL | / extern "C" { +LL | | #[rustc_access_level] static a: u8; +LL | | #[rustc_access_level] pub fn b(); +LL | | } + | |_________^ + +error: Some(Exported) + --> $DIR/access_levels.rs:11:9 + | +LL | pub trait Trait { + | ^^^^^^^^^^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:17:9 + | +LL | pub struct Struct { + | ^^^^^^^^^^^^^^^^^ + +error: None + --> $DIR/access_levels.rs:18:35 + | +LL | #[rustc_access_level] a: u8, + | ^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:19:35 + | +LL | #[rustc_access_level] pub b: u8, + | ^^^^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:23:9 + | +LL | pub union Union { + | ^^^^^^^^^^^^^^^ + +error: None + --> $DIR/access_levels.rs:24:35 + | +LL | #[rustc_access_level] a: u8, + | ^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:25:35 + | +LL | #[rustc_access_level] pub b: u8, + | ^^^^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:29:9 + | +LL | pub enum Enum { + | ^^^^^^^^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:30:35 + | +LL | #[rustc_access_level] A( + | ^ + +error: Some(Exported) + --> $DIR/access_levels.rs:31:39 + | +LL | #[rustc_access_level] Struct, + | ^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:32:39 + | +LL | #[rustc_access_level] Union, + | ^^^^^ + +error: None + --> $DIR/access_levels.rs:37:27 + | +LL | #[rustc_access_level] macro_rules! none_macro { + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: Some(Public) + --> $DIR/access_levels.rs:42:27 + | +LL | #[rustc_access_level] macro_rules! public_macro { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:12:35 + | +LL | #[rustc_access_level] const A: i32; + | ^^^^^^^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:13:35 + | +LL | #[rustc_access_level] type B; + | ^^^^^^ + +error: None + --> $DIR/access_levels.rs:7:35 + | +LL | #[rustc_access_level] static a: u8; + | ^^^^^^^^^^^^ + +error: Some(Exported) + --> $DIR/access_levels.rs:8:35 + | +LL | #[rustc_access_level] pub fn b(); + | ^^^^^^^^^^ + +error: aborting due to 20 previous errors + diff --git a/src/test/ui/proc-macro/auxiliary/expand-expr.rs b/src/test/ui/proc-macro/auxiliary/expand-expr.rs index 5463e79d7..1d6ef8a13 100644 --- a/src/test/ui/proc-macro/auxiliary/expand-expr.rs +++ b/src/test/ui/proc-macro/auxiliary/expand-expr.rs @@ -80,13 +80,21 @@ fn assert_ts_eq(lhs: &TokenStream, rhs: &TokenStream) { pub fn expand_expr_is(input: TokenStream) -> TokenStream { let mut iter = input.into_iter(); let mut expected_tts = Vec::new(); - loop { + let comma = loop { match iter.next() { - Some(TokenTree::Punct(ref p)) if p.as_char() == ',' => break, + Some(TokenTree::Punct(p)) if p.as_char() == ',' => break p, Some(tt) => expected_tts.push(tt), None => panic!("expected comma"), } - } + }; + + // Make sure that `Ident` and `Literal` objects from this proc-macro's + // environment are not invalidated when `expand_expr` recursively invokes + // another macro by taking a local copy, and checking it after the fact. + let pre_expand_span = comma.span(); + let pre_expand_ident = Ident::new("ident", comma.span()); + let pre_expand_literal = Literal::string("literal"); + let pre_expand_call_site = Span::call_site(); let expected = expected_tts.into_iter().collect::(); let expanded = iter.collect::().expand_expr().expect("expand_expr failed"); @@ -100,6 +108,15 @@ pub fn expand_expr_is(input: TokenStream) -> TokenStream { // Also compare the raw tts to make sure they line up. assert_ts_eq(&expected, &expanded); + assert!(comma.span().eq(&pre_expand_span), "pre-expansion span is still equal"); + assert_eq!(pre_expand_ident.to_string(), "ident", "pre-expansion identifier is still valid"); + assert_eq!( + pre_expand_literal.to_string(), + "\"literal\"", + "pre-expansion literal is still valid" + ); + assert!(Span::call_site().eq(&pre_expand_call_site), "pre-expansion call-site is still equal"); + TokenStream::new() } diff --git a/src/test/ui/proc-macro/auxiliary/re-export.rs b/src/test/ui/proc-macro/auxiliary/re-export.rs new file mode 100644 index 000000000..e8e9c9d3e --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/re-export.rs @@ -0,0 +1,19 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro] +pub fn cause_ice(_: TokenStream) -> TokenStream { + " + enum IceCause { + Variant, + } + + pub use IceCause::Variant; + ".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/crt-static.rs b/src/test/ui/proc-macro/crt-static.rs index 8c1a9dc80..6103acb7b 100644 --- a/src/test/ui/proc-macro/crt-static.rs +++ b/src/test/ui/proc-macro/crt-static.rs @@ -9,7 +9,7 @@ // FIXME: This don't work when crate-type is specified by attribute // `#![crate_type = "proc-macro"]`, not by `--crate-type=proc-macro` -// command line flag. This is beacuse the list of `cfg` symbols is generated +// command line flag. This is because the list of `cfg` symbols is generated // before attributes are parsed. See rustc_interface::util::add_configuration #[cfg(target_feature = "crt-static")] compile_error!("crt-static is enabled"); diff --git a/src/test/ui/proc-macro/dollar-crate-issue-101211.rs b/src/test/ui/proc-macro/dollar-crate-issue-101211.rs new file mode 100644 index 000000000..fc1acfd32 --- /dev/null +++ b/src/test/ui/proc-macro/dollar-crate-issue-101211.rs @@ -0,0 +1,29 @@ +// check-pass +// edition:2021 +// aux-build:test-macros.rs + +#![no_std] // Don't load unnecessary hygiene information from std +extern crate std; + +#[macro_use] +extern crate test_macros; + +macro_rules! foo { + ($($path:ident)::*) => ( + test_macros::recollect!( + $($path)::* + ) + ) +} + +macro_rules! baz { + () => ( + foo!($crate::BAR) + ) +} + +pub const BAR: u32 = 19; + +fn main(){ + std::println!("{}", baz!()); +} diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.rs b/src/test/ui/proc-macro/expand-to-unstable-2.rs deleted file mode 100644 index 4160e5418..000000000 --- a/src/test/ui/proc-macro/expand-to-unstable-2.rs +++ /dev/null @@ -1,17 +0,0 @@ -// aux-build:derive-unstable-2.rs - -#![feature(register_attr)] - -#![register_attr(rustc_foo)] - -#[macro_use] -extern crate derive_unstable_2; - -#[derive(Unstable)] -//~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler - -struct A; - -fn main() { - foo(); -} diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.stderr b/src/test/ui/proc-macro/expand-to-unstable-2.stderr deleted file mode 100644 index 8b16ffb76..000000000 --- a/src/test/ui/proc-macro/expand-to-unstable-2.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: attributes starting with `rustc` are reserved for use by the `rustc` compiler - --> $DIR/expand-to-unstable-2.rs:10:10 - | -LL | #[derive(Unstable)] - | ^^^^^^^^ - | - = note: this error originates in the derive macro `Unstable` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - diff --git a/src/test/ui/proc-macro/inner-attrs.rs b/src/test/ui/proc-macro/inner-attrs.rs index 2e3c704da..1000c9c75 100644 --- a/src/test/ui/proc-macro/inner-attrs.rs +++ b/src/test/ui/proc-macro/inner-attrs.rs @@ -1,3 +1,4 @@ +// gate-test-custom_inner_attributes // compile-flags: -Z span-debug --error-format human // aux-build:test-macros.rs // edition:2018 diff --git a/src/test/ui/proc-macro/inner-attrs.stderr b/src/test/ui/proc-macro/inner-attrs.stderr index 4da8751ef..a332e143a 100644 --- a/src/test/ui/proc-macro/inner-attrs.stderr +++ b/src/test/ui/proc-macro/inner-attrs.stderr @@ -1,23 +1,23 @@ error: expected non-macro inner attribute, found attribute macro `print_attr` - --> $DIR/inner-attrs.rs:63:12 + --> $DIR/inner-attrs.rs:64:12 | LL | #![print_attr] | ^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_attr` - --> $DIR/inner-attrs.rs:67:12 + --> $DIR/inner-attrs.rs:68:12 | LL | #![print_attr] | ^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_attr` - --> $DIR/inner-attrs.rs:71:12 + --> $DIR/inner-attrs.rs:72:12 | LL | #![print_attr] | ^^^^^^^^^^ not a non-macro inner attribute error: expected non-macro inner attribute, found attribute macro `print_attr` - --> $DIR/inner-attrs.rs:75:12 + --> $DIR/inner-attrs.rs:76:12 | LL | #![print_attr] | ^^^^^^^^^^ not a non-macro inner attribute diff --git a/src/test/ui/proc-macro/inner-attrs.stdout b/src/test/ui/proc-macro/inner-attrs.stdout index eaa8882d6..490fc02f5 100644 --- a/src/test/ui/proc-macro/inner-attrs.stdout +++ b/src/test/ui/proc-macro/inner-attrs.stdout @@ -2,7 +2,7 @@ PRINT-ATTR_ARGS INPUT (DISPLAY): first PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "first", - span: $DIR/inner-attrs.rs:16:25: 16:30 (#0), + span: $DIR/inner-attrs.rs:17:25: 17:30 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(second)] fn foo() @@ -11,40 +11,40 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/inner-attrs.rs:17:1: 17:2 (#0), + span: $DIR/inner-attrs.rs:18:1: 18:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:17:3: 17:24 (#0), + span: $DIR/inner-attrs.rs:18:3: 18:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "second", - span: $DIR/inner-attrs.rs:17:25: 17:31 (#0), + span: $DIR/inner-attrs.rs:18:25: 18:31 (#0), }, ], - span: $DIR/inner-attrs.rs:17:24: 17:32 (#0), + span: $DIR/inner-attrs.rs:18:24: 18:32 (#0), }, ], - span: $DIR/inner-attrs.rs:17:2: 17:33 (#0), + span: $DIR/inner-attrs.rs:18:2: 18:33 (#0), }, Ident { ident: "fn", - span: $DIR/inner-attrs.rs:18:1: 18:3 (#0), + span: $DIR/inner-attrs.rs:19:1: 19:3 (#0), }, Ident { ident: "foo", - span: $DIR/inner-attrs.rs:18:4: 18:7 (#0), + span: $DIR/inner-attrs.rs:19:4: 19:7 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:18:7: 18:9 (#0), + span: $DIR/inner-attrs.rs:19:7: 19:9 (#0), }, Group { delimiter: Brace, @@ -52,72 +52,72 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:19:5: 19:6 (#0), + span: $DIR/inner-attrs.rs:20:5: 20:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:19:6: 19:7 (#0), + span: $DIR/inner-attrs.rs:20:6: 20:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:19:8: 19:29 (#0), + span: $DIR/inner-attrs.rs:20:8: 20:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "third", - span: $DIR/inner-attrs.rs:19:30: 19:35 (#0), + span: $DIR/inner-attrs.rs:20:30: 20:35 (#0), }, ], - span: $DIR/inner-attrs.rs:19:29: 19:36 (#0), + span: $DIR/inner-attrs.rs:20:29: 20:36 (#0), }, ], - span: $DIR/inner-attrs.rs:19:7: 19:37 (#0), + span: $DIR/inner-attrs.rs:20:7: 20:37 (#0), }, Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:20:5: 20:6 (#0), + span: $DIR/inner-attrs.rs:21:5: 21:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:20:6: 20:7 (#0), + span: $DIR/inner-attrs.rs:21:6: 21:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:20:8: 20:29 (#0), + span: $DIR/inner-attrs.rs:21:8: 21:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "fourth", - span: $DIR/inner-attrs.rs:20:30: 20:36 (#0), + span: $DIR/inner-attrs.rs:21:30: 21:36 (#0), }, ], - span: $DIR/inner-attrs.rs:20:29: 20:37 (#0), + span: $DIR/inner-attrs.rs:21:29: 21:37 (#0), }, ], - span: $DIR/inner-attrs.rs:20:7: 20:38 (#0), + span: $DIR/inner-attrs.rs:21:7: 21:38 (#0), }, ], - span: $DIR/inner-attrs.rs:18:10: 21:2 (#0), + span: $DIR/inner-attrs.rs:19:10: 22:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): second PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "second", - span: $DIR/inner-attrs.rs:17:25: 17:31 (#0), + span: $DIR/inner-attrs.rs:18:25: 18:31 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): fn foo() @@ -125,16 +125,16 @@ PRINT-ATTR INPUT (DISPLAY): fn foo() PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", - span: $DIR/inner-attrs.rs:18:1: 18:3 (#0), + span: $DIR/inner-attrs.rs:19:1: 19:3 (#0), }, Ident { ident: "foo", - span: $DIR/inner-attrs.rs:18:4: 18:7 (#0), + span: $DIR/inner-attrs.rs:19:4: 19:7 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:18:7: 18:9 (#0), + span: $DIR/inner-attrs.rs:19:7: 19:9 (#0), }, Group { delimiter: Brace, @@ -142,88 +142,88 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:19:5: 19:6 (#0), + span: $DIR/inner-attrs.rs:20:5: 20:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:19:6: 19:7 (#0), + span: $DIR/inner-attrs.rs:20:6: 20:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:19:8: 19:29 (#0), + span: $DIR/inner-attrs.rs:20:8: 20:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "third", - span: $DIR/inner-attrs.rs:19:30: 19:35 (#0), + span: $DIR/inner-attrs.rs:20:30: 20:35 (#0), }, ], - span: $DIR/inner-attrs.rs:19:29: 19:36 (#0), + span: $DIR/inner-attrs.rs:20:29: 20:36 (#0), }, ], - span: $DIR/inner-attrs.rs:19:7: 19:37 (#0), + span: $DIR/inner-attrs.rs:20:7: 20:37 (#0), }, Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:20:5: 20:6 (#0), + span: $DIR/inner-attrs.rs:21:5: 21:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:20:6: 20:7 (#0), + span: $DIR/inner-attrs.rs:21:6: 21:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:20:8: 20:29 (#0), + span: $DIR/inner-attrs.rs:21:8: 21:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "fourth", - span: $DIR/inner-attrs.rs:20:30: 20:36 (#0), + span: $DIR/inner-attrs.rs:21:30: 21:36 (#0), }, ], - span: $DIR/inner-attrs.rs:20:29: 20:37 (#0), + span: $DIR/inner-attrs.rs:21:29: 21:37 (#0), }, ], - span: $DIR/inner-attrs.rs:20:7: 20:38 (#0), + span: $DIR/inner-attrs.rs:21:7: 21:38 (#0), }, ], - span: $DIR/inner-attrs.rs:18:10: 21:2 (#0), + span: $DIR/inner-attrs.rs:19:10: 22:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): third PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "third", - span: $DIR/inner-attrs.rs:19:30: 19:35 (#0), + span: $DIR/inner-attrs.rs:20:30: 20:35 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): fn foo() { #! [print_target_and_args(fourth)] } PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", - span: $DIR/inner-attrs.rs:18:1: 18:3 (#0), + span: $DIR/inner-attrs.rs:19:1: 19:3 (#0), }, Ident { ident: "foo", - span: $DIR/inner-attrs.rs:18:4: 18:7 (#0), + span: $DIR/inner-attrs.rs:19:4: 19:7 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:18:7: 18:9 (#0), + span: $DIR/inner-attrs.rs:19:7: 19:9 (#0), }, Group { delimiter: Brace, @@ -231,70 +231,70 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:20:5: 20:6 (#0), + span: $DIR/inner-attrs.rs:21:5: 21:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:20:6: 20:7 (#0), + span: $DIR/inner-attrs.rs:21:6: 21:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:20:8: 20:29 (#0), + span: $DIR/inner-attrs.rs:21:8: 21:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "fourth", - span: $DIR/inner-attrs.rs:20:30: 20:36 (#0), + span: $DIR/inner-attrs.rs:21:30: 21:36 (#0), }, ], - span: $DIR/inner-attrs.rs:20:29: 20:37 (#0), + span: $DIR/inner-attrs.rs:21:29: 21:37 (#0), }, ], - span: $DIR/inner-attrs.rs:20:7: 20:38 (#0), + span: $DIR/inner-attrs.rs:21:7: 21:38 (#0), }, ], - span: $DIR/inner-attrs.rs:18:10: 21:2 (#0), + span: $DIR/inner-attrs.rs:19:10: 22:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): fourth PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "fourth", - span: $DIR/inner-attrs.rs:20:30: 20:36 (#0), + span: $DIR/inner-attrs.rs:21:30: 21:36 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): fn foo() {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", - span: $DIR/inner-attrs.rs:18:1: 18:3 (#0), + span: $DIR/inner-attrs.rs:19:1: 19:3 (#0), }, Ident { ident: "foo", - span: $DIR/inner-attrs.rs:18:4: 18:7 (#0), + span: $DIR/inner-attrs.rs:19:4: 19:7 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:18:7: 18:9 (#0), + span: $DIR/inner-attrs.rs:19:7: 19:9 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/inner-attrs.rs:18:10: 21:2 (#0), + span: $DIR/inner-attrs.rs:19:10: 22:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): mod_first PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "mod_first", - span: $DIR/inner-attrs.rs:23:25: 23:34 (#0), + span: $DIR/inner-attrs.rs:24:25: 24:34 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): #[print_target_and_args(mod_second)] mod inline_mod @@ -306,35 +306,35 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/inner-attrs.rs:24:1: 24:2 (#0), + span: $DIR/inner-attrs.rs:25:1: 25:2 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:24:3: 24:24 (#0), + span: $DIR/inner-attrs.rs:25:3: 25:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_second", - span: $DIR/inner-attrs.rs:24:25: 24:35 (#0), + span: $DIR/inner-attrs.rs:25:25: 25:35 (#0), }, ], - span: $DIR/inner-attrs.rs:24:24: 24:36 (#0), + span: $DIR/inner-attrs.rs:25:24: 25:36 (#0), }, ], - span: $DIR/inner-attrs.rs:24:2: 24:37 (#0), + span: $DIR/inner-attrs.rs:25:2: 25:37 (#0), }, Ident { ident: "mod", - span: $DIR/inner-attrs.rs:25:1: 25:4 (#0), + span: $DIR/inner-attrs.rs:26:1: 26:4 (#0), }, Ident { ident: "inline_mod", - span: $DIR/inner-attrs.rs:25:5: 25:15 (#0), + span: $DIR/inner-attrs.rs:26:5: 26:15 (#0), }, Group { delimiter: Brace, @@ -342,72 +342,72 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:26:5: 26:6 (#0), + span: $DIR/inner-attrs.rs:27:5: 27:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:26:6: 26:7 (#0), + span: $DIR/inner-attrs.rs:27:6: 27:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:26:8: 26:29 (#0), + span: $DIR/inner-attrs.rs:27:8: 27:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_third", - span: $DIR/inner-attrs.rs:26:30: 26:39 (#0), + span: $DIR/inner-attrs.rs:27:30: 27:39 (#0), }, ], - span: $DIR/inner-attrs.rs:26:29: 26:40 (#0), + span: $DIR/inner-attrs.rs:27:29: 27:40 (#0), }, ], - span: $DIR/inner-attrs.rs:26:7: 26:41 (#0), + span: $DIR/inner-attrs.rs:27:7: 27:41 (#0), }, Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:27:5: 27:6 (#0), + span: $DIR/inner-attrs.rs:28:5: 28:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:27:6: 27:7 (#0), + span: $DIR/inner-attrs.rs:28:6: 28:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:27:8: 27:29 (#0), + span: $DIR/inner-attrs.rs:28:8: 28:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_fourth", - span: $DIR/inner-attrs.rs:27:30: 27:40 (#0), + span: $DIR/inner-attrs.rs:28:30: 28:40 (#0), }, ], - span: $DIR/inner-attrs.rs:27:29: 27:41 (#0), + span: $DIR/inner-attrs.rs:28:29: 28:41 (#0), }, ], - span: $DIR/inner-attrs.rs:27:7: 27:42 (#0), + span: $DIR/inner-attrs.rs:28:7: 28:42 (#0), }, ], - span: $DIR/inner-attrs.rs:25:16: 28:2 (#0), + span: $DIR/inner-attrs.rs:26:16: 29:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): mod_second PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "mod_second", - span: $DIR/inner-attrs.rs:24:25: 24:35 (#0), + span: $DIR/inner-attrs.rs:25:25: 25:35 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): mod inline_mod @@ -418,11 +418,11 @@ PRINT-ATTR INPUT (DISPLAY): mod inline_mod PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "mod", - span: $DIR/inner-attrs.rs:25:1: 25:4 (#0), + span: $DIR/inner-attrs.rs:26:1: 26:4 (#0), }, Ident { ident: "inline_mod", - span: $DIR/inner-attrs.rs:25:5: 25:15 (#0), + span: $DIR/inner-attrs.rs:26:5: 26:15 (#0), }, Group { delimiter: Brace, @@ -430,83 +430,83 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:26:5: 26:6 (#0), + span: $DIR/inner-attrs.rs:27:5: 27:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:26:6: 26:7 (#0), + span: $DIR/inner-attrs.rs:27:6: 27:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:26:8: 26:29 (#0), + span: $DIR/inner-attrs.rs:27:8: 27:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_third", - span: $DIR/inner-attrs.rs:26:30: 26:39 (#0), + span: $DIR/inner-attrs.rs:27:30: 27:39 (#0), }, ], - span: $DIR/inner-attrs.rs:26:29: 26:40 (#0), + span: $DIR/inner-attrs.rs:27:29: 27:40 (#0), }, ], - span: $DIR/inner-attrs.rs:26:7: 26:41 (#0), + span: $DIR/inner-attrs.rs:27:7: 27:41 (#0), }, Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:27:5: 27:6 (#0), + span: $DIR/inner-attrs.rs:28:5: 28:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:27:6: 27:7 (#0), + span: $DIR/inner-attrs.rs:28:6: 28:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:27:8: 27:29 (#0), + span: $DIR/inner-attrs.rs:28:8: 28:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_fourth", - span: $DIR/inner-attrs.rs:27:30: 27:40 (#0), + span: $DIR/inner-attrs.rs:28:30: 28:40 (#0), }, ], - span: $DIR/inner-attrs.rs:27:29: 27:41 (#0), + span: $DIR/inner-attrs.rs:28:29: 28:41 (#0), }, ], - span: $DIR/inner-attrs.rs:27:7: 27:42 (#0), + span: $DIR/inner-attrs.rs:28:7: 28:42 (#0), }, ], - span: $DIR/inner-attrs.rs:25:16: 28:2 (#0), + span: $DIR/inner-attrs.rs:26:16: 29:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): mod_third PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "mod_third", - span: $DIR/inner-attrs.rs:26:30: 26:39 (#0), + span: $DIR/inner-attrs.rs:27:30: 27:39 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): mod inline_mod { #! [print_target_and_args(mod_fourth)] } PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "mod", - span: $DIR/inner-attrs.rs:25:1: 25:4 (#0), + span: $DIR/inner-attrs.rs:26:1: 26:4 (#0), }, Ident { ident: "inline_mod", - span: $DIR/inner-attrs.rs:25:5: 25:15 (#0), + span: $DIR/inner-attrs.rs:26:5: 26:15 (#0), }, Group { delimiter: Brace, @@ -514,58 +514,58 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:27:5: 27:6 (#0), + span: $DIR/inner-attrs.rs:28:5: 28:6 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:27:6: 27:7 (#0), + span: $DIR/inner-attrs.rs:28:6: 28:7 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "print_target_and_args", - span: $DIR/inner-attrs.rs:27:8: 27:29 (#0), + span: $DIR/inner-attrs.rs:28:8: 28:29 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "mod_fourth", - span: $DIR/inner-attrs.rs:27:30: 27:40 (#0), + span: $DIR/inner-attrs.rs:28:30: 28:40 (#0), }, ], - span: $DIR/inner-attrs.rs:27:29: 27:41 (#0), + span: $DIR/inner-attrs.rs:28:29: 28:41 (#0), }, ], - span: $DIR/inner-attrs.rs:27:7: 27:42 (#0), + span: $DIR/inner-attrs.rs:28:7: 28:42 (#0), }, ], - span: $DIR/inner-attrs.rs:25:16: 28:2 (#0), + span: $DIR/inner-attrs.rs:26:16: 29:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): mod_fourth PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "mod_fourth", - span: $DIR/inner-attrs.rs:27:30: 27:40 (#0), + span: $DIR/inner-attrs.rs:28:30: 28:40 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): mod inline_mod {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "mod", - span: $DIR/inner-attrs.rs:25:1: 25:4 (#0), + span: $DIR/inner-attrs.rs:26:1: 26:4 (#0), }, Ident { ident: "inline_mod", - span: $DIR/inner-attrs.rs:25:5: 25:15 (#0), + span: $DIR/inner-attrs.rs:26:5: 26:15 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/inner-attrs.rs:25:16: 28:2 (#0), + span: $DIR/inner-attrs.rs:26:16: 29:2 (#0), }, ] PRINT-DERIVE INPUT (DISPLAY): struct MyDerivePrint @@ -576,63 +576,63 @@ PRINT-DERIVE INPUT (DISPLAY): struct MyDerivePrint PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "struct", - span: $DIR/inner-attrs.rs:35:1: 35:7 (#0), + span: $DIR/inner-attrs.rs:36:1: 36:7 (#0), }, Ident { ident: "MyDerivePrint", - span: $DIR/inner-attrs.rs:35:8: 35:21 (#0), + span: $DIR/inner-attrs.rs:36:8: 36:21 (#0), }, Group { delimiter: Brace, stream: TokenStream [ Ident { ident: "field", - span: $DIR/inner-attrs.rs:36:5: 36:10 (#0), + span: $DIR/inner-attrs.rs:37:5: 37:10 (#0), }, Punct { ch: ':', spacing: Alone, - span: $DIR/inner-attrs.rs:36:10: 36:11 (#0), + span: $DIR/inner-attrs.rs:37:10: 37:11 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "u8", - span: $DIR/inner-attrs.rs:36:13: 36:15 (#0), + span: $DIR/inner-attrs.rs:37:13: 37:15 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:36:15: 36:16 (#0), + span: $DIR/inner-attrs.rs:37:15: 37:16 (#0), }, Group { delimiter: Brace, stream: TokenStream [ Ident { ident: "match", - span: $DIR/inner-attrs.rs:37:9: 37:14 (#0), + span: $DIR/inner-attrs.rs:38:9: 38:14 (#0), }, Ident { ident: "true", - span: $DIR/inner-attrs.rs:37:15: 37:19 (#0), + span: $DIR/inner-attrs.rs:38:15: 38:19 (#0), }, Group { delimiter: Brace, stream: TokenStream [ Ident { ident: "_", - span: $DIR/inner-attrs.rs:38:13: 38:14 (#0), + span: $DIR/inner-attrs.rs:39:13: 39:14 (#0), }, Punct { ch: '=', spacing: Joint, - span: $DIR/inner-attrs.rs:38:15: 38:17 (#0), + span: $DIR/inner-attrs.rs:39:15: 39:17 (#0), }, Punct { ch: '>', spacing: Alone, - span: $DIR/inner-attrs.rs:38:15: 38:17 (#0), + span: $DIR/inner-attrs.rs:39:15: 39:17 (#0), }, Group { delimiter: Brace, @@ -640,69 +640,69 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Alone, - span: $DIR/inner-attrs.rs:39:17: 39:18 (#0), + span: $DIR/inner-attrs.rs:40:17: 40:18 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:39:18: 39:19 (#0), + span: $DIR/inner-attrs.rs:40:18: 40:19 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "rustc_dummy", - span: $DIR/inner-attrs.rs:39:41: 39:52 (#0), + span: $DIR/inner-attrs.rs:40:41: 40:52 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "third", - span: $DIR/inner-attrs.rs:39:53: 39:58 (#0), + span: $DIR/inner-attrs.rs:40:53: 40:58 (#0), }, ], - span: $DIR/inner-attrs.rs:39:52: 39:59 (#0), + span: $DIR/inner-attrs.rs:40:52: 40:59 (#0), }, ], - span: $DIR/inner-attrs.rs:39:17: 39:18 (#0), + span: $DIR/inner-attrs.rs:40:17: 40:18 (#0), }, Ident { ident: "true", - span: $DIR/inner-attrs.rs:40:17: 40:21 (#0), + span: $DIR/inner-attrs.rs:41:17: 41:21 (#0), }, ], - span: $DIR/inner-attrs.rs:38:18: 41:14 (#0), + span: $DIR/inner-attrs.rs:39:18: 42:14 (#0), }, ], - span: $DIR/inner-attrs.rs:37:20: 42:10 (#0), + span: $DIR/inner-attrs.rs:38:20: 43:10 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:42:10: 42:11 (#0), + span: $DIR/inner-attrs.rs:43:10: 43:11 (#0), }, Literal { kind: Integer, symbol: "0", suffix: None, - span: $DIR/inner-attrs.rs:43:9: 43:10 (#0), + span: $DIR/inner-attrs.rs:44:9: 44:10 (#0), }, ], - span: $DIR/inner-attrs.rs:36:17: 44:6 (#0), + span: $DIR/inner-attrs.rs:37:17: 45:6 (#0), }, ], - span: $DIR/inner-attrs.rs:36:12: 44:7 (#0), + span: $DIR/inner-attrs.rs:37:12: 45:7 (#0), }, ], - span: $DIR/inner-attrs.rs:35:22: 45:2 (#0), + span: $DIR/inner-attrs.rs:36:22: 46:2 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): tuple_attrs PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "tuple_attrs", - span: $DIR/inner-attrs.rs:48:29: 48:40 (#0), + span: $DIR/inner-attrs.rs:49:29: 49:40 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): (3, 4, { #! [cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 }) ; @@ -714,23 +714,23 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ kind: Integer, symbol: "3", suffix: None, - span: $DIR/inner-attrs.rs:49:9: 49:10 (#0), + span: $DIR/inner-attrs.rs:50:9: 50:10 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:49:10: 49:11 (#0), + span: $DIR/inner-attrs.rs:50:10: 50:11 (#0), }, Literal { kind: Integer, symbol: "4", suffix: None, - span: $DIR/inner-attrs.rs:49:12: 49:13 (#0), + span: $DIR/inner-attrs.rs:50:12: 50:13 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:49:13: 49:14 (#0), + span: $DIR/inner-attrs.rs:50:13: 50:14 (#0), }, Group { delimiter: Brace, @@ -738,85 +738,85 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:50:13: 50:14 (#0), + span: $DIR/inner-attrs.rs:51:13: 51:14 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:50:14: 50:15 (#0), + span: $DIR/inner-attrs.rs:51:14: 51:15 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg_attr", - span: $DIR/inner-attrs.rs:50:16: 50:24 (#0), + span: $DIR/inner-attrs.rs:51:16: 51:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/inner-attrs.rs:50:25: 50:28 (#0), + span: $DIR/inner-attrs.rs:51:25: 51:28 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/inner-attrs.rs:50:29: 50:34 (#0), + span: $DIR/inner-attrs.rs:51:29: 51:34 (#0), }, ], - span: $DIR/inner-attrs.rs:50:28: 50:35 (#0), + span: $DIR/inner-attrs.rs:51:28: 51:35 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:50:35: 50:36 (#0), + span: $DIR/inner-attrs.rs:51:35: 51:36 (#0), }, Ident { ident: "rustc_dummy", - span: $DIR/inner-attrs.rs:50:37: 50:48 (#0), + span: $DIR/inner-attrs.rs:51:37: 51:48 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "innermost", - span: $DIR/inner-attrs.rs:50:49: 50:58 (#0), + span: $DIR/inner-attrs.rs:51:49: 51:58 (#0), }, ], - span: $DIR/inner-attrs.rs:50:48: 50:59 (#0), + span: $DIR/inner-attrs.rs:51:48: 51:59 (#0), }, ], - span: $DIR/inner-attrs.rs:50:24: 50:60 (#0), + span: $DIR/inner-attrs.rs:51:24: 51:60 (#0), }, ], - span: $DIR/inner-attrs.rs:50:15: 50:61 (#0), + span: $DIR/inner-attrs.rs:51:15: 51:61 (#0), }, Literal { kind: Integer, symbol: "5", suffix: None, - span: $DIR/inner-attrs.rs:51:13: 51:14 (#0), + span: $DIR/inner-attrs.rs:52:13: 52:14 (#0), }, ], - span: $DIR/inner-attrs.rs:49:15: 52:10 (#0), + span: $DIR/inner-attrs.rs:50:15: 53:10 (#0), }, ], - span: $DIR/inner-attrs.rs:48:43: 53:6 (#0), + span: $DIR/inner-attrs.rs:49:43: 54:6 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:53:6: 53:7 (#0), + span: $DIR/inner-attrs.rs:54:6: 54:7 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): tuple_attrs PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "tuple_attrs", - span: $DIR/inner-attrs.rs:55:29: 55:40 (#0), + span: $DIR/inner-attrs.rs:56:29: 56:40 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): (3, 4, { #! [cfg_attr(not(FALSE), rustc_dummy(innermost))] 5 }) ; @@ -828,23 +828,23 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ kind: Integer, symbol: "3", suffix: None, - span: $DIR/inner-attrs.rs:56:9: 56:10 (#0), + span: $DIR/inner-attrs.rs:57:9: 57:10 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:56:10: 56:11 (#0), + span: $DIR/inner-attrs.rs:57:10: 57:11 (#0), }, Literal { kind: Integer, symbol: "4", suffix: None, - span: $DIR/inner-attrs.rs:56:12: 56:13 (#0), + span: $DIR/inner-attrs.rs:57:12: 57:13 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:56:13: 56:14 (#0), + span: $DIR/inner-attrs.rs:57:13: 57:14 (#0), }, Group { delimiter: Brace, @@ -852,105 +852,105 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', spacing: Joint, - span: $DIR/inner-attrs.rs:57:13: 57:14 (#0), + span: $DIR/inner-attrs.rs:58:13: 58:14 (#0), }, Punct { ch: '!', spacing: Alone, - span: $DIR/inner-attrs.rs:57:14: 57:15 (#0), + span: $DIR/inner-attrs.rs:58:14: 58:15 (#0), }, Group { delimiter: Bracket, stream: TokenStream [ Ident { ident: "cfg_attr", - span: $DIR/inner-attrs.rs:57:16: 57:24 (#0), + span: $DIR/inner-attrs.rs:58:16: 58:24 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "not", - span: $DIR/inner-attrs.rs:57:25: 57:28 (#0), + span: $DIR/inner-attrs.rs:58:25: 58:28 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "FALSE", - span: $DIR/inner-attrs.rs:57:29: 57:34 (#0), + span: $DIR/inner-attrs.rs:58:29: 58:34 (#0), }, ], - span: $DIR/inner-attrs.rs:57:28: 57:35 (#0), + span: $DIR/inner-attrs.rs:58:28: 58:35 (#0), }, Punct { ch: ',', spacing: Alone, - span: $DIR/inner-attrs.rs:57:35: 57:36 (#0), + span: $DIR/inner-attrs.rs:58:35: 58:36 (#0), }, Ident { ident: "rustc_dummy", - span: $DIR/inner-attrs.rs:57:37: 57:48 (#0), + span: $DIR/inner-attrs.rs:58:37: 58:48 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [ Ident { ident: "innermost", - span: $DIR/inner-attrs.rs:57:49: 57:58 (#0), + span: $DIR/inner-attrs.rs:58:49: 58:58 (#0), }, ], - span: $DIR/inner-attrs.rs:57:48: 57:59 (#0), + span: $DIR/inner-attrs.rs:58:48: 58:59 (#0), }, ], - span: $DIR/inner-attrs.rs:57:24: 57:60 (#0), + span: $DIR/inner-attrs.rs:58:24: 58:60 (#0), }, ], - span: $DIR/inner-attrs.rs:57:15: 57:61 (#0), + span: $DIR/inner-attrs.rs:58:15: 58:61 (#0), }, Literal { kind: Integer, symbol: "5", suffix: None, - span: $DIR/inner-attrs.rs:58:13: 58:14 (#0), + span: $DIR/inner-attrs.rs:59:13: 59:14 (#0), }, ], - span: $DIR/inner-attrs.rs:56:15: 59:10 (#0), + span: $DIR/inner-attrs.rs:57:15: 60:10 (#0), }, ], - span: $DIR/inner-attrs.rs:55:43: 60:6 (#0), + span: $DIR/inner-attrs.rs:56:43: 61:6 (#0), }, Punct { ch: ';', spacing: Alone, - span: $DIR/inner-attrs.rs:60:6: 60:7 (#0), + span: $DIR/inner-attrs.rs:61:6: 61:7 (#0), }, ] PRINT-ATTR_ARGS INPUT (DISPLAY): tenth PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ Ident { ident: "tenth", - span: $DIR/inner-attrs.rs:82:42: 82:47 (#0), + span: $DIR/inner-attrs.rs:83:42: 83:47 (#0), }, ] PRINT-ATTR INPUT (DISPLAY): fn weird_extern() {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", - span: $DIR/inner-attrs.rs:81:5: 81:7 (#0), + span: $DIR/inner-attrs.rs:82:5: 82:7 (#0), }, Ident { ident: "weird_extern", - span: $DIR/inner-attrs.rs:81:8: 81:20 (#0), + span: $DIR/inner-attrs.rs:82:8: 82:20 (#0), }, Group { delimiter: Parenthesis, stream: TokenStream [], - span: $DIR/inner-attrs.rs:81:20: 81:22 (#0), + span: $DIR/inner-attrs.rs:82:20: 82:22 (#0), }, Group { delimiter: Brace, stream: TokenStream [], - span: $DIR/inner-attrs.rs:81:23: 83:6 (#0), + span: $DIR/inner-attrs.rs:82:23: 84:6 (#0), }, ] diff --git a/src/test/ui/proc-macro/invalid-punct-ident-1.rs b/src/test/ui/proc-macro/invalid-punct-ident-1.rs index 814cd77cf..9a1802737 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-1.rs +++ b/src/test/ui/proc-macro/invalid-punct-ident-1.rs @@ -1,4 +1,5 @@ // aux-build:invalid-punct-ident.rs +// needs-unwind proc macro panics to report errors #[macro_use] extern crate invalid_punct_ident; diff --git a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr index 7babe685b..78aa84401 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr @@ -1,5 +1,5 @@ error: proc macro panicked - --> $DIR/invalid-punct-ident-1.rs:6:1 + --> $DIR/invalid-punct-ident-1.rs:7:1 | LL | invalid_punct!(); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/invalid-punct-ident-2.rs b/src/test/ui/proc-macro/invalid-punct-ident-2.rs index a04dec707..afb6985e4 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-2.rs +++ b/src/test/ui/proc-macro/invalid-punct-ident-2.rs @@ -1,4 +1,5 @@ // aux-build:invalid-punct-ident.rs +// needs-unwind proc macro panics to report errors #[macro_use] extern crate invalid_punct_ident; diff --git a/src/test/ui/proc-macro/invalid-punct-ident-2.stderr b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr index 01b80768c..66979e756 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-2.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr @@ -1,5 +1,5 @@ error: proc macro panicked - --> $DIR/invalid-punct-ident-2.rs:6:1 + --> $DIR/invalid-punct-ident-2.rs:7:1 | LL | invalid_ident!(); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/invalid-punct-ident-3.rs b/src/test/ui/proc-macro/invalid-punct-ident-3.rs index f0e953608..ff83695c5 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-3.rs +++ b/src/test/ui/proc-macro/invalid-punct-ident-3.rs @@ -1,4 +1,5 @@ // aux-build:invalid-punct-ident.rs +// needs-unwind proc macro panics to report errors #[macro_use] extern crate invalid_punct_ident; diff --git a/src/test/ui/proc-macro/invalid-punct-ident-3.stderr b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr index 899c38158..c096bc8c0 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-3.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr @@ -1,5 +1,5 @@ error: proc macro panicked - --> $DIR/invalid-punct-ident-3.rs:6:1 + --> $DIR/invalid-punct-ident-3.rs:7:1 | LL | invalid_raw_ident!(); | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/invalid-punct-ident-4.rs b/src/test/ui/proc-macro/invalid-punct-ident-4.rs index 59b347dac..2d2774bd1 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-4.rs +++ b/src/test/ui/proc-macro/invalid-punct-ident-4.rs @@ -1,4 +1,5 @@ // aux-build:invalid-punct-ident.rs +// needs-unwind proc macro panics to report errors #[macro_use] extern crate invalid_punct_ident; diff --git a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr index deb93b893..ab4116141 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr @@ -1,5 +1,5 @@ error: unexpected closing delimiter: `)` - --> $DIR/invalid-punct-ident-4.rs:6:1 + --> $DIR/invalid-punct-ident-4.rs:7:1 | LL | lexer_failure!(); | ^^^^^^^^^^^^^^^^ unexpected closing delimiter @@ -7,13 +7,13 @@ LL | lexer_failure!(); = note: this error originates in the macro `lexer_failure` (in Nightly builds, run with -Z macro-backtrace for more info) error: proc macro panicked - --> $DIR/invalid-punct-ident-4.rs:6:1 + --> $DIR/invalid-punct-ident-4.rs:7:1 | LL | lexer_failure!(); | ^^^^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/invalid-punct-ident-4.rs:11:33 + --> $DIR/invalid-punct-ident-4.rs:12:33 | LL | let _recovery_witness: () = 0; | -- ^ expected `()`, found integer diff --git a/src/test/ui/proc-macro/issue-36935.rs b/src/test/ui/proc-macro/issue-36935.rs index 5c43a564c..03cdfa05e 100644 --- a/src/test/ui/proc-macro/issue-36935.rs +++ b/src/test/ui/proc-macro/issue-36935.rs @@ -1,4 +1,5 @@ // aux-build:test-macros.rs +// needs-unwind proc macro panics to report errors #[macro_use] extern crate test_macros; diff --git a/src/test/ui/proc-macro/issue-36935.stderr b/src/test/ui/proc-macro/issue-36935.stderr index 079e134c6..122903798 100644 --- a/src/test/ui/proc-macro/issue-36935.stderr +++ b/src/test/ui/proc-macro/issue-36935.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Baz` is defined multiple times - --> $DIR/issue-36935.rs:7:1 + --> $DIR/issue-36935.rs:8:1 | LL | struct Baz { | ^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | struct Baz { = note: `Baz` must be defined only once in the type namespace of this module error: proc-macro derive panicked - --> $DIR/issue-36935.rs:6:20 + --> $DIR/issue-36935.rs:7:20 | LL | #[derive(Identity, Panic)] | ^^^^^ diff --git a/src/test/ui/proc-macro/issue-41211.rs b/src/test/ui/proc-macro/issue-41211.rs deleted file mode 100644 index 072a63baf..000000000 --- a/src/test/ui/proc-macro/issue-41211.rs +++ /dev/null @@ -1,16 +0,0 @@ -// aux-build:test-macros.rs - -// FIXME: https://github.com/rust-lang/rust/issues/41430 -// This is a temporary regression test for the ICE reported in #41211 - -#![feature(custom_inner_attributes)] -#![feature(register_attr)] - -#![register_attr(identity_attr)] - -#![identity_attr] -//~^ ERROR `identity_attr` is ambiguous -extern crate test_macros; -use test_macros::identity_attr; - -fn main() {} diff --git a/src/test/ui/proc-macro/issue-41211.stderr b/src/test/ui/proc-macro/issue-41211.stderr deleted file mode 100644 index 60cd36a9c..000000000 --- a/src/test/ui/proc-macro/issue-41211.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0659]: `identity_attr` is ambiguous - --> $DIR/issue-41211.rs:11:4 - | -LL | #![identity_attr] - | ^^^^^^^^^^^^^ ambiguous name - | - = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution -note: `identity_attr` could refer to the attribute macro imported here - --> $DIR/issue-41211.rs:14:5 - | -LL | use test_macros::identity_attr; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `crate::identity_attr` to refer to this attribute macro unambiguously -note: `identity_attr` could also refer to the explicitly registered attribute defined here - --> $DIR/issue-41211.rs:9:18 - | -LL | #![register_attr(identity_attr)] - | ^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/proc-macro/issue-76270-panic-in-libproc-macro.rs b/src/test/ui/proc-macro/issue-76270-panic-in-libproc-macro.rs index 98fa06b6e..5aefec3ec 100644 --- a/src/test/ui/proc-macro/issue-76270-panic-in-libproc-macro.rs +++ b/src/test/ui/proc-macro/issue-76270-panic-in-libproc-macro.rs @@ -1,5 +1,6 @@ // aux-build:proc-macro-panic.rs // edition:2018 +// needs-unwind proc macro panics to report errors // Regression test for issue #76270 // Tests that we don't print an ICE message when a panic diff --git a/src/test/ui/proc-macro/issue-76270-panic-in-libproc-macro.stderr b/src/test/ui/proc-macro/issue-76270-panic-in-libproc-macro.stderr index 1dc0f16bf..d69de23a4 100644 --- a/src/test/ui/proc-macro/issue-76270-panic-in-libproc-macro.stderr +++ b/src/test/ui/proc-macro/issue-76270-panic-in-libproc-macro.stderr @@ -1,5 +1,5 @@ error: proc macro panicked - --> $DIR/issue-76270-panic-in-libproc-macro.rs:10:1 + --> $DIR/issue-76270-panic-in-libproc-macro.rs:11:1 | LL | proc_macro_panic::panic_in_libproc_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/issue-79148.rs b/src/test/ui/proc-macro/issue-79148.rs new file mode 100644 index 000000000..3f01187a8 --- /dev/null +++ b/src/test/ui/proc-macro/issue-79148.rs @@ -0,0 +1,10 @@ +// aux-build:re-export.rs +// edition:2018 + +extern crate re_export; + +use re_export::cause_ice; + +cause_ice!(); //~ ERROR `Variant` is only public within the crate, and cannot be re-exported outside + +fn main() {} diff --git a/src/test/ui/proc-macro/issue-79148.stderr b/src/test/ui/proc-macro/issue-79148.stderr new file mode 100644 index 000000000..a3b2de01d --- /dev/null +++ b/src/test/ui/proc-macro/issue-79148.stderr @@ -0,0 +1,16 @@ +error[E0364]: `Variant` is only public within the crate, and cannot be re-exported outside + --> $DIR/issue-79148.rs:8:1 + | +LL | cause_ice!(); + | ^^^^^^^^^^^^ + | +note: consider marking `Variant` as `pub` in the imported module + --> $DIR/issue-79148.rs:8:1 + | +LL | cause_ice!(); + | ^^^^^^^^^^^^ + = note: this error originates in the macro `cause_ice` (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 E0364`. diff --git a/src/test/ui/proc-macro/load-panic-backtrace.rs b/src/test/ui/proc-macro/load-panic-backtrace.rs index cd6f70a55..bcdcb704a 100644 --- a/src/test/ui/proc-macro/load-panic-backtrace.rs +++ b/src/test/ui/proc-macro/load-panic-backtrace.rs @@ -3,6 +3,7 @@ // rustc-env:RUST_BACKTRACE=0 // normalize-stderr-test "thread '.*' panicked " -> "" // normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" +// needs-unwind proc macro panics to report errors #[macro_use] extern crate test_macros; diff --git a/src/test/ui/proc-macro/load-panic-backtrace.stderr b/src/test/ui/proc-macro/load-panic-backtrace.stderr index cef5786d1..45d4fd1c9 100644 --- a/src/test/ui/proc-macro/load-panic-backtrace.stderr +++ b/src/test/ui/proc-macro/load-panic-backtrace.stderr @@ -1,6 +1,6 @@ at 'panic-derive', $DIR/auxiliary/test-macros.rs:43:5 error: proc-macro derive panicked - --> $DIR/load-panic-backtrace.rs:10:10 + --> $DIR/load-panic-backtrace.rs:11:10 | LL | #[derive(Panic)] | ^^^^^ diff --git a/src/test/ui/proc-macro/load-panic.rs b/src/test/ui/proc-macro/load-panic.rs index 2e9a311d8..6ce88c400 100644 --- a/src/test/ui/proc-macro/load-panic.rs +++ b/src/test/ui/proc-macro/load-panic.rs @@ -1,4 +1,5 @@ // aux-build:test-macros.rs +// needs-unwind proc macro panics to report errors #[macro_use] extern crate test_macros; diff --git a/src/test/ui/proc-macro/load-panic.stderr b/src/test/ui/proc-macro/load-panic.stderr index 40cc4ee0e..f0d62f690 100644 --- a/src/test/ui/proc-macro/load-panic.stderr +++ b/src/test/ui/proc-macro/load-panic.stderr @@ -1,5 +1,5 @@ error: proc-macro derive panicked - --> $DIR/load-panic.rs:6:10 + --> $DIR/load-panic.rs:7:10 | LL | #[derive(Panic)] | ^^^^^ diff --git a/src/test/ui/proc-macro/signature.stderr b/src/test/ui/proc-macro/signature.stderr index a6bd98ddb..59b3e44c7 100644 --- a/src/test/ui/proc-macro/signature.stderr +++ b/src/test/ui/proc-macro/signature.stderr @@ -5,9 +5,12 @@ LL | / pub unsafe extern "C" fn foo(a: i32, b: u32) -> u32 { LL | | LL | | loop {} LL | | } - | |_^ call the function in a closure: `|| unsafe { /* code */ }` + | | ^ + | | | + | |_call the function in a closure: `|| unsafe { /* code */ }` + | required by a bound introduced by this call | - = help: the trait `Fn<(proc_macro::TokenStream,)>` is not implemented for `unsafe extern "C" fn(i32, u32) -> u32 {foo}` + = 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 diff --git a/src/test/ui/process/core-run-destroy.rs b/src/test/ui/process/core-run-destroy.rs index 5fd418e6c..d0e97bf01 100644 --- a/src/test/ui/process/core-run-destroy.rs +++ b/src/test/ui/process/core-run-destroy.rs @@ -8,6 +8,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-vxworks no 'cat' and 'sleep' +// ignore-fuchsia no 'cat' // N.B., these tests kill child processes. Valgrind sees these children as leaking // memory, which makes for some *confusing* logs. That's why these are here diff --git a/src/test/ui/process/process-envs.rs b/src/test/ui/process/process-envs.rs index 8fc99b23f..f3a469791 100644 --- a/src/test/ui/process/process-envs.rs +++ b/src/test/ui/process/process-envs.rs @@ -2,6 +2,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-vxworks no 'env' +// ignore-fuchsia no 'env' use std::process::Command; use std::env; diff --git a/src/test/ui/process/process-remove-from-env.rs b/src/test/ui/process/process-remove-from-env.rs index af4e49dfd..ad027d685 100644 --- a/src/test/ui/process/process-remove-from-env.rs +++ b/src/test/ui/process/process-remove-from-env.rs @@ -2,6 +2,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-vxworks no 'env' +// ignore-fuchsia no 'env' use std::process::Command; use std::env; diff --git a/src/test/ui/process/process-sigpipe.rs b/src/test/ui/process/process-sigpipe.rs index ecf5e93c9..107eba45d 100644 --- a/src/test/ui/process/process-sigpipe.rs +++ b/src/test/ui/process/process-sigpipe.rs @@ -14,6 +14,7 @@ // ignore-emscripten no threads support // ignore-vxworks no 'sh' +// ignore-fuchsia no 'sh' use std::process; use std::thread; diff --git a/src/test/ui/ptr_ops/issue-80309-safe.rs b/src/test/ui/ptr_ops/issue-80309-safe.rs index f7513b6b8..8a4ff1669 100644 --- a/src/test/ui/ptr_ops/issue-80309-safe.rs +++ b/src/test/ui/ptr_ops/issue-80309-safe.rs @@ -1,5 +1,4 @@ // run-pass -// min-llvm-version: 13.0 // compile-flags: -O // Regression test for issue #80309 diff --git a/src/test/ui/ptr_ops/issue-80309.rs b/src/test/ui/ptr_ops/issue-80309.rs index 5c0f4b76c..c13ce3c9c 100644 --- a/src/test/ui/ptr_ops/issue-80309.rs +++ b/src/test/ui/ptr_ops/issue-80309.rs @@ -1,5 +1,4 @@ // run-pass -// min-llvm-version: 13.0 // compile-flags: -O // Regression test for issue #80309 diff --git a/src/test/ui/range/range-1.stderr b/src/test/ui/range/range-1.stderr index 0bbed8704..aaea91ce0 100644 --- a/src/test/ui/range/range-1.stderr +++ b/src/test/ui/range/range-1.stderr @@ -20,14 +20,14 @@ LL | for i in false..true {} isize u128 and 5 others - = note: required because of the requirements on the impl of `Iterator` for `std::ops::Range` - = note: required because of the requirements on the impl of `IntoIterator` for `std::ops::Range` + = note: required for `std::ops::Range` to implement `Iterator` + = note: required for `std::ops::Range` to implement `IntoIterator` error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time --> $DIR/range-1.rs:14:17 | LL | let range = *arr..; - | ^^^^^^ doesn't have a size known at compile-time + | ^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[{integer}]` note: required by a bound in `RangeFrom` diff --git a/src/test/ui/recursion/issue-83150.stderr b/src/test/ui/recursion/issue-83150.stderr index 89a832984..32f25faf3 100644 --- a/src/test/ui/recursion/issue-83150.stderr +++ b/src/test/ui/recursion/issue-83150.stderr @@ -9,10 +9,12 @@ LL | func(&mut iter.map(|x| x + 1)) = note: `#[warn(unconditional_recursion)]` on by default = help: a `loop` may express intention better if this is on purpose -error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>: Iterator` +error[E0275]: overflow evaluating the requirement ` as Iterator>::Item` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) - = note: required because of the requirements on the impl of `Iterator` for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>` + = note: required for `Map<&mut std::ops::Range, [closure@$DIR/issue-83150.rs:11:24: 11:27]>` to implement `Iterator` + = note: 64 redundant requirements hidden + = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>, [closure@$DIR/issue-83150.rs:11:24: 11:27]>` to implement `Iterator` error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/recursion/issue-95134.rs b/src/test/ui/recursion/issue-95134.rs new file mode 100644 index 000000000..adc9c6ee2 --- /dev/null +++ b/src/test/ui/recursion/issue-95134.rs @@ -0,0 +1,28 @@ +// build-fail +// compile-flags: -Copt-level=0 +//~^^ ERROR overflow evaluating the requirement + +pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { + if n > 15 { + encode_num(n / 16, &mut writer)?; + } + Ok(()) +} + +pub trait ExampleWriter { + type Error; +} + +impl<'a, T: ExampleWriter> ExampleWriter for &'a mut T { + type Error = T::Error; +} + +struct EmptyWriter; + +impl ExampleWriter for EmptyWriter { + type Error = (); +} + +fn main() { + encode_num(69, &mut EmptyWriter).unwrap(); +} diff --git a/src/test/ui/recursion/issue-95134.stderr b/src/test/ui/recursion/issue-95134.stderr new file mode 100644 index 000000000..57a498694 --- /dev/null +++ b/src/test/ui/recursion/issue-95134.stderr @@ -0,0 +1,7 @@ +error[E0275]: overflow evaluating the requirement `::Error` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_95134`) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr index acbd0d059..321ee0a36 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr @@ -19,7 +19,7 @@ help: you might want to use `if let` to ignore the variant that isn't matched | LL | let x = if let Ok(x) = res { x } else { todo!() }; | ++++++++++ ++++++++++++++++++++++ -help: alternatively, on nightly, you might want to use `#![feature(let_else)]` to handle the variant that isn't matched +help: alternatively, you might want to use let else to handle the variant that isn't matched | LL | let Ok(x) = res else { todo!() }; | ++++++++++++++++ diff --git a/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs b/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs new file mode 100644 index 000000000..a1e801e39 --- /dev/null +++ b/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.rs @@ -0,0 +1,12 @@ +pub trait T {} + +struct S<'a>(&'a ()); + +impl<'a> T for S<'a> {} + +fn foo() -> impl T { + let x = (); + S(&x) //~ ERROR `x` does not live long enough +} + +fn main() {} diff --git a/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr b/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr new file mode 100644 index 000000000..6ea238f30 --- /dev/null +++ b/src/test/ui/regions/do-not-suggest-adding-bound-to-opaque-type.stderr @@ -0,0 +1,14 @@ +error[E0597]: `x` does not live long enough + --> $DIR/do-not-suggest-adding-bound-to-opaque-type.rs:9:7 + | +LL | S(&x) + | --^^- + | | | + | | borrowed value does not live long enough + | opaque type requires that `x` is borrowed for `'static` +LL | } + | - `x` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs b/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs index bdd1ae91f..a8f7a41c4 100644 --- a/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs +++ b/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs @@ -5,7 +5,7 @@ // by the function. // // This works today, which precludes changing things so that closures -// follow the same lifetime-elision rules used elsehwere. See +// follow the same lifetime-elision rules used elsewhere. See // rust-lang/rust#56537 // check-pass diff --git a/src/test/ui/regions/outlives-with-missing.rs b/src/test/ui/regions/outlives-with-missing.rs new file mode 100644 index 000000000..29d89718b --- /dev/null +++ b/src/test/ui/regions/outlives-with-missing.rs @@ -0,0 +1,16 @@ +trait HandlerFamily { + type Target; +} + +struct HandlerWrapper(H); + +impl HandlerWrapper { + pub fn set_handler(&self, handler: &H::Target) + where + T: Send + Sync + 'static, + //~^ ERROR cannot find type `T` in this scope + { + } +} + +fn main() {} diff --git a/src/test/ui/regions/outlives-with-missing.stderr b/src/test/ui/regions/outlives-with-missing.stderr new file mode 100644 index 000000000..e204c9187 --- /dev/null +++ b/src/test/ui/regions/outlives-with-missing.stderr @@ -0,0 +1,12 @@ +error[E0412]: cannot find type `T` in this scope + --> $DIR/outlives-with-missing.rs:10:9 + | +LL | impl HandlerWrapper { + | - similarly named type parameter `H` defined here +... +LL | T: Send + Sync + 'static, + | ^ help: a type parameter with a similar name exists: `H` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs index c1dab6086..110635203 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs @@ -19,7 +19,8 @@ trait Trait2<'a, 'b> { // since for it to be WF, we would need to know that `'y: 'x`, but we // do not infer that. fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) - //~^ the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied + //~^ ERROR the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied + //~| ERROR the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied { } diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr index 6844e8665..66f592c34 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr @@ -1,3 +1,18 @@ +error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied + --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1 + | +LL | / fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< >::Foo >) +LL | | +LL | | +LL | | { +LL | | } + | |_^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T` + | +help: consider restricting type parameter `T` + | +LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< >::Foo >) + | ++++++++++++++++++++++++ + error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:49 | @@ -9,6 +24,6 @@ help: consider restricting type parameter `T` LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< >::Foo >) | ++++++++++++++++++++++++ -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/reify-intrinsic.stderr b/src/test/ui/reify-intrinsic.stderr index 360557fb5..f78f1d822 100644 --- a/src/test/ui/reify-intrinsic.stderr +++ b/src/test/ui/reify-intrinsic.stderr @@ -23,6 +23,9 @@ 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` error: aborting due to 3 previous errors diff --git a/src/test/ui/repr/invalid_repr_list_help.rs b/src/test/ui/repr/invalid_repr_list_help.rs new file mode 100644 index 000000000..c32098453 --- /dev/null +++ b/src/test/ui/repr/invalid_repr_list_help.rs @@ -0,0 +1,17 @@ +#![crate_type = "lib"] + +#[repr(uwu)] //~ERROR: unrecognized representation hint +pub struct OwO; + +#[repr(uwu = "a")] //~ERROR: unrecognized representation hint +pub struct OwO2(i32); + +#[repr(uwu(4))] //~ERROR: unrecognized representation hint +pub struct OwO3 { + x: i32, +} + +#[repr(uwu, u8)] //~ERROR: unrecognized representation hint +pub enum OwO4 { + UwU = 1, +} diff --git a/src/test/ui/repr/invalid_repr_list_help.stderr b/src/test/ui/repr/invalid_repr_list_help.stderr new file mode 100644 index 000000000..2acd56d9a --- /dev/null +++ b/src/test/ui/repr/invalid_repr_list_help.stderr @@ -0,0 +1,35 @@ +error[E0552]: unrecognized representation hint + --> $DIR/invalid_repr_list_help.rs:3:8 + | +LL | #[repr(uwu)] + | ^^^ + | + = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` + +error[E0552]: unrecognized representation hint + --> $DIR/invalid_repr_list_help.rs:6:8 + | +LL | #[repr(uwu = "a")] + | ^^^^^^^^^ + | + = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` + +error[E0552]: unrecognized representation hint + --> $DIR/invalid_repr_list_help.rs:9:8 + | +LL | #[repr(uwu(4))] + | ^^^^^^ + | + = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` + +error[E0552]: unrecognized representation hint + --> $DIR/invalid_repr_list_help.rs:14:8 + | +LL | #[repr(uwu, u8)] + | ^^^ + | + = help: valid reprs are `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0552`. diff --git a/src/test/ui/resolve/bad-type-env-capture.stderr b/src/test/ui/resolve/bad-type-env-capture.stderr index 6f24c0d86..b6282c2d0 100644 --- a/src/test/ui/resolve/bad-type-env-capture.stderr +++ b/src/test/ui/resolve/bad-type-env-capture.stderr @@ -4,9 +4,9 @@ error[E0401]: can't use generic parameters from outer function LL | fn foo() { | - type parameter from outer function LL | fn bar(b: T) { } - | --- ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `bar` + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `` error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-100365.rs b/src/test/ui/resolve/issue-100365.rs new file mode 100644 index 000000000..1d8835036 --- /dev/null +++ b/src/test/ui/resolve/issue-100365.rs @@ -0,0 +1,50 @@ +fn main() { + let addr = Into::.into([127, 0, 0, 1]); + //~^ ERROR expected value, found trait `Into` + //~| HELP use the path separator + + let _ = Into.into(()); + //~^ ERROR expected value, found trait `Into` + //~| HELP use the path separator + + let _ = Into::<()>.into; + //~^ ERROR expected value, found trait `Into` + //~| HELP use the path separator +} + +macro_rules! Trait { + () => { + ::std::iter::Iterator + //~^ ERROR expected value, found trait `std::iter::Iterator` + //~| ERROR expected value, found trait `std::iter::Iterator` + }; +} + +macro_rules! create { + () => { + Into::.into("") + //~^ ERROR expected value, found trait `Into` + //~| HELP use the path separator + }; +} + +fn interaction_with_macros() { + // + // Note that if the receiver is a macro call, we do not want to suggest to replace + // `.` with `::` as that would be a syntax error. + // Since the receiver is a trait and not a type, we cannot suggest to surround + // it with angle brackets. It would be interpreted as a trait object type void of + // `dyn` which is most likely not what the user intended to write. + // `<_ as Trait!()>::` is also not an option as it's equally syntactically invalid. + // + + Trait!().map(std::convert::identity); // no `help` here! + + Trait!().map; // no `help` here! + + // + // Ensure that the suggestion is shown for expressions inside of macro definitions. + // + + let _ = create!(); +} diff --git a/src/test/ui/resolve/issue-100365.stderr b/src/test/ui/resolve/issue-100365.stderr new file mode 100644 index 000000000..372d77266 --- /dev/null +++ b/src/test/ui/resolve/issue-100365.stderr @@ -0,0 +1,54 @@ +error[E0423]: expected value, found trait `Into` + --> $DIR/issue-100365.rs:2:16 + | +LL | let addr = Into::.into([127, 0, 0, 1]); + | ^^^^^^^^^^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` + +error[E0423]: expected value, found trait `Into` + --> $DIR/issue-100365.rs:6:13 + | +LL | let _ = Into.into(()); + | ^^^^- help: use the path separator to refer to an item: `::` + +error[E0423]: expected value, found trait `Into` + --> $DIR/issue-100365.rs:10:13 + | +LL | let _ = Into::<()>.into; + | ^^^^^^^^^^- help: use the path separator to refer to an item: `::` + +error[E0423]: expected value, found trait `std::iter::Iterator` + --> $DIR/issue-100365.rs:17:9 + | +LL | ::std::iter::Iterator + | ^^^^^^^^^^^^^^^^^^^^^ not a value +... +LL | Trait!().map(std::convert::identity); // no `help` here! + | -------- in this macro invocation + | + = note: this error originates in the macro `Trait` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0423]: expected value, found trait `std::iter::Iterator` + --> $DIR/issue-100365.rs:17:9 + | +LL | ::std::iter::Iterator + | ^^^^^^^^^^^^^^^^^^^^^ not a value +... +LL | Trait!().map; // no `help` here! + | -------- in this macro invocation + | + = note: this error originates in the macro `Trait` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0423]: expected value, found trait `Into` + --> $DIR/issue-100365.rs:25:9 + | +LL | Into::.into("") + | ^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` +... +LL | let _ = create!(); + | --------- in this macro invocation + | + = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0423`. diff --git a/src/test/ui/resolve/issue-22692.rs b/src/test/ui/resolve/issue-22692.rs index 1d8f44222..31a762614 100644 --- a/src/test/ui/resolve/issue-22692.rs +++ b/src/test/ui/resolve/issue-22692.rs @@ -1,3 +1,60 @@ fn main() { - let _ = String.new(); //~ ERROR expected value, found struct `String` + let _ = String.new(); + //~^ ERROR expected value, found struct `String` + //~| HELP use the path separator + + let _ = String.default; + //~^ ERROR expected value, found struct `String` + //~| HELP use the path separator + + let _ = Vec::<()>.with_capacity(1); + //~^ ERROR expected value, found struct `Vec` + //~| HELP use the path separator +} + +macro_rules! Type { + () => { + ::std::cell::Cell + //~^ ERROR expected value, found struct `std::cell::Cell` + //~| ERROR expected value, found struct `std::cell::Cell` + //~| ERROR expected value, found struct `std::cell::Cell` + }; +} + +macro_rules! create { + (type method) => { + Vec.new() + //~^ ERROR expected value, found struct `Vec` + //~| HELP use the path separator + }; + (type field) => { + Vec.new + //~^ ERROR expected value, found struct `Vec` + //~| HELP use the path separator + }; + (macro method) => { + Type!().new(0) + //~^ HELP use the path separator + }; +} + +fn interaction_with_macros() { + // + // Verify that we do not only suggest to replace `.` with `::` if the receiver is a + // macro call but that we also correctly suggest to surround it with angle brackets. + // + + Type!().get(); + //~^ HELP use the path separator + + Type! {}.get; + //~^ HELP use the path separator + + // + // Ensure that the suggestion is shown for expressions inside of macro definitions. + // + + let _ = create!(type method); + let _ = create!(type field); + let _ = create!(macro method); } diff --git a/src/test/ui/resolve/issue-22692.stderr b/src/test/ui/resolve/issue-22692.stderr index e076419f6..6962aa161 100644 --- a/src/test/ui/resolve/issue-22692.stderr +++ b/src/test/ui/resolve/issue-22692.stderr @@ -2,10 +2,87 @@ error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:2:13 | LL | let _ = String.new(); - | ^^^^^^---- - | | - | help: use the path separator to refer to an item: `String::new` + | ^^^^^^- help: use the path separator to refer to an item: `::` -error: aborting due to previous error +error[E0423]: expected value, found struct `String` + --> $DIR/issue-22692.rs:6:13 + | +LL | let _ = String.default; + | ^^^^^^- help: use the path separator to refer to an item: `::` + +error[E0423]: expected value, found struct `Vec` + --> $DIR/issue-22692.rs:10:13 + | +LL | let _ = Vec::<()>.with_capacity(1); + | ^^^^^^^^^- help: use the path separator to refer to an item: `::` + +error[E0423]: expected value, found struct `std::cell::Cell` + --> $DIR/issue-22692.rs:17:9 + | +LL | ::std::cell::Cell + | ^^^^^^^^^^^^^^^^^ +... +LL | Type!().get(); + | ------- in this macro invocation + | + = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | ::get(); + | ~~~~~~~~~~~ + +error[E0423]: expected value, found struct `std::cell::Cell` + --> $DIR/issue-22692.rs:17:9 + | +LL | ::std::cell::Cell + | ^^^^^^^^^^^^^^^^^ +... +LL | Type! {}.get; + | -------- in this macro invocation + | + = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | ::get; + | ~~~~~~~~~~~~ + +error[E0423]: expected value, found struct `Vec` + --> $DIR/issue-22692.rs:26:9 + | +LL | Vec.new() + | ^^^- help: use the path separator to refer to an item: `::` +... +LL | let _ = create!(type method); + | -------------------- in this macro invocation + | + = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0423]: expected value, found struct `Vec` + --> $DIR/issue-22692.rs:31:9 + | +LL | Vec.new + | ^^^- help: use the path separator to refer to an item: `::` +... +LL | let _ = create!(type field); + | ------------------- in this macro invocation + | + = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0423]: expected value, found struct `std::cell::Cell` + --> $DIR/issue-22692.rs:17:9 + | +LL | ::std::cell::Cell + | ^^^^^^^^^^^^^^^^^ +... +LL | let _ = create!(macro method); + | --------------------- in this macro invocation + | + = note: this error originates in the macro `Type` which comes from the expansion of the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | ::new(0) + | ~~~~~~~~~~~ + +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0423`. diff --git a/src/test/ui/resolve/issue-3021-c.stderr b/src/test/ui/resolve/issue-3021-c.stderr index 8764ac8a8..5176efc3a 100644 --- a/src/test/ui/resolve/issue-3021-c.stderr +++ b/src/test/ui/resolve/issue-3021-c.stderr @@ -3,22 +3,22 @@ error[E0401]: can't use generic parameters from outer function | LL | fn siphash() { | - type parameter from outer function -... +LL | +LL | trait U { + | - help: try using a local generic parameter instead: `` LL | fn g(&self, x: T) -> T; - | - ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `g` + | ^ use of generic parameter from outer function error[E0401]: can't use generic parameters from outer function --> $DIR/issue-3021-c.rs:4:30 | LL | fn siphash() { | - type parameter from outer function -... +LL | +LL | trait U { + | - help: try using a local generic parameter instead: `` LL | fn g(&self, x: T) -> T; - | - ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `g` + | ^ use of generic parameter from outer function error: aborting due to 2 previous errors diff --git a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs index aaf0f7eae..49462f52f 100644 --- a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs +++ b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs @@ -14,7 +14,6 @@ trait B { impl B for A { async fn associated(); //~ ERROR without body //~^ ERROR cannot be declared `async` - //~| ERROR has an incompatible type for trait } fn main() {} diff --git a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr index d3214458e..55c3b66f1 100644 --- a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr +++ b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr @@ -14,17 +14,6 @@ LL | async fn inherent(); | | | help: provide a definition for the function: `{ }` -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:5 - | -LL | async fn associated(); - | -----^^^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - error: associated function in `impl` without body --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5 | @@ -34,7 +23,7 @@ LL | async fn associated(); | help: provide a definition for the function: `{ }` error[E0706]: functions in traits cannot be declared `async` - --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5 + --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:5 | LL | async fn associated(); | -----^^^^^^^^^^^^^^^^^ @@ -43,26 +32,22 @@ LL | async fn associated(); | = 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(return_position_impl_trait_in_trait)]` to the crate attributes to enable -error[E0053]: method `associated` has an incompatible type for trait - --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:26 +error[E0706]: functions in traits cannot be declared `async` + --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5 | LL | async fn associated(); - | ^ - | | - | checked the `Output` of this `async fn`, found opaque type - | expected `()`, found opaque type - | - = note: while checking the return type of the `async fn` -note: type in trait - --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:26 + | -----^^^^^^^^^^^^^^^^^ + | | + | `async` because of this | -LL | async fn associated(); - | ^ - = note: expected fn pointer `fn()` - found fn pointer `fn() -> impl Future` + = 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(return_position_impl_trait_in_trait)]` to the crate attributes to enable -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0053, E0706. -For more information about an error, try `rustc --explain E0053`. +For more information about this error, try `rustc --explain E0706`. diff --git a/src/test/ui/resolve/issue-73427.rs b/src/test/ui/resolve/issue-73427.rs index 3c62782a8..5c2459a59 100644 --- a/src/test/ui/resolve/issue-73427.rs +++ b/src/test/ui/resolve/issue-73427.rs @@ -22,6 +22,10 @@ enum D { Unit, } +enum E { + TupleWithFields(()), +} + fn main() { // Only variants without fields are suggested (and others mentioned in a note) where an enum // is used rather than a variant. @@ -34,6 +38,8 @@ fn main() { //~^ ERROR expected value, found enum `C` D.foo(); //~^ ERROR expected value, found enum `D` + E.foo(); + //~^ ERROR expected value, found enum `E` // Only tuple variants are suggested in calls or tuple struct pattern matching. diff --git a/src/test/ui/resolve/issue-73427.stderr b/src/test/ui/resolve/issue-73427.stderr index 59bb98a34..a2ca46f0c 100644 --- a/src/test/ui/resolve/issue-73427.stderr +++ b/src/test/ui/resolve/issue-73427.stderr @@ -1,5 +1,5 @@ error[E0423]: expected value, found enum `A` - --> $DIR/issue-73427.rs:29:5 + --> $DIR/issue-73427.rs:33:5 | LL | A.foo(); | ^ @@ -23,7 +23,7 @@ LL | (A::Tuple()).foo(); | ~~~~~~~~~~~~ LL | A::Unit.foo(); | ~~~~~~~ -help: the following enum variants are available +help: alternatively, the following enum variants are also available | LL | (A::StructWithFields { /* fields */ }).foo(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -31,7 +31,7 @@ LL | (A::TupleWithFields(/* fields */)).foo(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: expected value, found enum `B` - --> $DIR/issue-73427.rs:31:5 + --> $DIR/issue-73427.rs:35:5 | LL | B.foo(); | ^ @@ -52,7 +52,7 @@ LL | (B::TupleWithFields(/* fields */)).foo(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: expected value, found enum `C` - --> $DIR/issue-73427.rs:33:5 + --> $DIR/issue-73427.rs:37:5 | LL | C.foo(); | ^ @@ -70,7 +70,7 @@ help: you might have meant to use the following enum variant | LL | C::Unit.foo(); | ~~~~~~~ -help: the following enum variants are available +help: alternatively, the following enum variants are also available | LL | (C::StructWithFields { /* fields */ }).foo(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -78,7 +78,7 @@ LL | (C::TupleWithFields(/* fields */)).foo(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: expected value, found enum `D` - --> $DIR/issue-73427.rs:35:5 + --> $DIR/issue-73427.rs:39:5 | LL | D.foo(); | ^ @@ -95,13 +95,37 @@ help: you might have meant to use the following enum variant | LL | D::Unit.foo(); | ~~~~~~~ -help: the following enum variant is available +help: alternatively, the following enum variant is available | LL | (D::TupleWithFields(/* fields */)).foo(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +error[E0423]: expected value, found enum `E` + --> $DIR/issue-73427.rs:41:5 + | +LL | E.foo(); + | ^ + | +note: the enum is defined here + --> $DIR/issue-73427.rs:25:1 + | +LL | / enum E { +LL | | TupleWithFields(()), +LL | | } + | |_^ +help: the following enum variant is available + | +LL | (E::TupleWithFields(/* fields */)).foo(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +help: consider importing one of these items instead + | +LL | use std::f32::consts::E; + | +LL | use std::f64::consts::E; + | + error[E0423]: expected function, tuple struct or tuple variant, found enum `A` - --> $DIR/issue-73427.rs:40:13 + --> $DIR/issue-73427.rs:46:13 | LL | let x = A(3); | ^ @@ -126,7 +150,7 @@ LL | let x = A::TupleWithFields(3); | ~~~~~~~~~~~~~~~~~~ error[E0532]: expected tuple struct or tuple variant, found enum `A` - --> $DIR/issue-73427.rs:42:12 + --> $DIR/issue-73427.rs:48:12 | LL | if let A(3) = x { } | ^ @@ -150,7 +174,7 @@ LL | if let A::Tuple(3) = x { } LL | if let A::TupleWithFields(3) = x { } | ~~~~~~~~~~~~~~~~~~ -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors Some errors have detailed explanations: E0423, E0532. For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.rs b/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.rs new file mode 100644 index 000000000..bd496875e --- /dev/null +++ b/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.rs @@ -0,0 +1,21 @@ +trait Foo { + fn foo(&self, name: T) -> usize; +} + +struct Bar { + baz: Baz, +} + +struct Baz { + num: usize, +} + +impl Foo for Bar { + fn foo(&self, _name: Baz) -> usize { + match self.baz { + Baz { num } => num, //~ ERROR expected struct, variant or union type, found type parameter `Baz` + } + } +} + +fn main() {} diff --git a/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr b/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr new file mode 100644 index 000000000..af9f4612a --- /dev/null +++ b/src/test/ui/resolve/point-at-type-parameter-shadowing-another-type.stderr @@ -0,0 +1,12 @@ +error[E0574]: expected struct, variant or union type, found type parameter `Baz` + --> $DIR/point-at-type-parameter-shadowing-another-type.rs:16:13 + | +LL | impl Foo for Bar { + | --- found this type parameter +... +LL | Baz { num } => num, + | ^^^ 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/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index f885ac215..a369dc6db 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -19,7 +19,7 @@ help: you might have meant to use the following enum variant | LL | m::Z::Unit; | ~~~~~~~~~~ -help: the following enum variants are available +help: alternatively, the following enum variants are also available | LL | (m::Z::Fn(/* fields */)); | ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -47,7 +47,7 @@ help: you might have meant to use the following enum variant | LL | m::Z::Unit; | ~~~~~~~~~~ -help: the following enum variants are available +help: alternatively, the following enum variants are also available | LL | (m::Z::Fn(/* fields */)); | ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -89,7 +89,7 @@ help: you might have meant to use the following enum variant | LL | let _: E = E::Unit; | ~~~~~~~ -help: the following enum variants are available +help: alternatively, the following enum variants are also available | LL | let _: E = (E::Fn(/* fields */)); | ~~~~~~~~~~~~~~~~~~~~~ @@ -143,7 +143,7 @@ help: you might have meant to use the following enum variant | LL | let _: E = E::Unit; | ~~~~~~~ -help: the following enum variants are available +help: alternatively, the following enum variants are also available | LL | let _: E = (E::Fn(/* fields */)); | ~~~~~~~~~~~~~~~~~~~~~ @@ -203,7 +203,7 @@ help: you might have meant to use the following enum variant | LL | let _: Z = m::Z::Unit; | ~~~~~~~~~~ -help: the following enum variants are available +help: alternatively, the following enum variants are also available | LL | let _: Z = (m::Z::Fn(/* fields */)); | ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -329,8 +329,8 @@ LL | let _: Z = Z::Fn; found fn item `fn(u8) -> Z {Z::Fn}` help: use parentheses to instantiate this tuple variant | -LL | let _: Z = Z::Fn(_); - | +++ +LL | let _: Z = Z::Fn(/* u8 */); + | ++++++++++ error[E0618]: expected function, found enum variant `Z::Unit` --> $DIR/privacy-enum-ctor.rs:31:17 @@ -364,8 +364,8 @@ LL | let _: E = m::E::Fn; found fn item `fn(u8) -> E {E::Fn}` help: use parentheses to instantiate this tuple variant | -LL | let _: E = m::E::Fn(_); - | +++ +LL | let _: E = m::E::Fn(/* u8 */); + | ++++++++++ error[E0618]: expected function, found enum variant `m::E::Unit` --> $DIR/privacy-enum-ctor.rs:47:16 @@ -399,8 +399,8 @@ LL | let _: E = E::Fn; found fn item `fn(u8) -> E {E::Fn}` help: use parentheses to instantiate this tuple variant | -LL | let _: E = E::Fn(_); - | +++ +LL | let _: E = E::Fn(/* u8 */); + | ++++++++++ error[E0618]: expected function, found enum variant `E::Unit` --> $DIR/privacy-enum-ctor.rs:55:16 diff --git a/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr b/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr index 96c1869b4..c805c9eb1 100644 --- a/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr +++ b/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr @@ -31,6 +31,10 @@ LL | Opts::A(ref i) | Opts::B(i) => {} | first introduced with type `&isize` here | = note: in the same arm, a binding must have the same type in all alternatives +help: consider adding `ref` + | +LL | Opts::A(ref i) | Opts::B(ref i) => {} + | +++ error[E0308]: mismatched types --> $DIR/resolve-inconsistent-binding-mode.rs:18:34 @@ -43,6 +47,10 @@ LL | Opts::A(ref i) | Opts::B(i) => {} | first introduced with type `&isize` here | = note: in the same arm, a binding must have the same type in all alternatives +help: consider adding `ref` + | +LL | Opts::A(ref i) | Opts::B(ref i) => {} + | +++ error[E0308]: mismatched types --> $DIR/resolve-inconsistent-binding-mode.rs:27:38 diff --git a/src/test/ui/resolve/resolve-inconsistent-names.rs b/src/test/ui/resolve/resolve-inconsistent-names.rs index 989d2d452..9a40b2034 100644 --- a/src/test/ui/resolve/resolve-inconsistent-names.rs +++ b/src/test/ui/resolve/resolve-inconsistent-names.rs @@ -23,6 +23,7 @@ fn main() { //~| ERROR mismatched types //~| ERROR variable `c` is not bound in all patterns //~| HELP if you meant to match on unit variant `E::A`, use the full path in the pattern + //~| HELP consider removing `ref` } let z = (10, 20); diff --git a/src/test/ui/resolve/resolve-inconsistent-names.stderr b/src/test/ui/resolve/resolve-inconsistent-names.stderr index 9de191f7d..773c9f6cd 100644 --- a/src/test/ui/resolve/resolve-inconsistent-names.stderr +++ b/src/test/ui/resolve/resolve-inconsistent-names.stderr @@ -55,7 +55,7 @@ LL | (A, B) | (ref B, c) | (c, A) => () | first binding error[E0408]: variable `CONST1` is not bound in all patterns - --> $DIR/resolve-inconsistent-names.rs:30:23 + --> $DIR/resolve-inconsistent-names.rs:31:23 | LL | (CONST1, _) | (_, Const2) => () | ------ ^^^^^^^^^^^ pattern doesn't bind `CONST1` @@ -69,7 +69,7 @@ LL | const CONST1: usize = 10; | ^^^^^^^^^^^^^^^^^^^^^^^^^ not accessible error[E0408]: variable `Const2` is not bound in all patterns - --> $DIR/resolve-inconsistent-names.rs:30:9 + --> $DIR/resolve-inconsistent-names.rs:31:9 | LL | (CONST1, _) | (_, Const2) => () | ^^^^^^^^^^^ ------ variable not in all patterns @@ -92,6 +92,11 @@ LL | (A, B) | (ref B, c) | (c, A) => () | first introduced with type `E` here | = note: in the same arm, a binding must have the same type in all alternatives +help: consider removing `ref` + | +LL - (A, B) | (ref B, c) | (c, A) => () +LL + (A, B) | (B, c) | (c, A) => () + | error: aborting due to 9 previous errors diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr index f0eb1a4f4..6d5d5bad9 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.stderr +++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr @@ -34,7 +34,7 @@ LL | pub const fn size_of() -> usize { help: remove the extra argument | LL | std::mem::size_of(); - | ~~~~~~~~~~~~~~~~~~~ + | ~~ error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr index 10a703ee0..0a6d1cc3b 100644 --- a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr +++ b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr @@ -4,8 +4,8 @@ error[E0401]: can't use generic parameters from outer function LL | trait TraitA { | - type parameter from outer function LL | fn outer(&self) { - | ----- try adding a local generic parameter in this method instead LL | enum Foo { + | - help: try using a local generic parameter instead: `A,` LL | Variance(A) | ^ use of generic parameter from outer function @@ -15,9 +15,10 @@ error[E0401]: can't use generic parameters from outer function LL | trait TraitB { | - type parameter from outer function LL | fn outer(&self) { - | ----- try adding a local generic parameter in this method instead LL | struct Foo(A); - | ^ use of generic parameter from outer function + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `A,` error[E0401]: can't use generic parameters from outer function --> $DIR/resolve-type-param-in-item-in-trait.rs:23:28 @@ -25,9 +26,10 @@ error[E0401]: can't use generic parameters from outer function LL | trait TraitC { | - type parameter from outer function LL | fn outer(&self) { - | ----- try adding a local generic parameter in this method instead LL | struct Foo { a: A } - | ^ use of generic parameter from outer function + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `A,` error[E0401]: can't use generic parameters from outer function --> $DIR/resolve-type-param-in-item-in-trait.rs:30:22 @@ -36,9 +38,9 @@ LL | trait TraitD { | - type parameter from outer function LL | fn outer(&self) { LL | fn foo(a: A) { } - | ------ ^ use of generic parameter from outer function - | | - | help: try using a local generic parameter instead: `foo` + | - ^ use of generic parameter from outer function + | | + | help: try using a local generic parameter instead: `A,` error: aborting due to 4 previous errors diff --git a/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr b/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr index 957045ca7..4764cf2db 100644 --- a/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr +++ b/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr @@ -2,17 +2,13 @@ error[E0423]: expected value, found struct `SomeTupleStruct` --> $DIR/suggest-path-for-tuple-struct.rs:22:13 | LL | let _ = SomeTupleStruct.new(); - | ^^^^^^^^^^^^^^^---- - | | - | help: use the path separator to refer to an item: `SomeTupleStruct::new` + | ^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` error[E0423]: expected value, found struct `SomeRegularStruct` --> $DIR/suggest-path-for-tuple-struct.rs:24:13 | LL | let _ = SomeRegularStruct.new(); - | ^^^^^^^^^^^^^^^^^---- - | | - | help: use the path separator to refer to an item: `SomeRegularStruct::new` + | ^^^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` error: aborting due to 2 previous errors diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs index 204a27240..d5d6b13d6 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs @@ -16,44 +16,96 @@ pub mod a { fn h1() -> i32 { a.I //~^ ERROR expected value, found module `a` + //~| HELP use the path separator } fn h2() -> i32 { a.g() //~^ ERROR expected value, found module `a` + //~| HELP use the path separator } fn h3() -> i32 { a.b.J //~^ ERROR expected value, found module `a` + //~| HELP use the path separator } fn h4() -> i32 { a::b.J //~^ ERROR expected value, found module `a::b` + //~| HELP a constant with a similar name exists + //~| HELP use the path separator } fn h5() { a.b.f(); //~^ ERROR expected value, found module `a` + //~| HELP use the path separator let v = Vec::new(); v.push(a::b); //~^ ERROR expected value, found module `a::b` + //~| HELP a constant with a similar name exists } fn h6() -> i32 { a::b.f() //~^ ERROR expected value, found module `a::b` + //~| HELP a constant with a similar name exists + //~| HELP use the path separator } fn h7() { a::b //~^ ERROR expected value, found module `a::b` + //~| HELP a constant with a similar name exists } fn h8() -> i32 { a::b() //~^ ERROR expected function, found module `a::b` + //~| HELP a constant with a similar name exists +} + +macro_rules! module { + () => { + a + //~^ ERROR expected value, found module `a` + //~| ERROR expected value, found module `a` + }; +} + +macro_rules! create { + (method) => { + a.f() + //~^ ERROR expected value, found module `a` + //~| HELP use the path separator + }; + (field) => { + a.f + //~^ ERROR expected value, found module `a` + //~| HELP use the path separator + }; +} + +fn h9() { + // + // Note that if the receiver is a macro call, we do not want to suggest to replace + // `.` with `::` as that would be a syntax error. + // Since the receiver is a module and not a type, we cannot suggest to surround + // it with angle brackets. + // + + module!().g::<()>(); // no `help` here! + + module!().g; // no `help` here! + + // + // Ensure that the suggestion is shown for expressions inside of macro definitions. + // + + let _ = create!(method); + let _ = create!(field); } fn main() {} diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index 54b242123..a4ce0deeb 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -2,28 +2,22 @@ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:17:5 | LL | a.I - | ^-- - | | - | help: use the path separator to refer to an item: `a::I` + | ^- help: use the path separator to refer to an item: `::` error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:22:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:23:5 | LL | a.g() - | ^-- - | | - | help: use the path separator to refer to an item: `a::g` + | ^- help: use the path separator to refer to an item: `::` error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:27:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:29:5 | LL | a.b.J - | ^-- - | | - | help: use the path separator to refer to an item: `a::b` + | ^- help: use the path separator to refer to an item: `::` error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:32:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:35:5 | LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here @@ -34,22 +28,20 @@ LL | a::b.J help: use the path separator to refer to an item | LL | a::b::J - | + | ~~ help: a constant with a similar name exists | LL | a::I.J | ~ error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:37:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:42:5 | LL | a.b.f(); - | ^-- - | | - | help: use the path separator to refer to an item: `a::b` + | ^- help: use the path separator to refer to an item: `::` error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:40:12 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:46:12 | LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here @@ -60,7 +52,7 @@ LL | v.push(a::b); | help: a constant with a similar name exists: `I` error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:45:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:52:5 | LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here @@ -71,14 +63,14 @@ LL | a::b.f() help: use the path separator to refer to an item | LL | a::b::f() - | ~~~~~~~ + | ~~ help: a constant with a similar name exists | LL | a::I.f() | ~ error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:50:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:59:5 | LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here @@ -89,7 +81,7 @@ LL | a::b | help: a constant with a similar name exists: `I` error[E0423]: expected function, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:65:5 | LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here @@ -99,6 +91,50 @@ LL | a::b() | | | help: a constant with a similar name exists: `I` -error: aborting due to 9 previous errors +error[E0423]: expected value, found module `a` + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:72:9 + | +LL | a + | ^ not a value +... +LL | module!().g::<()>(); // no `help` here! + | --------- in this macro invocation + | + = note: this error originates in the macro `module` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0423]: expected value, found module `a` + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:72:9 + | +LL | a + | ^ not a value +... +LL | module!().g; // no `help` here! + | --------- in this macro invocation + | + = note: this error originates in the macro `module` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0423]: expected value, found module `a` + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:80:9 + | +LL | a.f() + | ^- help: use the path separator to refer to an item: `::` +... +LL | let _ = create!(method); + | --------------- in this macro invocation + | + = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0423]: expected value, found module `a` + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:85:9 + | +LL | a.f + | ^- help: use the path separator to refer to an item: `::` +... +LL | let _ = create!(field); + | -------------- in this macro invocation + | + = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 13 previous errors For more information about this error, try `rustc --explain E0423`. diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index 6086723b5..7d81de438 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -9,7 +9,7 @@ LL | | } | |_^ `main` can only return types that implement `Termination` | = help: the trait `Termination` is not implemented for `f32` - = note: required because of the requirements on the impl of `Termination` for `Result` + = note: required for `Result` to implement `Termination` note: required by a bound in `assert_test_result` --> $SRC_DIR/test/src/lib.rs:LL:COL | diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.rs b/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.rs index d9657bac7..5dce8180f 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.rs @@ -1,5 +1,4 @@ // aux-build:enums.rs -// run-pass extern crate enums; @@ -7,11 +6,6 @@ use enums::FieldLessWithNonExhaustiveVariant; fn main() { let e = FieldLessWithNonExhaustiveVariant::default(); - // FIXME: https://github.com/rust-lang/rust/issues/91161 - // This `as` cast *should* be an error, since it would fail - // if the non-exhaustive variant got fields. But today it - // doesn't. The fix for that will update this test to - // show an error (and not be run-pass any more). - let d = e as u8; + let d = e as u8; //~ ERROR casting `FieldLessWithNonExhaustiveVariant` as `u8` is invalid [E0606] assert_eq!(d, 0); } diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr new file mode 100644 index 000000000..a61dcf839 --- /dev/null +++ b/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.stderr @@ -0,0 +1,11 @@ +error[E0606]: casting `FieldLessWithNonExhaustiveVariant` as `u8` is invalid + --> $DIR/enum-as-cast.rs:9:13 + | +LL | let d = e as u8; + | ^^^^^^^ + | + = note: cannot cast an enum with a non-exhaustive variant when it's defined in another crate + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0606`. diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs index 70253a4fc..69a283c31 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.rs @@ -31,7 +31,7 @@ fn empty_non_exhaustive(x: EmptyNonExhaustiveEnum) { fn main() { match NonExhaustiveEnum::Unit {} - //~^ ERROR `Unit`, `Tuple(_)` and `Struct { .. }` not covered [E0004] + //~^ ERROR `NonExhaustiveEnum::Unit`, `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered [E0004] match NormalEnum::Unit {} - //~^ ERROR `Unit`, `Tuple(_)` and `Struct { .. }` not covered [E0004] + //~^ ERROR `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered [E0004] } diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index 1f2090448..de1bf8be8 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -10,11 +10,11 @@ note: the lint level is defined here LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ -error[E0004]: non-exhaustive patterns: `Unit`, `Tuple(_)` and `Struct { .. }` not covered +error[E0004]: non-exhaustive patterns: `NonExhaustiveEnum::Unit`, `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered --> $DIR/enum_same_crate_empty_match.rs:33:11 | LL | match NonExhaustiveEnum::Unit {} - | ^^^^^^^^^^^^^^^^^^^^^^^ patterns `Unit`, `Tuple(_)` and `Struct { .. }` not covered + | ^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonExhaustiveEnum::Unit`, `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered | note: `NonExhaustiveEnum` defined here --> $DIR/enum_same_crate_empty_match.rs:5:5 @@ -33,15 +33,15 @@ LL | Struct { field: u32 } help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ match NonExhaustiveEnum::Unit { -LL + Unit | Tuple(_) | Struct { .. } => todo!(), +LL + NonExhaustiveEnum::Unit | NonExhaustiveEnum::Tuple(_) | NonExhaustiveEnum::Struct { .. } => todo!(), LL + } | -error[E0004]: non-exhaustive patterns: `Unit`, `Tuple(_)` and `Struct { .. }` not covered +error[E0004]: non-exhaustive patterns: `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered --> $DIR/enum_same_crate_empty_match.rs:35:11 | LL | match NormalEnum::Unit {} - | ^^^^^^^^^^^^^^^^ patterns `Unit`, `Tuple(_)` and `Struct { .. }` not covered + | ^^^^^^^^^^^^^^^^ patterns `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered | note: `NormalEnum` defined here --> $DIR/enum_same_crate_empty_match.rs:14:5 @@ -60,7 +60,7 @@ LL | Struct { field: u32 } help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ match NormalEnum::Unit { -LL + Unit | Tuple(_) | Struct { .. } => todo!(), +LL + NormalEnum::Unit | NormalEnum::Tuple(_) | NormalEnum::Struct { .. } => todo!(), LL + } | diff --git a/src/test/ui/rfc-2008-non-exhaustive/omitted-patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/omitted-patterns.stderr index a9885449f..4b9f8564d 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/omitted-patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/omitted-patterns.stderr @@ -81,7 +81,7 @@ error: some variants are not matched explicitly --> $DIR/omitted-patterns.rs:58:9 | LL | _ => {} - | ^ pattern `Struct { .. }` not covered + | ^ pattern `NonExhaustiveEnum::Struct { .. }` not covered | note: the lint level is defined here --> $DIR/omitted-patterns.rs:57:16 @@ -95,7 +95,7 @@ error: some variants are not matched explicitly --> $DIR/omitted-patterns.rs:65:9 | LL | _ => {} - | ^ pattern `Tuple(_)` not covered + | ^ pattern `NonExhaustiveEnum::Tuple(_)` not covered | note: the lint level is defined here --> $DIR/omitted-patterns.rs:64:16 @@ -109,7 +109,7 @@ error: some variants are not matched explicitly --> $DIR/omitted-patterns.rs:75:9 | LL | _ => {} - | ^ pattern `Unit` not covered + | ^ pattern `NonExhaustiveEnum::Unit` not covered | note: the lint level is defined here --> $DIR/omitted-patterns.rs:74:16 @@ -123,7 +123,7 @@ error: some variants are not matched explicitly --> $DIR/omitted-patterns.rs:92:32 | LL | NestedNonExhaustive::A(_) => {} - | ^ patterns `Tuple(_)` and `Struct { .. }` not covered + | ^ patterns `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered | note: the lint level is defined here --> $DIR/omitted-patterns.rs:89:12 @@ -137,7 +137,7 @@ error: some variants are not matched explicitly --> $DIR/omitted-patterns.rs:94:9 | LL | _ => {} - | ^ pattern `C` not covered + | ^ pattern `NestedNonExhaustive::C` not covered | = help: ensure that all variants are matched explicitly by adding the suggested match arms = note: the matched value is of type `NestedNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found @@ -146,7 +146,7 @@ error: some variants are not matched explicitly --> $DIR/omitted-patterns.rs:132:9 | LL | _ => {} - | ^ pattern `A(_)` not covered + | ^ pattern `NonExhaustiveSingleVariant::A(_)` not covered | note: the lint level is defined here --> $DIR/omitted-patterns.rs:130:12 @@ -160,7 +160,7 @@ error: some variants are not matched explicitly --> $DIR/omitted-patterns.rs:144:9 | LL | _ => {} - | ^ pattern `Unstable` not covered + | ^ pattern `UnstableEnum::Unstable` not covered | note: the lint level is defined here --> $DIR/omitted-patterns.rs:143:16 @@ -174,7 +174,7 @@ error: some variants are not matched explicitly --> $DIR/omitted-patterns.rs:168:9 | LL | _ => {} - | ^ pattern `Unstable2` not covered + | ^ pattern `OnlyUnstableEnum::Unstable2` not covered | note: the lint level is defined here --> $DIR/omitted-patterns.rs:165:12 diff --git a/src/test/ui/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr index 7cce17898..533e8abf2 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr @@ -16,7 +16,7 @@ error: some variants are not matched explicitly --> $DIR/stable-omitted-patterns.rs:23:9 | LL | _ => {} - | ^ pattern `Stable2` not covered + | ^ pattern `UnstableEnum::Stable2` not covered | note: the lint level is defined here --> $DIR/stable-omitted-patterns.rs:22:16 diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr index 32a5c07f1..a9c54af04 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -55,11 +55,11 @@ LL + _ => todo!(), LL ~ } | -error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covered +error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered --> $DIR/match.rs:31:11 | LL | match x {} - | ^ patterns `Tuple(_)` and `Struct { .. }` not covered + | ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered | note: `UninhabitedVariants` defined here --> $DIR/auxiliary/uninhabited.rs:17:23 @@ -74,7 +74,7 @@ LL | #[non_exhaustive] Struct { x: ! } help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ match x { -LL + Tuple(_) | Struct { .. } => todo!(), +LL + UninhabitedVariants::Tuple(_) | UninhabitedVariants::Struct { .. } => todo!(), LL ~ } | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr index c89c70ae6..ec2a2f6f0 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr @@ -36,11 +36,11 @@ LL + _ => todo!(), LL ~ } | -error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covered +error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered --> $DIR/match_same_crate.rs:38:11 | LL | match x {} - | ^ patterns `Tuple(_)` and `Struct { .. }` not covered + | ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered | note: `UninhabitedVariants` defined here --> $DIR/match_same_crate.rs:16:23 @@ -55,7 +55,7 @@ LL | #[non_exhaustive] Struct { x: ! } help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ match x { -LL + Tuple(_) | Struct { .. } => todo!(), +LL + UninhabitedVariants::Tuple(_) | UninhabitedVariants::Struct { .. } => todo!(), LL ~ } | diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index d854ea28f..b6b777ec5 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -55,11 +55,11 @@ LL + _ => todo!(), LL ~ } | -error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covered +error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered --> $DIR/match_with_exhaustive_patterns.rs:34:11 | LL | match x {} - | ^ patterns `Tuple(_)` and `Struct { .. }` not covered + | ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered | note: `UninhabitedVariants` defined here --> $DIR/auxiliary/uninhabited.rs:17:23 @@ -74,7 +74,7 @@ LL | #[non_exhaustive] Struct { x: ! } help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ match x { -LL + Tuple(_) | Struct { .. } => todo!(), +LL + UninhabitedVariants::Tuple(_) | UninhabitedVariants::Struct { .. } => todo!(), LL ~ } | diff --git a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr index fce0cdfe0..bc06fde49 100644 --- a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr @@ -1493,17 +1493,11 @@ LL | if (let 0 = 0)? {} error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/disallowed-positions.rs:132:19 | -LL | / fn nested_within_if_expr() { -LL | | if &let 0 = 0 {} -LL | | -LL | | -... | -LL | | if (let 0 = 0)? {} - | | ^ cannot use the `?` operator in a function that returns `()` -... | -LL | | -LL | | } - | |_- this function should return `Result` or `Option` to accept `?` +LL | fn nested_within_if_expr() { + | -------------------------- this function should return `Result` or `Option` to accept `?` +... +LL | if (let 0 = 0)? {} + | ^ cannot use the `?` operator in a function that returns `()` | = help: the trait `FromResidual<_>` is not implemented for `()` @@ -1693,17 +1687,11 @@ LL | while (let 0 = 0)? {} error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/disallowed-positions.rs:224:22 | -LL | / fn nested_within_while_expr() { -LL | | while &let 0 = 0 {} -LL | | -LL | | -... | -LL | | while (let 0 = 0)? {} - | | ^ cannot use the `?` operator in a function that returns `()` -... | -LL | | -LL | | } - | |_- this function should return `Result` or `Option` to accept `?` +LL | fn nested_within_while_expr() { + | ----------------------------- this function should return `Result` or `Option` to accept `?` +... +LL | while (let 0 = 0)? {} + | ^ cannot use the `?` operator in a function that returns `()` | = help: the trait `FromResidual<_>` is not implemented for `()` @@ -1881,17 +1869,11 @@ LL | (let 0 = 0)?; error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/disallowed-positions.rs:325:16 | -LL | / fn outside_if_and_while_expr() { -LL | | &let 0 = 0; -LL | | -LL | | -... | -LL | | (let 0 = 0)?; - | | ^ cannot use the `?` operator in a function that returns `()` -... | -LL | | -LL | | } - | |_- this function should return `Result` or `Option` to accept `?` +LL | fn outside_if_and_while_expr() { + | ------------------------------ this function should return `Result` or `Option` to accept `?` +... +LL | (let 0 = 0)?; + | ^ cannot use the `?` operator in a function that returns `()` | = help: the trait `FromResidual<_>` is not implemented for `()` diff --git a/src/test/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs b/src/test/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs index 12befc637..2a6c14435 100644 --- a/src/test/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs +++ b/src/test/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.rs @@ -1,4 +1,4 @@ -#![feature(let_chains, let_else)] +#![feature(let_chains)] fn main() { let opt = Some(1i32); diff --git a/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr b/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr index 1ced8d8a1..6d18d295c 100644 --- a/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr +++ b/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.stderr @@ -23,97 +23,97 @@ LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `a` - --> $DIR/param-attrs-cfg.rs:107:27 + --> $DIR/param-attrs-cfg.rs:41:27 | LL | #[cfg(something)] a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:113:27 + --> $DIR/param-attrs-cfg.rs:48:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:115:44 + --> $DIR/param-attrs-cfg.rs:50:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:67:27 + --> $DIR/param-attrs-cfg.rs:56:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:69:44 + --> $DIR/param-attrs-cfg.rs:58:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:75:27 + --> $DIR/param-attrs-cfg.rs:67:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:77:44 + --> $DIR/param-attrs-cfg.rs:69:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` -error: unused variable: `a` - --> $DIR/param-attrs-cfg.rs:41:27 - | -LL | #[cfg(something)] a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` - error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:48:27 + --> $DIR/param-attrs-cfg.rs:75:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:50:44 + --> $DIR/param-attrs-cfg.rs:77:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:56:27 + --> $DIR/param-attrs-cfg.rs:86:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:58:44 + --> $DIR/param-attrs-cfg.rs:88:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:86:27 + --> $DIR/param-attrs-cfg.rs:94:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:88:44 + --> $DIR/param-attrs-cfg.rs:96:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` +error: unused variable: `a` + --> $DIR/param-attrs-cfg.rs:107:27 + | +LL | #[cfg(something)] a: i32, + | ^ help: if this is intentional, prefix it with an underscore: `_a` + error: unused variable: `b` - --> $DIR/param-attrs-cfg.rs:94:27 + --> $DIR/param-attrs-cfg.rs:113:27 | LL | #[cfg(something)] b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` error: unused variable: `c` - --> $DIR/param-attrs-cfg.rs:96:44 + --> $DIR/param-attrs-cfg.rs:115:44 | LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs new file mode 100644 index 000000000..22d57f8be --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.rs @@ -0,0 +1,9 @@ +// only-windows +// only-x86 +#![feature(raw_dylib)] + +#[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] +//~^ ERROR import name type must be of the form `import_name_type = "string"` +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr new file mode 100644 index 000000000..0e95fec29 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-invalid-format.stderr @@ -0,0 +1,8 @@ +error: import name type must be of the form `import_name_type = "string"` + --> $DIR/import-name-type-invalid-format.rs:5:42 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = 6)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs new file mode 100644 index 000000000..7ccb0082f --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.rs @@ -0,0 +1,10 @@ +// ignore-tidy-linelength +// only-windows +// only-x86 +#![feature(raw_dylib)] + +#[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] +//~^ ERROR multiple `import_name_type` arguments in a single `#[link]` attribute +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr new file mode 100644 index 000000000..7c0e0be91 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-multiple.stderr @@ -0,0 +1,8 @@ +error: multiple `import_name_type` arguments in a single `#[link]` attribute + --> $DIR/import-name-type-multiple.rs:6:74 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated", import_name_type = "decorated")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs new file mode 100644 index 000000000..f728a578d --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.rs @@ -0,0 +1,9 @@ +// only-windows +// only-x86 +#![feature(raw_dylib)] + +#[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] +//~^ ERROR unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr new file mode 100644 index 000000000..2b299f2fe --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unknown-value.stderr @@ -0,0 +1,8 @@ +error: unknown import name type `unknown`, expected one of: decorated, noprefix, undecorated + --> $DIR/import-name-type-unknown-value.rs:5:42 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "unknown")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs new file mode 100644 index 000000000..ae9207864 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.rs @@ -0,0 +1,17 @@ +// only-windows +// only-x86 +#![feature(raw_dylib)] + +#[link(name = "foo", import_name_type = "decorated")] +//~^ ERROR import name type can only be used with link kind `raw-dylib` +extern "C" { } + +#[link(name = "bar", kind = "static", import_name_type = "decorated")] +//~^ ERROR import name type can only be used with link kind `raw-dylib` +extern "C" { } + +// Specifying `import_name_type` before `kind` shouldn't raise an error. +#[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")] +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr new file mode 100644 index 000000000..5898cd875 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-unsupported-link-kind.stderr @@ -0,0 +1,14 @@ +error: import name type can only be used with link kind `raw-dylib` + --> $DIR/import-name-type-unsupported-link-kind.rs:5:22 + | +LL | #[link(name = "foo", import_name_type = "decorated")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: import name type can only be used with link kind `raw-dylib` + --> $DIR/import-name-type-unsupported-link-kind.rs:9:39 + | +LL | #[link(name = "bar", kind = "static", import_name_type = "decorated")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs b/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs new file mode 100644 index 000000000..346ea18a8 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.rs @@ -0,0 +1,7 @@ +// only-windows +// ignore-x86 +#[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] +//~^ ERROR import name type is only supported on x86 +extern "C" { } + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr b/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr new file mode 100644 index 000000000..b56449299 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/import-name-type-x86-only.stderr @@ -0,0 +1,8 @@ +error: import name type is only supported on x86 + --> $DIR/import-name-type-x86-only.rs:3:42 + | +LL | #[link(name = "foo", kind = "raw-dylib", import_name_type = "decorated")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs index 42685cad9..1a128c87a 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs @@ -1,5 +1,4 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name="foo")] extern "C" { @@ -7,6 +6,10 @@ extern "C" { #[link_ordinal(42)] //~^ ERROR cannot use `#[link_name]` with `#[link_ordinal]` fn foo(); + #[link_name="foo"] + #[link_ordinal(5)] + //~^ ERROR cannot use `#[link_name]` with `#[link_ordinal]` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr index 5d8545b50..481a06d27 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr @@ -1,17 +1,14 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-and-name.rs:1:12 - | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 for more information - error: cannot use `#[link_name]` with `#[link_ordinal]` - --> $DIR/link-ordinal-and-name.rs:7:5 + --> $DIR/link-ordinal-and-name.rs:6:5 | LL | #[link_ordinal(42)] | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: cannot use `#[link_name]` with `#[link_ordinal]` + --> $DIR/link-ordinal-and-name.rs:10:5 + | +LL | #[link_ordinal(5)] + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs index 135f5909e..7c8da050c 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs @@ -1,11 +1,13 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo")] extern "C" { #[link_ordinal("JustMonika")] //~^ ERROR illegal ordinal format in `link_ordinal` fn foo(); + #[link_ordinal("JustMonika")] + //~^ ERROR illegal ordinal format in `link_ordinal` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr index 8453a3966..55cdcad75 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr @@ -1,19 +1,18 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-invalid-format.rs:1:12 +error: illegal ordinal format in `link_ordinal` + --> $DIR/link-ordinal-invalid-format.rs:5:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal("JustMonika")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 for more information + = note: an unsuffixed integer value, e.g., `1`, is expected error: illegal ordinal format in `link_ordinal` - --> $DIR/link-ordinal-invalid-format.rs:6:5 + --> $DIR/link-ordinal-invalid-format.rs:8:5 | LL | #[link_ordinal("JustMonika")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: an unsuffixed integer value, e.g., `1`, is expected -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs index c391ccd1c..9feed3941 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.rs @@ -1,11 +1,13 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo")] extern "C" { #[link_ordinal()] //~^ ERROR incorrect number of arguments to `#[link_ordinal]` fn foo(); + #[link_ordinal()] + //~^ ERROR incorrect number of arguments to `#[link_ordinal]` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr index 8e9edfb9d..853cdad8c 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-missing-argument.stderr @@ -1,19 +1,18 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-missing-argument.rs:1:12 +error: incorrect number of arguments to `#[link_ordinal]` + --> $DIR/link-ordinal-missing-argument.rs:5:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal()] + | ^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 for more information + = note: the attribute requires exactly one argument error: incorrect number of arguments to `#[link_ordinal]` - --> $DIR/link-ordinal-missing-argument.rs:6:5 + --> $DIR/link-ordinal-missing-argument.rs:8:5 | LL | #[link_ordinal()] | ^^^^^^^^^^^^^^^^^ | = note: the attribute requires exactly one argument -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs index 2a15b1d79..631c363d4 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs @@ -1,12 +1,14 @@ // only-windows -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo", kind = "raw-dylib")] extern "C" { #[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes #[link_ordinal(2)] fn foo(); + #[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes + #[link_ordinal(2)] + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr index 4772533ab..c0453d2bf 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr @@ -1,23 +1,26 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-multiple.rs:2:12 +error: multiple `link_ordinal` attributes + --> $DIR/link-ordinal-multiple.rs:6:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal(1)] + | ^^^^^^^^^^^^^^^^^^ help: remove this attribute | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 for more information +note: attribute also specified here + --> $DIR/link-ordinal-multiple.rs:7:5 + | +LL | #[link_ordinal(2)] + | ^^^^^^^^^^^^^^^^^^ error: multiple `link_ordinal` attributes - --> $DIR/link-ordinal-multiple.rs:7:5 + --> $DIR/link-ordinal-multiple.rs:9:5 | LL | #[link_ordinal(1)] | ^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/link-ordinal-multiple.rs:8:5 + --> $DIR/link-ordinal-multiple.rs:10:5 | LL | #[link_ordinal(2)] | ^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs new file mode 100644 index 000000000..54e614164 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.rs @@ -0,0 +1,24 @@ +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] + +#[link_ordinal(123)] +//~^ ERROR attribute should be applied to a foreign function or static +struct Foo {} + +#[link_ordinal(123)] +//~^ ERROR attribute should be applied to a foreign function or static +fn test() {} + +#[link_ordinal(42)] +//~^ ERROR attribute should be applied to a foreign function or static +static mut imported_val: i32 = 123; + +#[link(name = "exporter", kind = "raw-dylib")] +extern { + #[link_ordinal(13)] + fn imported_function(); + + #[link_ordinal(42)] + static mut imported_variable: i32; +} + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr new file mode 100644 index 000000000..ec4104fbe --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-not-foreign-fn.stderr @@ -0,0 +1,20 @@ +error: attribute should be applied to a foreign function or static + --> $DIR/link-ordinal-not-foreign-fn.rs:3:1 + | +LL | #[link_ordinal(123)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: attribute should be applied to a foreign function or static + --> $DIR/link-ordinal-not-foreign-fn.rs:7:1 + | +LL | #[link_ordinal(123)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: attribute should be applied to a foreign function or static + --> $DIR/link-ordinal-not-foreign-fn.rs:11:1 + | +LL | #[link_ordinal(42)] + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs index b6089d27e..46731581e 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.rs @@ -1,11 +1,13 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo")] extern "C" { #[link_ordinal(72436)] //~^ ERROR ordinal value in `link_ordinal` is too large: `72436` fn foo(); + #[link_ordinal(72436)] + //~^ ERROR ordinal value in `link_ordinal` is too large: `72436` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr index bbe985fa1..fef6de6ae 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr @@ -1,19 +1,18 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-too-large.rs:1:12 +error: ordinal value in `link_ordinal` is too large: `72436` + --> $DIR/link-ordinal-too-large.rs:5:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal(72436)] + | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 for more information + = note: the value may not exceed `u16::MAX` error: ordinal value in `link_ordinal` is too large: `72436` - --> $DIR/link-ordinal-too-large.rs:6:5 + --> $DIR/link-ordinal-too-large.rs:8:5 | LL | #[link_ordinal(72436)] | ^^^^^^^^^^^^^^^^^^^^^^ | = note: the value may not exceed `u16::MAX` -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs index 93286c616..71e0ac9f3 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.rs @@ -1,11 +1,13 @@ -#![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo")] extern "C" { #[link_ordinal(3, 4)] //~^ ERROR incorrect number of arguments to `#[link_ordinal]` fn foo(); + #[link_ordinal(3, 4)] + //~^ ERROR incorrect number of arguments to `#[link_ordinal]` + static mut imported_variable: i32; } fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr index 484c85a0f..7e0fcd845 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-many-arguments.stderr @@ -1,19 +1,18 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/link-ordinal-too-many-arguments.rs:1:12 +error: incorrect number of arguments to `#[link_ordinal]` + --> $DIR/link-ordinal-too-many-arguments.rs:5:5 | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ +LL | #[link_ordinal(3, 4)] + | ^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 for more information + = note: the attribute requires exactly one argument error: incorrect number of arguments to `#[link_ordinal]` - --> $DIR/link-ordinal-too-many-arguments.rs:6:5 + --> $DIR/link-ordinal-too-many-arguments.rs:8:5 | LL | #[link_ordinal(3, 4)] | ^^^^^^^^^^^^^^^^^^^^^ | = note: the attribute requires exactly one argument -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs new file mode 100644 index 000000000..329c93fc1 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.rs @@ -0,0 +1,17 @@ +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] + +#[link(name = "foo")] +extern "C" { + #[link_ordinal(3)] + //~^ ERROR `#[link_ordinal]` is only supported if link kind is `raw-dylib` + fn foo(); +} + +#[link(name = "bar", kind = "static")] +extern "C" { + #[link_ordinal(3)] + //~^ ERROR `#[link_ordinal]` is only supported if link kind is `raw-dylib` + fn bar(); +} + +fn main() {} diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr new file mode 100644 index 000000000..5fbffbda5 --- /dev/null +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-unsupported-link-kind.stderr @@ -0,0 +1,14 @@ +error: `#[link_ordinal]` is only supported if link kind is `raw-dylib` + --> $DIR/link-ordinal-unsupported-link-kind.rs:5:5 + | +LL | #[link_ordinal(3)] + | ^^^^^^^^^^^^^^^^^^ + +error: `#[link_ordinal]` is only supported if link kind is `raw-dylib` + --> $DIR/link-ordinal-unsupported-link-kind.rs:12:5 + | +LL | #[link_ordinal(3)] + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs index 13c9aa01e..6542faad2 100644 --- a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs +++ b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs @@ -3,7 +3,6 @@ // compile-flags: --crate-type lib --emit link #![allow(clashing_extern_declarations)] #![feature(raw_dylib)] -//~^ WARN the feature `raw_dylib` is incomplete #[link(name = "foo", kind = "raw-dylib")] extern "C" { fn f(x: i32); diff --git a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr index 93ca8f4d8..c6808bec7 100644 --- a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr @@ -1,17 +1,8 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multiple-declarations.rs:5:12 - | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 for more information - error: multiple declarations of external function `f` from library `foo.dll` have different calling conventions - --> $DIR/multiple-declarations.rs:15:9 + --> $DIR/multiple-declarations.rs:14:9 | LL | fn f(x: i32); | ^^^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error diff --git a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs index 5856b18aa..4efffbd53 100644 --- a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs +++ b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.rs @@ -1,7 +1,6 @@ // ignore-windows // compile-flags: --crate-type lib -#![feature(raw_dylib)] -//~^ WARNING: the feature `raw_dylib` is incomplete +#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[link(name = "foo", kind = "raw-dylib")] //~^ ERROR: link kind `raw-dylib` is only supported on Windows targets extern "C" {} diff --git a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr index 600aac81a..14e791f1f 100644 --- a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-windows-only.stderr @@ -1,18 +1,9 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/raw-dylib-windows-only.rs:3:12 - | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 for more information - error[E0455]: link kind `raw-dylib` is only supported on Windows targets - --> $DIR/raw-dylib-windows-only.rs:5:29 + --> $DIR/raw-dylib-windows-only.rs:4:29 | LL | #[link(name = "foo", kind = "raw-dylib")] | ^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0455`. diff --git a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs index dc647fd63..2f5a23e47 100644 --- a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs +++ b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs @@ -1,8 +1,6 @@ // only-x86_64 // only-windows // compile-flags: --crate-type lib --emit link -#![allow(incomplete_features)] -#![feature(raw_dylib)] #[link(name = "foo", kind = "raw-dylib")] extern "stdcall" { fn f(x: i32); diff --git a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr index d8a2a6af9..f8265ae69 100644 --- a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr @@ -1,5 +1,5 @@ error: ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture - --> $DIR/unsupported-abi.rs:8:5 + --> $DIR/unsupported-abi.rs:6:5 | LL | fn f(x: i32); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr index ec724cc96..fddc8d37f 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied - --> $DIR/const-default-method-bodies.rs:24:18 + --> $DIR/const-default-method-bodies.rs:24:5 | LL | NonConstImpl.a(); - | ^ the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl` + | ^^^^^^^^^^^^ - required by a bound introduced by this call + | | + | the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl` | note: the trait `ConstDefaultFn` is implemented for `NonConstImpl`, but that implementation is not `const` - --> $DIR/const-default-method-bodies.rs:24:18 + --> $DIR/const-default-method-bodies.rs:24:5 | LL | NonConstImpl.a(); - | ^ + | ^^^^^^^^^^^^ help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | const fn test() where NonConstImpl: ~const ConstDefaultFn { diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr index 9dbaffd4c..2295a822f 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr @@ -5,7 +5,7 @@ LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | NonTrivialDrop, - | ^^^^^^^^^^^^^^ expected an implementor of trait `~const Destruct` + | ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop` | = note: the trait bound `NonTrivialDrop: ~const Destruct` is not satisfied note: required by a bound in `check` @@ -52,15 +52,15 @@ LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | ConstDropImplWithBounds::(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an implementor of trait `~const Destruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `ConstDropImplWithBounds` | -note: required because of the requirements on the impl of `~const Destruct` for `ConstDropImplWithBounds` +note: required for `ConstDropImplWithBounds` to implement `~const Destruct` --> $DIR/const-drop-fail.rs:28:25 | LL | impl const Drop for ConstDropImplWithBounds { | ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `~const Destruct` for `ConstDropImplWithBounds` + = note: required for `ConstDropImplWithBounds` to implement `~const Destruct` note: required by a bound in `check` --> $DIR/const-drop-fail.rs:34:19 | diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr index 9dbaffd4c..2295a822f 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr @@ -5,7 +5,7 @@ LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | NonTrivialDrop, - | ^^^^^^^^^^^^^^ expected an implementor of trait `~const Destruct` + | ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop` | = note: the trait bound `NonTrivialDrop: ~const Destruct` is not satisfied note: required by a bound in `check` @@ -52,15 +52,15 @@ LL | const _: () = check($exp); | ----- required by a bound introduced by this call ... LL | ConstDropImplWithBounds::(PhantomData), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an implementor of trait `~const Destruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `ConstDropImplWithBounds` | -note: required because of the requirements on the impl of `~const Destruct` for `ConstDropImplWithBounds` +note: required for `ConstDropImplWithBounds` to implement `~const Destruct` --> $DIR/const-drop-fail.rs:28:25 | LL | impl const Drop for ConstDropImplWithBounds { | ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `~const Destruct` for `ConstDropImplWithBounds` + = note: required for `ConstDropImplWithBounds` to implement `~const Destruct` note: required by a bound in `check` --> $DIR/const-drop-fail.rs:34:19 | diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr index 174c62912..d4fa44b4b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrait` is not satisfied - --> $DIR/cross-crate.rs:17:14 + --> $DIR/cross-crate.rs:17:5 | LL | NonConst.func(); - | ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` + | ^^^^^^^^ ---- required by a bound introduced by this call + | | + | the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` | note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const` - --> $DIR/cross-crate.rs:17:14 + --> $DIR/cross-crate.rs:17:5 | LL | NonConst.func(); - | ^^^^ + | ^^^^^^^^ help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | const fn const_context() where cross_crate::NonConst: ~const cross_crate::MyTrait { diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr index 4619dd113..71ecd9b06 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `cross_crate::NonConst: cross_crate::MyTrait` is not satisfied - --> $DIR/cross-crate.rs:17:14 + --> $DIR/cross-crate.rs:17:5 | LL | NonConst.func(); - | ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` + | ^^^^^^^^ ---- required by a bound introduced by this call + | | + | the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` | note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const` - --> $DIR/cross-crate.rs:17:14 + --> $DIR/cross-crate.rs:17:5 | LL | NonConst.func(); - | ^^^^ + | ^^^^^^^^ help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | const fn const_context() where cross_crate::NonConst: ~const cross_crate::MyTrait { diff --git a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr index b229053eb..85285ba84 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied - --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12 + --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:9 | LL | ().a() - | ^ the trait `~const Tr` is not implemented for `()` + | ^^ - required by a bound introduced by this call + | | + | the trait `~const Tr` is not implemented for `()` | note: the trait `Tr` is implemented for `()`, but that implementation is not `const` - --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12 + --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:9 | LL | ().a() - | ^ + | ^^ help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | pub trait Tr where (): ~const Tr { diff --git a/src/test/ui/rfc-2632-const-trait-impl/issue-100222.rs b/src/test/ui/rfc-2632-const-trait-impl/issue-100222.rs new file mode 100644 index 000000000..1004bb28c --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/issue-100222.rs @@ -0,0 +1,29 @@ +// revisions: nn ny yn yy +// check-pass +#![feature(const_trait_impl, associated_type_defaults, const_mut_refs)] + +#[cfg_attr(any(yn, yy), const_trait)] +pub trait Index { + type Output; +} + +#[cfg_attr(any(ny, yy), const_trait)] +pub trait IndexMut where Self: Index { + const C: ::Output; + type Assoc = ::Output; + fn foo(&mut self, x: ::Output) -> ::Output; +} + +impl Index for () { type Output = (); } + +impl const IndexMut for <() as Index>::Output { + const C: ::Output = (); + type Assoc = ::Output; + fn foo(&mut self, x: ::Output) -> ::Output + where ::Output:, + {} +} + +const C: <() as Index>::Output = (); + +fn main() {} diff --git a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr index d5b2d2697..fd5fe25dd 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr @@ -20,16 +20,16 @@ LL | const fn test1() { | ++++++++++++ error[E0277]: the trait bound `T: ~const Bar` is not satisfied - --> $DIR/trait-where-clause.rs:15:5 + --> $DIR/trait-where-clause.rs:15:12 | LL | T::c::(); - | ^^^^^^^^^ the trait `~const Bar` is not implemented for `T` + | ^ the trait `~const Bar` is not implemented for `T` | note: the trait `Bar` is implemented for `T`, but that implementation is not `const` - --> $DIR/trait-where-clause.rs:15:5 + --> $DIR/trait-where-clause.rs:15:12 | LL | T::c::(); - | ^^^^^^^^^ + | ^ note: required by a bound in `Foo::c` --> $DIR/trait-where-clause.rs:8:13 | @@ -57,10 +57,10 @@ LL | fn test3() { | +++++ error[E0277]: the trait bound `T: Bar` is not satisfied - --> $DIR/trait-where-clause.rs:29:5 + --> $DIR/trait-where-clause.rs:29:12 | LL | T::c::(); - | ^^^^^^^^^ the trait `Bar` is not implemented for `T` + | ^ the trait `Bar` is not implemented for `T` | note: required by a bound in `Foo::c` --> $DIR/trait-where-clause.rs:8:13 diff --git a/src/test/ui/rfc-2632-const-trait-impl/without-tilde.rs b/src/test/ui/rfc-2632-const-trait-impl/without-tilde.rs index e8b261545..d63381b5f 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/without-tilde.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/without-tilde.rs @@ -3,4 +3,4 @@ #![feature(const_trait_impl)] struct S; -//~^ ERROR expected one of `!`, `(`, `,`, `=`, `>`, `?`, `for`, `~`, lifetime, or path +//~^ ERROR const bounds must start with `~` diff --git a/src/test/ui/rfc-2632-const-trait-impl/without-tilde.stderr b/src/test/ui/rfc-2632-const-trait-impl/without-tilde.stderr index b6b77ac4a..31300354a 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/without-tilde.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/without-tilde.stderr @@ -1,8 +1,10 @@ -error: expected one of `!`, `(`, `,`, `=`, `>`, `?`, `for`, `~`, lifetime, or path, found keyword `const` +error: const bounds must start with `~` --> $DIR/without-tilde.rs:5:13 | LL | struct S; - | ^^^^^ expected one of 10 possible tokens + | -^^^^ + | | + | help: add `~`: `~` error: aborting due to previous error diff --git a/src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr b/src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr index 94a90a568..fc7bf2277 100644 --- a/src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr +++ b/src/test/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr @@ -6,7 +6,7 @@ LL | call(foo); | | | required by a bound introduced by this call | - = help: the trait `Fn<()>` is not implemented for `fn() {foo}` + = help: the trait `Fn<()>` is not implemented for fn item `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits note: required by a bound in `call` @@ -23,7 +23,7 @@ LL | call_mut(foo); | | | required by a bound introduced by this call | - = help: the trait `FnMut<()>` is not implemented for `fn() {foo}` + = help: the trait `FnMut<()>` is not implemented for fn item `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits note: required by a bound in `call_mut` @@ -40,7 +40,7 @@ LL | call_once(foo); | | | required by a bound introduced by this call | - = help: the trait `FnOnce<()>` is not implemented for `fn() {foo}` + = help: the trait `FnOnce<()>` is not implemented for fn item `fn() {foo}` = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits note: required by a bound in `call_once` @@ -57,7 +57,7 @@ LL | call(foo_unsafe); | | | required by a bound introduced by this call | - = help: the trait `Fn<()>` is not implemented for `unsafe fn() {foo_unsafe}` + = help: the trait `Fn<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits note: required by a bound in `call` @@ -74,7 +74,7 @@ LL | call_mut(foo_unsafe); | | | required by a bound introduced by this call | - = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {foo_unsafe}` + = help: the trait `FnMut<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits note: required by a bound in `call_mut` @@ -91,7 +91,7 @@ LL | call_once(foo_unsafe); | | | required by a bound introduced by this call | - = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {foo_unsafe}` + = help: the trait `FnOnce<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}` = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }` = note: `#[target_feature]` functions do not implement the `Fn` traits note: required by a bound in `call_once` diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr index 647a9f393..c6bc082cf 100644 --- a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr +++ b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr @@ -13,9 +13,8 @@ LL | #![warn(rust_2021_prefixes_incompatible_syntax)] = note: for more information, see help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | -LL - m2!(z"hey"); -LL + m2!(z "hey"); - | +LL | m2!(z "hey"); + | + warning: prefix `prefix` is unknown --> $DIR/reserved-prefixes-migration.rs:19:9 @@ -27,9 +26,8 @@ LL | m2!(prefix"hey"); = note: for more information, see help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | -LL - m2!(prefix"hey"); -LL + m2!(prefix "hey"); - | +LL | m2!(prefix "hey"); + | + warning: prefix `hey` is unknown --> $DIR/reserved-prefixes-migration.rs:22:9 @@ -41,9 +39,8 @@ LL | m3!(hey#123); = note: for more information, see help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | -LL - m3!(hey#123); -LL + m3!(hey #123); - | +LL | m3!(hey #123); + | + warning: prefix `hey` is unknown --> $DIR/reserved-prefixes-migration.rs:25:9 @@ -55,9 +52,8 @@ LL | m3!(hey#hey); = note: for more information, see help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | -LL - m3!(hey#hey); -LL + m3!(hey #hey); - | +LL | m3!(hey #hey); + | + warning: prefix `kind` is unknown --> $DIR/reserved-prefixes-migration.rs:35:14 @@ -69,9 +65,8 @@ LL | #name = #kind#value = note: for more information, see help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | -LL - #name = #kind#value -LL + #name = #kind #value - | +LL | #name = #kind #value + | + warning: 5 warnings emitted diff --git a/src/test/ui/rust-2021/reserved-prefixes.stderr b/src/test/ui/rust-2021/reserved-prefixes.stderr index df31aee66..807d6d98b 100644 --- a/src/test/ui/rust-2021/reserved-prefixes.stderr +++ b/src/test/ui/rust-2021/reserved-prefixes.stderr @@ -7,9 +7,8 @@ LL | demo3!(foo#bar); = note: prefixed identifiers and literals are reserved since Rust 2021 help: consider inserting whitespace here | -LL - demo3!(foo#bar); -LL + demo3!(foo #bar); - | +LL | demo3!(foo #bar); + | + error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:17:12 @@ -20,9 +19,8 @@ LL | demo2!(foo"bar"); = note: prefixed identifiers and literals are reserved since Rust 2021 help: consider inserting whitespace here | -LL - demo2!(foo"bar"); -LL + demo2!(foo "bar"); - | +LL | demo2!(foo "bar"); + | + error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:18:12 @@ -33,9 +31,8 @@ LL | demo2!(foo'b'); = note: prefixed identifiers and literals are reserved since Rust 2021 help: consider inserting whitespace here | -LL - demo2!(foo'b'); -LL + demo2!(foo 'b'); - | +LL | demo2!(foo 'b'); + | + error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:20:12 @@ -46,9 +43,8 @@ LL | demo2!(foo'b); = note: prefixed identifiers and literals are reserved since Rust 2021 help: consider inserting whitespace here | -LL - demo2!(foo'b); -LL + demo2!(foo 'b); - | +LL | demo2!(foo 'b); + | + error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:21:12 @@ -59,9 +55,8 @@ LL | demo3!(foo# bar); = note: prefixed identifiers and literals are reserved since Rust 2021 help: consider inserting whitespace here | -LL - demo3!(foo# bar); -LL + demo3!(foo # bar); - | +LL | demo3!(foo # bar); + | + error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:22:12 @@ -72,9 +67,8 @@ LL | demo4!(foo#! bar); = note: prefixed identifiers and literals are reserved since Rust 2021 help: consider inserting whitespace here | -LL - demo4!(foo#! bar); -LL + demo4!(foo #! bar); - | +LL | demo4!(foo #! bar); + | + error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:23:12 @@ -85,9 +79,8 @@ LL | demo4!(foo## bar); = note: prefixed identifiers and literals are reserved since Rust 2021 help: consider inserting whitespace here | -LL - demo4!(foo## bar); -LL + demo4!(foo ## bar); - | +LL | demo4!(foo ## bar); + | + error: prefix `foo` is unknown --> $DIR/reserved-prefixes.rs:25:12 @@ -98,9 +91,8 @@ LL | demo4!(foo#bar#); = note: prefixed identifiers and literals are reserved since Rust 2021 help: consider inserting whitespace here | -LL - demo4!(foo#bar#); -LL + demo4!(foo #bar#); - | +LL | demo4!(foo #bar#); + | + error: prefix `bar` is unknown --> $DIR/reserved-prefixes.rs:25:16 @@ -111,9 +103,8 @@ LL | demo4!(foo#bar#); = note: prefixed identifiers and literals are reserved since Rust 2021 help: consider inserting whitespace here | -LL - demo4!(foo#bar#); -LL + demo4!(foo#bar #); - | +LL | demo4!(foo#bar #); + | + error: aborting due to 9 previous errors diff --git a/src/test/ui/sanitize/memory-eager.rs b/src/test/ui/sanitize/memory-eager.rs new file mode 100644 index 000000000..cc0593ec0 --- /dev/null +++ b/src/test/ui/sanitize/memory-eager.rs @@ -0,0 +1,38 @@ +// needs-sanitizer-support +// needs-sanitizer-memory +// min-llvm-version: 14.0.0 +// +// revisions: unoptimized optimized +// +// [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O +// [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins +// +// run-fail +// error-pattern: MemorySanitizer: use-of-uninitialized-value +// error-pattern: Uninitialized value was created by an allocation +// error-pattern: in the stack frame +// +// This test case intentionally limits the usage of the std, +// since it will be linked with an uninstrumented version of it. + +#![feature(core_intrinsics)] +#![feature(start)] +#![feature(bench_black_box)] + +use std::hint::black_box; +use std::mem::MaybeUninit; + +#[inline(never)] +#[no_mangle] +#[allow(invalid_value)] +fn random() -> char { + let r = unsafe { MaybeUninit::uninit().assume_init() }; + // Avoid optimizing everything out. + black_box(r) +} + +#[start] +fn main(_: isize, _: *const *const u8) -> isize { + random(); + 0 +} diff --git a/src/test/ui/sanitize/memory.rs b/src/test/ui/sanitize/memory.rs index b53f19a5b..14d4de65d 100644 --- a/src/test/ui/sanitize/memory.rs +++ b/src/test/ui/sanitize/memory.rs @@ -1,12 +1,15 @@ // needs-sanitizer-support // needs-sanitizer-memory // -// compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O +// revisions: unoptimized optimized +// +// [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O +// [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins // // run-fail // error-pattern: MemorySanitizer: use-of-uninitialized-value // error-pattern: Uninitialized value was created by an allocation -// error-pattern: in the stack frame of function 'main' +// error-pattern: in the stack frame // // This test case intentionally limits the usage of the std, // since it will be linked with an uninstrumented version of it. @@ -14,6 +17,7 @@ #![feature(core_intrinsics)] #![feature(start)] #![feature(bench_black_box)] +#![allow(invalid_value)] use std::hint::black_box; use std::mem::MaybeUninit; @@ -21,9 +25,9 @@ use std::mem::MaybeUninit; #[inline(never)] #[no_mangle] fn random() -> [isize; 32] { - let r = unsafe { MaybeUninit::uninit().assume_init() }; + let r = MaybeUninit::uninit(); // Avoid optimizing everything out. - black_box(r) + unsafe { std::intrinsics::volatile_load(r.as_ptr()) } } #[inline(never)] @@ -38,6 +42,6 @@ fn xor(a: &[isize]) -> isize { #[start] fn main(_: isize, _: *const *const u8) -> isize { - let r = random(); + let r = black_box(random as fn() -> [isize; 32])(); xor(&r) } diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr index 35a65facb..0ec0d4be5 100644 --- a/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr +++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr @@ -31,7 +31,7 @@ LL | trait Foo { | --- this trait cannot be made into an object... LL | fn foo(self: &Rc) -> usize; | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on - = note: required because of the requirements on the impl of `CoerceUnsized>` for `Rc` + = note: required for `Rc` to implement `CoerceUnsized>` = note: required by cast to type `Rc` error: aborting due to 2 previous errors diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr index a74752cf8..b494b448e 100644 --- a/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr +++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr @@ -14,7 +14,7 @@ LL | trait Foo { | --- this trait cannot be made into an object... LL | fn foo(self: &Rc) -> usize; | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on - = note: required because of the requirements on the impl of `CoerceUnsized>` for `Rc` + = note: required for `Rc` to implement `CoerceUnsized>` = note: required by cast to type `Rc` error: aborting due to previous error diff --git a/src/test/ui/simd/intrinsic/ptr-cast.rs b/src/test/ui/simd/intrinsic/ptr-cast.rs new file mode 100644 index 000000000..1d13720bc --- /dev/null +++ b/src/test/ui/simd/intrinsic/ptr-cast.rs @@ -0,0 +1,33 @@ +// run-pass + +#![feature(repr_simd, platform_intrinsics)] + +extern "platform-intrinsic" { + fn simd_cast_ptr(x: T) -> U; + fn simd_expose_addr(x: T) -> U; + fn simd_from_exposed_addr(x: T) -> U; +} + +#[derive(Copy, Clone)] +#[repr(simd)] +struct V([T; 2]); + +fn main() { + unsafe { + let mut foo = 4i8; + let ptr = &mut foo as *mut i8; + + let ptrs = V::<*mut i8>([ptr, core::ptr::null_mut()]); + + // change constness and type + let const_ptrs: V<*const u8> = simd_cast_ptr(ptrs); + + let exposed_addr: V = simd_expose_addr(const_ptrs); + + let from_exposed_addr: V<*mut i8> = simd_from_exposed_addr(exposed_addr); + + assert!(const_ptrs.0 == [ptr as *const u8, core::ptr::null()]); + assert!(exposed_addr.0 == [ptr as usize, 0]); + assert!(from_exposed_addr.0 == ptrs.0); + } +} diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs index b280c8ab6..94f578af2 100644 --- a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs +++ b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs @@ -12,7 +12,8 @@ impl A { 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 mismatched types +//~| 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 diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr index 50de23229..3814c568e 100644 --- a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr +++ b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr @@ -1,5 +1,5 @@ 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:19:53 | LL | trait C{async fn new(val: T) {} | - unclosed delimiter @@ -25,17 +25,6 @@ LL | trait C{async fn new(val: T) {} = help: pass `--edition 2021` to `rustc` = note: for more on editions, read https://doc.rust-lang.org/edition-guide -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/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 - error[E0423]: expected function, found module `crate` --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:9:5 | @@ -51,6 +40,19 @@ LL | pub struct A {} 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(return_position_impl_trait_in_trait)]` to the crate attributes to enable + 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 | @@ -72,6 +74,20 @@ help: add a dummy let to cause `path` to be fully captured LL | async fn create(path: impl AsRef) { let _ = &path; | ++++++++++++++ +error[E0308]: mismatched types + --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30 + | +LL | trait C{async fn new(val: T) {} + | ^^ expected associated type, found opaque type + | + ::: $SRC_DIR/core/src/future/mod.rs:LL:COL + | +LL | pub const fn from_generator(gen: T) -> impl Future + | ------------------------------- the found opaque type + | + = note: expected associated type `impl Future` (trait associated opaque type at <$DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30>) + found opaque type `impl Future` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>) + 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 | @@ -87,7 +103,7 @@ 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 7 previous errors; 2 warnings emitted -Some errors have detailed explanations: E0412, E0423, E0670, E0706. -For more information about an error, try `rustc --explain E0412`. +Some errors have detailed explanations: E0308, E0412, E0423, E0670, E0706. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr index e676d7372..15179954a 100644 --- a/src/test/ui/span/issue-34264.stderr +++ b/src/test/ui/span/issue-34264.stderr @@ -64,7 +64,7 @@ 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 @@ -78,7 +78,7 @@ note: function defined here --> $DIR/issue-34264.rs:3:4 | LL | fn bar(x, y: usize) {} - | ^^^ - -------- + | ^^^ -------- error[E0061]: this function takes 2 arguments but 3 arguments were supplied --> $DIR/issue-34264.rs:10:5 @@ -94,7 +94,7 @@ 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/src/test/ui/span/issue-35987.stderr b/src/test/ui/span/issue-35987.stderr index 2bc3ff4c3..d8fddc800 100644 --- a/src/test/ui/span/issue-35987.stderr +++ b/src/test/ui/span/issue-35987.stderr @@ -2,7 +2,9 @@ error[E0404]: expected trait, found type parameter `Add` --> $DIR/issue-35987.rs:5:21 | LL | impl Add for Foo { - | ^^^ not a trait + | --- ^^^ not a trait + | | + | found this type parameter | help: consider importing this trait instead | diff --git a/src/test/ui/span/issue-36530.rs b/src/test/ui/span/issue-36530.rs deleted file mode 100644 index 70e04bf7e..000000000 --- a/src/test/ui/span/issue-36530.rs +++ /dev/null @@ -1,12 +0,0 @@ -// gate-test-custom_inner_attributes - -#![feature(register_attr)] - -#![register_attr(foo)] - -#[foo] -mod foo { - #![foo] //~ ERROR custom inner attributes are unstable -} - -fn main() {} diff --git a/src/test/ui/span/issue-36530.stderr b/src/test/ui/span/issue-36530.stderr deleted file mode 100644 index a998d7217..000000000 --- a/src/test/ui/span/issue-36530.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: custom inner attributes are unstable - --> $DIR/issue-36530.rs:9:8 - | -LL | #![foo] - | ^^^ - | - = note: see issue #54726 for more information - = help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/span/lint-unused-unsafe-thir.rs b/src/test/ui/span/lint-unused-unsafe-thir.rs index 95a537ed2..adb72c26b 100644 --- a/src/test/ui/span/lint-unused-unsafe-thir.rs +++ b/src/test/ui/span/lint-unused-unsafe-thir.rs @@ -22,7 +22,7 @@ fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block +unsafe fn bad5() { unsafe { unsf() } } fn bad6() { unsafe { // don't put the warning here unsafe { //~ ERROR: unnecessary `unsafe` block @@ -31,7 +31,7 @@ fn bad6() { } } unsafe fn bad7() { - unsafe { //~ ERROR: unnecessary `unsafe` block + unsafe { unsafe { //~ ERROR: unnecessary `unsafe` block unsf() } diff --git a/src/test/ui/span/lint-unused-unsafe-thir.stderr b/src/test/ui/span/lint-unused-unsafe-thir.stderr index 6654910c5..3bcbb7597 100644 --- a/src/test/ui/span/lint-unused-unsafe-thir.stderr +++ b/src/test/ui/span/lint-unused-unsafe-thir.stderr @@ -30,14 +30,6 @@ error: unnecessary `unsafe` block LL | fn bad4() { unsafe { callback(||{}) } } | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:25:20 - | -LL | unsafe fn bad5() { unsafe { unsf() } } - | ---------------- ^^^^^^ unnecessary `unsafe` block - | | - | because it's nested under this `unsafe` fn - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe-thir.rs:28:9 | @@ -54,13 +46,5 @@ LL | unsafe { LL | unsafe { | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:34:5 - | -LL | unsafe fn bad7() { - | ---------------- because it's nested under this `unsafe` fn -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 8 previous errors +error: aborting due to 6 previous errors diff --git a/src/test/ui/span/lint-unused-unsafe.mir.stderr b/src/test/ui/span/lint-unused-unsafe.mir.stderr index 850550a1d..d8412908c 100644 --- a/src/test/ui/span/lint-unused-unsafe.mir.stderr +++ b/src/test/ui/span/lint-unused-unsafe.mir.stderr @@ -28,17 +28,6 @@ error: unnecessary `unsafe` block LL | fn bad4() { unsafe { callback(||{}) } } | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:30:20 - | -LL | unsafe fn bad5() { unsafe { unsf() } } - | ---------------- ^^^^^^ unnecessary `unsafe` block - | | - | because it's nested under this `unsafe` fn - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - = note: `#[allow(unsafe_op_in_unsafe_fn)]` on by default - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:32:5 | @@ -51,17 +40,6 @@ error: unnecessary `unsafe` block LL | unsafe { | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:40:9 - | -LL | unsafe fn bad7() { - | ---------------- because it's nested under this `unsafe` fn -LL | unsafe { -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:74:9 | @@ -272,91 +250,32 @@ error: unnecessary `unsafe` block LL | unsafe { | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:197:13 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -LL | unsafe { -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:194:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:198:13 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:199:13 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:205:9 - | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:203:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:207:13 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -... +LL | unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:208:13 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | unsafe { + | ------ because it's nested under this `unsafe` block ... LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:209:13 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | unsafe { + | ------ because it's nested under this `unsafe` block ... LL | unsafe { unsf() } | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:220:17 @@ -398,19 +317,12 @@ LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:254:9 + --> $DIR/lint-unused-unsafe.rs:255:13 | -LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { - | ----------------------------------------------- because it's nested under this `unsafe` fn LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:252:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ------ because it's nested under this `unsafe` block +LL | unsafe { + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:268:13 @@ -630,91 +542,32 @@ error: unnecessary `unsafe` block LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:409:24 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -LL | let _ = || unsafe { -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:406:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:410:24 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:411:24 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:417:20 - | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:415:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:419:24 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -... +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:420:24 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:421:24 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:432:28 @@ -756,19 +609,12 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:466:20 + --> $DIR/lint-unused-unsafe.rs:467:24 | -LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { - | ----------------------------------------------- because it's nested under this `unsafe` fn LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:464:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:480:24 @@ -988,91 +834,32 @@ error: unnecessary `unsafe` block LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:622:24 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -LL | let _ = || unsafe { -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:619:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:623:24 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:624:24 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:630:20 - | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:628:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:632:24 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -... +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsf(); LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:633:24 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:634:24 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = || unsafe { let _ = || unsf(); }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:645:28 @@ -1114,19 +901,12 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:679:20 + --> $DIR/lint-unused-unsafe.rs:680:24 | -LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { - | ----------------------------------------------- because it's nested under this `unsafe` fn LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:677:13 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:693:24 @@ -1256,91 +1036,32 @@ error: unnecessary `unsafe` block LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:784:28 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -LL | let _ = || unsafe { -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:781:17 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:785:28 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:786:28 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:792:24 - | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:790:17 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:794:28 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -... +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:795:28 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:796:28 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:807:32 @@ -1382,19 +1103,12 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:841:24 + --> $DIR/lint-unused-unsafe.rs:842:28 | -LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { - | ----------------------------------------------- because it's nested under this `unsafe` fn LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:839:17 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:855:28 @@ -1524,91 +1238,32 @@ error: unnecessary `unsafe` block LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:942:28 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -LL | let _ = || unsafe { -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:939:17 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:943:28 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:944:28 - | -LL | unsafe fn granularity_2() { - | ------------------------- because it's nested under this `unsafe` fn -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:950:24 - | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:948:17 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:952:28 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn -... +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block +LL | unsf(); LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:953:28 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:954:28 | -LL | unsafe fn top_level_used_2() { - | ---------------------------- because it's nested under this `unsafe` fn +LL | let _ = || unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = || unsafe { unsf() }; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:965:32 @@ -1650,19 +1305,12 @@ LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:999:24 + --> $DIR/lint-unused-unsafe.rs:1000:28 | -LL | unsafe fn granular_disallow_op_in_unsafe_fn_3() { - | ----------------------------------------------- because it's nested under this `unsafe` fn LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:997:17 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ------ because it's nested under this `unsafe` block +LL | let _ = || unsafe { + | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:1013:28 @@ -1672,21 +1320,6 @@ LL | let _ = || unsafe { LL | let _ = || unsafe { | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1044:9 - | -LL | unsafe fn multiple_unsafe_op_in_unsafe_fn_allows() { - | -------------------------------------------------- because it's nested under this `unsafe` fn -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:1045:21 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:1059:29 | @@ -1726,87 +1359,32 @@ error: unnecessary `unsafe` block LL | let _ = async { unsafe { | ^^^^^^ unnecessary `unsafe` block -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1074:33 - | -LL | async unsafe fn async_blocks() { - | ------------------------------ because it's nested under this `unsafe` fn -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:1071:17 - | -LL | #[allow(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1075:33 - | -LL | async unsafe fn async_blocks() { - | ------------------------------ because it's nested under this `unsafe` fn -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1076:33 - | -LL | async unsafe fn async_blocks() { - | ------------------------------ because it's nested under this `unsafe` fn -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1078:29 - | -LL | async unsafe fn async_blocks() { - | ------------------------------ because it's nested under this `unsafe` fn -... -LL | let _ = async { unsafe { - | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` - error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:1080:33 | -LL | async unsafe fn async_blocks() { - | ------------------------------ because it's nested under this `unsafe` fn -... +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block +LL | let _ = async { unsf() }; LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:1081:33 | -LL | async unsafe fn async_blocks() { - | ------------------------------ because it's nested under this `unsafe` fn +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:1082:33 | -LL | async unsafe fn async_blocks() { - | ------------------------------ because it's nested under this `unsafe` fn +LL | let _ = async { unsafe { + | ------ because it's nested under this `unsafe` block ... LL | let _ = async { unsafe { let _ = async { unsf() }; }}; | ^^^^^^ unnecessary `unsafe` block - | - = note: this `unsafe` block does contain unsafe operations, but those are already allowed in an `unsafe fn` error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:1092:22 @@ -1820,5 +1398,5 @@ error: unnecessary `unsafe` block LL | let _x: [(); unsafe { unsafe { size() } }] = []; | ^^^^^^ unnecessary `unsafe` block -error: aborting due to 201 previous errors +error: aborting due to 174 previous errors diff --git a/src/test/ui/span/lint-unused-unsafe.rs b/src/test/ui/span/lint-unused-unsafe.rs index f8d1dff35..5d042768b 100644 --- a/src/test/ui/span/lint-unused-unsafe.rs +++ b/src/test/ui/span/lint-unused-unsafe.rs @@ -27,7 +27,7 @@ fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block +unsafe fn bad5() { unsafe { unsf() } } fn bad6() { unsafe { //~ ERROR: unnecessary `unsafe` block unsafe { // don't put the warning here @@ -37,7 +37,7 @@ fn bad6() { } unsafe fn bad7() { unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { //~ ERROR: unnecessary `unsafe` block + unsafe { unsf() } } @@ -194,15 +194,15 @@ mod additional_tests { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granularity_2() { unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block + unsafe { unsf() } + unsafe { unsf() } + unsafe { unsf() } } } #[allow(unsafe_op_in_unsafe_fn)] unsafe fn top_level_used_2() { - unsafe { //~ ERROR: unnecessary `unsafe` block + unsafe { unsf(); unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block @@ -251,8 +251,8 @@ mod additional_tests { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granular_disallow_op_in_unsafe_fn_3() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { + unsafe { + unsafe { //~ ERROR: unnecessary `unsafe` block #[deny(unsafe_op_in_unsafe_fn)] { unsf(); @@ -406,15 +406,15 @@ mod additional_tests_closures { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granularity_2() { let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block + let _ = || unsafe { unsf() }; + let _ = || unsafe { unsf() }; + let _ = || unsafe { unsf() }; }; } #[allow(unsafe_op_in_unsafe_fn)] unsafe fn top_level_used_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block + let _ = || unsafe { unsf(); let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block @@ -463,8 +463,8 @@ mod additional_tests_closures { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granular_disallow_op_in_unsafe_fn_3() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { + let _ = || unsafe { + let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block #[deny(unsafe_op_in_unsafe_fn)] { unsf(); @@ -619,15 +619,15 @@ mod additional_tests_even_more_closures { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granularity_2() { let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block + let _ = || unsafe { let _ = || unsf(); }; + let _ = || unsafe { let _ = || unsf(); }; + let _ = || unsafe { let _ = || unsf(); }; }; } #[allow(unsafe_op_in_unsafe_fn)] unsafe fn top_level_used_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block + let _ = || unsafe { let _ = || unsf(); let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block @@ -676,8 +676,8 @@ mod additional_tests_even_more_closures { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granular_disallow_op_in_unsafe_fn_3() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { + let _ = || unsafe { + let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block #[deny(unsafe_op_in_unsafe_fn)] { let _ = || unsf(); @@ -781,15 +781,15 @@ mod item_likes { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granularity_2() { let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block + let _ = || unsafe { unsf() }; + let _ = || unsafe { unsf() }; + let _ = || unsafe { unsf() }; }; } #[allow(unsafe_op_in_unsafe_fn)] unsafe fn top_level_used_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block + let _ = || unsafe { unsf(); let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block @@ -838,8 +838,8 @@ mod item_likes { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granular_disallow_op_in_unsafe_fn_3() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { + let _ = || unsafe { + let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block #[deny(unsafe_op_in_unsafe_fn)] { unsf(); @@ -939,15 +939,15 @@ mod item_likes { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granularity_2() { let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block + let _ = || unsafe { unsf() }; + let _ = || unsafe { unsf() }; + let _ = || unsafe { unsf() }; }; } #[allow(unsafe_op_in_unsafe_fn)] unsafe fn top_level_used_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block + let _ = || unsafe { unsf(); let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block @@ -996,8 +996,8 @@ mod item_likes { #[allow(unsafe_op_in_unsafe_fn)] unsafe fn granular_disallow_op_in_unsafe_fn_3() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { + let _ = || unsafe { + let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block #[deny(unsafe_op_in_unsafe_fn)] { unsf(); @@ -1041,7 +1041,7 @@ mod additional_tests_extra { #[warn(unsafe_op_in_unsafe_fn)] unsafe fn multiple_unsafe_op_in_unsafe_fn_allows() { - unsafe { //~ ERROR: unnecessary `unsafe` block + unsafe { #[allow(unsafe_op_in_unsafe_fn)] { unsf(); @@ -1071,11 +1071,11 @@ mod additional_tests_extra { #[allow(unsafe_op_in_unsafe_fn)] { let _ = async { unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block - let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block - let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block + let _ = async { unsafe { let _ = async { unsf() }; }}; + let _ = async { unsafe { let _ = async { unsf() }; }}; + let _ = async { unsafe { let _ = async { unsf() }; }}; }}; - let _ = async { unsafe { //~ ERROR: unnecessary `unsafe` block + let _ = async { unsafe { let _ = async { unsf() }; let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index e68260e4a..b76a3ab30 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -12,7 +12,7 @@ LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), help: provide the argument | LL | let _: Result<(), String> = Ok(()); - | ~~~~~~ + | ~~~~ error[E0061]: this function takes 2 arguments but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:12:5 @@ -28,7 +28,7 @@ LL | fn foo(():(), ():()) {} help: provide the arguments | LL | foo((), ()); - | ~~~~~~~~~~~ + | ~~~~~~~~ error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing-unit-argument.rs:13:5 @@ -44,7 +44,7 @@ LL | fn foo(():(), ():()) {} help: provide the argument | LL | foo((), ()); - | ~~~~~~~~~~~ + | ~~~~~~~~ error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:14:5 @@ -60,7 +60,7 @@ LL | fn bar(():()) {} help: provide the argument | LL | bar(()); - | ~~~~~~~ + | ~~~~ error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:15:7 @@ -72,11 +72,11 @@ note: associated function defined here --> $DIR/missing-unit-argument.rs:6:8 | LL | fn baz(self, (): ()) { } - | ^^^ ---- ------ + | ^^^ ------ help: provide the argument | LL | S.baz(()); - | ~~~~~~~ + | ~~~~ error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:16:7 @@ -88,11 +88,11 @@ note: associated function defined here --> $DIR/missing-unit-argument.rs:7:8 | LL | fn generic(self, _: T) { } - | ^^^^^^^ ---- ---- + | ^^^^^^^ ---- help: provide the argument | LL | S.generic::<()>(()); - | ~~~~~~~~~~~~~~~~~ + | ~~~~ error: aborting due to 6 previous errors diff --git a/src/test/ui/specialization/default-generic-associated-type-bound.rs b/src/test/ui/specialization/default-generic-associated-type-bound.rs index 0f5714e99..31a0685d0 100644 --- a/src/test/ui/specialization/default-generic-associated-type-bound.rs +++ b/src/test/ui/specialization/default-generic-associated-type-bound.rs @@ -1,8 +1,7 @@ // Check that default generics associated types are validated. #![feature(specialization)] -#![feature(generic_associated_types)] -//~^^ WARNING `specialization` is incomplete +//~^ WARNING `specialization` is incomplete trait X { type U<'a>: PartialEq<&'a Self> where Self: 'a; diff --git a/src/test/ui/specialization/default-generic-associated-type-bound.stderr b/src/test/ui/specialization/default-generic-associated-type-bound.stderr index 58c6667c8..44c24c1e5 100644 --- a/src/test/ui/specialization/default-generic-associated-type-bound.stderr +++ b/src/test/ui/specialization/default-generic-associated-type-bound.stderr @@ -9,14 +9,14 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete error[E0277]: can't compare `T` with `T` - --> $DIR/default-generic-associated-type-bound.rs:18:26 + --> $DIR/default-generic-associated-type-bound.rs:17:26 | LL | default type U<'a> = &'a T; | ^^^^^ no implementation for `T == T` | - = note: required because of the requirements on the impl of `PartialEq` for `&'a T` + = note: required for `&'a T` to implement `PartialEq` note: required by a bound in `X::U` - --> $DIR/default-generic-associated-type-bound.rs:8:17 + --> $DIR/default-generic-associated-type-bound.rs:7:17 | LL | type U<'a>: PartialEq<&'a Self> where Self: 'a; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `X::U` diff --git a/src/test/ui/specialization/issue-33017.rs b/src/test/ui/specialization/issue-33017.rs index 4d19230df..8dbadf58d 100644 --- a/src/test/ui/specialization/issue-33017.rs +++ b/src/test/ui/specialization/issue-33017.rs @@ -1,4 +1,4 @@ -// Test to ensure that trait bounds are propertly +// Test to ensure that trait bounds are properly // checked on specializable associated types #![allow(incomplete_features)] diff --git a/src/test/ui/specialization/issue-38091-2.stderr b/src/test/ui/specialization/issue-38091-2.stderr index a93f27ff0..146a56358 100644 --- a/src/test/ui/specialization/issue-38091-2.stderr +++ b/src/test/ui/specialization/issue-38091-2.stderr @@ -10,7 +10,7 @@ LL | #![feature(specialization)] error[E0275]: overflow evaluating the requirement `i32: Check` | -note: required because of the requirements on the impl of `Iterate` for `i32` +note: required for `i32` to implement `Iterate` --> $DIR/issue-38091-2.rs:11:13 | LL | impl<'a, T> Iterate<'a> for T diff --git a/src/test/ui/specialization/issue-39448.stderr b/src/test/ui/specialization/issue-39448.stderr index c4fc44c73..9b74f684b 100644 --- a/src/test/ui/specialization/issue-39448.stderr +++ b/src/test/ui/specialization/issue-39448.stderr @@ -14,12 +14,12 @@ error[E0275]: overflow evaluating the requirement `T: FromA` LL | x.foo(y.to()).to() | ^^ | -note: required because of the requirements on the impl of `FromA` for `T` +note: required for `T` to implement `FromA` --> $DIR/issue-39448.rs:24:29 | LL | impl> FromA for U { | ^^^^^^^^ ^ -note: required because of the requirements on the impl of `ToA` for `U` +note: required for `U` to implement `ToA` --> $DIR/issue-39448.rs:34:12 | LL | impl ToA for T diff --git a/src/test/ui/specialization/issue-45814.stderr b/src/test/ui/specialization/issue-45814.stderr index ab6adf477..419345add 100644 --- a/src/test/ui/specialization/issue-45814.stderr +++ b/src/test/ui/specialization/issue-45814.stderr @@ -1,13 +1,13 @@ error[E0275]: overflow evaluating the requirement `T: Trait<_>` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_45814`) -note: required because of the requirements on the impl of `Trait<_>` for `T` +note: required for `T` to implement `Trait<_>` --> $DIR/issue-45814.rs:8:20 | LL | default impl Trait for U {} | ^^^^^^^^ ^ = note: 128 redundant requirements hidden - = note: required because of the requirements on the impl of `Trait<_>` for `T` + = note: required for `T` to implement `Trait<_>` error: aborting due to previous error diff --git a/src/test/ui/specialization/min_specialization/issue-79224.stderr b/src/test/ui/specialization/min_specialization/issue-79224.stderr index cfb9007c7..fd34a59d2 100644 --- a/src/test/ui/specialization/min_specialization/issue-79224.stderr +++ b/src/test/ui/specialization/min_specialization/issue-79224.stderr @@ -1,22 +1,28 @@ error[E0277]: the trait bound `B: Clone` is not satisfied - --> $DIR/issue-79224.rs:18:17 + --> $DIR/issue-79224.rs:18:1 | -LL | impl Display for Cow<'_, B> { - | ^^^^^^^ the trait `Clone` is not implemented for `B` +LL | / impl Display for Cow<'_, B> { +LL | | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +LL | | write!(f, "foo") +LL | | } +LL | | } + | |_^ the trait `Clone` is not implemented for `B` | - = note: required because of the requirements on the impl of `ToOwned` for `B` + = note: required for `B` to implement `ToOwned` help: consider further restricting this bound | LL | impl Display for Cow<'_, B> { | +++++++++++++++++++ error[E0277]: the trait bound `B: Clone` is not satisfied - --> $DIR/issue-79224.rs:19:12 + --> $DIR/issue-79224.rs:19:5 | -LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - | ^^^^^ the trait `Clone` is not implemented for `B` +LL | / fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +LL | | write!(f, "foo") +LL | | } + | |_____^ the trait `Clone` is not implemented for `B` | - = note: required because of the requirements on the impl of `ToOwned` for `B` + = note: required for `B` to implement `ToOwned` help: consider further restricting this bound | LL | impl Display for Cow<'_, B> { diff --git a/src/test/ui/stability-attribute/auxiliary/ctor-stability.rs b/src/test/ui/stability-attribute/auxiliary/ctor-stability.rs new file mode 100644 index 000000000..74c6023d7 --- /dev/null +++ b/src/test/ui/stability-attribute/auxiliary/ctor-stability.rs @@ -0,0 +1,8 @@ +#![crate_type = "lib"] +#![feature(staged_api)] +#![stable(feature = "none", since = "1.0")] + +#[stable(feature = "none", since = "1.0")] +pub enum Foo { + A, +} diff --git a/src/test/ui/stability-attribute/auxiliary/default_body.rs b/src/test/ui/stability-attribute/auxiliary/default_body.rs new file mode 100644 index 000000000..3a177419d --- /dev/null +++ b/src/test/ui/stability-attribute/auxiliary/default_body.rs @@ -0,0 +1,29 @@ +#![crate_type = "lib"] +#![feature(staged_api, rustc_attrs)] +#![stable(feature = "stable_feature", since = "1.0.0")] + +#[stable(feature = "stable_feature", since = "1.0.0")] +pub trait JustTrait { + #[stable(feature = "stable_feature", since = "1.0.0")] + #[rustc_default_body_unstable(feature = "constant_default_body", issue = "none")] + const CONSTANT: usize = 0; + + #[rustc_default_body_unstable(feature = "fun_default_body", issue = "none")] + #[stable(feature = "stable_feature", since = "1.0.0")] + fn fun() {} +} + +#[rustc_must_implement_one_of(eq, neq)] +#[stable(feature = "stable_feature", since = "1.0.0")] +pub trait Equal { + #[rustc_default_body_unstable(feature = "eq_default_body", issue = "none")] + #[stable(feature = "stable_feature", since = "1.0.0")] + fn eq(&self, other: &Self) -> bool { + !self.neq(other) + } + + #[stable(feature = "stable_feature", since = "1.0.0")] + fn neq(&self, other: &Self) -> bool { + !self.eq(other) + } +} diff --git a/src/test/ui/stability-attribute/ctor-stability.rs b/src/test/ui/stability-attribute/ctor-stability.rs new file mode 100644 index 000000000..fcab0cb10 --- /dev/null +++ b/src/test/ui/stability-attribute/ctor-stability.rs @@ -0,0 +1,8 @@ +// aux-build:ctor-stability.rs +// check-pass + +extern crate ctor_stability; + +fn main() { + let _ = ctor_stability::Foo::A; +} diff --git a/src/test/ui/stability-attribute/default-body-stability-err.rs b/src/test/ui/stability-attribute/default-body-stability-err.rs new file mode 100644 index 000000000..ecb281bcc --- /dev/null +++ b/src/test/ui/stability-attribute/default-body-stability-err.rs @@ -0,0 +1,19 @@ +// aux-build:default_body.rs +#![crate_type = "lib"] + +extern crate default_body; + +use default_body::{Equal, JustTrait}; + +struct Type; + +impl JustTrait for Type {} +//~^ ERROR not all trait items implemented, missing: `CONSTANT` [E0046] +//~| ERROR not all trait items implemented, missing: `fun` [E0046] + +impl Equal for Type { + //~^ ERROR not all trait items implemented, missing: `eq` [E0046] + fn neq(&self, other: &Self) -> bool { + false + } +} diff --git a/src/test/ui/stability-attribute/default-body-stability-err.stderr b/src/test/ui/stability-attribute/default-body-stability-err.stderr new file mode 100644 index 000000000..ef666f30f --- /dev/null +++ b/src/test/ui/stability-attribute/default-body-stability-err.stderr @@ -0,0 +1,38 @@ +error[E0046]: not all trait items implemented, missing: `CONSTANT` + --> $DIR/default-body-stability-err.rs:10:1 + | +LL | impl JustTrait for Type {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: default implementation of `CONSTANT` is unstable + = note: use of unstable library feature 'constant_default_body' + = help: add `#![feature(constant_default_body)]` to the crate attributes to enable + +error[E0046]: not all trait items implemented, missing: `fun` + --> $DIR/default-body-stability-err.rs:10:1 + | +LL | impl JustTrait for Type {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: default implementation of `fun` is unstable + = note: use of unstable library feature 'fun_default_body' + = help: add `#![feature(fun_default_body)]` to the crate attributes to enable + +error[E0046]: not all trait items implemented, missing: `eq` + --> $DIR/default-body-stability-err.rs:14:1 + | +LL | / impl Equal for Type { +LL | | +LL | | fn neq(&self, other: &Self) -> bool { +LL | | false +LL | | } +LL | | } + | |_^ + | + = note: default implementation of `eq` is unstable + = note: use of unstable library feature 'eq_default_body' + = help: add `#![feature(eq_default_body)]` to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0046`. diff --git a/src/test/ui/stability-attribute/default-body-stability-ok-enables.rs b/src/test/ui/stability-attribute/default-body-stability-ok-enables.rs new file mode 100644 index 000000000..bdc7522f4 --- /dev/null +++ b/src/test/ui/stability-attribute/default-body-stability-ok-enables.rs @@ -0,0 +1,18 @@ +// check-pass +// aux-build:default_body.rs +#![crate_type = "lib"] +#![feature(fun_default_body, eq_default_body, constant_default_body)] + +extern crate default_body; + +use default_body::{Equal, JustTrait}; + +struct Type; + +impl JustTrait for Type {} + +impl Equal for Type { + fn neq(&self, other: &Self) -> bool { + false + } +} diff --git a/src/test/ui/stability-attribute/default-body-stability-ok-impls.rs b/src/test/ui/stability-attribute/default-body-stability-ok-impls.rs new file mode 100644 index 000000000..e1f5c0170 --- /dev/null +++ b/src/test/ui/stability-attribute/default-body-stability-ok-impls.rs @@ -0,0 +1,21 @@ +// check-pass +// aux-build:default_body.rs +#![crate_type = "lib"] + +extern crate default_body; + +use default_body::{Equal, JustTrait}; + +struct Type; + +impl JustTrait for Type { + const CONSTANT: usize = 1; + + fn fun() {} +} + +impl Equal for Type { + fn eq(&self, other: &Self) -> bool { + false + } +} diff --git a/src/test/ui/static/static-vec-repeat-not-constant.stderr b/src/test/ui/static/static-vec-repeat-not-constant.stderr index 84fc638a9..dec012318 100644 --- a/src/test/ui/static/static-vec-repeat-not-constant.stderr +++ b/src/test/ui/static/static-vec-repeat-not-constant.stderr @@ -5,6 +5,7 @@ LL | static a: [isize; 2] = [foo(); 2]; | ^^^^^ | = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error: aborting due to previous error diff --git a/src/test/ui/stats/hir-stats.rs b/src/test/ui/stats/hir-stats.rs new file mode 100644 index 000000000..5102574d4 --- /dev/null +++ b/src/test/ui/stats/hir-stats.rs @@ -0,0 +1,42 @@ +// check-pass +// compile-flags: -Zhir-stats +// only-x86_64 +// ignore-stage1 + +// The aim here is to include at least one of every different type of top-level +// AST/HIR node reported by `-Zhir-stats`. + +#![allow(dead_code)] + +use std::arch::asm; +use std::fmt::Debug; +use std::ffi::c_void; + +extern "C" { fn f(p: *mut c_void); } + +/// An enum. +enum E<'a, T: Copy> { A { t: T }, B(&'a u32) } + +trait Go { + type G: Debug; + fn go(self) -> u32; +} + +impl<'a, T: Copy> Go for E<'a, T> { + type G = bool; + fn go(self) -> u32 { + 99 + } +} + +fn f2(t: T) where T: Debug {} + +fn main() { + let x = E::A { t: 3 }; + match x { + E::A { .. } => {} + _ => {} + } + + unsafe { asm!("mov rdi, 1"); } +} diff --git a/src/test/ui/stats/hir-stats.stderr b/src/test/ui/stats/hir-stats.stderr new file mode 100644 index 000000000..8d9776065 --- /dev/null +++ b/src/test/ui/stats/hir-stats.stderr @@ -0,0 +1,178 @@ +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 Crate 56 ( 0.7%) 1 56 +ast-stats-1 Attribute 64 ( 0.8%) 2 32 +ast-stats-1 - Normal 32 ( 0.4%) 1 +ast-stats-1 - DocComment 32 ( 0.4%) 1 +ast-stats-1 GenericArgs 64 ( 0.8%) 1 64 +ast-stats-1 - AngleBracketed 64 ( 0.8%) 1 +ast-stats-1 Local 72 ( 0.9%) 1 72 +ast-stats-1 WherePredicate 72 ( 0.9%) 1 72 +ast-stats-1 - BoundPredicate 72 ( 0.9%) 1 +ast-stats-1 Arm 96 ( 1.1%) 2 48 +ast-stats-1 ForeignItem 96 ( 1.1%) 1 96 +ast-stats-1 - Fn 96 ( 1.1%) 1 +ast-stats-1 FieldDef 160 ( 1.9%) 2 80 +ast-stats-1 Stmt 160 ( 1.9%) 5 32 +ast-stats-1 - Local 32 ( 0.4%) 1 +ast-stats-1 - MacCall 32 ( 0.4%) 1 +ast-stats-1 - Expr 96 ( 1.1%) 3 +ast-stats-1 Param 160 ( 1.9%) 4 40 +ast-stats-1 FnDecl 200 ( 2.4%) 5 40 +ast-stats-1 Variant 240 ( 2.9%) 2 120 +ast-stats-1 Block 288 ( 3.4%) 6 48 +ast-stats-1 GenericBound 352 ( 4.2%) 4 88 +ast-stats-1 - Trait 352 ( 4.2%) 4 +ast-stats-1 AssocItem 416 ( 4.9%) 4 104 +ast-stats-1 - TyAlias 208 ( 2.5%) 2 +ast-stats-1 - Fn 208 ( 2.5%) 2 +ast-stats-1 GenericParam 480 ( 5.7%) 5 96 +ast-stats-1 PathSegment 720 ( 8.6%) 30 24 +ast-stats-1 Expr 832 ( 9.9%) 8 104 +ast-stats-1 - Path 104 ( 1.2%) 1 +ast-stats-1 - Match 104 ( 1.2%) 1 +ast-stats-1 - Struct 104 ( 1.2%) 1 +ast-stats-1 - Lit 208 ( 2.5%) 2 +ast-stats-1 - Block 312 ( 3.7%) 3 +ast-stats-1 Pat 840 (10.0%) 7 120 +ast-stats-1 - Struct 120 ( 1.4%) 1 +ast-stats-1 - Wild 120 ( 1.4%) 1 +ast-stats-1 - Ident 600 ( 7.1%) 5 +ast-stats-1 Ty 1_344 (16.0%) 14 96 +ast-stats-1 - Rptr 96 ( 1.1%) 1 +ast-stats-1 - Ptr 96 ( 1.1%) 1 +ast-stats-1 - ImplicitSelf 192 ( 2.3%) 2 +ast-stats-1 - Path 960 (11.4%) 10 +ast-stats-1 Item 1_656 (19.7%) 9 184 +ast-stats-1 - Trait 184 ( 2.2%) 1 +ast-stats-1 - Enum 184 ( 2.2%) 1 +ast-stats-1 - ForeignMod 184 ( 2.2%) 1 +ast-stats-1 - Impl 184 ( 2.2%) 1 +ast-stats-1 - Fn 368 ( 4.4%) 2 +ast-stats-1 - Use 552 ( 6.6%) 3 +ast-stats-1 ---------------------------------------------------------------- +ast-stats-1 Total 8_416 +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.5%) 1 48 +ast-stats-2 Crate 56 ( 0.6%) 1 56 +ast-stats-2 GenericArgs 64 ( 0.7%) 1 64 +ast-stats-2 - AngleBracketed 64 ( 0.7%) 1 +ast-stats-2 Local 72 ( 0.8%) 1 72 +ast-stats-2 WherePredicate 72 ( 0.8%) 1 72 +ast-stats-2 - BoundPredicate 72 ( 0.8%) 1 +ast-stats-2 Arm 96 ( 1.0%) 2 48 +ast-stats-2 ForeignItem 96 ( 1.0%) 1 96 +ast-stats-2 - Fn 96 ( 1.0%) 1 +ast-stats-2 InlineAsm 120 ( 1.3%) 1 120 +ast-stats-2 Attribute 128 ( 1.4%) 4 32 +ast-stats-2 - DocComment 32 ( 0.3%) 1 +ast-stats-2 - Normal 96 ( 1.0%) 3 +ast-stats-2 FieldDef 160 ( 1.7%) 2 80 +ast-stats-2 Stmt 160 ( 1.7%) 5 32 +ast-stats-2 - Local 32 ( 0.3%) 1 +ast-stats-2 - Semi 32 ( 0.3%) 1 +ast-stats-2 - Expr 96 ( 1.0%) 3 +ast-stats-2 Param 160 ( 1.7%) 4 40 +ast-stats-2 FnDecl 200 ( 2.2%) 5 40 +ast-stats-2 Variant 240 ( 2.6%) 2 120 +ast-stats-2 Block 288 ( 3.1%) 6 48 +ast-stats-2 GenericBound 352 ( 3.8%) 4 88 +ast-stats-2 - Trait 352 ( 3.8%) 4 +ast-stats-2 AssocItem 416 ( 4.5%) 4 104 +ast-stats-2 - TyAlias 208 ( 2.3%) 2 +ast-stats-2 - Fn 208 ( 2.3%) 2 +ast-stats-2 GenericParam 480 ( 5.2%) 5 96 +ast-stats-2 PathSegment 792 ( 8.7%) 33 24 +ast-stats-2 Pat 840 ( 9.2%) 7 120 +ast-stats-2 - Struct 120 ( 1.3%) 1 +ast-stats-2 - Wild 120 ( 1.3%) 1 +ast-stats-2 - Ident 600 ( 6.6%) 5 +ast-stats-2 Expr 936 (10.2%) 9 104 +ast-stats-2 - Path 104 ( 1.1%) 1 +ast-stats-2 - Match 104 ( 1.1%) 1 +ast-stats-2 - Struct 104 ( 1.1%) 1 +ast-stats-2 - InlineAsm 104 ( 1.1%) 1 +ast-stats-2 - Lit 208 ( 2.3%) 2 +ast-stats-2 - Block 312 ( 3.4%) 3 +ast-stats-2 Ty 1_344 (14.7%) 14 96 +ast-stats-2 - Rptr 96 ( 1.0%) 1 +ast-stats-2 - Ptr 96 ( 1.0%) 1 +ast-stats-2 - ImplicitSelf 192 ( 2.1%) 2 +ast-stats-2 - Path 960 (10.5%) 10 +ast-stats-2 Item 2_024 (22.1%) 11 184 +ast-stats-2 - Trait 184 ( 2.0%) 1 +ast-stats-2 - Enum 184 ( 2.0%) 1 +ast-stats-2 - ExternCrate 184 ( 2.0%) 1 +ast-stats-2 - ForeignMod 184 ( 2.0%) 1 +ast-stats-2 - Impl 184 ( 2.0%) 1 +ast-stats-2 - Fn 368 ( 4.0%) 2 +ast-stats-2 - Use 736 ( 8.0%) 4 +ast-stats-2 ---------------------------------------------------------------- +ast-stats-2 Total 9_144 +ast-stats-2 +hir-stats HIR STATS +hir-stats Name Accumulated Size Count Item Size +hir-stats ---------------------------------------------------------------- +hir-stats ForeignItemRef 24 ( 0.2%) 1 24 +hir-stats Lifetime 32 ( 0.3%) 1 32 +hir-stats Mod 32 ( 0.3%) 1 32 +hir-stats ExprField 40 ( 0.4%) 1 40 +hir-stats TraitItemRef 56 ( 0.6%) 2 28 +hir-stats Local 64 ( 0.7%) 1 64 +hir-stats Param 64 ( 0.7%) 2 32 +hir-stats InlineAsm 72 ( 0.7%) 1 72 +hir-stats ImplItemRef 72 ( 0.7%) 2 36 +hir-stats Body 96 ( 1.0%) 3 32 +hir-stats GenericArg 96 ( 1.0%) 4 24 +hir-stats - Type 24 ( 0.2%) 1 +hir-stats - Lifetime 72 ( 0.7%) 3 +hir-stats FieldDef 96 ( 1.0%) 2 48 +hir-stats Arm 96 ( 1.0%) 2 48 +hir-stats Stmt 96 ( 1.0%) 3 32 +hir-stats - Local 32 ( 0.3%) 1 +hir-stats - Semi 32 ( 0.3%) 1 +hir-stats - Expr 32 ( 0.3%) 1 +hir-stats FnDecl 120 ( 1.2%) 3 40 +hir-stats Attribute 128 ( 1.3%) 4 32 +hir-stats GenericArgs 144 ( 1.5%) 3 48 +hir-stats Variant 160 ( 1.7%) 2 80 +hir-stats WherePredicate 168 ( 1.7%) 3 56 +hir-stats - BoundPredicate 168 ( 1.7%) 3 +hir-stats GenericBound 192 ( 2.0%) 4 48 +hir-stats - Trait 192 ( 2.0%) 4 +hir-stats Block 288 ( 3.0%) 6 48 +hir-stats Pat 360 ( 3.7%) 5 72 +hir-stats - Wild 72 ( 0.7%) 1 +hir-stats - Struct 72 ( 0.7%) 1 +hir-stats - Binding 216 ( 2.2%) 3 +hir-stats GenericParam 400 ( 4.1%) 5 80 +hir-stats Generics 560 ( 5.8%) 10 56 +hir-stats Ty 720 ( 7.4%) 15 48 +hir-stats - Ptr 48 ( 0.5%) 1 +hir-stats - Rptr 48 ( 0.5%) 1 +hir-stats - Path 624 ( 6.4%) 13 +hir-stats Expr 768 ( 7.9%) 12 64 +hir-stats - Path 64 ( 0.7%) 1 +hir-stats - Struct 64 ( 0.7%) 1 +hir-stats - Match 64 ( 0.7%) 1 +hir-stats - InlineAsm 64 ( 0.7%) 1 +hir-stats - Lit 128 ( 1.3%) 2 +hir-stats - Block 384 ( 4.0%) 6 +hir-stats Item 960 ( 9.9%) 12 80 +hir-stats - Trait 80 ( 0.8%) 1 +hir-stats - Enum 80 ( 0.8%) 1 +hir-stats - ExternCrate 80 ( 0.8%) 1 +hir-stats - ForeignMod 80 ( 0.8%) 1 +hir-stats - Impl 80 ( 0.8%) 1 +hir-stats - Fn 160 ( 1.7%) 2 +hir-stats - Use 400 ( 4.1%) 5 +hir-stats Path 1_536 (15.9%) 32 48 +hir-stats PathSegment 2_240 (23.1%) 40 56 +hir-stats ---------------------------------------------------------------- +hir-stats Total 9_680 +hir-stats diff --git a/src/test/ui/std-backtrace.rs b/src/test/ui/std-backtrace.rs index 07de066b5..3f8306baf 100644 --- a/src/test/ui/std-backtrace.rs +++ b/src/test/ui/std-backtrace.rs @@ -7,8 +7,6 @@ // compile-flags:-g // compile-flags:-Cstrip=none -#![feature(backtrace)] - use std::env; use std::process::Command; use std::str; diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index 9079a18d6..019305def 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -8,7 +8,7 @@ LL | let _: u8 = s[4]; = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index<{integer}>` for `str` + = note: required for `str` to implement `Index<{integer}>` error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:4:19 @@ -53,7 +53,7 @@ LL | let _: u8 = s['c']; | ^^^ string indices are ranges of `usize` | = help: the trait `SliceIndex` is not implemented for `char` - = note: required because of the requirements on the impl of `Index` for `str` + = note: required for `str` to implement `Index` error: aborting due to 4 previous errors diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index 2d062e56a..b165c4825 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -32,7 +32,7 @@ LL | s[1usize] = bot(); | = help: the trait `SliceIndex` is not implemented for `usize` = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required because of the requirements on the impl of `Index` for `str` + = note: required for `str` to implement `Index` error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-mut-idx.rs:9:15 @@ -77,7 +77,7 @@ LL | s['c']; | ^^^ string indices are ranges of `usize` | = help: the trait `SliceIndex` is not implemented for `char` - = note: required because of the requirements on the impl of `Index` for `str` + = note: required for `str` to implement `Index` error: aborting due to 6 previous errors diff --git a/src/test/ui/structs-enums/align-struct.rs b/src/test/ui/structs-enums/align-struct.rs index 27ef990aa..f5418e754 100644 --- a/src/test/ui/structs-enums/align-struct.rs +++ b/src/test/ui/structs-enums/align-struct.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -#![feature(box_syntax)] use std::mem; @@ -232,9 +231,9 @@ pub fn main() { assert_eq!(mem::size_of_val(&a), 32); assert!(is_aligned_to(&a, 16)); - let mut large = box AlignLarge { + let mut large = Box::new(AlignLarge { stuff: [0; 0x10000], - }; + }); large.stuff[0] = 132; *large.stuff.last_mut().unwrap() = 102; assert_eq!(large.stuff[0], 132); diff --git a/src/test/ui/structs-enums/type-sizes.rs b/src/test/ui/structs-enums/type-sizes.rs index 73a11a5e7..7a23f1363 100644 --- a/src/test/ui/structs-enums/type-sizes.rs +++ b/src/test/ui/structs-enums/type-sizes.rs @@ -120,6 +120,54 @@ pub enum AlwaysTaggedBecauseItHasNoNiche { B } +pub enum NicheFilledMultipleFields { + A(bool, u8), + B(u8), + C(u8), + D(bool), + E, + F, + G, +} + +struct BoolInTheMiddle(std::num::NonZeroU16, bool, u8); + +enum NicheWithData { + A, + B([u16; 5]), + Largest { a1: u32, a2: BoolInTheMiddle, a3: u32 }, + C, + D(u32, u32), +} + +// A type with almost 2^16 invalid values. +#[repr(u16)] +pub enum NicheU16 { + _0, +} + +pub enum EnumManyVariant { + Dataful(u8, X), + + // 0x100 niche variants. + _00, _01, _02, _03, _04, _05, _06, _07, _08, _09, _0A, _0B, _0C, _0D, _0E, _0F, + _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _1A, _1B, _1C, _1D, _1E, _1F, + _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _2A, _2B, _2C, _2D, _2E, _2F, + _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _3A, _3B, _3C, _3D, _3E, _3F, + _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _4A, _4B, _4C, _4D, _4E, _4F, + _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _5A, _5B, _5C, _5D, _5E, _5F, + _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _6A, _6B, _6C, _6D, _6E, _6F, + _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _7A, _7B, _7C, _7D, _7E, _7F, + _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _8A, _8B, _8C, _8D, _8E, _8F, + _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _9A, _9B, _9C, _9D, _9E, _9F, + _A0, _A1, _A2, _A3, _A4, _A5, _A6, _A7, _A8, _A9, _AA, _AB, _AC, _AD, _AE, _AF, + _B0, _B1, _B2, _B3, _B4, _B5, _B6, _B7, _B8, _B9, _BA, _BB, _BC, _BD, _BE, _BF, + _C0, _C1, _C2, _C3, _C4, _C5, _C6, _C7, _C8, _C9, _CA, _CB, _CC, _CD, _CE, _CF, + _D0, _D1, _D2, _D3, _D4, _D5, _D6, _D7, _D8, _D9, _DA, _DB, _DC, _DD, _DE, _DF, + _E0, _E1, _E2, _E3, _E4, _E5, _E6, _E7, _E8, _E9, _EA, _EB, _EC, _ED, _EE, _EF, + _F0, _F1, _F2, _F3, _F4, _F5, _F6, _F7, _F8, _F9, _FA, _FB, _FC, _FD, _FE, _FF, +} + pub fn main() { assert_eq!(size_of::(), 1 as usize); assert_eq!(size_of::(), 4 as usize); @@ -170,4 +218,35 @@ pub fn main() { assert_eq!(size_of::(), 8); assert_eq!(size_of::>(), 8); assert_eq!(size_of::>>(), 8); + + assert_eq!(size_of::(), 2); + assert_eq!(size_of::>(), 2); + assert_eq!(size_of::>>(), 2); + + struct S1{ a: u16, b: std::num::NonZeroU16, c: u16, d: u8, e: u32, f: u64, g:[u8;2] } + assert_eq!(size_of::(), 24); + assert_eq!(size_of::>(), 24); + + assert_eq!(size_of::(), 12); + assert_eq!(size_of::>(), 12); + assert_eq!(size_of::>>(), 12); + assert_eq!( + size_of::>>>(), + size_of::<(&(), NicheWithData)>() + ); + + pub enum FillPadding { A(std::num::NonZeroU8, u32), B } + assert_eq!(size_of::(), 8); + assert_eq!(size_of::>(), 8); + assert_eq!(size_of::>>(), 8); + + assert_eq!(size_of::>(), 4); + assert_eq!(size_of::>>(), 4); + assert_eq!(size_of::>(), 4); + + assert_eq!(size_of::>(), 6); + assert_eq!(size_of::>(), 4); + assert_eq!(size_of::>>(), 4); + assert_eq!(size_of::>>(), 6); + assert_eq!(size_of::>>(), 6); } diff --git a/src/test/ui/structs/struct-record-suggestion.fixed b/src/test/ui/structs/struct-record-suggestion.fixed index 48144cd1c..49e38b196 100644 --- a/src/test/ui/structs/struct-record-suggestion.fixed +++ b/src/test/ui/structs/struct-record-suggestion.fixed @@ -6,11 +6,29 @@ struct A { d: usize, } -fn main() { - let q = A { c: 5, .. Default::default() }; +fn a() { + let q = A { c: 5,..Default::default() }; //~^ ERROR mismatched types //~| ERROR missing fields //~| HELP separate the last named field with a comma - let r = A { c: 5, .. Default::default() }; + let r = A { c: 5, ..Default::default() }; assert_eq!(q, r); } + +#[derive(Debug, Default, Eq, PartialEq)] +struct B { + b: u32, +} + +fn b() { + let q = B { b: 1,..Default::default() }; + //~^ ERROR mismatched types + //~| HELP separate the last named field with a comma + let r = B { b: 1 }; + assert_eq!(q, r); +} + +fn main() { + a(); + b(); +} diff --git a/src/test/ui/structs/struct-record-suggestion.rs b/src/test/ui/structs/struct-record-suggestion.rs index 6d169d5c6..901f310c8 100644 --- a/src/test/ui/structs/struct-record-suggestion.rs +++ b/src/test/ui/structs/struct-record-suggestion.rs @@ -6,11 +6,29 @@ struct A { d: usize, } -fn main() { - let q = A { c: 5 .. Default::default() }; +fn a() { + let q = A { c: 5..Default::default() }; //~^ ERROR mismatched types //~| ERROR missing fields //~| HELP separate the last named field with a comma - let r = A { c: 5, .. Default::default() }; + let r = A { c: 5, ..Default::default() }; assert_eq!(q, r); } + +#[derive(Debug, Default, Eq, PartialEq)] +struct B { + b: u32, +} + +fn b() { + let q = B { b: 1..Default::default() }; + //~^ ERROR mismatched types + //~| HELP separate the last named field with a comma + let r = B { b: 1 }; + assert_eq!(q, r); +} + +fn main() { + a(); + b(); +} diff --git a/src/test/ui/structs/struct-record-suggestion.stderr b/src/test/ui/structs/struct-record-suggestion.stderr index e5bd03117..66e9f021e 100644 --- a/src/test/ui/structs/struct-record-suggestion.stderr +++ b/src/test/ui/structs/struct-record-suggestion.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types --> $DIR/struct-record-suggestion.rs:10:20 | -LL | let q = A { c: 5 .. Default::default() }; - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found struct `std::ops::Range` +LL | let q = A { c: 5..Default::default() }; + | ^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found struct `std::ops::Range` | = note: expected type `u64` found struct `std::ops::Range<{integer}>` @@ -10,15 +10,28 @@ LL | let q = A { c: 5 .. Default::default() }; error[E0063]: missing fields `b` and `d` in initializer of `A` --> $DIR/struct-record-suggestion.rs:10:13 | -LL | let q = A { c: 5 .. Default::default() }; +LL | let q = A { c: 5..Default::default() }; | ^ missing `b` and `d` | help: to set the remaining fields from `Default::default()`, separate the last named field with a comma | -LL | let q = A { c: 5, .. Default::default() }; +LL | let q = A { c: 5,..Default::default() }; | + -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/struct-record-suggestion.rs:24:20 + | +LL | let q = B { b: 1..Default::default() }; + | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found struct `std::ops::Range` + | + = note: expected type `u32` + found struct `std::ops::Range<{integer}>` +help: to set the remaining fields from `Default::default()`, separate the last named field with a comma + | +LL | let q = B { b: 1,..Default::default() }; + | + + +error: aborting due to 3 previous errors Some errors have detailed explanations: E0063, E0308. For more information about an error, try `rustc --explain E0063`. diff --git a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr index 805c75f46..0a91c442d 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr @@ -2,10 +2,13 @@ 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 - | | - | expected tuple, found integer + | ^^^^ - argument of type `{integer}` unexpected | +note: expected tuple, found integer + --> $DIR/args-instead-of-tuple-errors.rs:6:39 + | +LL | let _: Option<(i32, bool)> = Some(1, 2); + | ^ = note: expected tuple `(i32, bool)` found type `{integer}` note: tuple variant defined here @@ -16,16 +19,19 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), help: remove the extra argument | 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 - | | - | expected tuple, found integer + | ^^^^^^^^ - argument of type `{integer}` unexpected | +note: expected tuple, found integer + --> $DIR/args-instead-of-tuple-errors.rs:8:14 + | +LL | int_bool(1, 2); + | ^ = note: expected tuple `(i32, bool)` found type `{integer}` note: function defined here @@ -36,7 +42,7 @@ LL | fn int_bool(_: (i32, bool)) { help: remove the extra argument | 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 @@ -52,7 +58,7 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), help: provide the argument | LL | let _: Option<(i8,)> = Some(/* (i8,) */); - | ~~~~~~~~~~~~~~~~~ + | ~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple-errors.rs:14:34 diff --git a/src/test/ui/suggestions/args-instead-of-tuple.stderr b/src/test/ui/suggestions/args-instead-of-tuple.stderr index 2448a5149..20f9e5259 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple.stderr @@ -44,7 +44,7 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), help: provide the argument | LL | let _: Option<()> = Some(()); - | ~~~~~~~~ + | ~~~~ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple.rs:14:34 diff --git a/src/test/ui/suggestions/as-ref-2.fixed b/src/test/ui/suggestions/as-ref-2.fixed deleted file mode 100644 index 13bbb233f..000000000 --- a/src/test/ui/suggestions/as-ref-2.fixed +++ /dev/null @@ -1,13 +0,0 @@ -// run-rustfix - -struct Struct; - -fn bar(_: &Struct) -> Struct { - Struct -} - -fn main() { - let foo = Some(Struct); - let _x: Option = foo.as_ref().map(|s| bar(&s)); - let _y = foo; //~ERROR use of moved value: `foo` -} diff --git a/src/test/ui/suggestions/as-ref-2.rs b/src/test/ui/suggestions/as-ref-2.rs index 74d61cdd9..b22f409b4 100644 --- a/src/test/ui/suggestions/as-ref-2.rs +++ b/src/test/ui/suggestions/as-ref-2.rs @@ -1,5 +1,3 @@ -// run-rustfix - struct Struct; fn bar(_: &Struct) -> Struct { diff --git a/src/test/ui/suggestions/as-ref-2.stderr b/src/test/ui/suggestions/as-ref-2.stderr index 3c9d0f72a..e15e45d86 100644 --- a/src/test/ui/suggestions/as-ref-2.stderr +++ b/src/test/ui/suggestions/as-ref-2.stderr @@ -1,10 +1,12 @@ error[E0382]: use of moved value: `foo` - --> $DIR/as-ref-2.rs:12:14 + --> $DIR/as-ref-2.rs:10:14 | LL | let foo = Some(Struct); | --- move occurs because `foo` has type `Option`, which does not implement the `Copy` trait LL | let _x: Option = foo.map(|s| bar(&s)); - | ---------------- `foo` moved due to this method call + | --- ---------------- `foo` moved due to this method call + | | + | help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents LL | let _y = foo; | ^^^ value used here after move | @@ -13,10 +15,6 @@ note: this function takes ownership of the receiver `self`, which moves `foo` | LL | pub const fn map(self, f: F) -> Option | ^^^^ -help: consider calling `.as_ref()` to borrow the type's contents - | -LL | let _x: Option = foo.as_ref().map(|s| bar(&s)); - | +++++++++ error: aborting due to previous error diff --git a/src/test/ui/suggestions/as-ref.rs b/src/test/ui/suggestions/as-ref.rs index 46d946153..a05353441 100644 --- a/src/test/ui/suggestions/as-ref.rs +++ b/src/test/ui/suggestions/as-ref.rs @@ -17,4 +17,11 @@ fn main() { // note: do not suggest because of `E: usize` let x: &Result = &Ok(3); let y: Result<&usize, usize> = x; //~ ERROR mismatched types [E0308] + + let multiple_ref_opt = &&Some(Foo); + multiple_ref_opt.map(|arg| takes_ref(arg)); //~ ERROR mismatched types [E0308] + multiple_ref_opt.and_then(|arg| Some(takes_ref(arg))); //~ ERROR mismatched types [E0308] + let multiple_ref_result = &&Ok(Foo); + multiple_ref_result.map(|arg| takes_ref(arg)); //~ ERROR mismatched types [E0308] + multiple_ref_result.and_then(|arg| Ok(takes_ref(arg))); //~ ERROR mismatched types [E0308] } diff --git a/src/test/ui/suggestions/as-ref.stderr b/src/test/ui/suggestions/as-ref.stderr index 1efd1b317..deafa9f48 100644 --- a/src/test/ui/suggestions/as-ref.stderr +++ b/src/test/ui/suggestions/as-ref.stderr @@ -97,6 +97,66 @@ LL | let y: Result<&usize, usize> = x; = note: expected enum `Result<&usize, usize>` found reference `&Result` -error: aborting due to 7 previous errors +error[E0308]: mismatched types + --> $DIR/as-ref.rs:22:42 + | +LL | multiple_ref_opt.map(|arg| takes_ref(arg)); + | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | | | + | | arguments to this function are incorrect + | help: consider using `as_ref` instead: `as_ref().map` + | +note: function defined here + --> $DIR/as-ref.rs:3:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- + +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` + | | | + | | arguments to this function are incorrect + | help: consider using `as_ref` instead: `as_ref().and_then` + | +note: function defined here + --> $DIR/as-ref.rs:3:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:25:45 + | +LL | multiple_ref_result.map(|arg| takes_ref(arg)); + | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | | | + | | arguments to this function are incorrect + | help: consider using `as_ref` instead: `as_ref().map` + | +note: function defined here + --> $DIR/as-ref.rs:3:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- + +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` + | | | + | | arguments to this function are incorrect + | help: consider using `as_ref` instead: `as_ref().and_then` + | +note: function defined here + --> $DIR/as-ref.rs:3:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- + +error: aborting due to 11 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/assoc-const-as-field.stderr b/src/test/ui/suggestions/assoc-const-as-field.stderr index 5e746ecb2..78e5634b2 100644 --- a/src/test/ui/suggestions/assoc-const-as-field.stderr +++ b/src/test/ui/suggestions/assoc-const-as-field.stderr @@ -2,9 +2,7 @@ error[E0423]: expected value, found struct `Mod::Foo` --> $DIR/assoc-const-as-field.rs:11:9 | LL | foo(Mod::Foo.Bar); - | ^^^^^^^^---- - | | - | help: use the path separator to refer to an item: `Mod::Foo::Bar` + | ^^^^^^^^- help: use the path separator to refer to an item: `::` error: aborting due to previous error diff --git a/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index c7d420e0a..bfd506c9f 100644 --- a/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -9,7 +9,7 @@ LL | bar(foo); | | | required by a bound introduced by this call | - = help: the trait `Future` is not implemented for `fn() -> impl Future {foo}` + = help: the trait `Future` is not implemented for fn item `fn() -> impl Future {foo}` = note: fn() -> impl Future {foo} must be a future or must implement `IntoFuture` to be awaited note: required by a bound in `bar` --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 @@ -31,7 +31,7 @@ LL | bar(async_closure); | | | required by a bound introduced by this call | - = help: the trait `Future` is not implemented for `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]` + = help: the trait `Future` is not implemented for closure `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33]` = note: [closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:33] must be a future or must implement `IntoFuture` to be awaited note: required by a bound in `bar` --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 diff --git a/src/test/ui/suggestions/bool_typo_err_suggest.rs b/src/test/ui/suggestions/bool_typo_err_suggest.rs new file mode 100644 index 000000000..deab0fb05 --- /dev/null +++ b/src/test/ui/suggestions/bool_typo_err_suggest.rs @@ -0,0 +1,12 @@ +// Suggest the boolean value instead of emit a generic error that the value +// True is not in the scope. + +fn main() { + let x = True; + //~^ ERROR cannot find value `True` in this scope + //~| HELP you may want to use a bool value instead + + let y = False; + //~^ ERROR cannot find value `False` in this scope + //~| HELP you may want to use a bool value instead +} diff --git a/src/test/ui/suggestions/bool_typo_err_suggest.stderr b/src/test/ui/suggestions/bool_typo_err_suggest.stderr new file mode 100644 index 000000000..52bde07ca --- /dev/null +++ b/src/test/ui/suggestions/bool_typo_err_suggest.stderr @@ -0,0 +1,25 @@ +error[E0425]: cannot find value `True` in this scope + --> $DIR/bool_typo_err_suggest.rs:5:13 + | +LL | let x = True; + | ^^^^ not found in this scope + | +help: you may want to use a bool value instead + | +LL | let x = true; + | ~~~~ + +error[E0425]: cannot find value `False` in this scope + --> $DIR/bool_typo_err_suggest.rs:9:13 + | +LL | let y = False; + | ^^^^^ not found in this scope + | +help: you may want to use a bool value instead + | +LL | let y = false; + | ~~~~~ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/suggestions/call-boxed.rs b/src/test/ui/suggestions/call-boxed.rs new file mode 100644 index 000000000..d19e4596a --- /dev/null +++ b/src/test/ui/suggestions/call-boxed.rs @@ -0,0 +1,7 @@ +fn main() { + let mut x = 1i32; + let y = Box::new(|| 1); + x = y; + //~^ ERROR mismatched types + //~| HELP use parentheses to call this closure +} diff --git a/src/test/ui/suggestions/call-boxed.stderr b/src/test/ui/suggestions/call-boxed.stderr new file mode 100644 index 000000000..9b619ac9a --- /dev/null +++ b/src/test/ui/suggestions/call-boxed.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/call-boxed.rs:4:9 + | +LL | let mut x = 1i32; + | ---- expected due to this value +LL | let y = Box::new(|| 1); + | -- the found closure +LL | x = y; + | ^ expected `i32`, found struct `Box` + | + = note: expected type `i32` + found struct `Box<[closure@$DIR/call-boxed.rs:3:22: 3:24]>` +help: use parentheses to call this closure + | +LL | x = y(); + | ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/call-on-missing.rs b/src/test/ui/suggestions/call-on-missing.rs new file mode 100644 index 000000000..25ced84dd --- /dev/null +++ b/src/test/ui/suggestions/call-on-missing.rs @@ -0,0 +1,39 @@ +struct Foo { i: i32 } + +impl Foo { + fn bar(&self) {} +} + +fn foo() -> Foo { + Foo { i: 1 } +} + +fn main() { + foo.bar(); + //~^ ERROR no method named `bar` + //~| HELP use parentheses to call this function + + foo.i; + //~^ ERROR no field `i` + //~| HELP use parentheses to call this function + + let callable = Box::new(|| Foo { i: 1 }) as Box Foo>; + + callable.bar(); + //~^ ERROR no method named `bar` + //~| HELP use parentheses to call this trait object + + callable.i; + //~^ ERROR no field `i` + //~| HELP use parentheses to call this trait object +} + +fn type_param Foo>(t: T) { + t.bar(); + //~^ ERROR no method named `bar` + //~| HELP use parentheses to call this type parameter + + t.i; + //~^ ERROR no field `i` + //~| HELP use parentheses to call this type parameter +} diff --git a/src/test/ui/suggestions/call-on-missing.stderr b/src/test/ui/suggestions/call-on-missing.stderr new file mode 100644 index 000000000..ca9abc7e9 --- /dev/null +++ b/src/test/ui/suggestions/call-on-missing.stderr @@ -0,0 +1,75 @@ +error[E0599]: no method named `bar` found for fn item `fn() -> Foo {foo}` in the current scope + --> $DIR/call-on-missing.rs:12:9 + | +LL | foo.bar(); + | ^^^ method not found in `fn() -> Foo {foo}` + | +help: use parentheses to call this function + | +LL | foo().bar(); + | ++ + +error[E0609]: no field `i` on type `fn() -> Foo {foo}` + --> $DIR/call-on-missing.rs:16:9 + | +LL | foo.i; + | ^ + | +help: use parentheses to call this function + | +LL | foo().i; + | ++ + +error[E0599]: no method named `bar` found for struct `Box Foo>` in the current scope + --> $DIR/call-on-missing.rs:22:14 + | +LL | callable.bar(); + | ^^^ method not found in `Box Foo>` + | +help: use parentheses to call this trait object + | +LL | callable().bar(); + | ++ + +error[E0609]: no field `i` on type `Box Foo>` + --> $DIR/call-on-missing.rs:26:14 + | +LL | callable.i; + | ^ unknown field + | +help: use parentheses to call this trait object + | +LL | callable().i; + | ++ + +error[E0599]: no method named `bar` found for type parameter `T` in the current scope + --> $DIR/call-on-missing.rs:32:7 + | +LL | fn type_param Foo>(t: T) { + | - method `bar` not found for this type parameter +LL | t.bar(); + | ^^^ method not found in `T` + | +help: use parentheses to call this type parameter + | +LL | t().bar(); + | ++ + +error[E0609]: no field `i` on type `T` + --> $DIR/call-on-missing.rs:36:7 + | +LL | fn type_param Foo>(t: T) { + | - type parameter 'T' declared here +... +LL | t.i; + | ^ + | +help: use parentheses to call this type parameter + | +LL | t().i; + | ++ + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0599, E0609. +For more information about an error, try `rustc --explain E0599`. diff --git a/src/test/ui/suggestions/const-no-type.rs b/src/test/ui/suggestions/const-no-type.rs index 6f46cfdf0..c6fdcdadb 100644 --- a/src/test/ui/suggestions/const-no-type.rs +++ b/src/test/ui/suggestions/const-no-type.rs @@ -14,38 +14,38 @@ fn main() {} const C2 = 42; //~^ ERROR missing type for `const` item //~| HELP provide a type for the item -//~| SUGGESTION C2: +//~| SUGGESTION : #[cfg(FALSE)] static S2 = "abc"; //~^ ERROR missing type for `static` item //~| HELP provide a type for the item -//~| SUGGESTION S2: +//~| SUGGESTION : #[cfg(FALSE)] static mut SM2 = "abc"; //~^ ERROR missing type for `static mut` item //~| HELP provide a type for the item -//~| SUGGESTION SM2: +//~| SUGGESTION : // These will, so the diagnostics should be stolen by typeck: const C = 42; //~^ ERROR missing type for `const` item //~| HELP provide a type for the constant -//~| SUGGESTION C: i32 +//~| SUGGESTION : i32 const D = &&42; //~^ ERROR missing type for `const` item //~| HELP provide a type for the constant -//~| SUGGESTION D: &&i32 +//~| SUGGESTION : &&i32 static S = Vec::::new(); //~^ ERROR missing type for `static` item //~| HELP provide a type for the static variable -//~| SUGGESTION S: Vec +//~| SUGGESTION : Vec static mut SM = "abc"; //~^ ERROR missing type for `static mut` item //~| HELP provide a type for the static variable -//~| SUGGESTION &str +//~| SUGGESTION : &str diff --git a/src/test/ui/suggestions/const-no-type.stderr b/src/test/ui/suggestions/const-no-type.stderr index 3b0fd6337..bd703992f 100644 --- a/src/test/ui/suggestions/const-no-type.stderr +++ b/src/test/ui/suggestions/const-no-type.stderr @@ -1,44 +1,44 @@ error: missing type for `const` item - --> $DIR/const-no-type.rs:33:7 + --> $DIR/const-no-type.rs:33:8 | LL | const C = 42; - | ^ help: provide a type for the constant: `C: i32` + | ^ help: provide a type for the constant: `: i32` error: missing type for `const` item - --> $DIR/const-no-type.rs:38:7 + --> $DIR/const-no-type.rs:38:8 | LL | const D = &&42; - | ^ help: provide a type for the constant: `D: &&i32` + | ^ help: provide a type for the constant: `: &&i32` error: missing type for `static` item - --> $DIR/const-no-type.rs:43:8 + --> $DIR/const-no-type.rs:43:9 | LL | static S = Vec::::new(); - | ^ help: provide a type for the static variable: `S: Vec` + | ^ help: provide a type for the static variable: `: Vec` error: missing type for `static mut` item - --> $DIR/const-no-type.rs:48:12 + --> $DIR/const-no-type.rs:48:14 | LL | static mut SM = "abc"; - | ^^ help: provide a type for the static variable: `SM: &str` + | ^ help: provide a type for the static variable: `: &str` error: missing type for `const` item - --> $DIR/const-no-type.rs:14:7 + --> $DIR/const-no-type.rs:14:9 | LL | const C2 = 42; - | ^^ help: provide a type for the item: `C2: ` + | ^ help: provide a type for the item: `: ` error: missing type for `static` item - --> $DIR/const-no-type.rs:20:8 + --> $DIR/const-no-type.rs:20:10 | LL | static S2 = "abc"; - | ^^ help: provide a type for the item: `S2: ` + | ^ help: provide a type for the item: `: ` error: missing type for `static mut` item - --> $DIR/const-no-type.rs:26:12 + --> $DIR/const-no-type.rs:26:15 | LL | static mut SM2 = "abc"; - | ^^^ help: provide a type for the item: `SM2: ` + | ^ help: provide a type for the item: `: ` error: aborting due to 7 previous errors diff --git a/src/test/ui/suggestions/copied-and-cloned.fixed b/src/test/ui/suggestions/copied-and-cloned.fixed new file mode 100644 index 000000000..f801403fe --- /dev/null +++ b/src/test/ui/suggestions/copied-and-cloned.fixed @@ -0,0 +1,23 @@ +// run-rustfix + +fn expect(_: T) {} + +fn main() { + let x = Some(&()); + expect::>(x.copied()); + //~^ ERROR mismatched types + //~| HELP use `Option::copied` to copy the value inside the `Option` + let x = Ok(&()); + expect::>(x.copied()); + //~^ ERROR mismatched types + //~| HELP use `Result::copied` to copy the value inside the `Result` + let s = String::new(); + let x = Some(&s); + expect::>(x.cloned()); + //~^ ERROR mismatched types + //~| HELP use `Option::cloned` to clone the value inside the `Option` + let x = Ok(&s); + expect::>(x.cloned()); + //~^ ERROR mismatched types + //~| HELP use `Result::cloned` to clone the value inside the `Result` +} diff --git a/src/test/ui/suggestions/copied-and-cloned.rs b/src/test/ui/suggestions/copied-and-cloned.rs new file mode 100644 index 000000000..640450b76 --- /dev/null +++ b/src/test/ui/suggestions/copied-and-cloned.rs @@ -0,0 +1,23 @@ +// run-rustfix + +fn expect(_: T) {} + +fn main() { + let x = Some(&()); + expect::>(x); + //~^ ERROR mismatched types + //~| HELP use `Option::copied` to copy the value inside the `Option` + let x = Ok(&()); + expect::>(x); + //~^ ERROR mismatched types + //~| HELP use `Result::copied` to copy the value inside the `Result` + let s = String::new(); + let x = Some(&s); + expect::>(x); + //~^ ERROR mismatched types + //~| HELP use `Option::cloned` to clone the value inside the `Option` + let x = Ok(&s); + expect::>(x); + //~^ ERROR mismatched types + //~| HELP use `Result::cloned` to clone the value inside the `Result` +} diff --git a/src/test/ui/suggestions/copied-and-cloned.stderr b/src/test/ui/suggestions/copied-and-cloned.stderr new file mode 100644 index 000000000..a6336281b --- /dev/null +++ b/src/test/ui/suggestions/copied-and-cloned.stderr @@ -0,0 +1,83 @@ +error[E0308]: mismatched types + --> $DIR/copied-and-cloned.rs:7:26 + | +LL | expect::>(x); + | -------------------- ^ expected `()`, found `&()` + | | + | arguments to this function are incorrect + | + = note: expected enum `Option<()>` + found enum `Option<&()>` +note: function defined here + --> $DIR/copied-and-cloned.rs:3:4 + | +LL | fn expect(_: T) {} + | ^^^^^^ ---- +help: use `Option::copied` to copy the value inside the `Option` + | +LL | expect::>(x.copied()); + | +++++++++ + +error[E0308]: mismatched types + --> $DIR/copied-and-cloned.rs:11:30 + | +LL | expect::>(x); + | ------------------------ ^ expected `()`, found `&()` + | | + | arguments to this function are incorrect + | + = note: expected enum `Result<(), ()>` + found enum `Result<&(), _>` +note: function defined here + --> $DIR/copied-and-cloned.rs:3:4 + | +LL | fn expect(_: T) {} + | ^^^^^^ ---- +help: use `Result::copied` to copy the value inside the `Result` + | +LL | expect::>(x.copied()); + | +++++++++ + +error[E0308]: mismatched types + --> $DIR/copied-and-cloned.rs:16:30 + | +LL | expect::>(x); + | ------------------------ ^ expected struct `String`, found `&String` + | | + | arguments to this function are incorrect + | + = note: expected enum `Option` + found enum `Option<&String>` +note: function defined here + --> $DIR/copied-and-cloned.rs:3:4 + | +LL | fn expect(_: T) {} + | ^^^^^^ ---- +help: use `Option::cloned` to clone the value inside the `Option` + | +LL | expect::>(x.cloned()); + | +++++++++ + +error[E0308]: mismatched types + --> $DIR/copied-and-cloned.rs:20:34 + | +LL | expect::>(x); + | ---------------------------- ^ expected struct `String`, found `&String` + | | + | arguments to this function are incorrect + | + = note: expected enum `Result` + found enum `Result<&String, _>` +note: function defined here + --> $DIR/copied-and-cloned.rs:3:4 + | +LL | fn expect(_: T) {} + | ^^^^^^ ---- +help: use `Result::cloned` to clone the value inside the `Result` + | +LL | expect::>(x.cloned()); + | +++++++++ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/deref-path-method.rs b/src/test/ui/suggestions/deref-path-method.rs new file mode 100644 index 000000000..0281cdb6b --- /dev/null +++ b/src/test/ui/suggestions/deref-path-method.rs @@ -0,0 +1,6 @@ +fn main() { + let vec = Vec::new(); + Vec::contains(&vec, &0); + //~^ ERROR no function or associated item named `contains` found for struct `Vec<_, _>` in the current scope + //~| HELP the function `contains` is implemented on `[_]` +} diff --git a/src/test/ui/suggestions/deref-path-method.stderr b/src/test/ui/suggestions/deref-path-method.stderr new file mode 100644 index 000000000..1cc37d611 --- /dev/null +++ b/src/test/ui/suggestions/deref-path-method.stderr @@ -0,0 +1,14 @@ +error[E0599]: no function or associated item named `contains` found for struct `Vec<_, _>` in the current scope + --> $DIR/deref-path-method.rs:3:10 + | +LL | Vec::contains(&vec, &0); + | ^^^^^^^^ function or associated item not found in `Vec<_, _>` + | +help: the function `contains` is implemented on `[_]` + | +LL | <[_]>::contains(&vec, &0); + | ~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/suggestions/derive-clone-for-eq.stderr b/src/test/ui/suggestions/derive-clone-for-eq.stderr index 55a23c031..0645f0cdd 100644 --- a/src/test/ui/suggestions/derive-clone-for-eq.stderr +++ b/src/test/ui/suggestions/derive-clone-for-eq.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Clone` is not satisfied LL | #[derive(Clone, Eq)] | ^^ the trait `Clone` is not implemented for `T` | -note: required because of the requirements on the impl of `PartialEq` for `Struct` +note: required for `Struct` to implement `PartialEq` --> $DIR/derive-clone-for-eq.rs:9:19 | LL | impl PartialEq for Struct diff --git a/src/test/ui/suggestions/derive-macro-missing-bounds.stderr b/src/test/ui/suggestions/derive-macro-missing-bounds.stderr index 4186dc7cb..b9f773965 100644 --- a/src/test/ui/suggestions/derive-macro-missing-bounds.stderr +++ b/src/test/ui/suggestions/derive-macro-missing-bounds.stderr @@ -26,13 +26,13 @@ LL | #[derive(Debug)] LL | struct Outer(Inner); | ^^^^^^^^ the trait `c::Trait` is not implemented for `T` | -note: required because of the requirements on the impl of `Debug` for `c::Inner` +note: required for `c::Inner` to implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:34:28 | LL | impl Debug for Inner { | ^^^^^ ^^^^^^^^ = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `Debug` for `&c::Inner` + = note: required for `&c::Inner` to implement `Debug` = note: required for the cast from `&c::Inner` to the object type `dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` @@ -48,13 +48,13 @@ LL | #[derive(Debug)] LL | struct Outer(Inner); | ^^^^^^^^ the trait `d::Trait` is not implemented for `T` | -note: required because of the requirements on the impl of `Debug` for `d::Inner` +note: required for `d::Inner` to implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:49:13 | LL | impl Debug for Inner where T: Debug, T: Trait { | ^^^^^ ^^^^^^^^ = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `Debug` for `&d::Inner` + = note: required for `&d::Inner` to implement `Debug` = note: required for the cast from `&d::Inner` to the object type `dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` @@ -70,13 +70,13 @@ LL | #[derive(Debug)] LL | struct Outer(Inner); | ^^^^^^^^ the trait `e::Trait` is not implemented for `T` | -note: required because of the requirements on the impl of `Debug` for `e::Inner` +note: required for `e::Inner` to implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:64:13 | LL | impl Debug for Inner where T: Debug + Trait { | ^^^^^ ^^^^^^^^ = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `Debug` for `&e::Inner` + = note: required for `&e::Inner` to implement `Debug` = note: required for the cast from `&e::Inner` to the object type `dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` @@ -92,13 +92,13 @@ LL | #[derive(Debug)] LL | struct Outer(Inner); | ^^^^^^^^ the trait `f::Trait` is not implemented for `T` | -note: required because of the requirements on the impl of `Debug` for `f::Inner` +note: required for `f::Inner` to implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:79:20 | LL | impl Debug for Inner where T: Trait { | ^^^^^ ^^^^^^^^ = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `Debug` for `&f::Inner` + = note: required for `&f::Inner` to implement `Debug` = note: required for the cast from `&f::Inner` to the object type `dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` diff --git a/src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr b/src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr index 677aa031b..c66da3ea6 100644 --- a/src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr +++ b/src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `set` found for array `[u8; 1]` in the current sco --> $DIR/dont-suggest-pin-array-dot-set.rs:14:7 | LL | a.set(0, 3); - | ^^^ help: there is an associated function with a similar name: `get` + | ^^^ help: there is a method with a similar name: `get` error: aborting due to previous error diff --git a/src/test/ui/suggestions/dont-try-removing-the-field.rs b/src/test/ui/suggestions/dont-try-removing-the-field.rs new file mode 100644 index 000000000..948aa2b94 --- /dev/null +++ b/src/test/ui/suggestions/dont-try-removing-the-field.rs @@ -0,0 +1,17 @@ +// run-pass + +#![allow(dead_code)] + +struct Foo { + foo: i32, + bar: i32, + baz: (), +} + +fn use_foo(x: Foo) -> (i32, i32) { + let Foo { foo, bar, baz } = x; //~ WARNING unused variable: `baz` + //~| help: try ignoring the field + return (foo, bar); +} + +fn main() {} diff --git a/src/test/ui/suggestions/dont-try-removing-the-field.stderr b/src/test/ui/suggestions/dont-try-removing-the-field.stderr new file mode 100644 index 000000000..263171a4a --- /dev/null +++ b/src/test/ui/suggestions/dont-try-removing-the-field.stderr @@ -0,0 +1,10 @@ +warning: unused variable: `baz` + --> $DIR/dont-try-removing-the-field.rs:12:25 + | +LL | let Foo { foo, bar, baz } = x; + | ^^^ help: try ignoring the field: `baz: _` + | + = note: `#[warn(unused_variables)]` on by default + +warning: 1 warning emitted + diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index 71facf57e..77cef485f 100644 --- a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -46,10 +46,12 @@ LL | pub const fn new(pointer: P) -> Pin