summaryrefslogtreecommitdiffstats
path: root/tests/ui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/abi/relocation_model_pic.rs9
-rw-r--r--tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr27
-rw-r--r--tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr27
-rw-r--r--tests/ui/abi/riscv-discoverability-guidance.rs27
-rw-r--r--tests/ui/abi/stack-probes-lto.rs12
-rw-r--r--tests/ui/abi/stack-probes.rs11
-rw-r--r--tests/ui/abi/stack-protector.rs2
-rw-r--r--tests/ui/abi/unsupported.aarch64.stderr26
-rw-r--r--tests/ui/abi/unsupported.arm.stderr24
-rw-r--r--tests/ui/abi/unsupported.i686.stderr20
-rw-r--r--tests/ui/abi/unsupported.riscv32.stderr61
-rw-r--r--tests/ui/abi/unsupported.riscv64.stderr61
-rw-r--r--tests/ui/abi/unsupported.rs41
-rw-r--r--tests/ui/abi/unsupported.x64.stderr24
-rw-r--r--tests/ui/annotate-snippet/auxiliary/other_file.rs6
-rw-r--r--tests/ui/annotate-snippet/multiple-files.rs8
-rw-r--r--tests/ui/annotate-snippet/multiple-files.stderr11
-rw-r--r--tests/ui/anonymous-higher-ranked-lifetime.stderr22
-rw-r--r--tests/ui/argument-suggestions/extra_arguments.rs26
-rw-r--r--tests/ui/argument-suggestions/extra_arguments.stderr148
-rw-r--r--tests/ui/array-slice-vec/infer_array_len.rs4
-rw-r--r--tests/ui/array-slice-vec/infer_array_len.stderr14
-rw-r--r--tests/ui/array-slice-vec/slice-2.stderr16
-rw-r--r--tests/ui/array-slice-vec/slice-pat-type-mismatches.rs15
-rw-r--r--tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr2
-rw-r--r--tests/ui/array-slice-vec/vec-mut-iter-borrow.stderr2
-rw-r--r--tests/ui/asm/issue-113788.rs7
-rw-r--r--tests/ui/asm/issue-113788.stderr9
-rw-r--r--tests/ui/asm/x86_64/issue-96797.rs1
-rw-r--r--tests/ui/associated-consts/defaults-cyclic-fail.stderr1
-rw-r--r--tests/ui/associated-consts/issue-105330.stderr12
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr1
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr1
-rw-r--r--tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr1
-rw-r--r--tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr1
-rw-r--r--tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr1
-rw-r--r--tests/ui/associated-inherent-types/inference.rs2
-rw-r--r--tests/ui/associated-inherent-types/issue-111879-0.rs4
-rw-r--r--tests/ui/associated-inherent-types/issue-111879-0.stderr6
-rw-r--r--tests/ui/associated-inherent-types/late-bound-regions.rs4
-rw-r--r--tests/ui/associated-inherent-types/late-bound-regions.stderr2
-rw-r--r--tests/ui/associated-inherent-types/not-found-self-type-differs.alias.stderr16
-rw-r--r--tests/ui/associated-inherent-types/not-found-self-type-differs.local.stderr16
-rw-r--r--tests/ui/associated-inherent-types/not-found-self-type-differs.rs9
-rw-r--r--tests/ui/associated-inherent-types/not-found-self-type-differs.stderr29
-rw-r--r--tests/ui/associated-inherent-types/substitute-params-bad.rs2
-rw-r--r--tests/ui/associated-inherent-types/substitute-params.rs3
-rw-r--r--tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs4
-rw-r--r--tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr55
-rw-r--r--tests/ui/associated-type-bounds/ambiguous-associated-type2.rs2
-rw-r--r--tests/ui/associated-type-bounds/ambiguous-associated-type2.stderr1
-rw-r--r--tests/ui/associated-type-bounds/consts.rs10
-rw-r--r--tests/ui/associated-type-bounds/consts.stderr10
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr48
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.rs14
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.stderr17
-rw-r--r--tests/ui/associated-types/dont-suggest-cyclic-constraint.rs2
-rw-r--r--tests/ui/associated-types/issue-20825.stderr1
-rw-r--r--tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs11
-rw-r--r--tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr78
-rw-r--r--tests/ui/async-await/clone-suggestion.stderr2
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.rs2
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.stderr98
-rw-r--r--tests/ui/async-await/in-trait/async-associated-types.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-default-fn-overridden.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr17
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr (renamed from tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr)4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr11
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr (renamed from tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-extra.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr11
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.stderr (renamed from tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr37
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.stderr (renamed from tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr)20
-rw-r--r--tests/ui/async-await/in-trait/async-generics.next.stderr37
-rw-r--r--tests/ui/async-await/in-trait/async-generics.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-generics.stderr (renamed from tests/ui/async-await/in-trait/async-generics.current.stderr)20
-rw-r--r--tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-lifetimes.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.next.stderr12
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.stderr (renamed from tests/ui/async-await/in-trait/async-recursive-generic.current.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.current.stderr12
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.rs2
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.stderr (renamed from tests/ui/async-await/in-trait/async-recursive.next.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.next.stderr17
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.rs2
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.stderr (renamed from tests/ui/async-await/in-trait/bad-signatures.current.stderr)4
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr10
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs2
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr (renamed from tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr)6
-rw-r--r--tests/ui/async-await/in-trait/early-bound-1.rs2
-rw-r--r--tests/ui/async-await/in-trait/early-bound-2.rs2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr12
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.rs2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.stderr (renamed from tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.current.stderr16
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.next.stderr16
-rw-r--r--tests/ui/async-await/in-trait/implied-bounds.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-102138.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-102219.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-102310.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-104678.rs2
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr12
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.rs2
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.stderr (renamed from tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/missing-feature-flag.current.stderr30
-rw-r--r--tests/ui/async-await/in-trait/missing-feature-flag.rs2
-rw-r--r--tests/ui/async-await/in-trait/missing-feature-flag.stderr (renamed from tests/ui/async-await/in-trait/missing-feature-flag.next.stderr)6
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.next.stderr20
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.rs2
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.stderr (renamed from tests/ui/async-await/in-trait/missing-send-bound.current.stderr)6
-rw-r--r--tests/ui/async-await/in-trait/object-safety.next.stderr18
-rw-r--r--tests/ui/async-await/in-trait/object-safety.rs2
-rw-r--r--tests/ui/async-await/in-trait/object-safety.stderr (renamed from tests/ui/async-await/in-trait/object-safety.current.stderr)4
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-pair.next.stderr39
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-pair.rs2
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-pair.stderr (renamed from tests/ui/async-await/in-trait/return-not-existing-pair.current.stderr)8
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.current.stderr9
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs2
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr (renamed from tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.next.stderr)2
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.current.stderr14
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.rs3
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.stderr (renamed from tests/ui/async-await/in-trait/return-type-suggestion.next.stderr)6
-rw-r--r--tests/ui/async-await/issue-61452.stderr2
-rw-r--r--tests/ui/async-await/issues/issue-61187.stderr2
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs3
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs3
-rw-r--r--tests/ui/async-await/normalize-output-in-signature-deduction.rs19
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.stderr37
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-late.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-late.stderr11
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.stderr11
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.stderr11
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr29
-rw-r--r--tests/ui/async-await/track-caller/async-block.afn.stderr30
-rw-r--r--tests/ui/async-await/track-caller/async-block.nofeat.stderr30
-rw-r--r--tests/ui/async-await/track-caller/async-block.rs18
-rw-r--r--tests/ui/async-await/track-caller/async-block.stderr12
-rw-r--r--tests/ui/async-await/track-caller/async-closure-gate.afn.stderr57
-rw-r--r--tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr57
-rw-r--r--tests/ui/async-await/track-caller/async-closure-gate.rs41
-rw-r--r--tests/ui/async-await/track-caller/async-closure-gate.stderr12
-rw-r--r--tests/ui/async-await/track-caller/panic-track-caller.cls.stderr31
-rw-r--r--tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr14
-rw-r--r--tests/ui/async-await/track-caller/panic-track-caller.rs46
-rw-r--r--tests/ui/attributes/auxiliary/rustc_confusables_across_crate.rs11
-rw-r--r--tests/ui/attributes/invalid-doc-attr.rs32
-rw-r--r--tests/ui/attributes/invalid-doc-attr.stderr78
-rw-r--r--tests/ui/attributes/macro_export_on_decl_macro.rs9
-rw-r--r--tests/ui/attributes/macro_export_on_decl_macro.stderr16
-rw-r--r--tests/ui/attributes/rustc_confusables.rs47
-rw-r--r--tests/ui/attributes/rustc_confusables.stderr68
-rw-r--r--tests/ui/auto-traits/issue-83857-ub.rs33
-rw-r--r--tests/ui/auto-traits/issue-83857-ub.stderr22
-rw-r--r--tests/ui/binop/binop-move-semantics.stderr2
-rw-r--r--tests/ui/binop/borrow-suggestion-109352-2.rs27
-rw-r--r--tests/ui/binop/borrow-suggestion-109352-2.stderr64
-rw-r--r--tests/ui/binop/borrow-suggestion-109352.fixed27
-rw-r--r--tests/ui/binop/borrow-suggestion-109352.rs27
-rw-r--r--tests/ui/binop/borrow-suggestion-109352.stderr45
-rw-r--r--tests/ui/borrowck/borrow-tuple-fields.stderr12
-rw-r--r--tests/ui/borrowck/borrowck-argument.stderr8
-rw-r--r--tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr6
-rw-r--r--tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr14
-rw-r--r--tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr6
-rw-r--r--tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-closures-unique-imm.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-describe-lvalue.stderr12
-rw-r--r--tests/ui/borrowck/borrowck-insert-during-each.stderr20
-rw-r--r--tests/ui/borrowck/borrowck-issue-2657-1.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-lend-flow-if.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-lend-flow.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr4
-rw-r--r--tests/ui/borrowck/borrowck-loan-blocks-move.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-loan-rcvr.stderr18
-rw-r--r--tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr7
-rw-r--r--tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr15
-rw-r--r--tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr4
-rw-r--r--tests/ui/borrowck/borrowck-object-lifetime.stderr8
-rw-r--r--tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr16
-rw-r--r--tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr6
-rw-r--r--tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-union-borrow-nested.stderr2
-rw-r--r--tests/ui/borrowck/borrowck-uniq-via-lend.stderr4
-rw-r--r--tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr5
-rw-r--r--tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr4
-rw-r--r--tests/ui/borrowck/clone-span-on-try-operator.fixed11
-rw-r--r--tests/ui/borrowck/clone-span-on-try-operator.rs11
-rw-r--r--tests/ui/borrowck/clone-span-on-try-operator.stderr21
-rw-r--r--tests/ui/borrowck/copy-suggestion-region-vid.rs1
-rw-r--r--tests/ui/borrowck/copy-suggestion-region-vid.stderr9
-rw-r--r--tests/ui/borrowck/index-mut-help-with-impl.stderr2
-rw-r--r--tests/ui/borrowck/index-mut-help.stderr7
-rw-r--r--tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr28
-rw-r--r--tests/ui/borrowck/issue-42344.stderr2
-rw-r--r--tests/ui/borrowck/issue-47646.stderr2
-rw-r--r--tests/ui/borrowck/issue-51117.stderr2
-rw-r--r--tests/ui/borrowck/issue-81365-10.stderr2
-rw-r--r--tests/ui/borrowck/issue-81365-5.stderr2
-rw-r--r--tests/ui/borrowck/issue-82032.stderr2
-rw-r--r--tests/ui/borrowck/issue-85581.stderr2
-rw-r--r--tests/ui/borrowck/issue-85765-closure.rs31
-rw-r--r--tests/ui/borrowck/issue-85765-closure.stderr48
-rw-r--r--tests/ui/borrowck/issue-85765.stderr2
-rw-r--r--tests/ui/borrowck/issue-91206.stderr2
-rw-r--r--tests/ui/borrowck/issue-93078.stderr2
-rw-r--r--tests/ui/borrowck/many-mutable-borrows.stderr18
-rw-r--r--tests/ui/borrowck/mut-borrow-of-mut-ref.stderr2
-rw-r--r--tests/ui/borrowck/mut-borrow-outside-loop.stderr4
-rw-r--r--tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr5
-rw-r--r--tests/ui/borrowck/suggest-local-var-double-mut.stderr5
-rw-r--r--tests/ui/borrowck/suggest-local-var-for-vector.stderr12
-rw-r--r--tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr5
-rw-r--r--tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr12
-rw-r--r--tests/ui/borrowck/two-phase-across-loop.stderr5
-rw-r--r--tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr19
-rw-r--r--tests/ui/borrowck/two-phase-multi-mut.stderr5
-rw-r--r--tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr28
-rw-r--r--tests/ui/borrowck/two-phase-sneaky.stderr2
-rw-r--r--tests/ui/borrowck/two-phase-surprise-no-conflict.stderr37
-rw-r--r--tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr2
-rw-r--r--tests/ui/box/leak-alloc.stderr2
-rw-r--r--tests/ui/btreemap/btreemap-index-mut-2.rs8
-rw-r--r--tests/ui/btreemap/btreemap-index-mut-2.stderr19
-rw-r--r--tests/ui/cannot-mutate-captured-non-mut-var.stderr2
-rw-r--r--tests/ui/check-cfg/compact-values.stderr2
-rw-r--r--tests/ui/check-cfg/values-target-json.stderr2
-rw-r--r--tests/ui/check-cfg/well-known-values.stderr2
-rw-r--r--tests/ui/closures/binder/nested-closures-regions.stderr4
-rw-r--r--tests/ui/closures/multiple-fn-bounds.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-generic-verbose-2.stderr2
-rw-r--r--tests/ui/closures/print/closure-print-verbose.stderr2
-rw-r--r--tests/ui/codegen/issue-55976.rs2
-rw-r--r--tests/ui/codegen/target-cpus.rs4
-rw-r--r--tests/ui/codegen/target-cpus.stdout4
-rw-r--r--tests/ui/codemap_tests/issue-11715.stderr2
-rw-r--r--tests/ui/codemap_tests/one_line.stderr5
-rw-r--r--tests/ui/codemap_tests/tab_3.stderr2
-rw-r--r--tests/ui/coercion/coerce-block-tail-83783.fixed13
-rw-r--r--tests/ui/coercion/coerce-block-tail-83783.rs2
-rw-r--r--tests/ui/coercion/coerce-block-tail-83783.stderr4
-rw-r--r--tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.rs24
-rw-r--r--tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.stderr12
-rw-r--r--tests/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr1
-rw-r--r--tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs35
-rw-r--r--tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr23
-rw-r--r--tests/ui/command/need-crate-arg-ignore-tidy.x.rs2
-rw-r--r--tests/ui/command/need-crate-arg-ignore-tidy.x.stderr6
-rw-r--r--tests/ui/conditional-compilation/cfg-arg-invalid-1.rs2
-rw-r--r--tests/ui/conditional-compilation/cfg-arg-invalid-2.rs2
-rw-r--r--tests/ui/conditional-compilation/cfg-arg-invalid-4.rs2
-rw-r--r--tests/ui/conditional-compilation/cfg-arg-invalid-6.rs2
-rw-r--r--tests/ui/conditional-compilation/cfg-arg-invalid-8.rs2
-rw-r--r--tests/ui/conditional-compilation/cfg-arg-invalid-9.rs2
-rw-r--r--tests/ui/conditional-compilation/cfg-empty-codemap.rs2
-rw-r--r--tests/ui/const-generics/const-generic-default-wont-borrowck.stderr2
-rw-r--r--tests/ui/const-generics/const_trait_fn-issue-88433.rs2
-rw-r--r--tests/ui/const-generics/generic_const_exprs/closures.stderr1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-109141.stderr2
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-80742.rs8
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-80742.stderr75
-rw-r--r--tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr42
-rw-r--r--tests/ui/const-generics/issue-93647.rs1
-rw-r--r--tests/ui/const-generics/issue-93647.stderr19
-rw-r--r--tests/ui/const-generics/issues/issue-100313.rs1
-rw-r--r--tests/ui/const-generics/issues/issue-100313.stderr12
-rw-r--r--tests/ui/const-generics/issues/issue-67375.full.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-83765.stderr1
-rw-r--r--tests/ui/const-generics/late-bound-vars/in_closure.rs6
-rw-r--r--tests/ui/const-generics/late-bound-vars/in_closure.stderr7
-rw-r--r--tests/ui/const-generics/late-bound-vars/simple.rs4
-rw-r--r--tests/ui/const-generics/late-bound-vars/simple.stderr3
-rw-r--r--tests/ui/const-generics/lifetime-in-const-param.rs9
-rw-r--r--tests/ui/const-generics/lifetime-in-const-param.stderr18
-rw-r--r--tests/ui/const-generics/slice-const-param.rs21
-rw-r--r--tests/ui/const-generics/transmute-fail.stderr24
-rw-r--r--tests/ui/const-generics/type_mismatch.stderr12
-rw-r--r--tests/ui/const-ptr/forbidden_slices.stderr12
-rw-r--r--tests/ui/const_prop/apfloat-f64-roundtrip.rs9
-rw-r--r--tests/ui/const_prop/apfloat-remainder-regression.rs15
-rw-r--r--tests/ui/const_prop/ice-issue-111353.rs7
-rw-r--r--tests/ui/const_prop/ice-issue-96944.rs26
-rw-r--r--tests/ui/consts/const-block-const-bound.rs4
-rw-r--r--tests/ui/consts/const-block-const-bound.stderr20
-rw-r--r--tests/ui/consts/const-compare-bytes-ub.rs41
-rw-r--r--tests/ui/consts/const-compare-bytes-ub.stderr54
-rw-r--r--tests/ui/consts/const-compare-bytes.rs27
-rw-r--r--tests/ui/consts/const-eval/const-eval-query-stack.rs4
-rw-r--r--tests/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr54
-rw-r--r--tests/ui/consts/const-eval/const_fn_target_feature.rs17
-rw-r--r--tests/ui/consts/const-eval/const_fn_target_feature.stderr9
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr4
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-49296.stderr2
-rw-r--r--tests/ui/consts/const-eval/nonnull_as_ref.rs8
-rw-r--r--tests/ui/consts/const-eval/nonnull_as_ref_ub.rs6
-rw-r--r--tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr16
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.32bit.stderr23
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.64bit.stderr23
-rw-r--r--tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-enum.32bit.stderr33
-rw-r--r--tests/ui/consts/const-eval/ub-enum.64bit.stderr33
-rw-r--r--tests/ui/consts/const-eval/ub-enum.rs12
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.32bit.stderr39
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.64bit.stderr39
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.rs84
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.stderr8
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.stderr12
-rw-r--r--tests/ui/consts/const-float-classify.rs3
-rw-r--r--tests/ui/consts/const-float-classify.stderr11
-rw-r--r--tests/ui/consts/const-size_of-cycle.stderr1
-rw-r--r--tests/ui/consts/const-try.stderr33
-rw-r--r--tests/ui/consts/const_cmp_type_id.stderr44
-rw-r--r--tests/ui/consts/const_discriminant.rs7
-rw-r--r--tests/ui/consts/const_let_assign3.stderr2
-rw-r--r--tests/ui/consts/constifconst-call-in-const-position.stderr18
-rw-r--r--tests/ui/consts/drop-maybe_uninit.rs17
-rw-r--r--tests/ui/consts/extra-const-ub/detect-extra-ub.rs61
-rw-r--r--tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr38
-rw-r--r--tests/ui/consts/invalid-inline-const-in-match-arm.rs1
-rw-r--r--tests/ui/consts/invalid-inline-const-in-match-arm.stderr19
-rw-r--r--tests/ui/consts/issue-103790.stderr2
-rw-r--r--tests/ui/consts/issue-28113.rs1
-rw-r--r--tests/ui/consts/issue-28113.stderr19
-rw-r--r--tests/ui/consts/issue-36163.stderr1
-rw-r--r--tests/ui/consts/issue-44415.stderr1
-rw-r--r--tests/ui/consts/issue-56164.rs1
-rw-r--r--tests/ui/consts/issue-56164.stderr21
-rw-r--r--tests/ui/consts/issue-68542-closure-in-array-len.rs1
-rw-r--r--tests/ui/consts/issue-68542-closure-in-array-len.stderr19
-rw-r--r--tests/ui/consts/issue-73976-monomorphic.stderr18
-rw-r--r--tests/ui/consts/issue-83182.rs9
-rw-r--r--tests/ui/consts/issue-83182.stderr15
-rw-r--r--tests/ui/consts/issue-94675.rs8
-rw-r--r--tests/ui/consts/issue-94675.stderr24
-rw-r--r--tests/ui/consts/issue-miri-1910.stderr2
-rw-r--r--tests/ui/consts/miri_unleashed/ptr_arith.rs4
-rw-r--r--tests/ui/consts/miri_unleashed/ptr_arith.stderr2
-rw-r--r--tests/ui/consts/precise-drop-with-promoted.rs8
-rw-r--r--tests/ui/consts/precise-drop-with-promoted.stderr6
-rw-r--r--tests/ui/consts/promoted_const_call.rs14
-rw-r--r--tests/ui/consts/promoted_const_call.stderr25
-rw-r--r--tests/ui/consts/ptr_comparisons.rs36
-rw-r--r--tests/ui/consts/ptr_comparisons.stderr40
-rw-r--r--tests/ui/consts/ptr_is_null.rs1
-rw-r--r--tests/ui/consts/recursive-zst-static.default.stderr1
-rw-r--r--tests/ui/consts/recursive-zst-static.unleash.stderr1
-rw-r--r--tests/ui/consts/rustc-impl-const-stability.rs2
-rw-r--r--tests/ui/consts/rustc-impl-const-stability.stderr12
-rw-r--r--tests/ui/consts/unstable-const-fn-in-libcore.rs1
-rw-r--r--tests/ui/consts/unstable-const-fn-in-libcore.stderr17
-rw-r--r--tests/ui/consts/write-to-static-mut-in-static.stderr1
-rw-r--r--tests/ui/cross-crate/auxiliary/static_init_aux.rs4
-rw-r--r--tests/ui/cross-crate/static-init.rs3
-rw-r--r--tests/ui/cycle-trait/cycle-trait-default-type-trait.stderr1
-rw-r--r--tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr1
-rw-r--r--tests/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr1
-rw-r--r--tests/ui/cycle-trait/issue-12511.stderr1
-rw-r--r--tests/ui/debuginfo/sroa-fragment-debuginfo.rs31
-rw-r--r--tests/ui/deriving/deriving-all-codegen.stdout14
-rw-r--r--tests/ui/destructuring-assignment/slice_destructure_fail.rs10
-rw-r--r--tests/ui/destructuring-assignment/slice_destructure_fail.stderr22
-rw-r--r--tests/ui/diagnostic-flags/colored-session-opt-error.rs4
-rw-r--r--tests/ui/diagnostic-flags/colored-session-opt-error.stderr2
-rw-r--r--tests/ui/diagnostic-width/E0271.stderr3
-rw-r--r--tests/ui/diagnostic-width/long-E0308.rs2
-rw-r--r--tests/ui/diagnostic_namespace/auxiliary/proc-macro-helper.rs12
-rw-r--r--tests/ui/diagnostic_namespace/can_use_the_diagnostic_name_in_other_places.rs13
-rw-r--r--tests/ui/diagnostic_namespace/existing_proc_macros.rs24
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs13
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr35
-rw-r--r--tests/ui/diagnostic_namespace/non_existing_attributes_accepted.rs13
-rw-r--r--tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr16
-rw-r--r--tests/ui/diagnostic_namespace/requires_path.rs9
-rw-r--r--tests/ui/diagnostic_namespace/requires_path.stderr8
-rw-r--r--tests/ui/did_you_mean/compatible-variants.stderr2
-rw-r--r--tests/ui/did_you_mean/issue-114112.rs11
-rw-r--r--tests/ui/did_you_mean/issue-114112.stderr13
-rw-r--r--tests/ui/did_you_mean/issue-34126.stderr5
-rw-r--r--tests/ui/did_you_mean/issue-35937.stderr2
-rw-r--r--tests/ui/did_you_mean/issue-38147-1.stderr2
-rw-r--r--tests/ui/did_you_mean/issue-38147-2.stderr4
-rw-r--r--tests/ui/did_you_mean/issue-38147-3.stderr2
-rw-r--r--tests/ui/did_you_mean/issue-38147-4.stderr2
-rw-r--r--tests/ui/did_you_mean/issue-40823.stderr2
-rw-r--r--tests/ui/dropck/drop-with-active-borrows-1.stderr2
-rw-r--r--tests/ui/dropck/drop-with-active-borrows-2.stderr2
-rw-r--r--tests/ui/dropck/explicit-drop-bounds.bad1.stderr4
-rw-r--r--tests/ui/dropck/explicit-drop-bounds.bad2.stderr4
-rw-r--r--tests/ui/dst/issue-113447.fixed25
-rw-r--r--tests/ui/dst/issue-113447.rs25
-rw-r--r--tests/ui/dst/issue-113447.stderr25
-rw-r--r--tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.rs13
-rw-r--r--tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.stderr29
-rw-r--r--tests/ui/dyn-star/llvm-old-style-ptrs.rs23
-rw-r--r--tests/ui/dyn-star/param-env-region-infer.current.stderr2
-rw-r--r--tests/ui/dyn-star/param-env-region-infer.next.stderr29
-rw-r--r--tests/ui/dyn-star/param-env-region-infer.rs9
-rw-r--r--tests/ui/error-codes/E0161.base.stderr2
-rw-r--r--tests/ui/error-codes/E0275.stderr3
-rw-r--r--tests/ui/error-codes/E0283.stderr2
-rw-r--r--tests/ui/error-codes/E0499.stderr2
-rw-r--r--tests/ui/error-codes/E0502.stderr2
-rw-r--r--tests/ui/error-codes/E0503.stderr2
-rw-r--r--tests/ui/error-codes/E0505.stderr2
-rw-r--r--tests/ui/error-codes/E0507.stderr5
-rw-r--r--tests/ui/error-codes/E0608.stderr4
-rw-r--r--tests/ui/error-codes/E0790.stderr2
-rw-r--r--tests/ui/extern/extern-thiscall.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs33
-rw-r--r--tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr57
-rw-r--r--tests/ui/feature-gates/feature-gate-cfg-relocation-model.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-cfg-relocation-model.stderr12
-rw-r--r--tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr9
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.rs24
-rw-r--r--tests/ui/feature-gates/feature-gate-thiscall.rs38
-rw-r--r--tests/ui/feature-gates/feature-gate-thiscall.stderr115
-rw-r--r--tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr7
-rw-r--r--tests/ui/feature-gates/print-with-path.cfg.stderr2
-rw-r--r--tests/ui/feature-gates/print-with-path.rs7
-rw-r--r--tests/ui/feature-gates/print-with-path.target-cpus.stderr2
-rw-r--r--tests/ui/feature-gates/print-with-path.target-features.stderr2
-rw-r--r--tests/ui/fmt/closing-brace-as-fill.rs8
-rw-r--r--tests/ui/fmt/closing-brace-as-fill.stderr12
-rw-r--r--tests/ui/fmt/format-string-error-2.stderr26
-rw-r--r--tests/ui/fmt/format-string-error.stderr2
-rw-r--r--tests/ui/fmt/format-string-wrong-order.stderr4
-rw-r--r--tests/ui/fmt/ifmt-bad-arg.stderr2
-rw-r--r--tests/ui/fmt/suggest-inline-args.rs28
-rw-r--r--tests/ui/fmt/suggest-inline-args.stderr57
-rw-r--r--tests/ui/for/issue-20605.next.stderr12
-rw-r--r--tests/ui/generator/auto-trait-regions.rs6
-rw-r--r--tests/ui/generator/dropck-resume.stderr2
-rw-r--r--tests/ui/generator/dropck.stderr2
-rw-r--r--tests/ui/generator/issue-113279.rs27
-rw-r--r--tests/ui/generator/issue-113279.stderr16
-rw-r--r--tests/ui/generic-associated-types/issue-102114.current.stderr (renamed from tests/ui/generic-associated-types/issue-102114.stderr)2
-rw-r--r--tests/ui/generic-associated-types/issue-102114.next.stderr12
-rw-r--r--tests/ui/generic-associated-types/issue-102114.rs3
-rw-r--r--tests/ui/generic-associated-types/issue-86218.rs1
-rw-r--r--tests/ui/generic-associated-types/issue-90014-tait.rs1
-rw-r--r--tests/ui/generic-associated-types/issue-90014-tait.stderr8
-rw-r--r--tests/ui/generic-associated-types/issue-90014-tait2.rs19
-rw-r--r--tests/ui/generic-associated-types/issue-90014-tait2.stderr13
-rw-r--r--tests/ui/generic-associated-types/streaming_iterator.rs3
-rw-r--r--tests/ui/generic-const-items/associated-const-equality.rs22
-rw-r--r--tests/ui/generic-const-items/basic.rs61
-rw-r--r--tests/ui/generic-const-items/compare-impl-item.rs30
-rw-r--r--tests/ui/generic-const-items/compare-impl-item.stderr66
-rw-r--r--tests/ui/generic-const-items/const-trait-impl.rs25
-rw-r--r--tests/ui/generic-const-items/const-trait-impl.stderr11
-rw-r--r--tests/ui/generic-const-items/duplicate-where-clause.rs27
-rw-r--r--tests/ui/generic-const-items/duplicate-where-clause.stderr27
-rw-r--r--tests/ui/generic-const-items/elided-lifetimes.rs18
-rw-r--r--tests/ui/generic-const-items/elided-lifetimes.stderr35
-rw-r--r--tests/ui/generic-const-items/evaluatable-bounds.rs31
-rw-r--r--tests/ui/generic-const-items/evaluatable-bounds.unconstrained.stderr10
-rw-r--r--tests/ui/generic-const-items/feature-gate-generic_const_items.rs37
-rw-r--r--tests/ui/generic-const-items/feature-gate-generic_const_items.stderr77
-rw-r--r--tests/ui/generic-const-items/inference-failure.rs15
-rw-r--r--tests/ui/generic-const-items/inference-failure.stderr20
-rw-r--r--tests/ui/generic-const-items/misplaced-where-clause.fixed18
-rw-r--r--tests/ui/generic-const-items/misplaced-where-clause.rs20
-rw-r--r--tests/ui/generic-const-items/misplaced-where-clause.stderr36
-rw-r--r--tests/ui/generic-const-items/parameter-defaults.rs14
-rw-r--r--tests/ui/generic-const-items/parameter-defaults.stderr8
-rw-r--r--tests/ui/generic-const-items/recursive.rs12
-rw-r--r--tests/ui/generic-const-items/reference-outlives-referent.rs9
-rw-r--r--tests/ui/generic-const-items/reference-outlives-referent.stderr20
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs12
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr18
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.rs12
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.stderr11
-rw-r--r--tests/ui/generic-const-items/unsatisfied-bounds.rs34
-rw-r--r--tests/ui/generic-const-items/unsatisfied-bounds.stderr62
-rw-r--r--tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.rs12
-rw-r--r--tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.stderr9
-rw-r--r--tests/ui/generic-const-items/unsatisfied-outlives-bounds.rs17
-rw-r--r--tests/ui/generic-const-items/unsatisfied-outlives-bounds.stderr18
-rw-r--r--tests/ui/generics/issue-94923.rs1
-rw-r--r--tests/ui/hashmap/hashmap-iter-value-lifetime.stderr2
-rw-r--r--tests/ui/hashmap/hashmap-lifetimes.stderr2
-rw-r--r--tests/ui/hello_world/main.rs2
-rw-r--r--tests/ui/higher-ranked/subtype/placeholder-pattern-fail.stderr4
-rw-r--r--tests/ui/higher-ranked/trait-bounds/future.rs2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr3
-rw-r--r--tests/ui/higher-ranked/trait-bounds/hrtb-debruijn-in-receiver.stderr4
-rw-r--r--tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-fn.stderr4
-rw-r--r--tests/ui/higher-ranked/trait-bounds/issue-30786.stderr1
-rw-r--r--tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs29
-rw-r--r--tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr53
-rw-r--r--tests/ui/hygiene/extern-prelude-from-opaque-fail.rs1
-rw-r--r--tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr20
-rw-r--r--tests/ui/hygiene/fields-numeric-borrowck.stderr2
-rw-r--r--tests/ui/hygiene/panic-location.run.stderr3
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.stderr2
-rw-r--r--tests/ui/impl-trait/autoderef.rs2
-rw-r--r--tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.rs22
-rw-r--r--tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr42
-rw-r--r--tests/ui/impl-trait/hidden-type-is-opaque-2.rs6
-rw-r--r--tests/ui/impl-trait/hidden-type-is-opaque-2.stderr24
-rw-r--r--tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs29
-rw-r--r--tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs6
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr33
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs24
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr17
-rw-r--r--tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs10
-rw-r--r--tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr16
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match-works.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match.next.stderr15
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match.stderr (renamed from tests/ui/impl-trait/in-trait/deep-match.current.stderr)2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.next.stderr11
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr (renamed from tests/ui/impl-trait/in-trait/default-body-type-err-2.current.stderr)2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err.next.stderr12
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err.stderr (renamed from tests/ui/impl-trait/in-trait/default-body-type-err.current.stderr)2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-with-rpit.current.stderr24
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-with-rpit.next.stderr24
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-with-rpit.rs4
-rw-r--r--tests/ui/impl-trait/in-trait/default-body.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/default-method-constraint.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/doesnt-satisfy.current.stderr17
-rw-r--r--tests/ui/impl-trait/in-trait/doesnt-satisfy.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr (renamed from tests/ui/impl-trait/in-trait/doesnt-satisfy.next.stderr)4
-rw-r--r--tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.current.stderr12
-rw-r--r--tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr (renamed from tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.next.stderr)2
-rw-r--r--tests/ui/impl-trait/in-trait/early.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/encode.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/foreign.rs6
-rw-r--r--tests/ui/impl-trait/in-trait/generics-mismatch.current.stderr12
-rw-r--r--tests/ui/impl-trait/in-trait/generics-mismatch.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/generics-mismatch.stderr (renamed from tests/ui/impl-trait/in-trait/generics-mismatch.next.stderr)2
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.current.stderr33
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.stderr (renamed from tests/ui/impl-trait/in-trait/issue-102140.next.stderr)6
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102301.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.next.stderr14
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.stderr (renamed from tests/ui/impl-trait/in-trait/issue-102571.current.stderr)2
-rw-r--r--tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs12
-rw-r--r--tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr23
-rw-r--r--tests/ui/impl-trait/in-trait/nested-rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.next.stderr49
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.stderr (renamed from tests/ui/impl-trait/in-trait/object-safety.current.stderr)12
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.next.stderr17
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr (renamed from tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.current.stderr)2
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.current.stderr16
-rw-r--r--tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr (renamed from tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.next.stderr)4
-rw-r--r--tests/ui/impl-trait/in-trait/reveal.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs18
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.stderr9
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr61
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.stderr (renamed from tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr)16
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-broken.current.stderr31
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-broken.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-broken.stderr (renamed from tests/ui/impl-trait/in-trait/specialization-broken.next.stderr)6
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-substs-remap.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/success.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.current.stderr12
-rw-r--r--tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr (renamed from tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.next.stderr)2
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.rs7
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.stderr (renamed from tests/ui/impl-trait/in-trait/unconstrained-lt.current.stderr)2
-rw-r--r--tests/ui/impl-trait/in-trait/variances-of-gat.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/wf-bounds.next.stderr57
-rw-r--r--tests/ui/impl-trait/in-trait/wf-bounds.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/wf-bounds.stderr (renamed from tests/ui/impl-trait/in-trait/wf-bounds.current.stderr)16
-rw-r--r--tests/ui/impl-trait/in-trait/where-clause.rs2
-rw-r--r--tests/ui/impl-trait/issue-102605.stderr16
-rw-r--r--tests/ui/impl-trait/issue-99073-2.rs1
-rw-r--r--tests/ui/impl-trait/issue-99073-2.stderr18
-rw-r--r--tests/ui/impl-trait/issue-99073.rs1
-rw-r--r--tests/ui/impl-trait/issue-99073.stderr21
-rw-r--r--tests/ui/impl-trait/issues/issue-86800.rs2
-rw-r--r--tests/ui/impl-trait/lifetime-ambiguity-regression.rs13
-rw-r--r--tests/ui/impl-trait/mapping-duplicated-lifetimes-issue-114597.rs15
-rw-r--r--tests/ui/impl-trait/nested-rpit-hrtb-2.rs9
-rw-r--r--tests/ui/impl-trait/nested-rpit-hrtb-2.stderr12
-rw-r--r--tests/ui/impl-trait/normalize-tait-in-const.rs5
-rw-r--r--tests/ui/impl-trait/normalize-tait-in-const.stderr29
-rw-r--r--tests/ui/impl-trait/opaque-cast-field-access-in-future.rs27
-rw-r--r--tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr9
-rw-r--r--tests/ui/impl-trait/recursive-auto-trait.rs10
-rw-r--r--tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs19
-rw-r--r--tests/ui/impl-trait/rpit/non-defining-use.rs14
-rw-r--r--tests/ui/impl-trait/rpit/non-defining-use.stderr31
-rw-r--r--tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-1.rs26
-rw-r--r--tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-2.rs26
-rw-r--r--tests/ui/implied-bounds/implied_bounds_entailment_alias_var.rs32
-rw-r--r--tests/ui/implied-bounds/implied_bounds_entailment_skip_non_outlives.rs23
-rw-r--r--tests/ui/implied-bounds/trait-where-clause-implied.rs15
-rw-r--r--tests/ui/imports/ambiguous-1.rs30
-rw-r--r--tests/ui/imports/ambiguous-1.stderr36
-rw-r--r--tests/ui/imports/ambiguous-10.rs19
-rw-r--r--tests/ui/imports/ambiguous-10.stderr25
-rw-r--r--tests/ui/imports/ambiguous-11.rs14
-rw-r--r--tests/ui/imports/ambiguous-11.stderr23
-rw-r--r--tests/ui/imports/ambiguous-12.rs25
-rw-r--r--tests/ui/imports/ambiguous-12.stderr25
-rw-r--r--tests/ui/imports/ambiguous-13.rs22
-rw-r--r--tests/ui/imports/ambiguous-13.stderr25
-rw-r--r--tests/ui/imports/ambiguous-14.rs26
-rw-r--r--tests/ui/imports/ambiguous-14.stderr25
-rw-r--r--tests/ui/imports/ambiguous-15.rs27
-rw-r--r--tests/ui/imports/ambiguous-15.stderr25
-rw-r--r--tests/ui/imports/ambiguous-16.rs27
-rw-r--r--tests/ui/imports/ambiguous-16.stderr25
-rw-r--r--tests/ui/imports/ambiguous-17.rs29
-rw-r--r--tests/ui/imports/ambiguous-17.stderr35
-rw-r--r--tests/ui/imports/ambiguous-2.rs9
-rw-r--r--tests/ui/imports/ambiguous-3.rs21
-rw-r--r--tests/ui/imports/ambiguous-3.stderr25
-rw-r--r--tests/ui/imports/ambiguous-4-extern.rs26
-rw-r--r--tests/ui/imports/ambiguous-4-extern.stderr35
-rw-r--r--tests/ui/imports/ambiguous-4.rs9
-rw-r--r--tests/ui/imports/ambiguous-5.rs24
-rw-r--r--tests/ui/imports/ambiguous-5.stderr25
-rw-r--r--tests/ui/imports/ambiguous-6.rs20
-rw-r--r--tests/ui/imports/ambiguous-6.stderr25
-rw-r--r--tests/ui/imports/ambiguous-7.rs18
-rw-r--r--tests/ui/imports/ambiguous-7.stderr23
-rw-r--r--tests/ui/imports/ambiguous-8.rs14
-rw-r--r--tests/ui/imports/ambiguous-8.stderr23
-rw-r--r--tests/ui/imports/ambiguous-9.rs29
-rw-r--r--tests/ui/imports/ambiguous-9.stderr65
-rw-r--r--tests/ui/imports/auxiliary/ambiguous-11-extern.rs6
-rw-r--r--tests/ui/imports/auxiliary/ambiguous-8-extern.rs12
-rw-r--r--tests/ui/imports/auxiliary/extern-with-ambiguous-1-extern.rs4
-rw-r--r--tests/ui/imports/auxiliary/extern-with-ambiguous-2-extern.rs9
-rw-r--r--tests/ui/imports/auxiliary/extern-with-ambiguous-3-extern.rs14
-rw-r--r--tests/ui/imports/duplicate.rs2
-rw-r--r--tests/ui/imports/duplicate.stderr37
-rw-r--r--tests/ui/imports/extern-with-ambiguous-1.rs19
-rw-r--r--tests/ui/imports/extern-with-ambiguous-1.stderr23
-rw-r--r--tests/ui/imports/extern-with-ambiguous-2.rs16
-rw-r--r--tests/ui/imports/extern-with-ambiguous-3.rs17
-rw-r--r--tests/ui/imports/import-after-macro-expand-1.rs19
-rw-r--r--tests/ui/imports/import-after-macro-expand-2.rs27
-rw-r--r--tests/ui/imports/import-after-macro-expand-3.rs24
-rw-r--r--tests/ui/imports/import-after-macro-expand-4.rs30
-rw-r--r--tests/ui/imports/import-after-macro-expand-4.stderr53
-rw-r--r--tests/ui/imports/import-after-macro-expand-5.rs31
-rw-r--r--tests/ui/imports/import-after-macro-expand-6.rs24
-rw-r--r--tests/ui/imports/import-after-macro-expand-7.rs21
-rw-r--r--tests/ui/imports/import-after-macro-expand-8.rs22
-rw-r--r--tests/ui/imports/issue-113953.rs6
-rw-r--r--tests/ui/imports/issue-113953.stderr9
-rw-r--r--tests/ui/imports/issue-81413.rs23
-rw-r--r--tests/ui/imports/issue-81413.stderr11
-rw-r--r--tests/ui/imports/resolve-other-libc.rs14
-rw-r--r--tests/ui/imports/resolve-other-libc.stderr8
-rw-r--r--tests/ui/indexing/index-bot.rs (renamed from tests/ui/index-bot.rs)0
-rw-r--r--tests/ui/indexing/index-bot.stderr (renamed from tests/ui/index-bot.stderr)4
-rw-r--r--tests/ui/indexing/index-help.rs (renamed from tests/ui/index-help.rs)0
-rw-r--r--tests/ui/indexing/index-help.stderr (renamed from tests/ui/index-help.stderr)0
-rw-r--r--tests/ui/indexing/index_message.rs (renamed from tests/ui/index_message.rs)0
-rw-r--r--tests/ui/indexing/index_message.stderr (renamed from tests/ui/index_message.stderr)4
-rw-r--r--tests/ui/indexing/indexing-requires-a-uint.rs (renamed from tests/ui/indexing-requires-a-uint.rs)0
-rw-r--r--tests/ui/indexing/indexing-requires-a-uint.stderr (renamed from tests/ui/indexing-requires-a-uint.stderr)0
-rw-r--r--tests/ui/indexing/indexing-spans-caller-location.rs27
-rw-r--r--tests/ui/inference/issue-113354.fixed4
-rw-r--r--tests/ui/inference/issue-113354.rs4
-rw-r--r--tests/ui/inference/issue-113354.stderr14
-rw-r--r--tests/ui/inference/need_type_info/infer-var-for-self-param.rs7
-rw-r--r--tests/ui/inference/need_type_info/infer-var-for-self-param.stderr14
-rw-r--r--tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.rs12
-rw-r--r--tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr14
-rw-r--r--tests/ui/inference/str-as-char.fixed1
-rw-r--r--tests/ui/inference/str-as-char.rs1
-rw-r--r--tests/ui/inference/str-as-char.stderr13
-rw-r--r--tests/ui/inference/type-infer-generalize-ty-var.rs4
-rw-r--r--tests/ui/infinite/infinite-trait-alias-recursion.stderr1
-rw-r--r--tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr1
-rw-r--r--tests/ui/infinite/infinite-vec-type-recursion.stderr1
-rw-r--r--tests/ui/inline-const/instance-doesnt-depend-on-type.rs10
-rw-r--r--tests/ui/inline-const/interpolated.rs32
-rw-r--r--tests/ui/inline-const/pat-match-fndef.rs13
-rw-r--r--tests/ui/inline-const/pat-match-fndef.stderr17
-rw-r--r--tests/ui/inline-const/required-const.rs13
-rw-r--r--tests/ui/inline-const/required-const.stderr11
-rw-r--r--tests/ui/internal/internal-unstable.rs2
-rw-r--r--tests/ui/internal/internal-unstable.stderr10
-rw-r--r--tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr3
-rw-r--r--tests/ui/intrinsics/const-eval-select-backtrace.run.stderr3
-rw-r--r--tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs17
-rw-r--r--tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr (renamed from tests/ui/intrinsics/intrinsic-raw_eq-const-padding.stderr)10
-rw-r--r--tests/ui/intrinsics/intrinsic-raw_eq-const-padding.rs10
-rw-r--r--tests/ui/invalid/issue-114435-layout-type-err.rs44
-rw-r--r--tests/ui/invalid/issue-114435-layout-type-err.stderr8
-rw-r--r--tests/ui/issues/issue-100605.rs9
-rw-r--r--tests/ui/issues/issue-11820.rs2
-rw-r--r--tests/ui/issues/issue-13497-2.stderr12
-rw-r--r--tests/ui/issues/issue-17252.stderr1
-rw-r--r--tests/ui/issues/issue-20413.stderr15
-rw-r--r--tests/ui/issues/issue-20772.stderr1
-rw-r--r--tests/ui/issues/issue-21177.stderr1
-rw-r--r--tests/ui/issues/issue-21600.stderr2
-rw-r--r--tests/ui/issues/issue-23122-2.stderr3
-rw-r--r--tests/ui/issues/issue-23302-1.stderr1
-rw-r--r--tests/ui/issues/issue-23302-2.stderr1
-rw-r--r--tests/ui/issues/issue-23302-3.stderr1
-rw-r--r--tests/ui/issues/issue-27842.stderr12
-rw-r--r--tests/ui/issues/issue-34373.stderr1
-rw-r--r--tests/ui/issues/issue-40861.stderr4
-rw-r--r--tests/ui/issues/issue-41726.stderr7
-rw-r--r--tests/ui/issues/issue-42106.stderr4
-rw-r--r--tests/ui/issues/issue-44405.stderr2
-rw-r--r--tests/ui/issues/issue-48364.stderr1
-rw-r--r--tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr2
-rw-r--r--tests/ui/issues/issue-52126-assign-op-invariance.stderr2
-rw-r--r--tests/ui/issues/issue-61108.stderr2
-rw-r--r--tests/ui/issues/issue-81584.stderr2
-rw-r--r--tests/ui/issues/issue-87707.run.stderr6
-rw-r--r--tests/ui/layout/debug.stderr36
-rw-r--r--tests/ui/layout/hexagon-enum.stderr20
-rw-r--r--tests/ui/layout/issue-113941.rs13
-rw-r--r--tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr34
-rw-r--r--tests/ui/layout/issue-96185-overaligned-enum.stderr24
-rw-r--r--tests/ui/layout/malformed-unsized-type-in-union.rs8
-rw-r--r--tests/ui/layout/malformed-unsized-type-in-union.stderr9
-rw-r--r--tests/ui/layout/thumb-enum.stderr20
-rw-r--r--tests/ui/layout/valid_range_oob.stderr1
-rw-r--r--tests/ui/layout/zero-sized-array-enum-niche.stderr26
-rw-r--r--tests/ui/lazy-type-alias/auxiliary/eager.rs6
-rw-r--r--tests/ui/lazy-type-alias/auxiliary/lazy.rs4
-rw-r--r--tests/ui/lazy-type-alias/coerce-behind-lazy.current.stderr11
-rw-r--r--tests/ui/lazy-type-alias/coerce-behind-lazy.next.stderr11
-rw-r--r--tests/ui/lazy-type-alias/coerce-behind-lazy.rs16
-rw-r--r--tests/ui/lazy-type-alias/enum-variant.rs18
-rw-r--r--tests/ui/lazy-type-alias/enum-variant.stderr11
-rw-r--r--tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs23
-rw-r--r--tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr15
-rw-r--r--tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr15
-rw-r--r--tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs16
-rw-r--r--tests/ui/lazy-type-alias/leading-where-clause.fixed15
-rw-r--r--tests/ui/lazy-type-alias/leading-where-clause.rs16
-rw-r--r--tests/ui/lazy-type-alias/leading-where-clause.stderr16
-rw-r--r--tests/ui/lazy-type-alias/trailing-where-clause.rs13
-rw-r--r--tests/ui/lazy-type-alias/trailing-where-clause.stderr22
-rw-r--r--tests/ui/lazy-type-alias/type-alias-bounds-are-enforced.rs14
-rw-r--r--tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.rs8
-rw-r--r--tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr14
-rw-r--r--tests/ui/lazy-type-alias/variance.rs38
-rw-r--r--tests/ui/lexer/lex-emoji-identifiers.rs6
-rw-r--r--tests/ui/lexer/lex-emoji-identifiers.stderr34
-rw-r--r--tests/ui/lifetimes/borrowck-let-suggestion.stderr8
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr22
-rw-r--r--tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr22
-rw-r--r--tests/ui/lifetimes/unusual-rib-combinations.stderr5
-rw-r--r--tests/ui/limits/issue-17913.stderr1
-rw-r--r--tests/ui/lint/clashing-extern-fn.stderr124
-rw-r--r--tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.rs19
-rw-r--r--tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.stderr10
-rw-r--r--tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.rs13
-rw-r--r--tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.stderr10
-rw-r--r--tests/ui/lint/dead-code/allow-or-expect-dead_code-114557.rs18
-rw-r--r--tests/ui/lint/invalid-nan-comparison.stderr5
-rw-r--r--tests/ui/lint/issue-111359.stderr16
-rw-r--r--tests/ui/lint/issue-1866.stderr4
-rw-r--r--tests/ui/lint/lint-attr-everywhere-late.stderr104
-rw-r--r--tests/ui/lint/lint-cap-trait-bounds.rs8
-rw-r--r--tests/ui/lint/lint-missing-doc.stderr36
-rw-r--r--tests/ui/lint/lint-qualification.fixed21
-rw-r--r--tests/ui/lint/lint-qualification.rs1
-rw-r--r--tests/ui/lint/lint-qualification.stderr9
-rw-r--r--tests/ui/lint/lint-struct-necessary.rs31
-rw-r--r--tests/ui/lint/lint-struct-necessary.stderr19
-rw-r--r--tests/ui/lint/lint-unconditional-drop-recursion.rs38
-rw-r--r--tests/ui/lint/lint-unconditional-drop-recursion.stderr17
-rw-r--r--tests/ui/lint/lint-unconditional-recursion.stderr2
-rw-r--r--tests/ui/lint/missing-copy-implementations-negative-copy.rs15
-rw-r--r--tests/ui/lint/missing-doc-private-macro.stderr12
-rw-r--r--tests/ui/lint/noop-method-call.fixed51
-rw-r--r--tests/ui/lint/noop-method-call.rs30
-rw-r--r--tests/ui/lint/noop-method-call.stderr64
-rw-r--r--tests/ui/lint/ptr_null_checks.rs76
-rw-r--r--tests/ui/lint/ptr_null_checks.stderr225
-rw-r--r--tests/ui/lint/reference_casting.rs122
-rw-r--r--tests/ui/lint/reference_casting.stderr162
-rw-r--r--tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.rs4
-rw-r--r--tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.stderr12
-rw-r--r--tests/ui/lint/suspicious-double-ref-op.rs27
-rw-r--r--tests/ui/lint/suspicious-double-ref-op.stderr33
-rw-r--r--tests/ui/lint/unaligned_references.stderr2
-rw-r--r--tests/ui/lint/unknown-lints/allow-in-other-module.rs26
-rw-r--r--tests/ui/lint/unknown-lints/other.rs10
-rw-r--r--tests/ui/lint/unused/const-local-var.rs23
-rw-r--r--tests/ui/liveness/liveness-move-call-arg-2.rs12
-rw-r--r--tests/ui/liveness/liveness-move-call-arg-2.stderr26
-rw-r--r--tests/ui/lto/issue-100772.rs4
-rw-r--r--tests/ui/macros/assert-eq-macro-msg.rs6
-rw-r--r--tests/ui/macros/assert-eq-macro-panic.rs6
-rw-r--r--tests/ui/macros/assert-macro-explicit.rs2
-rw-r--r--tests/ui/macros/assert-macro-fmt.rs3
-rw-r--r--tests/ui/macros/assert-macro-owned.rs3
-rw-r--r--tests/ui/macros/assert-macro-static.rs3
-rw-r--r--tests/ui/macros/assert-matches-macro-msg.rs6
-rw-r--r--tests/ui/macros/assert-ne-macro-msg.rs6
-rw-r--r--tests/ui/macros/assert-ne-macro-panic.rs6
-rw-r--r--tests/ui/macros/builtin-env-issue-114010.rs10
-rw-r--r--tests/ui/macros/builtin-env-issue-114010.stderr20
-rw-r--r--tests/ui/macros/builtin-prelude-no-accidents.stderr4
-rw-r--r--tests/ui/macros/format-args-temporaries-in-write.stderr4
-rw-r--r--tests/ui/macros/issue-19163.stderr6
-rw-r--r--tests/ui/macros/macro-interpolation.rs4
-rw-r--r--tests/ui/macros/macro-interpolation.stderr16
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs14
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr19
-rw-r--r--tests/ui/match/issue-114691.rs39
-rw-r--r--tests/ui/match/issue-115681.rs32
-rw-r--r--tests/ui/match/issue-74050-end-span.stderr2
-rw-r--r--tests/ui/match/non-first-arm-doesnt-match-expected-return-type.rs21
-rw-r--r--tests/ui/match/non-first-arm-doesnt-match-expected-return-type.stderr12
-rw-r--r--tests/ui/methods/inherent-bound-in-probe.stderr3
-rw-r--r--tests/ui/methods/method-self-arg-2.stderr4
-rw-r--r--tests/ui/methods/suggest-method-on-call-with-macro-rcvr.rs6
-rw-r--r--tests/ui/methods/suggest-method-on-call-with-macro-rcvr.stderr15
-rw-r--r--tests/ui/mir/debug-ref-undef.rs57
-rw-r--r--tests/ui/mir/validate/storage-live.stderr1
-rw-r--r--tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.stderr4
-rw-r--r--tests/ui/mismatched_types/closure-arg-type-mismatch.stderr2
-rw-r--r--tests/ui/mismatched_types/closure-ref-114180.rs8
-rw-r--r--tests/ui/mismatched_types/closure-ref-114180.stderr22
-rw-r--r--tests/ui/mismatched_types/issue-36053-2.stderr2
-rw-r--r--tests/ui/mismatched_types/ref-pat-suggestions.stderr44
-rw-r--r--tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr2
-rw-r--r--tests/ui/mismatched_types/suggest-option-asderef.fixed2
-rw-r--r--tests/ui/mismatched_types/suggest-option-asderef.rs2
-rw-r--r--tests/ui/mismatched_types/suggest-option-asderef.stderr2
-rw-r--r--tests/ui/missing_debug_impls.rs2
-rw-r--r--tests/ui/modules/issue-107649.stderr2
-rw-r--r--tests/ui/moves/move-fn-self-receiver.stderr8
-rw-r--r--tests/ui/moves/moves-based-on-type-access-to-field.stderr2
-rw-r--r--tests/ui/moves/moves-based-on-type-exprs.stderr4
-rw-r--r--tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr2
-rw-r--r--tests/ui/moves/pin-mut-reborrow.stderr2
-rw-r--r--tests/ui/moves/suggest-clone.stderr7
-rw-r--r--tests/ui/moves/use_of_moved_value_clone_suggestions.stderr2
-rw-r--r--tests/ui/mut/mut-cant-alias.stderr2
-rw-r--r--tests/ui/mut/mut-suggestion.stderr4
-rw-r--r--tests/ui/nll/closure-access-spans.stderr10
-rw-r--r--tests/ui/nll/closure-borrow-spans.stderr28
-rw-r--r--tests/ui/nll/closure-requirements/escape-argument-callee.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/escape-argument.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/escape-upvar-nested.stderr4
-rw-r--r--tests/ui/nll/closure-requirements/escape-upvar-ref.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr4
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-approximated-val.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr2
-rw-r--r--tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr2
-rw-r--r--tests/ui/nll/closures-in-loops.stderr10
-rw-r--r--tests/ui/nll/get_default.stderr6
-rw-r--r--tests/ui/nll/guarantor-issue-46974.rs1
-rw-r--r--tests/ui/nll/guarantor-issue-46974.stderr3
-rw-r--r--tests/ui/nll/issue-46589.stderr4
-rw-r--r--tests/ui/nll/issue-51191.stderr2
-rw-r--r--tests/ui/nll/issue-51345-2.rs3
-rw-r--r--tests/ui/nll/issue-52669.stderr2
-rw-r--r--tests/ui/nll/issue-53773.stderr4
-rw-r--r--tests/ui/nll/issue-54556-niconii.stderr2
-rw-r--r--tests/ui/nll/issue-62007-assign-const-index.stderr2
-rw-r--r--tests/ui/nll/issue-62007-assign-differing-fields.stderr2
-rw-r--r--tests/ui/nll/loan_ends_mid_block_vec.stderr6
-rw-r--r--tests/ui/nll/polonius/assignment-to-differing-field.stderr4
-rw-r--r--tests/ui/nll/return_from_loop.stderr4
-rw-r--r--tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr8
-rw-r--r--tests/ui/nll/ty-outlives/projection-one-region-closure.stderr8
-rw-r--r--tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr16
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr4
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr2
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr8
-rw-r--r--tests/ui/nll/user-annotations/dump-adt-brace-struct.rs2
-rw-r--r--tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr2
-rw-r--r--tests/ui/nll/user-annotations/dump-fn-method.rs2
-rw-r--r--tests/ui/nll/user-annotations/dump-fn-method.stderr8
-rw-r--r--tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs15
-rw-r--r--tests/ui/numbers-arithmetic/overflowing-add.rs3
-rw-r--r--tests/ui/numbers-arithmetic/overflowing-mul.rs3
-rw-r--r--tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs2
-rw-r--r--tests/ui/numbers-arithmetic/overflowing-neg.rs2
-rw-r--r--tests/ui/numbers-arithmetic/overflowing-pow-signed.rs3
-rw-r--r--tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs3
-rw-r--r--tests/ui/numbers-arithmetic/overflowing-sub.rs3
-rw-r--r--tests/ui/object-safety/assoc_const_bounds.rs9
-rw-r--r--tests/ui/object-safety/assoc_const_bounds.stderr15
-rw-r--r--tests/ui/object-safety/assoc_const_bounds_sized.rs9
-rw-r--r--tests/ui/object-safety/assoc_const_bounds_sized.stderr15
-rw-r--r--tests/ui/object-safety/object-safety-by-value-self-use.stderr2
-rw-r--r--tests/ui/or-patterns/missing-bindings.stderr68
-rw-r--r--tests/ui/panic-handler/weak-lang-item-2.rs12
-rw-r--r--tests/ui/panics/abort-on-panic.rs2
-rw-r--r--tests/ui/panics/default-backtrace-ice.stderr1
-rw-r--r--tests/ui/panics/fmt-only-once.run.stderr3
-rw-r--r--tests/ui/panics/issue-47429-short-backtraces.legacy.run.stderr3
-rw-r--r--tests/ui/panics/issue-47429-short-backtraces.v0.run.stderr3
-rw-r--r--tests/ui/panics/location-detail-panic-no-column.run.stderr3
-rw-r--r--tests/ui/panics/location-detail-panic-no-file.run.stderr3
-rw-r--r--tests/ui/panics/location-detail-panic-no-line.run.stderr3
-rw-r--r--tests/ui/panics/location-detail-panic-no-location-info.run.stderr3
-rw-r--r--tests/ui/panics/location-detail-unwrap-no-file.run.stderr3
-rw-r--r--tests/ui/panics/panic-macro-any-wrapped.rs3
-rw-r--r--tests/ui/panics/panic-macro-any.rs3
-rw-r--r--tests/ui/panics/panic-macro-explicit.rs3
-rw-r--r--tests/ui/panics/panic-macro-fmt.rs3
-rw-r--r--tests/ui/panics/panic-macro-owned.rs3
-rw-r--r--tests/ui/panics/panic-macro-static.rs3
-rw-r--r--tests/ui/panics/panic-set-unset-handler.rs3
-rw-r--r--tests/ui/panics/panic-take-handler-nop.rs3
-rw-r--r--tests/ui/panics/panic-task-name-none.rs3
-rw-r--r--tests/ui/panics/panic-task-name-owned.rs3
-rw-r--r--tests/ui/panics/runtime-switch.legacy.run.stderr3
-rw-r--r--tests/ui/panics/runtime-switch.v0.run.stderr3
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr5
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames.run.stderr4
-rw-r--r--tests/ui/parser/async-with-nonterminal-block.rs16
-rw-r--r--tests/ui/parser/generic-statics.rs4
-rw-r--r--tests/ui/parser/generic-statics.stderr8
-rw-r--r--tests/ui/parser/issues/issue-113203.rs7
-rw-r--r--tests/ui/parser/issues/issue-113203.stderr8
-rw-r--r--tests/ui/parser/issues/issue-114219.rs4
-rw-r--r--tests/ui/parser/issues/issue-114219.stderr8
-rw-r--r--tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs21
-rw-r--r--tests/ui/parser/issues/issue-22647.rs2
-rw-r--r--tests/ui/parser/issues/issue-22647.stderr9
-rw-r--r--tests/ui/parser/issues/issue-22712.rs2
-rw-r--r--tests/ui/parser/issues/issue-22712.stderr9
-rw-r--r--tests/ui/parser/issues/issue-70583-block-is-empty-2.rs8
-rw-r--r--tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr3
-rw-r--r--tests/ui/parser/macro/macro-expand-to-field.rs70
-rw-r--r--tests/ui/parser/macro/macro-expand-to-field.stderr74
-rw-r--r--tests/ui/parser/macro/macro-expand-to-match-arm.rs18
-rw-r--r--tests/ui/parser/macro/macro-expand-to-match-arm.stderr10
-rw-r--r--tests/ui/parser/pat-lt-bracket-3.rs3
-rw-r--r--tests/ui/parser/pat-lt-bracket-3.stderr9
-rw-r--r--tests/ui/parser/pat-lt-bracket-4.rs2
-rw-r--r--tests/ui/parser/pat-lt-bracket-4.stderr9
-rw-r--r--tests/ui/parser/ternary_operator.rs69
-rw-r--r--tests/ui/parser/ternary_operator.stderr115
-rw-r--r--tests/ui/parser/trait-object-delimiters.rs4
-rw-r--r--tests/ui/parser/trait-object-delimiters.stderr12
-rw-r--r--tests/ui/parser/try-with-nonterminal-block.rs19
-rw-r--r--tests/ui/parser/type-alias-where.stderr18
-rw-r--r--tests/ui/pattern/slice-array-infer.rs27
-rw-r--r--tests/ui/pattern/slice-pattern-refutable.rs36
-rw-r--r--tests/ui/pattern/slice-pattern-refutable.stderr40
-rw-r--r--tests/ui/pattern/slice-patterns-ambiguity.rs47
-rw-r--r--tests/ui/pattern/slice-patterns-ambiguity.stderr40
-rw-r--r--tests/ui/pattern/slice-patterns-irrefutable.rs74
-rw-r--r--tests/ui/pattern/slice-patterns-irrefutable.stderr14
-rw-r--r--tests/ui/pattern/slice-patterns-nested.rs15
-rw-r--r--tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr6
-rw-r--r--tests/ui/privacy/issue-113860-1.rs16
-rw-r--r--tests/ui/privacy/issue-113860-1.stderr49
-rw-r--r--tests/ui/privacy/issue-113860-2.rs16
-rw-r--r--tests/ui/privacy/issue-113860-2.stderr49
-rw-r--r--tests/ui/privacy/issue-113860.rs16
-rw-r--r--tests/ui/privacy/issue-113860.stderr49
-rw-r--r--tests/ui/privacy/privacy2.rs2
-rw-r--r--tests/ui/privacy/privacy2.stderr8
-rw-r--r--tests/ui/privacy/privacy3.rs2
-rw-r--r--tests/ui/privacy/privacy3.stderr2
-rw-r--r--tests/ui/privacy/sealed-traits/sealed-trait-local.stderr2
-rw-r--r--tests/ui/privacy/unnameable_types.rs4
-rw-r--r--tests/ui/privacy/unnameable_types.stderr14
-rw-r--r--tests/ui/proc-macro/allowed-attr-stmt-expr.stdout12
-rw-r--r--tests/ui/proc-macro/attr-stmt-expr.stdout12
-rw-r--r--tests/ui/proc-macro/auxiliary/issue-107113.rs13
-rw-r--r--tests/ui/proc-macro/capture-macro-rules-invoke.stdout42
-rw-r--r--tests/ui/proc-macro/capture-unglued-token.stdout2
-rw-r--r--tests/ui/proc-macro/derive-helper-shadowed.rs2
-rw-r--r--tests/ui/proc-macro/derive-in-mod.rs2
-rw-r--r--tests/ui/proc-macro/dollar-crate-issue-57089.stdout32
-rw-r--r--tests/ui/proc-macro/dollar-crate-issue-62325.stdout44
-rw-r--r--tests/ui/proc-macro/dollar-crate.stdout96
-rw-r--r--tests/ui/proc-macro/edition-imports-2018.rs2
-rw-r--r--tests/ui/proc-macro/expand-to-derive.stdout20
-rw-r--r--tests/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout166
-rw-r--r--tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs2
-rw-r--r--tests/ui/proc-macro/helper-attr-blocked-by-import.rs2
-rw-r--r--tests/ui/proc-macro/input-interpolated.stdout16
-rw-r--r--tests/ui/proc-macro/issue-107113-wrap.rs8
-rw-r--r--tests/ui/proc-macro/issue-107113-wrap.stderr16
-rw-r--r--tests/ui/proc-macro/issue-53481.rs2
-rw-r--r--tests/ui/proc-macro/issue-75734-pp-paren.stdout6
-rw-r--r--tests/ui/proc-macro/issue-78675-captured-inner-attrs.stdout14
-rw-r--r--tests/ui/proc-macro/issue-80760-empty-stmt.stdout2
-rw-r--r--tests/ui/proc-macro/load-panic-backtrace.stderr3
-rw-r--r--tests/ui/proc-macro/macro-rules-derive-cfg.stdout38
-rw-r--r--tests/ui/proc-macro/macro-use-attr.rs2
-rw-r--r--tests/ui/proc-macro/macro-use-bang.rs2
-rw-r--r--tests/ui/proc-macro/meta-macro-hygiene.rs4
-rw-r--r--tests/ui/proc-macro/meta-macro-hygiene.stdout33
-rw-r--r--tests/ui/proc-macro/meta-macro.stdout2
-rw-r--r--tests/ui/proc-macro/nested-macro-rules.stdout16
-rw-r--r--tests/ui/proc-macro/nested-nonterminal-tokens.stdout18
-rw-r--r--tests/ui/proc-macro/nodelim-groups.stdout30
-rw-r--r--tests/ui/proc-macro/nonterminal-expansion.stdout10
-rw-r--r--tests/ui/proc-macro/nonterminal-recollect-attr.stdout24
-rw-r--r--tests/ui/proc-macro/nonterminal-token-hygiene.rs3
-rw-r--r--tests/ui/proc-macro/nonterminal-token-hygiene.stdout36
-rw-r--r--tests/ui/process/multi-panic.rs4
-rw-r--r--tests/ui/process/println-with-broken-pipe.rs44
-rw-r--r--tests/ui/process/println-with-broken-pipe.run.stderr3
-rw-r--r--tests/ui/process/println-with-broken-pipe.run.stdout1
-rw-r--r--tests/ui/recursion/issue-26548-recursion-via-normalize.rs1
-rw-r--r--tests/ui/recursion/issue-26548-recursion-via-normalize.stderr1
-rw-r--r--tests/ui/recursion/issue-83150.stderr3
-rw-r--r--tests/ui/recursion/recursive-static-definition.stderr1
-rw-r--r--tests/ui/regions/higher-ranked-implied.stderr8
-rw-r--r--tests/ui/regions/issue-102374.stderr3
-rw-r--r--tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr4
-rw-r--r--tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr4
-rw-r--r--tests/ui/regions/region-object-lifetime-5.rs2
-rw-r--r--tests/ui/regions/region-object-lifetime-5.stderr7
-rw-r--r--tests/ui/regions/regions-lifetime-bounds-on-fns.stderr4
-rw-r--r--tests/ui/repr/repr-transparent.stderr8
-rw-r--r--tests/ui/resolve/112590-2.fixed34
-rw-r--r--tests/ui/resolve/112590-2.rs26
-rw-r--r--tests/ui/resolve/112590-2.stderr71
-rw-r--r--tests/ui/resolve/bad-expr-path.stderr12
-rw-r--r--tests/ui/resolve/bad-expr-path2.stderr12
-rw-r--r--tests/ui/resolve/derive-macro-1.rs (renamed from tests/ui/resolve/issue-112831.rs)6
-rw-r--r--tests/ui/resolve/derive-macro-2.rs18
-rw-r--r--tests/ui/resolve/export-fully-qualified-2018.stderr5
-rw-r--r--tests/ui/resolve/export-fully-qualified.stderr5
-rw-r--r--tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed31
-rw-r--r--tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs31
-rw-r--r--tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr31
-rw-r--r--tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs10
-rw-r--r--tests/ui/resolve/issue-2356.stderr21
-rw-r--r--tests/ui/resolve/resolve-inconsistent-names.stderr18
-rw-r--r--tests/ui/resolve/resolve-self-in-impl.stderr1
-rw-r--r--tests/ui/resolve/unresolved-segments-visibility.rs11
-rw-r--r--tests/ui/resolve/unresolved-segments-visibility.stderr9
-rw-r--r--tests/ui/resolve/unused-qualifications-suggestion.fixed23
-rw-r--r--tests/ui/resolve/unused-qualifications-suggestion.rs23
-rw-r--r--tests/ui/resolve/unused-qualifications-suggestion.stderr31
-rw-r--r--tests/ui/return/return-struct.rs24
-rw-r--r--tests/ui/return/return-struct.stderr35
-rw-r--r--tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs3
-rw-r--r--tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2027-object-safe-for-dispatch/manual-self-impl-for-unsafe-obj.rs2
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs18
-rw-r--r--tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.rs4
-rw-r--r--tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr3
-rw-r--r--tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.rs5
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/staged-api.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr28
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-chain.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-dup-bound.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-fail.rs5
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-fail.stderr28
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs5
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-pass.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr27
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr19
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr39
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.stderr9
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.rs7
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.stderr55
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr61
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr63
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr19
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs7
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr19
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.rs8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.rs1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.stderr12
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr40
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.stderr12
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.rs5
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr22
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.rs5
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/do-not-const-check-override.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/helloworld.rs6
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr17
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/hir-const-check.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.rs7
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr36
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.rs6
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr19
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr22
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.rs5
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs6
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr18
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-impl-non-const-specialized-impl.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs6
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.stderr12
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr18
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.rs4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/staged-api.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.rs8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr16
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr16
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr6
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs3
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yy.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs5
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr20
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs10
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr25
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde_const_on_impl_bound.rs5
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde_const_on_impl_bound.stderr12
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-default-body-stability.stderr33
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.rs8
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr32
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-self-referential.rs2
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/count.rs14
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs3
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr25
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs16
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr31
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rsbin760 -> 623 bytes
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderrbin4477 -> 674 bytes
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs3
-rw-r--r--tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr38
-rw-r--r--tests/ui/rmeta/auxiliary/rmeta-rlib-rpass.rs8
-rw-r--r--tests/ui/rmeta/auxiliary/rmeta-rmeta.rs9
-rw-r--r--tests/ui/rmeta/rmeta-rpass.rs18
-rw-r--r--tests/ui/sanitize/address.rs3
-rw-r--r--tests/ui/sanitize/badfree.rs1
-rw-r--r--tests/ui/sanitize/issue-111184-generator-witness.rs4
-rw-r--r--tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs15
-rw-r--r--tests/ui/sanitize/issue-72154-lifetime-markers.rs1
-rw-r--r--tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs1
-rw-r--r--tests/ui/sanitize/sanitizer-cfi-requires-lto.rs2
-rw-r--r--tests/ui/sanitize/sanitizer-cfi-requires-lto.stderr2
-rw-r--r--tests/ui/sanitize/sanitizer-cfi-with-rustc-lto-requires-single-codegen-unit.rs8
-rw-r--r--tests/ui/sanitize/sanitizer-cfi-with-rustc-lto-requires-single-codegen-unit.stderr4
-rw-r--r--tests/ui/sanitize/use-after-scope.rs1
-rw-r--r--tests/ui/self/arbitrary_self_type_mut_difference.rs13
-rw-r--r--tests/ui/self/arbitrary_self_type_mut_difference.stderr27
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.fixed17
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.rs17
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.stderr43
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed12
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_mut_pin.rs12
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr20
-rw-r--r--tests/ui/self/arbitrary_self_types_pin_needing_borrow.rs13
-rw-r--r--tests/ui/self/arbitrary_self_types_pin_needing_borrow.stderr33
-rw-r--r--tests/ui/simd/intrinsic/float-minmax-pass.rs2
-rw-r--r--tests/ui/simd/intrinsic/generic-arithmetic-2.rs28
-rw-r--r--tests/ui/simd/intrinsic/generic-arithmetic-2.stderr80
-rw-r--r--tests/ui/simd/intrinsic/generic-arithmetic-pass.rs35
-rw-r--r--tests/ui/simd/intrinsic/generic-bswap-byte.rs22
-rw-r--r--tests/ui/simd/intrinsic/generic-elements-pass.rs22
-rw-r--r--tests/ui/simd/intrinsic/generic-elements.rs22
-rw-r--r--tests/ui/simd/intrinsic/generic-elements.stderr74
-rw-r--r--tests/ui/simd/intrinsic/inlining-issue67557-ice.rs4
-rw-r--r--tests/ui/simd/intrinsic/inlining-issue67557.rs6
-rw-r--r--tests/ui/simd/shuffle-not-out-of-bounds.rs31
-rw-r--r--tests/ui/simd/shuffle-not-out-of-bounds.stderr50
-rw-r--r--tests/ui/simd/shuffle.rs3
-rw-r--r--tests/ui/sized/recursive-type-2.stderr1
-rw-r--r--tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr8
-rw-r--r--tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr2
-rw-r--r--tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr2
-rw-r--r--tests/ui/span/borrowck-fn-in-const-b.stderr2
-rw-r--r--tests/ui/span/borrowck-let-suggestion-suffixes.stderr2
-rw-r--r--tests/ui/span/borrowck-object-mutability.stderr4
-rw-r--r--tests/ui/span/destructor-restrictions.stderr2
-rw-r--r--tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr4
-rw-r--r--tests/ui/span/issue-36537.stderr2
-rw-r--r--tests/ui/span/issue-39698.stderr20
-rw-r--r--tests/ui/span/issue-40157.stderr2
-rw-r--r--tests/ui/span/mut-arg-hint.stderr6
-rw-r--r--tests/ui/span/mut-ptr-cant-outlive-ref.stderr2
-rw-r--r--tests/ui/span/regionck-unboxed-closure-lifetimes.stderr2
-rw-r--r--tests/ui/span/regions-escape-loop-via-vec.stderr10
-rw-r--r--tests/ui/span/send-is-not-static-std-sync.stderr10
-rw-r--r--tests/ui/span/slice-borrow.stderr2
-rw-r--r--tests/ui/span/suggestion-non-ascii.stderr4
-rw-r--r--tests/ui/span/visibility-ty-params.rs2
-rw-r--r--tests/ui/span/visibility-ty-params.stderr6
-rw-r--r--tests/ui/specialization/min_specialization/issue-79224.stderr4
-rw-r--r--tests/ui/stability-attribute/missing-const-stability.rs2
-rw-r--r--tests/ui/std/issue-15149.rs57
-rw-r--r--tests/ui/std/switch-stdout.rs52
-rw-r--r--tests/ui/suggestions/copied-and-cloned.fixed34
-rw-r--r--tests/ui/suggestions/copied-and-cloned.rs34
-rw-r--r--tests/ui/suggestions/copied-and-cloned.stderr64
-rw-r--r--tests/ui/suggestions/crate-or-module-typo.stderr16
-rw-r--r--tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs2
-rw-r--r--tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr21
-rw-r--r--tests/ui/suggestions/issue-102972.stderr9
-rw-r--r--tests/ui/suggestions/issue-114701.rs15
-rw-r--r--tests/ui/suggestions/issue-114701.stderr15
-rw-r--r--tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.fixed17
-rw-r--r--tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.rs17
-rw-r--r--tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.stderr38
-rw-r--r--tests/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr2
-rw-r--r--tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr2
-rw-r--r--tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr (renamed from tests/ui/suggestions/missing-lifetime-in-assoc-const-type.stderr)8
-rw-r--r--tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr47
-rw-r--r--tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs4
-rw-r--r--tests/ui/suggestions/missing-semicolon.fixed38
-rw-r--r--tests/ui/suggestions/missing-semicolon.rs38
-rw-r--r--tests/ui/suggestions/missing-semicolon.stderr75
-rw-r--r--tests/ui/suggestions/option-content-move.stderr4
-rw-r--r--tests/ui/suggestions/remove-question-symbol-with-paren.rs9
-rw-r--r--tests/ui/suggestions/remove-question-symbol-with-paren.stderr25
-rw-r--r--tests/ui/suggestions/suggest-mut-method-for-loop-closure.rs19
-rw-r--r--tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr15
-rw-r--r--tests/ui/target-feature/gate.rs16
-rw-r--r--tests/ui/target-feature/gate.stderr2
-rw-r--r--tests/ui/target-feature/invalid-attribute.rs14
-rw-r--r--tests/ui/target-feature/invalid-attribute.stderr44
-rw-r--r--tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr14
-rw-r--r--tests/ui/test-attrs/test-panic-abort.run.stdout7
-rw-r--r--tests/ui/test-attrs/test-thread-capture.run.stdout3
-rw-r--r--tests/ui/test-attrs/test-thread-nocapture.run.stderr3
-rw-r--r--tests/ui/thir-print/thir-flat-const-variant.stdout8
-rw-r--r--tests/ui/thir-print/thir-tree-match.stdout8
-rw-r--r--tests/ui/threads-sendsync/issue-24313.rs2
-rw-r--r--tests/ui/traits/dont-autoderef-ty-with-escaping-var.rs22
-rw-r--r--tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr27
-rw-r--r--tests/ui/traits/issue-105231.rs2
-rw-r--r--tests/ui/traits/issue-105231.stderr8
-rw-r--r--tests/ui/traits/issue-24010.rs2
-rw-r--r--tests/ui/traits/issue-91949-hangs-on-recursion.stderr3
-rw-r--r--tests/ui/traits/new-solver/alias-bound-preference.rs39
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.rs9
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.stderr65
-rw-r--r--tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs27
-rw-r--r--tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.rs (renamed from tests/ui/traits/new-solver/runaway-impl-candidate-selection.rs)0
-rw-r--r--tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr (renamed from tests/ui/traits/new-solver/runaway-impl-candidate-selection.stderr)0
-rw-r--r--tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs20
-rw-r--r--tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr12
-rw-r--r--tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs22
-rw-r--r--tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs25
-rw-r--r--tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs24
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs32
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr23
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs69
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.stderr16
-rw-r--r--tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs37
-rw-r--r--tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr29
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs48
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.stderr16
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs44
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs36
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs46
-rw-r--r--tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr16
-rw-r--r--tests/ui/traits/new-solver/cycles/leak-check-coinductive-cycle.rs (renamed from tests/ui/traits/new-solver/leak-check-coinductive-cycle.rs)2
-rw-r--r--tests/ui/traits/new-solver/cycles/provisional-result-done.rs (renamed from tests/ui/traits/new-solver/provisional-result-done.rs)0
-rw-r--r--tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs17
-rw-r--r--tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs32
-rw-r--r--tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs22
-rw-r--r--tests/ui/traits/new-solver/dont-normalize-proj-with-error.stderr9
-rw-r--r--tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs4
-rw-r--r--tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs18
-rw-r--r--tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs73
-rw-r--r--tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs75
-rw-r--r--tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr9
-rw-r--r--tests/ui/traits/new-solver/lazy-nested-obligations-2.rs2
-rw-r--r--tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr39
-rw-r--r--tests/ui/traits/new-solver/more-object-bound.stderr4
-rw-r--r--tests/ui/traits/new-solver/normalize-unsize-rhs.rs23
-rw-r--r--tests/ui/traits/new-solver/object-soundness-requires-generalization.rs20
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs (renamed from tests/ui/traits/new-solver/exponential-trait-goals.rs)0
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr (renamed from tests/ui/traits/new-solver/exponential-trait-goals.stderr)0
-rw-r--r--tests/ui/traits/new-solver/overflow/global-cache.rs23
-rw-r--r--tests/ui/traits/new-solver/overflow/global-cache.stderr16
-rw-r--r--tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.rs (renamed from tests/ui/traits/new-solver/recursive-self-normalization-2.rs)0
-rw-r--r--tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr (renamed from tests/ui/traits/new-solver/recursive-self-normalization-2.stderr)0
-rw-r--r--tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs (renamed from tests/ui/traits/new-solver/recursive-self-normalization.rs)0
-rw-r--r--tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr (renamed from tests/ui/traits/new-solver/recursive-self-normalization.stderr)0
-rw-r--r--tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs20
-rw-r--r--tests/ui/traits/new-solver/unsize-although-ambiguous.rs13
-rw-r--r--tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.rs19
-rw-r--r--tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.stderr11
-rw-r--r--tests/ui/traits/object/print_vtable_sizes.rs5
-rw-r--r--tests/ui/traits/object/print_vtable_sizes.stdout2
-rw-r--r--tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs2
-rw-r--r--tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr8
-rw-r--r--tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr1
-rw-r--r--tests/ui/traits/trait-upcasting/fewer-associated.rs25
-rw-r--r--tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.current.stderr14
-rw-r--r--tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.next.stderr14
-rw-r--r--tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs23
-rw-r--r--tests/ui/traits/trait-upcasting/issue-11515.current.stderr (renamed from tests/ui/issues/issue-11515.stderr)2
-rw-r--r--tests/ui/traits/trait-upcasting/issue-11515.next.stderr13
-rw-r--r--tests/ui/traits/trait-upcasting/issue-11515.rs (renamed from tests/ui/issues/issue-11515.rs)5
-rw-r--r--tests/ui/traits/trait-upcasting/normalization.rs20
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-1.current.stderr9
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-1.next.stderr9
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-1.rs4
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-1.stderr23
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-2.rs2
-rw-r--r--tests/ui/traits/trait-upcasting/type-checking-test-2.stderr37
-rw-r--r--tests/ui/traits/trait-upcasting/upcast-through-struct-tail.current.stderr13
-rw-r--r--tests/ui/traits/trait-upcasting/upcast-through-struct-tail.next.stderr13
-rw-r--r--tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs14
-rw-r--r--tests/ui/traits/vtable/multiple-markers.rs47
-rw-r--r--tests/ui/traits/vtable/multiple-markers.stderr52
-rw-r--r--tests/ui/transmutability/issue-110892.rs40
-rw-r--r--tests/ui/transmutability/issue-110892.stderr36
-rw-r--r--tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs5
-rw-r--r--tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.stderr25
-rw-r--r--tests/ui/transmutability/references/recursive-wrapper-types.rs5
-rw-r--r--tests/ui/transmutability/references/recursive-wrapper-types.stderr25
-rw-r--r--tests/ui/treat-err-as-bug/delay_span_bug.rs2
-rw-r--r--tests/ui/treat-err-as-bug/err.rs2
-rw-r--r--tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr1
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/broken_mir.rs16
-rw-r--r--tests/ui/type-alias-impl-trait/coherence.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/coherence.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/coherence_generalization.rs5
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_type_mismatch.rs57
-rw-r--r--tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/inference-cycle.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53092-2.stderr1
-rw-r--r--tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs (renamed from tests/ui/issues/issue-83190.rs)4
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-hrtb.rs15
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr23
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs21
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.rs34
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/reveal_local.stderr3
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-impl-param.rs25
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-impl-param.stderr (renamed from tests/ui/impl-trait/in-trait/unconstrained-lt.next.stderr)4
-rw-r--r--tests/ui/type-alias-impl-trait/under-binder.rs9
-rw-r--r--tests/ui/type-alias-impl-trait/under-binder.stderr12
-rw-r--r--tests/ui/type-alias-impl-trait/wf-check-rpit-lifetimes.rs19
-rw-r--r--tests/ui/type/option-ref-advice.rs11
-rw-r--r--tests/ui/type/option-ref-advice.stderr (renamed from tests/ui/issues/issue-100605.stderr)8
-rw-r--r--tests/ui/typeck/apit-with-error-type-in-sig.rs8
-rw-r--r--tests/ui/typeck/apit-with-error-type-in-sig.stderr9
-rw-r--r--tests/ui/typeck/explain_clone_autoref.rs116
-rw-r--r--tests/ui/typeck/explain_clone_autoref.stderr215
-rw-r--r--tests/ui/typeck/issue-110017-format-into-help-deletes-macro.fixed55
-rw-r--r--tests/ui/typeck/issue-110017-format-into-help-deletes-macro.rs55
-rw-r--r--tests/ui/typeck/issue-110017-format-into-help-deletes-macro.stderr59
-rw-r--r--tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.fixed37
-rw-r--r--tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.rs37
-rw-r--r--tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.stderr50
-rw-r--r--tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr4
-rw-r--r--tests/ui/typeck/issue-114423-ice-regression-in-suggestion.rs15
-rw-r--r--tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr52
-rw-r--r--tests/ui/typeck/mismatched-map-under-self.rs17
-rw-r--r--tests/ui/typeck/mismatched-map-under-self.stderr37
-rw-r--r--tests/ui/underscore-imports/cycle.rs2
-rw-r--r--tests/ui/underscore-imports/hygiene.rs1
-rw-r--r--tests/ui/unop-move-semantics.stderr2
-rw-r--r--tests/ui/unpretty/avoid-crash.stderr2
-rw-r--r--tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr (renamed from tests/ui/unsafe/unsafe-not-inherited.stderr)4
-rw-r--r--tests/ui/unsafe/unsafe-not-inherited.rs2
-rw-r--r--tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr24
-rw-r--r--tests/ui/unsized/issue-75899.rs2
-rw-r--r--tests/ui/use/use-after-move-implicity-coerced-object.stderr2
-rw-r--r--tests/ui/use/use-self-type.stderr4
-rw-r--r--tests/ui/where-clauses/where-clause-bounds-inconsistency.rs1
-rw-r--r--tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.fixed (renamed from tests/ui/parser/type-alias-where-fixable.fixed)0
-rw-r--r--tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs (renamed from tests/ui/parser/type-alias-where-fixable.rs)0
-rw-r--r--tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr (renamed from tests/ui/parser/type-alias-where-fixable.stderr)6
-rw-r--r--tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.fixed15
-rw-r--r--tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.rs15
-rw-r--r--tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.stderr29
-rw-r--r--tests/ui/where-clauses/where-clause-placement-type-alias.rs (renamed from tests/ui/parser/type-alias-where.rs)0
-rw-r--r--tests/ui/where-clauses/where-clause-placement-type-alias.stderr20
1438 files changed, 15711 insertions, 5328 deletions
diff --git a/tests/ui/abi/relocation_model_pic.rs b/tests/ui/abi/relocation_model_pic.rs
new file mode 100644
index 000000000..0cfc44cd0
--- /dev/null
+++ b/tests/ui/abi/relocation_model_pic.rs
@@ -0,0 +1,9 @@
+// run-pass
+// compile-flags: -C relocation-model=pic
+// ignore-emscripten no pic
+// ignore-wasm
+
+#![feature(cfg_relocation_model)]
+
+#[cfg(relocation_model = "pic")]
+fn main() {}
diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr
new file mode 100644
index 000000000..02082c13f
--- /dev/null
+++ b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr
@@ -0,0 +1,27 @@
+error[E0703]: invalid ABI: found `riscv-interrupt`
+ --> $DIR/riscv-discoverability-guidance.rs:17:8
+ |
+LL | extern "riscv-interrupt" fn isr() {}
+ | ^^^^^^^^^^^^^^^^^
+ | |
+ | invalid ABI
+ | help: did you mean: `"riscv-interrupt-m"`
+ |
+ = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
+ = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively
+
+error[E0703]: invalid ABI: found `riscv-interrupt-u`
+ --> $DIR/riscv-discoverability-guidance.rs:23:8
+ |
+LL | extern "riscv-interrupt-u" fn isr_U() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ | |
+ | invalid ABI
+ | help: did you mean: `"riscv-interrupt-m"`
+ |
+ = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
+ = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0703`.
diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr
new file mode 100644
index 000000000..02082c13f
--- /dev/null
+++ b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr
@@ -0,0 +1,27 @@
+error[E0703]: invalid ABI: found `riscv-interrupt`
+ --> $DIR/riscv-discoverability-guidance.rs:17:8
+ |
+LL | extern "riscv-interrupt" fn isr() {}
+ | ^^^^^^^^^^^^^^^^^
+ | |
+ | invalid ABI
+ | help: did you mean: `"riscv-interrupt-m"`
+ |
+ = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
+ = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively
+
+error[E0703]: invalid ABI: found `riscv-interrupt-u`
+ --> $DIR/riscv-discoverability-guidance.rs:23:8
+ |
+LL | extern "riscv-interrupt-u" fn isr_U() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ | |
+ | invalid ABI
+ | help: did you mean: `"riscv-interrupt-m"`
+ |
+ = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions.
+ = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0703`.
diff --git a/tests/ui/abi/riscv-discoverability-guidance.rs b/tests/ui/abi/riscv-discoverability-guidance.rs
new file mode 100644
index 000000000..f57fcd604
--- /dev/null
+++ b/tests/ui/abi/riscv-discoverability-guidance.rs
@@ -0,0 +1,27 @@
+// ignore-tidy-linelength
+// revisions: riscv32 riscv64
+//
+// [riscv32] needs-llvm-components: riscv
+// [riscv32] compile-flags: --target=riscv32i-unknown-none-elf -C target-feature=-unaligned-scalar-mem --crate-type=rlib
+// [riscv64] needs-llvm-components: riscv
+// [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf -C target-feature=-unaligned-scalar-mem --crate-type=rlib
+#![no_core]
+#![feature(
+ no_core,
+ lang_items,
+ abi_riscv_interrupt
+)]
+#[lang = "sized"]
+trait Sized {}
+
+extern "riscv-interrupt" fn isr() {}
+//~^ ERROR invalid ABI
+//~^^ NOTE invalid ABI
+//~^^^ NOTE invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
+//~^^^^ NOTE please use one of riscv-interrupt-m or riscv-interrupt-s
+
+extern "riscv-interrupt-u" fn isr_U() {}
+//~^ ERROR invalid ABI
+//~^^ NOTE invalid ABI
+//~^^^ NOTE invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
+//~^^^^ NOTE user-mode interrupt handlers have been removed from LLVM pending standardization
diff --git a/tests/ui/abi/stack-probes-lto.rs b/tests/ui/abi/stack-probes-lto.rs
index 0dccb633d..7282d0970 100644
--- a/tests/ui/abi/stack-probes-lto.rs
+++ b/tests/ui/abi/stack-probes-lto.rs
@@ -1,13 +1,7 @@
+// revisions: x32 x64
// run-pass
-// ignore-arm
-// ignore-aarch64
-// ignore-mips
-// ignore-mips64
-// ignore-sparc
-// ignore-sparc64
-// ignore-loongarch64
-// ignore-wasm
-// ignore-emscripten no processes
+//[x32] only-x86
+//[x64] only-x86_64
// ignore-sgx no processes
// ignore-musl FIXME #31506
// ignore-fuchsia no exception handler registered for segfault
diff --git a/tests/ui/abi/stack-probes.rs b/tests/ui/abi/stack-probes.rs
index 8137c9230..4b8a79a4b 100644
--- a/tests/ui/abi/stack-probes.rs
+++ b/tests/ui/abi/stack-probes.rs
@@ -1,12 +1,7 @@
+// revisions: x32 x64
// run-pass
-// ignore-arm
-// ignore-aarch64
-// ignore-mips
-// ignore-mips64
-// ignore-sparc
-// ignore-sparc64
-// ignore-loongarch64
-// ignore-wasm
+//[x32] only-x86
+//[x64] only-x86_64
// ignore-emscripten no processes
// ignore-sgx no processes
// ignore-fuchsia no exception handler registered for segfault
diff --git a/tests/ui/abi/stack-protector.rs b/tests/ui/abi/stack-protector.rs
index 24bd2e219..e94aa816d 100644
--- a/tests/ui/abi/stack-protector.rs
+++ b/tests/ui/abi/stack-protector.rs
@@ -40,6 +40,8 @@ fn vulnerable_function() {
// Overwrite the on-stack return address with the address of `malicious_code()`,
// thereby jumping to that function when returning from `vulnerable_function()`.
unsafe { fill(stackaddr, bad_code_ptr, 20); }
+ // Capture the address, so the write is not optimized away.
+ std::hint::black_box(stackaddr);
}
// Use an uninlined function with its own stack frame to make sure that we don't
diff --git a/tests/ui/abi/unsupported.aarch64.stderr b/tests/ui/abi/unsupported.aarch64.stderr
index e86a73ea6..d7b4e6150 100644
--- a/tests/ui/abi/unsupported.aarch64.stderr
+++ b/tests/ui/abi/unsupported.aarch64.stderr
@@ -1,53 +1,59 @@
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:26:1
+ --> $DIR/unsupported.rs:30:1
|
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:28:1
+ --> $DIR/unsupported.rs:32:1
|
LL | extern "amdgpu-kernel" fn amdgpu() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"wasm"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:30:1
+ --> $DIR/unsupported.rs:34:1
|
LL | extern "wasm" fn wasm() {}
| ^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"aapcs"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:32:1
+ --> $DIR/unsupported.rs:36:1
|
LL | extern "aapcs" fn aapcs() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:36:1
+ --> $DIR/unsupported.rs:42:1
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:38:1
+ --> $DIR/unsupported.rs:44:1
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:46:1
+ |
+LL | extern "riscv-interrupt-m" fn riscv() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:40:1
+ --> $DIR/unsupported.rs:51:1
|
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"thiscall"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:43:1
+ --> $DIR/unsupported.rs:56:1
|
LL | extern "thiscall" fn thiscall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: use of calling convention not supported on this target
- --> $DIR/unsupported.rs:47:1
+ --> $DIR/unsupported.rs:62:1
|
LL | extern "stdcall" fn stdcall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -56,6 +62,6 @@ LL | extern "stdcall" fn stdcall() {}
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
= note: `#[warn(unsupported_calling_conventions)]` on by default
-error: aborting due to 8 previous errors; 1 warning emitted
+error: aborting due to 9 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0570`.
diff --git a/tests/ui/abi/unsupported.arm.stderr b/tests/ui/abi/unsupported.arm.stderr
index f7569c8cd..3a3ed2dd9 100644
--- a/tests/ui/abi/unsupported.arm.stderr
+++ b/tests/ui/abi/unsupported.arm.stderr
@@ -1,47 +1,53 @@
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:26:1
+ --> $DIR/unsupported.rs:30:1
|
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:28:1
+ --> $DIR/unsupported.rs:32:1
|
LL | extern "amdgpu-kernel" fn amdgpu() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"wasm"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:30:1
+ --> $DIR/unsupported.rs:34:1
|
LL | extern "wasm" fn wasm() {}
| ^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:36:1
+ --> $DIR/unsupported.rs:42:1
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:38:1
+ --> $DIR/unsupported.rs:44:1
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:46:1
+ |
+LL | extern "riscv-interrupt-m" fn riscv() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:40:1
+ --> $DIR/unsupported.rs:51:1
|
LL | extern "x86-interrupt" fn x86() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"thiscall"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:43:1
+ --> $DIR/unsupported.rs:56:1
|
LL | extern "thiscall" fn thiscall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: use of calling convention not supported on this target
- --> $DIR/unsupported.rs:47:1
+ --> $DIR/unsupported.rs:62:1
|
LL | extern "stdcall" fn stdcall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,6 +56,6 @@ LL | extern "stdcall" fn stdcall() {}
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
= note: `#[warn(unsupported_calling_conventions)]` on by default
-error: aborting due to 7 previous errors; 1 warning emitted
+error: aborting due to 8 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0570`.
diff --git a/tests/ui/abi/unsupported.i686.stderr b/tests/ui/abi/unsupported.i686.stderr
index 7ca93516d..31b7d030b 100644
--- a/tests/ui/abi/unsupported.i686.stderr
+++ b/tests/ui/abi/unsupported.i686.stderr
@@ -1,39 +1,45 @@
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:26:1
+ --> $DIR/unsupported.rs:30:1
|
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:28:1
+ --> $DIR/unsupported.rs:32:1
|
LL | extern "amdgpu-kernel" fn amdgpu() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"wasm"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:30:1
+ --> $DIR/unsupported.rs:34:1
|
LL | extern "wasm" fn wasm() {}
| ^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"aapcs"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:32:1
+ --> $DIR/unsupported.rs:36:1
|
LL | extern "aapcs" fn aapcs() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:36:1
+ --> $DIR/unsupported.rs:42:1
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:38:1
+ --> $DIR/unsupported.rs:44:1
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 6 previous errors
+error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:46:1
+ |
+LL | extern "riscv-interrupt-m" fn riscv() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0570`.
diff --git a/tests/ui/abi/unsupported.riscv32.stderr b/tests/ui/abi/unsupported.riscv32.stderr
new file mode 100644
index 000000000..1966e18f0
--- /dev/null
+++ b/tests/ui/abi/unsupported.riscv32.stderr
@@ -0,0 +1,61 @@
+error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:30:1
+ |
+LL | extern "ptx-kernel" fn ptx() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:32:1
+ |
+LL | extern "amdgpu-kernel" fn amdgpu() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"wasm"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:34:1
+ |
+LL | extern "wasm" fn wasm() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"aapcs"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:36:1
+ |
+LL | extern "aapcs" fn aapcs() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:42:1
+ |
+LL | extern "msp430-interrupt" fn msp430() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:44:1
+ |
+LL | extern "avr-interrupt" fn avr() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:51:1
+ |
+LL | extern "x86-interrupt" fn x86() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"thiscall"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:56:1
+ |
+LL | extern "thiscall" fn thiscall() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of calling convention not supported on this target
+ --> $DIR/unsupported.rs:62:1
+ |
+LL | extern "stdcall" fn stdcall() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = 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 #87678 <https://github.com/rust-lang/rust/issues/87678>
+ = note: `#[warn(unsupported_calling_conventions)]` on by default
+
+error: aborting due to 8 previous errors; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0570`.
diff --git a/tests/ui/abi/unsupported.riscv64.stderr b/tests/ui/abi/unsupported.riscv64.stderr
new file mode 100644
index 000000000..1966e18f0
--- /dev/null
+++ b/tests/ui/abi/unsupported.riscv64.stderr
@@ -0,0 +1,61 @@
+error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:30:1
+ |
+LL | extern "ptx-kernel" fn ptx() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:32:1
+ |
+LL | extern "amdgpu-kernel" fn amdgpu() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"wasm"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:34:1
+ |
+LL | extern "wasm" fn wasm() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"aapcs"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:36:1
+ |
+LL | extern "aapcs" fn aapcs() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:42:1
+ |
+LL | extern "msp430-interrupt" fn msp430() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:44:1
+ |
+LL | extern "avr-interrupt" fn avr() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:51:1
+ |
+LL | extern "x86-interrupt" fn x86() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0570]: `"thiscall"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:56:1
+ |
+LL | extern "thiscall" fn thiscall() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of calling convention not supported on this target
+ --> $DIR/unsupported.rs:62:1
+ |
+LL | extern "stdcall" fn stdcall() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = 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 #87678 <https://github.com/rust-lang/rust/issues/87678>
+ = note: `#[warn(unsupported_calling_conventions)]` on by default
+
+error: aborting due to 8 previous errors; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0570`.
diff --git a/tests/ui/abi/unsupported.rs b/tests/ui/abi/unsupported.rs
index 6427a5695..57278e664 100644
--- a/tests/ui/abi/unsupported.rs
+++ b/tests/ui/abi/unsupported.rs
@@ -1,4 +1,4 @@
-// revisions: x64 i686 aarch64 arm
+// revisions: x64 i686 aarch64 arm riscv32 riscv64
//
// [x64] needs-llvm-components: x86
// [x64] compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib
@@ -8,6 +8,10 @@
// [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu --crate-type=rlib
// [arm] needs-llvm-components: arm
// [arm] compile-flags: --target=armv7-unknown-linux-gnueabihf --crate-type=rlib
+// [riscv32] needs-llvm-components: riscv
+// [riscv32] compile-flags: --target=riscv32i-unknown-none-elf --crate-type=rlib
+// [riscv64] needs-llvm-components: riscv
+// [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf --crate-type=rlib
#![no_core]
#![feature(
no_core,
@@ -15,13 +19,13 @@
abi_ptx,
abi_msp430_interrupt,
abi_avr_interrupt,
- abi_thiscall,
abi_amdgpu_kernel,
wasm_abi,
- abi_x86_interrupt
+ abi_x86_interrupt,
+ abi_riscv_interrupt
)]
-#[lang="sized"]
-trait Sized { }
+#[lang = "sized"]
+trait Sized {}
extern "ptx-kernel" fn ptx() {}
//~^ ERROR is not a supported ABI
@@ -33,21 +37,36 @@ extern "aapcs" fn aapcs() {}
//[x64]~^ ERROR is not a supported ABI
//[i686]~^^ ERROR is not a supported ABI
//[aarch64]~^^^ ERROR is not a supported ABI
+//[riscv32]~^^^^ ERROR is not a supported ABI
+//[riscv64]~^^^^^ ERROR is not a supported ABI
extern "msp430-interrupt" fn msp430() {}
//~^ ERROR is not a supported ABI
extern "avr-interrupt" fn avr() {}
//~^ ERROR is not a supported ABI
+extern "riscv-interrupt-m" fn riscv() {}
+//[arm]~^ ERROR is not a supported ABI
+//[x64]~^^ ERROR is not a supported ABI
+//[i686]~^^^ ERROR is not a supported ABI
+//[aarch64]~^^^^ ERROR is not a supported ABI
extern "x86-interrupt" fn x86() {}
//[aarch64]~^ ERROR is not a supported ABI
//[arm]~^^ ERROR is not a supported ABI
+//[riscv32]~^^^ ERROR is not a supported ABI
+//[riscv64]~^^^^ ERROR is not a supported ABI
extern "thiscall" fn thiscall() {}
//[x64]~^ ERROR is not a supported ABI
-//[aarch64]~^^ ERROR is not a supported ABI
-//[arm]~^^^ ERROR is not a supported ABI
+//[arm]~^^ ERROR is not a supported ABI
+//[aarch64]~^^^ ERROR is not a supported ABI
+//[riscv32]~^^^^ ERROR is not a supported ABI
+//[riscv64]~^^^^^ ERROR is not a supported ABI
extern "stdcall" fn stdcall() {}
//[x64]~^ WARN use of calling convention not supported
//[x64]~^^ WARN this was previously accepted
-//[aarch64]~^^^ WARN use of calling convention not supported
-//[aarch64]~^^^^ WARN this was previously accepted
-//[arm]~^^^^^ WARN use of calling convention not supported
-//[arm]~^^^^^^ WARN this was previously accepted
+//[arm]~^^^ WARN use of calling convention not supported
+//[arm]~^^^^ WARN this was previously accepted
+//[aarch64]~^^^^^ WARN use of calling convention not supported
+//[aarch64]~^^^^^^ WARN this was previously accepted
+//[riscv32]~^^^^^^^ WARN use of calling convention not supported
+//[riscv32]~^^^^^^^^ WARN this was previously accepted
+//[riscv64]~^^^^^^^^^ WARN use of calling convention not supported
+//[riscv64]~^^^^^^^^^^ WARN this was previously accepted
diff --git a/tests/ui/abi/unsupported.x64.stderr b/tests/ui/abi/unsupported.x64.stderr
index 26023a458..ea62cb151 100644
--- a/tests/ui/abi/unsupported.x64.stderr
+++ b/tests/ui/abi/unsupported.x64.stderr
@@ -1,47 +1,53 @@
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:26:1
+ --> $DIR/unsupported.rs:30:1
|
LL | extern "ptx-kernel" fn ptx() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:28:1
+ --> $DIR/unsupported.rs:32:1
|
LL | extern "amdgpu-kernel" fn amdgpu() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"wasm"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:30:1
+ --> $DIR/unsupported.rs:34:1
|
LL | extern "wasm" fn wasm() {}
| ^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"aapcs"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:32:1
+ --> $DIR/unsupported.rs:36:1
|
LL | extern "aapcs" fn aapcs() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:36:1
+ --> $DIR/unsupported.rs:42:1
|
LL | extern "msp430-interrupt" fn msp430() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:38:1
+ --> $DIR/unsupported.rs:44:1
|
LL | extern "avr-interrupt" fn avr() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
+ --> $DIR/unsupported.rs:46:1
+ |
+LL | extern "riscv-interrupt-m" fn riscv() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
- --> $DIR/unsupported.rs:43:1
+ --> $DIR/unsupported.rs:56:1
|
LL | extern "thiscall" fn thiscall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: use of calling convention not supported on this target
- --> $DIR/unsupported.rs:47:1
+ --> $DIR/unsupported.rs:62:1
|
LL | extern "stdcall" fn stdcall() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,6 +56,6 @@ LL | extern "stdcall" fn stdcall() {}
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
= note: `#[warn(unsupported_calling_conventions)]` on by default
-error: aborting due to 7 previous errors; 1 warning emitted
+error: aborting due to 8 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0570`.
diff --git a/tests/ui/annotate-snippet/auxiliary/other_file.rs b/tests/ui/annotate-snippet/auxiliary/other_file.rs
new file mode 100644
index 000000000..6f5f412d0
--- /dev/null
+++ b/tests/ui/annotate-snippet/auxiliary/other_file.rs
@@ -0,0 +1,6 @@
+pub struct WithPrivateMethod;
+
+impl WithPrivateMethod {
+ /// Private to get an error involving two files
+ fn private_method(&self) {}
+}
diff --git a/tests/ui/annotate-snippet/multiple-files.rs b/tests/ui/annotate-snippet/multiple-files.rs
new file mode 100644
index 000000000..981cdbb10
--- /dev/null
+++ b/tests/ui/annotate-snippet/multiple-files.rs
@@ -0,0 +1,8 @@
+// aux-build:other_file.rs
+// compile-flags: --error-format human-annotate-rs -Z unstable-options
+
+extern crate other_file;
+
+fn main() {
+ other_file::WithPrivateMethod.private_method();
+}
diff --git a/tests/ui/annotate-snippet/multiple-files.stderr b/tests/ui/annotate-snippet/multiple-files.stderr
new file mode 100644
index 000000000..4236ec811
--- /dev/null
+++ b/tests/ui/annotate-snippet/multiple-files.stderr
@@ -0,0 +1,11 @@
+error[E0624]: method `private_method` is private
+ --> $DIR/multiple-files.rs:7:35
+ |
+LL | other_file::WithPrivateMethod.private_method();
+ | ^^^^^^^^^^^^^^ private method
+ |
+ ::: $DIR/auxiliary/other_file.rs:5:5
+ |
+LL | fn private_method(&self) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ private method defined here
+ |
diff --git a/tests/ui/anonymous-higher-ranked-lifetime.stderr b/tests/ui/anonymous-higher-ranked-lifetime.stderr
index c023d1b15..e441cbdc8 100644
--- a/tests/ui/anonymous-higher-ranked-lifetime.stderr
+++ b/tests/ui/anonymous-higher-ranked-lifetime.stderr
@@ -13,7 +13,7 @@ note: required by a bound in `f1`
|
LL | fn f1<F>(_: F) where F: Fn(&(), &()) {}
| ^^^^^^^^^^^^ required by this bound in `f1`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its arguments
|
LL | f1(|_: &(), _: &()| {});
| + +
@@ -33,7 +33,7 @@ note: required by a bound in `f2`
|
LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its arguments
|
LL | f2(|_: &(), _: &()| {});
| + +
@@ -53,7 +53,7 @@ note: required by a bound in `f3`
|
LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}
| ^^^^^^^^^^^^^^^ required by this bound in `f3`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its arguments
|
LL | f3(|_: &(), _: &()| {});
| + +
@@ -73,7 +73,7 @@ note: required by a bound in `f4`
|
LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its arguments
|
LL | f4(|_: &(), _: &()| {});
| + +
@@ -93,7 +93,7 @@ note: required by a bound in `f5`
|
LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its arguments
|
LL | f5(|_: &(), _: &()| {});
| + +
@@ -113,7 +113,7 @@ note: required by a bound in `g1`
|
LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its argument
|
LL | g1(|_: &(), _: ()| {});
| +
@@ -133,7 +133,7 @@ note: required by a bound in `g2`
|
LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
| ^^^^^^^^^^^^^^^^ required by this bound in `g2`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its argument
|
LL | g2(|_: &(), _: ()| {});
| +
@@ -153,7 +153,7 @@ note: required by a bound in `g3`
|
LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its argument
|
LL | g3(|_: &(), _: ()| {});
| +
@@ -173,7 +173,7 @@ note: required by a bound in `g4`
|
LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its argument
|
LL | g4(|_: &(), _: ()| {});
| +
@@ -193,7 +193,7 @@ note: required by a bound in `h1`
|
LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its arguments
|
LL | h1(|_: &(), _: (), _: &(), _: ()| {});
| + +
@@ -213,7 +213,7 @@ note: required by a bound in `h2`
|
LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its arguments
|
LL | h2(|_: &(), _: (), _: &(), _: ()| {});
| + +
diff --git a/tests/ui/argument-suggestions/extra_arguments.rs b/tests/ui/argument-suggestions/extra_arguments.rs
index 144206232..4f2f3517d 100644
--- a/tests/ui/argument-suggestions/extra_arguments.rs
+++ b/tests/ui/argument-suggestions/extra_arguments.rs
@@ -1,12 +1,18 @@
fn empty() {}
-fn one_arg(_a: i32) {}
+fn one_arg<T>(_a: T) {}
fn two_arg_same(_a: i32, _b: i32) {}
fn two_arg_diff(_a: i32, _b: &str) {}
macro_rules! foo {
- ($x:expr) => {
+ ($x:expr, ~) => {
empty($x, 1); //~ ERROR function takes
- }
+ };
+ ($x:expr, $y:expr) => {
+ empty($x, $y); //~ ERROR function takes
+ };
+ (~, $y:expr) => {
+ empty(1, $y); //~ ERROR function takes
+ };
}
fn main() {
@@ -39,5 +45,17 @@ fn main() {
1,
""
);
- foo!(1);
+
+ // Check with macro expansions
+ foo!(1, ~);
+ foo!(~, 1);
+ foo!(1, 1);
+ one_arg(1, panic!()); //~ ERROR function takes
+ one_arg(panic!(), 1); //~ ERROR function takes
+ one_arg(stringify!($e), 1); //~ ERROR function takes
+
+ // Not a macro, but this also has multiple spans with equal source code,
+ // but different expansion contexts.
+ // https://github.com/rust-lang/rust/issues/114255
+ one_arg(for _ in 1.. {}, 1); //~ ERROR function takes
}
diff --git a/tests/ui/argument-suggestions/extra_arguments.stderr b/tests/ui/argument-suggestions/extra_arguments.stderr
index 11c710997..5ad8e3592 100644
--- a/tests/ui/argument-suggestions/extra_arguments.stderr
+++ b/tests/ui/argument-suggestions/extra_arguments.stderr
@@ -1,5 +1,5 @@
error[E0061]: this function takes 0 arguments but 1 argument was supplied
- --> $DIR/extra_arguments.rs:13:3
+ --> $DIR/extra_arguments.rs:19:3
|
LL | empty("");
| ^^^^^ --
@@ -14,7 +14,7 @@ LL | fn empty() {}
| ^^^^^
error[E0061]: this function takes 0 arguments but 2 arguments were supplied
- --> $DIR/extra_arguments.rs:14:3
+ --> $DIR/extra_arguments.rs:20:3
|
LL | empty(1, 1);
| ^^^^^ - - unexpected argument of type `{integer}`
@@ -33,7 +33,7 @@ LL + empty();
|
error[E0061]: this function takes 1 argument but 2 arguments were supplied
- --> $DIR/extra_arguments.rs:16:3
+ --> $DIR/extra_arguments.rs:22:3
|
LL | one_arg(1, 1);
| ^^^^^^^ ---
@@ -44,11 +44,11 @@ LL | one_arg(1, 1);
note: function defined here
--> $DIR/extra_arguments.rs:2:4
|
-LL | fn one_arg(_a: i32) {}
- | ^^^^^^^ -------
+LL | fn one_arg<T>(_a: T) {}
+ | ^^^^^^^ -----
error[E0061]: this function takes 1 argument but 2 arguments were supplied
- --> $DIR/extra_arguments.rs:17:3
+ --> $DIR/extra_arguments.rs:23:3
|
LL | one_arg(1, "");
| ^^^^^^^ ----
@@ -59,11 +59,11 @@ LL | one_arg(1, "");
note: function defined here
--> $DIR/extra_arguments.rs:2:4
|
-LL | fn one_arg(_a: i32) {}
- | ^^^^^^^ -------
+LL | fn one_arg<T>(_a: T) {}
+ | ^^^^^^^ -----
error[E0061]: this function takes 1 argument but 3 arguments were supplied
- --> $DIR/extra_arguments.rs:18:3
+ --> $DIR/extra_arguments.rs:24:3
|
LL | one_arg(1, "", 1.0);
| ^^^^^^^ -- --- unexpected argument of type `{float}`
@@ -73,8 +73,8 @@ LL | one_arg(1, "", 1.0);
note: function defined here
--> $DIR/extra_arguments.rs:2:4
|
-LL | fn one_arg(_a: i32) {}
- | ^^^^^^^ -------
+LL | fn one_arg<T>(_a: T) {}
+ | ^^^^^^^ -----
help: remove the extra arguments
|
LL - one_arg(1, "", 1.0);
@@ -82,7 +82,7 @@ LL + one_arg(1);
|
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
- --> $DIR/extra_arguments.rs:20:3
+ --> $DIR/extra_arguments.rs:26:3
|
LL | two_arg_same(1, 1, 1);
| ^^^^^^^^^^^^ ---
@@ -97,7 +97,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {}
| ^^^^^^^^^^^^ ------- -------
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
- --> $DIR/extra_arguments.rs:21:3
+ --> $DIR/extra_arguments.rs:27:3
|
LL | two_arg_same(1, 1, 1.0);
| ^^^^^^^^^^^^ -----
@@ -112,7 +112,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {}
| ^^^^^^^^^^^^ ------- -------
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
- --> $DIR/extra_arguments.rs:23:3
+ --> $DIR/extra_arguments.rs:29:3
|
LL | two_arg_diff(1, 1, "");
| ^^^^^^^^^^^^ ---
@@ -127,7 +127,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {}
| ^^^^^^^^^^^^ ------- --------
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
- --> $DIR/extra_arguments.rs:24:3
+ --> $DIR/extra_arguments.rs:30:3
|
LL | two_arg_diff(1, "", "");
| ^^^^^^^^^^^^ ----
@@ -142,7 +142,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {}
| ^^^^^^^^^^^^ ------- --------
error[E0061]: this function takes 2 arguments but 4 arguments were supplied
- --> $DIR/extra_arguments.rs:25:3
+ --> $DIR/extra_arguments.rs:31:3
|
LL | two_arg_diff(1, 1, "", "");
| ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str`
@@ -161,7 +161,7 @@ LL + two_arg_diff(1, "");
|
error[E0061]: this function takes 2 arguments but 4 arguments were supplied
- --> $DIR/extra_arguments.rs:26:3
+ --> $DIR/extra_arguments.rs:32:3
|
LL | two_arg_diff(1, "", 1, "");
| ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str`
@@ -180,7 +180,7 @@ LL + two_arg_diff(1, "");
|
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
- --> $DIR/extra_arguments.rs:29:3
+ --> $DIR/extra_arguments.rs:35:3
|
LL | two_arg_same(1, 1, "");
| ^^^^^^^^^^^^ --------
@@ -195,7 +195,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {}
| ^^^^^^^^^^^^ ------- -------
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
- --> $DIR/extra_arguments.rs:30:3
+ --> $DIR/extra_arguments.rs:36:3
|
LL | two_arg_diff(1, 1, "");
| ^^^^^^^^^^^^ ---
@@ -210,7 +210,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {}
| ^^^^^^^^^^^^ ------- --------
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
- --> $DIR/extra_arguments.rs:31:3
+ --> $DIR/extra_arguments.rs:37:3
|
LL | two_arg_same(
| ^^^^^^^^^^^^
@@ -230,7 +230,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {}
| ^^^^^^^^^^^^ ------- -------
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
- --> $DIR/extra_arguments.rs:37:3
+ --> $DIR/extra_arguments.rs:43:3
|
LL | two_arg_diff(
| ^^^^^^^^^^^^
@@ -254,11 +254,10 @@ error[E0061]: this function takes 0 arguments but 2 arguments were supplied
LL | empty($x, 1);
| ^^^^^ - unexpected argument of type `{integer}`
...
-LL | foo!(1);
- | -------
+LL | foo!(1, ~);
+ | ----------
| | |
| | unexpected argument of type `{integer}`
- | | help: remove the extra argument
| in this macro invocation
|
note: function defined here
@@ -268,6 +267,105 @@ LL | fn empty() {}
| ^^^^^
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 16 previous errors
+error[E0061]: this function takes 0 arguments but 2 arguments were supplied
+ --> $DIR/extra_arguments.rs:14:9
+ |
+LL | empty(1, $y);
+ | ^^^^^ - unexpected argument of type `{integer}`
+...
+LL | foo!(~, 1);
+ | ----------
+ | | |
+ | | unexpected argument of type `{integer}`
+ | in this macro invocation
+ |
+note: function defined here
+ --> $DIR/extra_arguments.rs:1:4
+ |
+LL | fn empty() {}
+ | ^^^^^
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0061]: this function takes 0 arguments but 2 arguments were supplied
+ --> $DIR/extra_arguments.rs:11:9
+ |
+LL | empty($x, $y);
+ | ^^^^^
+...
+LL | foo!(1, 1);
+ | ----------
+ | | | |
+ | | | unexpected argument of type `{integer}`
+ | | unexpected argument of type `{integer}`
+ | in this macro invocation
+ |
+note: function defined here
+ --> $DIR/extra_arguments.rs:1:4
+ |
+LL | fn empty() {}
+ | ^^^^^
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0061]: this function takes 1 argument but 2 arguments were supplied
+ --> $DIR/extra_arguments.rs:53:3
+ |
+LL | one_arg(1, panic!());
+ | ^^^^^^^ ----------
+ | | |
+ | | unexpected argument
+ | help: remove the extra argument
+ |
+note: function defined here
+ --> $DIR/extra_arguments.rs:2:4
+ |
+LL | fn one_arg<T>(_a: T) {}
+ | ^^^^^^^ -----
+
+error[E0061]: this function takes 1 argument but 2 arguments were supplied
+ --> $DIR/extra_arguments.rs:54:3
+ |
+LL | one_arg(panic!(), 1);
+ | ^^^^^^^ ---
+ | | |
+ | | unexpected argument of type `{integer}`
+ | help: remove the extra argument
+ |
+note: function defined here
+ --> $DIR/extra_arguments.rs:2:4
+ |
+LL | fn one_arg<T>(_a: T) {}
+ | ^^^^^^^ -----
+
+error[E0061]: this function takes 1 argument but 2 arguments were supplied
+ --> $DIR/extra_arguments.rs:55:3
+ |
+LL | one_arg(stringify!($e), 1);
+ | ^^^^^^^ ---
+ | | |
+ | | unexpected argument of type `{integer}`
+ | help: remove the extra argument
+ |
+note: function defined here
+ --> $DIR/extra_arguments.rs:2:4
+ |
+LL | fn one_arg<T>(_a: T) {}
+ | ^^^^^^^ -----
+
+error[E0061]: this function takes 1 argument but 2 arguments were supplied
+ --> $DIR/extra_arguments.rs:60:3
+ |
+LL | one_arg(for _ in 1.. {}, 1);
+ | ^^^^^^^ ---
+ | | |
+ | | unexpected argument of type `{integer}`
+ | help: remove the extra argument
+ |
+note: function defined here
+ --> $DIR/extra_arguments.rs:2:4
+ |
+LL | fn one_arg<T>(_a: T) {}
+ | ^^^^^^^ -----
+
+error: aborting due to 22 previous errors
For more information about this error, try `rustc --explain E0061`.
diff --git a/tests/ui/array-slice-vec/infer_array_len.rs b/tests/ui/array-slice-vec/infer_array_len.rs
index 22fe7cb88..547c1f572 100644
--- a/tests/ui/array-slice-vec/infer_array_len.rs
+++ b/tests/ui/array-slice-vec/infer_array_len.rs
@@ -1,4 +1,4 @@
-// see issue #70529
+// check-pass
struct A;
impl From<A> for [u8; 2] {
@@ -13,9 +13,7 @@ impl From<A> for [u8; 3] {
}
}
-
fn main() {
let a = A;
let [_, _] = a.into();
- //~^ ERROR type annotations needed
}
diff --git a/tests/ui/array-slice-vec/infer_array_len.stderr b/tests/ui/array-slice-vec/infer_array_len.stderr
deleted file mode 100644
index c2a509a19..000000000
--- a/tests/ui/array-slice-vec/infer_array_len.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0282]: type annotations needed
- --> $DIR/infer_array_len.rs:19:9
- |
-LL | let [_, _] = a.into();
- | ^^^^^^
- |
-help: consider giving this pattern a type
- |
-LL | let [_, _]: /* Type */ = a.into();
- | ++++++++++++
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/array-slice-vec/slice-2.stderr b/tests/ui/array-slice-vec/slice-2.stderr
index 561feb90f..b122b4691 100644
--- a/tests/ui/array-slice-vec/slice-2.stderr
+++ b/tests/ui/array-slice-vec/slice-2.stderr
@@ -1,26 +1,26 @@
error[E0608]: cannot index into a value of type `Foo`
- --> $DIR/slice-2.rs:7:6
+ --> $DIR/slice-2.rs:7:7
|
LL | &x[..];
- | ^^^^^
+ | ^^^^
error[E0608]: cannot index into a value of type `Foo`
- --> $DIR/slice-2.rs:8:6
+ --> $DIR/slice-2.rs:8:7
|
LL | &x[Foo..];
- | ^^^^^^^^
+ | ^^^^^^^
error[E0608]: cannot index into a value of type `Foo`
- --> $DIR/slice-2.rs:9:6
+ --> $DIR/slice-2.rs:9:7
|
LL | &x[..Foo];
- | ^^^^^^^^
+ | ^^^^^^^
error[E0608]: cannot index into a value of type `Foo`
- --> $DIR/slice-2.rs:10:6
+ --> $DIR/slice-2.rs:10:7
|
LL | &x[Foo..Foo];
- | ^^^^^^^^^^^
+ | ^^^^^^^^^^
error: aborting due to 4 previous errors
diff --git a/tests/ui/array-slice-vec/slice-pat-type-mismatches.rs b/tests/ui/array-slice-vec/slice-pat-type-mismatches.rs
index 521b898e7..03a1876fd 100644
--- a/tests/ui/array-slice-vec/slice-pat-type-mismatches.rs
+++ b/tests/ui/array-slice-vec/slice-pat-type-mismatches.rs
@@ -2,7 +2,7 @@ fn main() {
match "foo".to_string() {
['f', 'o', ..] => {}
//~^ ERROR expected an array or slice, found `String`
- _ => { }
+ _ => {}
};
// Note that this one works with default binding modes.
@@ -15,7 +15,7 @@ fn main() {
};
match [0, 1, 2] {
- [0] => {}, //~ ERROR pattern requires
+ [0] => {} //~ ERROR pattern requires
[0, 1, x @ ..] => {
let a: [_; 1] = x;
@@ -23,14 +23,15 @@ fn main() {
[0, 1, 2, 3, x @ ..] => {} //~ ERROR pattern requires
};
- match does_not_exist { //~ ERROR cannot find value `does_not_exist` in this scope
- [] => {}
+ match does_not_exist {
+ //~^ ERROR cannot find value `does_not_exist` in this scope
+ [] => {} // ERROR cannot find value `does_not_exist` in this scope
};
}
fn another_fn_to_avoid_suppression() {
- match Default::default()
- {
- [] => {} //~ ERROR type annotations needed
+ match Default::default() {
+ [] => {}
+ //~^ ERROR type annotations needed
};
}
diff --git a/tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr b/tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr
index 70a4cbebe..d1d042c47 100644
--- a/tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr
+++ b/tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr
@@ -13,7 +13,7 @@ LL | ['f', 'o', ..] => {}
error[E0527]: pattern requires 1 element but array has 3
--> $DIR/slice-pat-type-mismatches.rs:18:9
|
-LL | [0] => {},
+LL | [0] => {}
| ^^^ expected 3 elements
error[E0528]: pattern requires at least 4 elements but array has 3
diff --git a/tests/ui/array-slice-vec/vec-mut-iter-borrow.stderr b/tests/ui/array-slice-vec/vec-mut-iter-borrow.stderr
index 0ec263c85..679fd8997 100644
--- a/tests/ui/array-slice-vec/vec-mut-iter-borrow.stderr
+++ b/tests/ui/array-slice-vec/vec-mut-iter-borrow.stderr
@@ -7,7 +7,7 @@ LL | for x in &mut xs {
| first mutable borrow occurs here
| first borrow later used here
LL | xs.push(1)
- | ^^^^^^^^^^ second mutable borrow occurs here
+ | ^^ second mutable borrow occurs here
error: aborting due to previous error
diff --git a/tests/ui/asm/issue-113788.rs b/tests/ui/asm/issue-113788.rs
new file mode 100644
index 000000000..903b44476
--- /dev/null
+++ b/tests/ui/asm/issue-113788.rs
@@ -0,0 +1,7 @@
+// test that "error: arguments for inline assembly must be copyable" doesn't show up in this code
+// needs-asm-support
+// only-x86_64
+fn main() {
+ let peb: *const PEB; //~ ERROR cannot find type `PEB` in this scope [E0412]
+ unsafe { std::arch::asm!("mov {0}, fs:[0x30]", out(reg) peb); }
+}
diff --git a/tests/ui/asm/issue-113788.stderr b/tests/ui/asm/issue-113788.stderr
new file mode 100644
index 000000000..f8e65b6f5
--- /dev/null
+++ b/tests/ui/asm/issue-113788.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `PEB` in this scope
+ --> $DIR/issue-113788.rs:5:21
+ |
+LL | let peb: *const PEB;
+ | ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/asm/x86_64/issue-96797.rs b/tests/ui/asm/x86_64/issue-96797.rs
index 954f8c5cc..951dd949b 100644
--- a/tests/ui/asm/x86_64/issue-96797.rs
+++ b/tests/ui/asm/x86_64/issue-96797.rs
@@ -1,6 +1,5 @@
// build-pass
// compile-flags: -O
-// min-llvm-version: 14.0.5
// needs-asm-support
// only-x86_64
// only-linux
diff --git a/tests/ui/associated-consts/defaults-cyclic-fail.stderr b/tests/ui/associated-consts/defaults-cyclic-fail.stderr
index a1483911b..ebdb76e42 100644
--- a/tests/ui/associated-consts/defaults-cyclic-fail.stderr
+++ b/tests/ui/associated-consts/defaults-cyclic-fail.stderr
@@ -15,6 +15,7 @@ note: cycle used when const-evaluating + checking `main::promoted[1]`
|
LL | assert_eq!(<() as Tr>::A, 0);
| ^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr
index bbafc55da..e9fe3a5e5 100644
--- a/tests/ui/associated-consts/issue-105330.stderr
+++ b/tests/ui/associated-consts/issue-105330.stderr
@@ -39,6 +39,12 @@ error[E0562]: `impl Trait` only allowed in function and inherent method return t
LL | impl TraitWAssocConst for impl Demo {
| ^^^^^^^^^
+error[E0131]: `main` function is not allowed to have generic parameters
+ --> $DIR/issue-105330.rs:17:8
+ |
+LL | fn main<A: TraitWAssocConst<A=32>>() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` cannot have generic parameters
+
error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
--> $DIR/issue-105330.rs:12:11
|
@@ -101,12 +107,6 @@ note: required by a bound in `foo`
LL | fn foo<A: TraitWAssocConst<A=32>>() {
| ^^^^ required by this bound in `foo`
-error[E0131]: `main` function is not allowed to have generic parameters
- --> $DIR/issue-105330.rs:17:8
- |
-LL | fn main<A: TraitWAssocConst<A=32>>() {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` cannot have generic parameters
-
error: aborting due to 11 previous errors
Some errors have detailed explanations: E0131, E0271, E0277, E0404, E0562, E0618, E0658.
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
index be5781761..51bf0cb5e 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
@@ -26,6 +26,7 @@ LL | const BAR: u32 = IMPL_REF_BAR;
| ^^^^^^^^^^^^^^
= note: ...which again requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 11:19>::BAR`, completing the cycle
= note: cycle used when running analysis passes on this crate
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
index 8347b260b..8277d41a1 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
@@ -26,6 +26,7 @@ LL | const BAR: u32 = DEFAULT_REF_BAR;
| ^^^^^^^^^^^^^^
= note: ...which again requires elaborating drops for `FooDefault::BAR`, completing the cycle
= note: cycle used when running analysis passes on this crate
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
index 3955a3120..9983ba794 100644
--- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
+++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
@@ -26,6 +26,7 @@ LL | const BAR: u32 = TRAIT_REF_BAR;
| ^^^^^^^^^^^^^^
= note: ...which again requires elaborating drops for `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 11:28>::BAR`, completing the cycle
= note: cycle used when running analysis passes on this crate
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr
index 23269e1af..3c373f139 100644
--- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr
+++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr
@@ -37,6 +37,7 @@ LL | |
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr
index aaa9a39ea..ab6a97b3d 100644
--- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr
+++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr
@@ -31,6 +31,7 @@ LL | | // FIXME(inherent_associated_types): This shouldn't lead to a cycle error
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/associated-inherent-types/inference.rs b/tests/ui/associated-inherent-types/inference.rs
index ebd8e1d55..66f879c5a 100644
--- a/tests/ui/associated-inherent-types/inference.rs
+++ b/tests/ui/associated-inherent-types/inference.rs
@@ -1,5 +1,7 @@
// Testing inference capabilities.
// check-pass
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
diff --git a/tests/ui/associated-inherent-types/issue-111879-0.rs b/tests/ui/associated-inherent-types/issue-111879-0.rs
index e37f7d34a..d01354465 100644
--- a/tests/ui/associated-inherent-types/issue-111879-0.rs
+++ b/tests/ui/associated-inherent-types/issue-111879-0.rs
@@ -5,10 +5,8 @@
pub struct Carrier<'a>(&'a ());
-pub type User = for<'b> fn(Carrier<'b>::Focus<i32>);
-
impl<'a> Carrier<'a> {
- pub type Focus<T> = &'a mut User; //~ ERROR overflow evaluating associated type
+ pub type Focus<T> = &'a mut for<'b> fn(Carrier<'b>::Focus<i32>); //~ ERROR overflow evaluating associated type
}
fn main() {}
diff --git a/tests/ui/associated-inherent-types/issue-111879-0.stderr b/tests/ui/associated-inherent-types/issue-111879-0.stderr
index 7bdbad440..f6367c88a 100644
--- a/tests/ui/associated-inherent-types/issue-111879-0.stderr
+++ b/tests/ui/associated-inherent-types/issue-111879-0.stderr
@@ -1,8 +1,8 @@
error: overflow evaluating associated type `Carrier<'b>::Focus<i32>`
- --> $DIR/issue-111879-0.rs:11:25
+ --> $DIR/issue-111879-0.rs:9:25
|
-LL | pub type Focus<T> = &'a mut User;
- | ^^^^^^^^^^^^
+LL | pub type Focus<T> = &'a mut for<'b> fn(Carrier<'b>::Focus<i32>);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/associated-inherent-types/late-bound-regions.rs b/tests/ui/associated-inherent-types/late-bound-regions.rs
index 488a2cda6..1dbeb00d4 100644
--- a/tests/ui/associated-inherent-types/late-bound-regions.rs
+++ b/tests/ui/associated-inherent-types/late-bound-regions.rs
@@ -3,8 +3,6 @@
// Test if we correctly normalize `S<'a>::P` with respect to late-bound regions.
-type Function = for<'a> fn(&'a i32) -> S<'a>::P;
-
struct S<'a>(&'a ());
trait Inter {
@@ -16,7 +14,7 @@ impl<'a> S<'a> {
}
fn ret_ref_local<'e>() -> &'e i32 {
- let f: Function = |x| x;
+ let f: for<'a> fn(&'a i32) -> S<'a>::P = |x| x;
let local = 0;
f(&local) //~ ERROR cannot return value referencing local variable `local`
diff --git a/tests/ui/associated-inherent-types/late-bound-regions.stderr b/tests/ui/associated-inherent-types/late-bound-regions.stderr
index 4706fcca9..0dd17b05c 100644
--- a/tests/ui/associated-inherent-types/late-bound-regions.stderr
+++ b/tests/ui/associated-inherent-types/late-bound-regions.stderr
@@ -1,5 +1,5 @@
error[E0515]: cannot return value referencing local variable `local`
- --> $DIR/late-bound-regions.rs:22:5
+ --> $DIR/late-bound-regions.rs:20:5
|
LL | f(&local)
| ^^------^
diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs.alias.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs.alias.stderr
deleted file mode 100644
index 4396435a6..000000000
--- a/tests/ui/associated-inherent-types/not-found-self-type-differs.alias.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0220]: associated type `Proj` not found for `Family<Option<()>>` in the current scope
- --> $DIR/not-found-self-type-differs.rs:17:34
- |
-LL | struct Family<T>(T);
- | ---------------- associated item `Proj` not found for this struct
-...
-LL | type Alias = Family<Option<()>>::Proj;
- | ^^^^ associated item not found in `Family<Option<()>>`
- |
- = note: the associated type was found for
- - `Family<()>`
- - `Family<Result<T, ()>>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs.local.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs.local.stderr
deleted file mode 100644
index d527db022..000000000
--- a/tests/ui/associated-inherent-types/not-found-self-type-differs.local.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0220]: associated type `Proj` not found for `Family<PathBuf>` in the current scope
- --> $DIR/not-found-self-type-differs.rs:21:40
- |
-LL | struct Family<T>(T);
- | ---------------- associated item `Proj` not found for this struct
-...
-LL | let _: Family<std::path::PathBuf>::Proj = ();
- | ^^^^ associated item not found in `Family<PathBuf>`
- |
- = note: the associated type was found for
- - `Family<()>`
- - `Family<Result<T, ()>>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs.rs b/tests/ui/associated-inherent-types/not-found-self-type-differs.rs
index 93f58dcb6..76c5d4e7f 100644
--- a/tests/ui/associated-inherent-types/not-found-self-type-differs.rs
+++ b/tests/ui/associated-inherent-types/not-found-self-type-differs.rs
@@ -1,5 +1,3 @@
-// revisions: local alias
-
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
@@ -13,10 +11,7 @@ impl<T> Family<Result<T, ()>> {
type Proj = Self;
}
-#[cfg(alias)]
-type Alias = Family<Option<()>>::Proj; //[alias]~ ERROR associated type `Proj` not found for `Family<Option<()>>`
-
fn main() {
- #[cfg(local)]
- let _: Family<std::path::PathBuf>::Proj = (); //[local]~ ERROR associated type `Proj` not found for `Family<PathBuf>`
+ let _: Family<Option<()>>::Proj; //~ ERROR associated type `Proj` not found for `Family<Option<()>>`
+ let _: Family<std::path::PathBuf>::Proj = (); //~ ERROR associated type `Proj` not found for `Family<PathBuf>`
}
diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs.stderr
new file mode 100644
index 000000000..1871407c6
--- /dev/null
+++ b/tests/ui/associated-inherent-types/not-found-self-type-differs.stderr
@@ -0,0 +1,29 @@
+error[E0220]: associated type `Proj` not found for `Family<Option<()>>` in the current scope
+ --> $DIR/not-found-self-type-differs.rs:15:32
+ |
+LL | struct Family<T>(T);
+ | ---------------- associated item `Proj` not found for this struct
+...
+LL | let _: Family<Option<()>>::Proj;
+ | ^^^^ associated item not found in `Family<Option<()>>`
+ |
+ = note: the associated type was found for
+ - `Family<()>`
+ - `Family<Result<T, ()>>`
+
+error[E0220]: associated type `Proj` not found for `Family<PathBuf>` in the current scope
+ --> $DIR/not-found-self-type-differs.rs:16:40
+ |
+LL | struct Family<T>(T);
+ | ---------------- associated item `Proj` not found for this struct
+...
+LL | let _: Family<std::path::PathBuf>::Proj = ();
+ | ^^^^ associated item not found in `Family<PathBuf>`
+ |
+ = note: the associated type was found for
+ - `Family<()>`
+ - `Family<Result<T, ()>>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/associated-inherent-types/substitute-params-bad.rs b/tests/ui/associated-inherent-types/substitute-params-bad.rs
index 00eb1a14d..a5d73c7b4 100644
--- a/tests/ui/associated-inherent-types/substitute-params-bad.rs
+++ b/tests/ui/associated-inherent-types/substitute-params-bad.rs
@@ -17,7 +17,7 @@ impl<T, S> Subj<(T, S)> {
}
fn main() {
- type A = S<()>::P;
+ let _: S<()>::P;
let _: Subj<(i32, i32)>::Un = 0i32; //~ ERROR mismatched types
}
diff --git a/tests/ui/associated-inherent-types/substitute-params.rs b/tests/ui/associated-inherent-types/substitute-params.rs
index e94d68331..631340b2b 100644
--- a/tests/ui/associated-inherent-types/substitute-params.rs
+++ b/tests/ui/associated-inherent-types/substitute-params.rs
@@ -15,8 +15,7 @@ impl<T> S<(T,)> {
fn main() {
// Regression test for issue #104240.
- type A = S<()>::P;
- let _: A = ();
+ let _: S<()>::P = ();
// Regression test for issue #107468.
let _: S<(i32,)>::Un = 0i32;
diff --git a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs
index b32b4288a..5c59f217b 100644
--- a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs
+++ b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs
@@ -1,4 +1,5 @@
-// check-pass
+// FIXME(inherent_associated_types): This should be `check-pass`
+// known-bug: #108491
// compile-flags: --crate-type=lib
#![feature(inherent_associated_types)]
@@ -17,7 +18,6 @@
pub type Alias<T: Bound> = (Source<T>::Assoc,);
-
pub struct Source<T>(T);
pub trait Bound {}
diff --git a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr
new file mode 100644
index 000000000..5e18543fc
--- /dev/null
+++ b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.stderr
@@ -0,0 +1,55 @@
+error[E0391]: cycle detected when expanding type alias `Alias`
+ --> $DIR/type-alias-bounds-are-enforced.rs:19:1
+ |
+LL | pub type Alias<T: Bound> = (Source<T>::Assoc,);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: ...which requires computing the variances of `Source`...
+ --> $DIR/type-alias-bounds-are-enforced.rs:21:1
+ |
+LL | pub struct Source<T>(T);
+ | ^^^^^^^^^^^^^^^^^^^^
+ = note: ...which requires computing the variances for items in this crate...
+ = note: ...which again requires expanding type alias `Alias`, completing the cycle
+note: cycle used when collecting item types in top-level module
+ --> $DIR/type-alias-bounds-are-enforced.rs:5:1
+ |
+LL | / #![feature(inherent_associated_types)]
+LL | | #![allow(incomplete_features)]
+LL | |
+LL | | // Bounds on the self type play a major role in the resolution of inherent associated types (*).
+... |
+LL | | pub type Assoc = ();
+LL | | }
+ | |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error[E0391]: cycle detected when expanding type alias `Alias`
+ --> $DIR/type-alias-bounds-are-enforced.rs:19:1
+ |
+LL | pub type Alias<T: Bound> = (Source<T>::Assoc,);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: ...which requires computing the variances of `Source`...
+ --> $DIR/type-alias-bounds-are-enforced.rs:21:1
+ |
+LL | pub struct Source<T>(T);
+ | ^^^^^^^^^^^^^^^^^^^^
+ = note: ...which requires computing the variances for items in this crate...
+ = note: ...which again requires expanding type alias `Alias`, completing the cycle
+note: cycle used when collecting item types in top-level module
+ --> $DIR/type-alias-bounds-are-enforced.rs:5:1
+ |
+LL | / #![feature(inherent_associated_types)]
+LL | | #![allow(incomplete_features)]
+LL | |
+LL | | // Bounds on the self type play a major role in the resolution of inherent associated types (*).
+... |
+LL | | pub type Assoc = ();
+LL | | }
+ | |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/associated-type-bounds/ambiguous-associated-type2.rs b/tests/ui/associated-type-bounds/ambiguous-associated-type2.rs
index 48de59334..e9cd57f17 100644
--- a/tests/ui/associated-type-bounds/ambiguous-associated-type2.rs
+++ b/tests/ui/associated-type-bounds/ambiguous-associated-type2.rs
@@ -7,4 +7,6 @@ trait Bar<T> {
trait Baz: Foo + Bar<Self::Item> {}
//~^ ERROR cycle detected when computing the super traits of `Baz` with associated type name `Item` [E0391]
+
+
fn main() {}
diff --git a/tests/ui/associated-type-bounds/ambiguous-associated-type2.stderr b/tests/ui/associated-type-bounds/ambiguous-associated-type2.stderr
index 575b00e09..f2604f0ba 100644
--- a/tests/ui/associated-type-bounds/ambiguous-associated-type2.stderr
+++ b/tests/ui/associated-type-bounds/ambiguous-associated-type2.stderr
@@ -10,6 +10,7 @@ note: cycle used when computing the super predicates of `Baz`
|
LL | trait Baz: Foo + Bar<Self::Item> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/associated-type-bounds/consts.rs b/tests/ui/associated-type-bounds/consts.rs
new file mode 100644
index 000000000..9b95b1b52
--- /dev/null
+++ b/tests/ui/associated-type-bounds/consts.rs
@@ -0,0 +1,10 @@
+#![feature(associated_type_bounds)]
+
+pub fn accept(_: impl Trait<K: Copy>) {}
+//~^ ERROR expected associated type, found associated constant
+
+pub trait Trait {
+ const K: i32;
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/consts.stderr b/tests/ui/associated-type-bounds/consts.stderr
new file mode 100644
index 000000000..ddfb6612b
--- /dev/null
+++ b/tests/ui/associated-type-bounds/consts.stderr
@@ -0,0 +1,10 @@
+error: expected associated type, found associated constant
+ --> $DIR/consts.rs:3:29
+ |
+LL | pub fn accept(_: impl Trait<K: Copy>) {}
+ | ^
+ |
+ = note: trait bounds not allowed on associated constant
+
+error: aborting due to previous error
+
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
index 771acb6c4..58ce41d1a 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_type_notation, async_fn_in_trait)]
//~^ WARN the feature `return_type_notation` is incomplete
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr
new file mode 100644
index 000000000..95ef7d82f
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr
@@ -0,0 +1,48 @@
+error: return type notation uses `()` instead of `(..)` for elided arguments
+ --> $DIR/bad-inputs-and-output.rs:18:24
+ |
+LL | fn baz<T: Trait<method(..): Send>>() {}
+ | ^^ help: remove the `..`
+
+error[E0658]: associated type bounds are unstable
+ --> $DIR/bad-inputs-and-output.rs:10:17
+ |
+LL | fn foo<T: Trait<method(i32): Send>>() {}
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
+ = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
+
+error[E0658]: associated type bounds are unstable
+ --> $DIR/bad-inputs-and-output.rs:14:17
+ |
+LL | fn bar<T: Trait<method() -> (): Send>>() {}
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
+ = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
+
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/bad-inputs-and-output.rs:3:12
+ |
+LL | #![feature(return_type_notation, async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: argument types not allowed with return type notation
+ --> $DIR/bad-inputs-and-output.rs:10:23
+ |
+LL | fn foo<T: Trait<method(i32): Send>>() {}
+ | ^^^^^ help: remove the input types: `()`
+
+error: return type not allowed with return type notation
+ --> $DIR/bad-inputs-and-output.rs:14:25
+ |
+LL | fn bar<T: Trait<method() -> (): Send>>() {}
+ | ^^^^^^ help: remove the return type
+
+error: aborting due to 5 previous errors; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.rs b/tests/ui/associated-type-bounds/return-type-notation/basic.rs
index d443c9dc1..3dd9249a7 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.rs
@@ -1,9 +1,6 @@
-// revisions: current_with current_without next_with next_without
-// [next_with] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// [next_without] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: with without
// edition: 2021
-// [current_with] check-pass
-// [next_with] check-pass
+// [with] check-pass
#![feature(return_type_notation, async_fn_in_trait)]
//~^ WARN the feature `return_type_notation` is incomplete
@@ -20,12 +17,11 @@ async fn foo<T: Foo>() -> Result<(), ()> {
fn is_send(_: impl Send) {}
fn test<
- #[cfg(any(current_with, next_with))] T: Foo<method(): Send>,
- #[cfg(any(current_without, next_without))] T: Foo,
+ #[cfg(with)] T: Foo<method(): Send>,
+ #[cfg(without)] T: Foo,
>() {
is_send(foo::<T>());
- //[current_without]~^ ERROR future cannot be sent between threads safely
- //[next_without]~^^ ERROR future cannot be sent between threads safely
+ //[without]~^ ERROR future cannot be sent between threads safely
}
fn main() {}
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.rs b/tests/ui/associated-type-bounds/return-type-notation/equality.rs
index 0d6545cc2..6884305d7 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_type_notation, async_fn_in_trait)]
//~^ WARN the feature `return_type_notation` is incomplete
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr
new file mode 100644
index 000000000..490bfdc4c
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr
@@ -0,0 +1,17 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/equality.rs:3:12
+ |
+LL | #![feature(return_type_notation, async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: return type notation is not allowed to use type equality
+ --> $DIR/equality.rs:12:18
+ |
+LL | fn test<T: Trait<method() = Box<dyn Future<Output = ()>>>>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/associated-types/dont-suggest-cyclic-constraint.rs b/tests/ui/associated-types/dont-suggest-cyclic-constraint.rs
index 6894f6b6c..0848b4c55 100644
--- a/tests/ui/associated-types/dont-suggest-cyclic-constraint.rs
+++ b/tests/ui/associated-types/dont-suggest-cyclic-constraint.rs
@@ -1,6 +1,6 @@
use std::fmt::Debug;
-fn foo<I: Iterator>(mut iter: I, value: &I::Item)
+pub fn foo<I: Iterator>(mut iter: I, value: &I::Item)
where
I::Item: Eq + Debug,
{
diff --git a/tests/ui/associated-types/issue-20825.stderr b/tests/ui/associated-types/issue-20825.stderr
index c4dea68b8..02b3536e2 100644
--- a/tests/ui/associated-types/issue-20825.stderr
+++ b/tests/ui/associated-types/issue-20825.stderr
@@ -10,6 +10,7 @@ note: cycle used when computing the super predicates of `Processor`
|
LL | pub trait Processor: Subscriber<Input = Self::Input> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs b/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs
index 554ac673d..ab675d0a1 100644
--- a/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs
+++ b/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs
@@ -49,13 +49,11 @@ async fn foo8() -> Result<(), ()> {
Ok(())
}
fn foo9() -> Result<(), ()> {
- let _ = await bar(); //~ ERROR `await` is only allowed inside `async` functions and blocks
- //~^ ERROR incorrect use of `await`
+ let _ = await bar(); //~ ERROR incorrect use of `await`
Ok(())
}
fn foo10() -> Result<(), ()> {
- let _ = await? bar(); //~ ERROR `await` is only allowed inside `async` functions and blocks
- //~^ ERROR incorrect use of `await`
+ let _ = await? bar(); //~ ERROR incorrect use of `await`
Ok(())
}
fn foo11() -> Result<(), ()> {
@@ -63,8 +61,7 @@ fn foo11() -> Result<(), ()> {
Ok(())
}
fn foo12() -> Result<(), ()> {
- let _ = (await bar())?; //~ ERROR `await` is only allowed inside `async` functions and blocks
- //~^ ERROR incorrect use of `await`
+ let _ = (await bar())?; //~ ERROR incorrect use of `await`
Ok(())
}
fn foo13() -> Result<(), ()> {
@@ -111,7 +108,6 @@ async fn foo27() -> Result<(), ()> {
fn foo28() -> Result<(), ()> {
fn foo() -> Result<(), ()> {
let _ = await!(bar())?; //~ ERROR incorrect use of `await`
- //~^ ERROR `await` is only allowed inside `async` functions
Ok(())
}
foo()
@@ -119,7 +115,6 @@ fn foo28() -> Result<(), ()> {
fn foo29() -> Result<(), ()> {
let foo = || {
let _ = await!(bar())?; //~ ERROR incorrect use of `await`
- //~^ ERROR `await` is only allowed inside `async` functions
Ok(())
};
foo()
diff --git a/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr b/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
index 7b03e5666..928eb0b82 100644
--- a/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
+++ b/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
@@ -59,61 +59,61 @@ LL | let _ = await bar();
| ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:57:13
+ --> $DIR/incorrect-syntax-suggestions.rs:56:13
|
LL | let _ = await? bar();
| ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await?`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:62:13
+ --> $DIR/incorrect-syntax-suggestions.rs:60:13
|
LL | let _ = await bar()?;
| ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:66:14
+ --> $DIR/incorrect-syntax-suggestions.rs:64:14
|
LL | let _ = (await bar())?;
| ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:71:24
+ --> $DIR/incorrect-syntax-suggestions.rs:68:24
|
LL | let _ = bar().await();
| ^^ help: `await` is not a method call, remove the parentheses
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:76:24
+ --> $DIR/incorrect-syntax-suggestions.rs:73:24
|
LL | let _ = bar().await()?;
| ^^ help: `await` is not a method call, remove the parentheses
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:104:13
+ --> $DIR/incorrect-syntax-suggestions.rs:101:13
|
LL | let _ = await!(bar());
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:108:13
+ --> $DIR/incorrect-syntax-suggestions.rs:105:13
|
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:113:17
+ --> $DIR/incorrect-syntax-suggestions.rs:110:17
|
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:121:17
+ --> $DIR/incorrect-syntax-suggestions.rs:117:17
|
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: expected expression, found `=>`
- --> $DIR/incorrect-syntax-suggestions.rs:129:25
+ --> $DIR/incorrect-syntax-suggestions.rs:124:25
|
LL | match await { await => () }
| ----- ^^ expected expression
@@ -121,13 +121,13 @@ LL | match await { await => () }
| while parsing this incorrect await expression
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:129:11
+ --> $DIR/incorrect-syntax-suggestions.rs:124:11
|
LL | match await { await => () }
| ^^^^^^^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ await => () }.await`
error: expected one of `.`, `?`, `{`, or an operator, found `}`
- --> $DIR/incorrect-syntax-suggestions.rs:132:1
+ --> $DIR/incorrect-syntax-suggestions.rs:127:1
|
LL | match await { await => () }
| ----- - expected one of `.`, `?`, `{`, or an operator
@@ -138,31 +138,7 @@ LL | }
| ^ unexpected token
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:52:13
- |
-LL | fn foo9() -> Result<(), ()> {
- | ---- this is not `async`
-LL | let _ = await bar();
- | ^^^^^ only allowed inside `async` functions and blocks
-
-error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:57:13
- |
-LL | fn foo10() -> Result<(), ()> {
- | ----- this is not `async`
-LL | let _ = await? bar();
- | ^^^^^ only allowed inside `async` functions and blocks
-
-error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:66:14
- |
-LL | fn foo12() -> Result<(), ()> {
- | ----- this is not `async`
-LL | let _ = (await bar())?;
- | ^^^^^ only allowed inside `async` functions and blocks
-
-error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:71:19
+ --> $DIR/incorrect-syntax-suggestions.rs:68:19
|
LL | fn foo13() -> Result<(), ()> {
| ----- this is not `async`
@@ -170,7 +146,7 @@ LL | let _ = bar().await();
| ^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:76:19
+ --> $DIR/incorrect-syntax-suggestions.rs:73:19
|
LL | fn foo14() -> Result<(), ()> {
| ----- this is not `async`
@@ -178,7 +154,7 @@ LL | let _ = bar().await()?;
| ^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:81:19
+ --> $DIR/incorrect-syntax-suggestions.rs:78:19
|
LL | fn foo15() -> Result<(), ()> {
| ----- this is not `async`
@@ -186,7 +162,7 @@ LL | let _ = bar().await;
| ^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:85:19
+ --> $DIR/incorrect-syntax-suggestions.rs:82:19
|
LL | fn foo16() -> Result<(), ()> {
| ----- this is not `async`
@@ -194,7 +170,7 @@ LL | let _ = bar().await?;
| ^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:90:23
+ --> $DIR/incorrect-syntax-suggestions.rs:87:23
|
LL | fn foo() -> Result<(), ()> {
| --- this is not `async`
@@ -202,29 +178,13 @@ LL | let _ = bar().await?;
| ^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:97:23
+ --> $DIR/incorrect-syntax-suggestions.rs:94:23
|
LL | let foo = || {
| -- this is not `async`
LL | let _ = bar().await?;
| ^^^^^ only allowed inside `async` functions and blocks
-error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:113:17
- |
-LL | fn foo() -> Result<(), ()> {
- | --- this is not `async`
-LL | let _ = await!(bar())?;
- | ^^^^^ only allowed inside `async` functions and blocks
-
-error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:121:17
- |
-LL | let foo = || {
- | -- this is not `async`
-LL | let _ = await!(bar())?;
- | ^^^^^ only allowed inside `async` functions and blocks
-
-error: aborting due to 33 previous errors
+error: aborting due to 28 previous errors
For more information about this error, try `rustc --explain E0728`.
diff --git a/tests/ui/async-await/clone-suggestion.stderr b/tests/ui/async-await/clone-suggestion.stderr
index c02206f6f..b5c8ef699 100644
--- a/tests/ui/async-await/clone-suggestion.stderr
+++ b/tests/ui/async-await/clone-suggestion.stderr
@@ -13,7 +13,7 @@ note: `into_future` takes ownership of the receiver `self`, which moves `f`
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | f.clone().await;
- | ++++++++
+ | ++++++++
error: aborting due to previous error
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.rs b/tests/ui/async-await/edition-deny-async-fns-2015.rs
index d4c30dc9d..6bd6d879a 100644
--- a/tests/ui/async-await/edition-deny-async-fns-2015.rs
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.rs
@@ -1,6 +1,4 @@
// edition:2015
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.stderr
new file mode 100644
index 000000000..ba918eb28
--- /dev/null
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.stderr
@@ -0,0 +1,98 @@
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:3:1
+ |
+LL | async fn foo() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:5:12
+ |
+LL | fn baz() { async fn foo() {} }
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:7:1
+ |
+LL | async fn async_baz() {
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:8:5
+ |
+LL | async fn bar() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:14:5
+ |
+LL | async fn foo() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:18:5
+ |
+LL | async fn foo() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:36:9
+ |
+LL | async fn bar() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:26:9
+ |
+LL | async fn foo() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0670]: `async fn` is not permitted in Rust 2015
+ --> $DIR/edition-deny-async-fns-2015.rs:31:13
+ |
+LL | async fn bar() {}
+ | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+ |
+ = help: pass `--edition 2021` to `rustc`
+ = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0706]: functions in traits cannot be declared `async`
+ --> $DIR/edition-deny-async-fns-2015.rs:18:5
+ |
+LL | async fn foo() {}
+ | -----^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
+
+error: aborting due to 10 previous errors
+
+Some errors have detailed explanations: E0670, E0706.
+For more information about an error, try `rustc --explain E0670`.
diff --git a/tests/ui/async-await/in-trait/async-associated-types.rs b/tests/ui/async-await/in-trait/async-associated-types.rs
index 89ca4039b..974f5aaff 100644
--- a/tests/ui/async-await/in-trait/async-associated-types.rs
+++ b/tests/ui/async-await/in-trait/async-associated-types.rs
@@ -1,7 +1,5 @@
// check-pass
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(impl_trait_projections)]
diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
index 99c3ba6a3..06413fe6f 100644
--- a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
+++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
@@ -1,7 +1,5 @@
// run-pass
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr
deleted file mode 100644
index b5ace9ada..000000000
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.current.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0053]: method `foo` has an incompatible type for trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:17:28
- |
-LL | async fn foo(&self) -> i32 {
- | ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
- |
-note: type in trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:13:22
- |
-LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: expected signature `fn(&i32) -> Pin<Box<dyn Future<Output = i32>>>`
- found signature `fn(&i32) -> impl Future<Output = i32>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
index 7b53379b2..38ba29718 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
index b5ace9ada..168ef8e9e 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.next.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
@@ -1,11 +1,11 @@
error[E0053]: method `foo` has an incompatible type for trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:17:28
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
|
LL | async fn foo(&self) -> i32 {
| ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
|
note: type in trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:13:22
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr
deleted file mode 100644
index 6c0b58591..000000000
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.current.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-boxed.rs:17:5
- |
-LL | async fn foo(&self) -> i32;
- | --------------------------- required because the trait method is async
-...
-LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
index 916488ffa..1b1b3cffd 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
index 6c0b58591..60fa534a6 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.next.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-boxed.rs:17:5
+ --> $DIR/async-example-desugared-boxed.rs:15:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
index edac0b374..81e1e59a3 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
@@ -1,7 +1,5 @@
// check-pass
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
index 934f7643d..feeda719e 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
@@ -1,7 +1,5 @@
// check-pass
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr
deleted file mode 100644
index 0d2551ab8..000000000
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.current.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-manual.rs:25:5
- |
-LL | async fn foo(&self) -> i32;
- | --------------------------- required because the trait method is async
-...
-LL | fn foo(&self) -> MyFuture {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
index 4883828d3..71473e745 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
index 0d2551ab8..567a36a86 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.next.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-manual.rs:25:5
+ --> $DIR/async-example-desugared-manual.rs:23:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
diff --git a/tests/ui/async-await/in-trait/async-example-desugared.rs b/tests/ui/async-await/in-trait/async-example-desugared.rs
index 214171b2e..fb92ec786 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared.rs
@@ -1,7 +1,5 @@
// check-pass
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr
deleted file mode 100644
index 780da0689..000000000
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.next.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:14:28
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
- |
-note: the parameter type `U` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics-and-bounds.rs:14:18
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:14:28
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
-
-error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:14:28
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics-and-bounds.rs:14:18
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:14:28
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0311`.
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
index 146e74ec2..a73d55adf 100644
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
@@ -1,8 +1,6 @@
// check-fail
// known-bug: #102682
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
index 780da0689..5c8d64fc6 100644
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.current.stderr
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
@@ -1,33 +1,33 @@
error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:14:28
+ --> $DIR/async-generics-and-bounds.rs:12:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
|
-note: the parameter type `U` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics-and-bounds.rs:14:18
+note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
+ --> $DIR/async-generics-and-bounds.rs:12:18
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^
+ | ^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:14:28
+ --> $DIR/async-generics-and-bounds.rs:12:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:14:28
+ --> $DIR/async-generics-and-bounds.rs:12:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
|
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics-and-bounds.rs:14:18
+note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
+ --> $DIR/async-generics-and-bounds.rs:12:18
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^
+ | ^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:14:28
+ --> $DIR/async-generics-and-bounds.rs:12:28
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
| ^^^^^^^
diff --git a/tests/ui/async-await/in-trait/async-generics.next.stderr b/tests/ui/async-await/in-trait/async-generics.next.stderr
deleted file mode 100644
index 04e1ab6d7..000000000
--- a/tests/ui/async-await/in-trait/async-generics.next.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics.rs:11:28
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
- |
-note: the parameter type `U` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics.rs:11:18
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:11:28
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
-
-error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics.rs:11:28
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics.rs:11:18
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:11:28
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0311`.
diff --git a/tests/ui/async-await/in-trait/async-generics.rs b/tests/ui/async-await/in-trait/async-generics.rs
index 507500abf..67000e577 100644
--- a/tests/ui/async-await/in-trait/async-generics.rs
+++ b/tests/ui/async-await/in-trait/async-generics.rs
@@ -1,8 +1,6 @@
// check-fail
// known-bug: #102682
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/async-generics.current.stderr b/tests/ui/async-await/in-trait/async-generics.stderr
index 04e1ab6d7..6ae73d9e3 100644
--- a/tests/ui/async-await/in-trait/async-generics.current.stderr
+++ b/tests/ui/async-await/in-trait/async-generics.stderr
@@ -1,33 +1,33 @@
error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics.rs:11:28
+ --> $DIR/async-generics.rs:9:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
|
-note: the parameter type `U` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics.rs:11:18
+note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
+ --> $DIR/async-generics.rs:9:18
|
LL | async fn foo(&self) -> &(T, U);
- | ^^^^^
+ | ^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:11:28
+ --> $DIR/async-generics.rs:9:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics.rs:11:28
+ --> $DIR/async-generics.rs:9:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
|
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/async-generics.rs:11:18
+note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
+ --> $DIR/async-generics.rs:9:18
|
LL | async fn foo(&self) -> &(T, U);
- | ^^^^^
+ | ^
note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:11:28
+ --> $DIR/async-generics.rs:9:28
|
LL | async fn foo(&self) -> &(T, U);
| ^^^^^^^
diff --git a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
index 9869a8d71..d5481d277 100644
--- a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
+++ b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
@@ -1,7 +1,5 @@
// check-pass
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/async-lifetimes.rs b/tests/ui/async-await/in-trait/async-lifetimes.rs
index ecbd1910a..f298e45d2 100644
--- a/tests/ui/async-await/in-trait/async-lifetimes.rs
+++ b/tests/ui/async-await/in-trait/async-lifetimes.rs
@@ -1,7 +1,5 @@
// check-pass
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.next.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.next.stderr
deleted file mode 100644
index 67b491f19..000000000
--- a/tests/ui/async-await/in-trait/async-recursive-generic.next.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive-generic.rs:13:48
- |
-LL | async fn foo_recursive(&self, n: usize) -> T {
- | ^ recursive `async fn`
- |
- = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
- = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.rs b/tests/ui/async-await/in-trait/async-recursive-generic.rs
index 64c6ba15c..6839abd38 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.rs
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.current.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.stderr
index 67b491f19..cab173bdd 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.current.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive-generic.rs:13:48
+ --> $DIR/async-recursive-generic.rs:11:48
|
LL | async fn foo_recursive(&self, n: usize) -> T {
| ^ recursive `async fn`
diff --git a/tests/ui/async-await/in-trait/async-recursive.current.stderr b/tests/ui/async-await/in-trait/async-recursive.current.stderr
deleted file mode 100644
index 85af27e37..000000000
--- a/tests/ui/async-await/in-trait/async-recursive.current.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive.rs:13:48
- |
-LL | async fn foo_recursive(&self, n: usize) -> i32 {
- | ^^^ recursive `async fn`
- |
- = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
- = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/in-trait/async-recursive.rs b/tests/ui/async-await/in-trait/async-recursive.rs
index d928909e3..61119f809 100644
--- a/tests/ui/async-await/in-trait/async-recursive.rs
+++ b/tests/ui/async-await/in-trait/async-recursive.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/async-recursive.next.stderr b/tests/ui/async-await/in-trait/async-recursive.stderr
index 85af27e37..9feff37b3 100644
--- a/tests/ui/async-await/in-trait/async-recursive.next.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive.rs:13:48
+ --> $DIR/async-recursive.rs:11:48
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
| ^^^ recursive `async fn`
diff --git a/tests/ui/async-await/in-trait/bad-signatures.next.stderr b/tests/ui/async-await/in-trait/bad-signatures.next.stderr
deleted file mode 100644
index ae590fb05..000000000
--- a/tests/ui/async-await/in-trait/bad-signatures.next.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error: expected identifier, found keyword `self`
- --> $DIR/bad-signatures.rs:8:23
- |
-LL | async fn bar(&abc self);
- | ^^^^ expected identifier, found keyword
-
-error: expected one of `:`, `@`, or `|`, found keyword `self`
- --> $DIR/bad-signatures.rs:8:23
- |
-LL | async fn bar(&abc self);
- | -----^^^^
- | | |
- | | expected one of `:`, `@`, or `|`
- | help: declare the type after the parameter binding: `<identifier>: <type>`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/async-await/in-trait/bad-signatures.rs b/tests/ui/async-await/in-trait/bad-signatures.rs
index 4baddd8cc..98dddc126 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.rs
+++ b/tests/ui/async-await/in-trait/bad-signatures.rs
@@ -1,6 +1,4 @@
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
diff --git a/tests/ui/async-await/in-trait/bad-signatures.current.stderr b/tests/ui/async-await/in-trait/bad-signatures.stderr
index ae590fb05..7cbd96e24 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.current.stderr
+++ b/tests/ui/async-await/in-trait/bad-signatures.stderr
@@ -1,11 +1,11 @@
error: expected identifier, found keyword `self`
- --> $DIR/bad-signatures.rs:8:23
+ --> $DIR/bad-signatures.rs:6:23
|
LL | async fn bar(&abc self);
| ^^^^ expected identifier, found keyword
error: expected one of `:`, `@`, or `|`, found keyword `self`
- --> $DIR/bad-signatures.rs:8:23
+ --> $DIR/bad-signatures.rs:6:23
|
LL | async fn bar(&abc self);
| -----^^^^
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr
deleted file mode 100644
index eec5ab065..000000000
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.current.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error: async associated function in trait cannot be specialized
- --> $DIR/dont-project-to-specializable-projection.rs:16:5
- |
-LL | default async fn foo(_: T) -> &'static str {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
index 7183eaccc..afd3db5e0 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
@@ -1,7 +1,5 @@
// edition: 2021
// known-bug: #108309
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
index 25a7f3bb5..7c750bf51 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.next.stderr
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
@@ -1,11 +1,11 @@
error[E0053]: method `foo` has an incompatible type for trait
- --> $DIR/dont-project-to-specializable-projection.rs:16:35
+ --> $DIR/dont-project-to-specializable-projection.rs:14:35
|
LL | default async fn foo(_: T) -> &'static str {
| ^^^^^^^^^^^^ expected associated type, found future
|
note: type in trait
- --> $DIR/dont-project-to-specializable-projection.rs:12:27
+ --> $DIR/dont-project-to-specializable-projection.rs:10:27
|
LL | async fn foo(_: T) -> &'static str;
| ^^^^^^^^^^^^
@@ -13,7 +13,7 @@ LL | async fn foo(_: T) -> &'static str;
found signature `fn(_) -> impl Future<Output = &'static str>`
error: async associated function in trait cannot be specialized
- --> $DIR/dont-project-to-specializable-projection.rs:16:5
+ --> $DIR/dont-project-to-specializable-projection.rs:14:5
|
LL | default async fn foo(_: T) -> &'static str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/early-bound-1.rs b/tests/ui/async-await/in-trait/early-bound-1.rs
index 30843473d..6b3b14201 100644
--- a/tests/ui/async-await/in-trait/early-bound-1.rs
+++ b/tests/ui/async-await/in-trait/early-bound-1.rs
@@ -1,7 +1,5 @@
// check-pass
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/early-bound-2.rs b/tests/ui/async-await/in-trait/early-bound-2.rs
index 1c5a68c2a..270443229 100644
--- a/tests/ui/async-await/in-trait/early-bound-2.rs
+++ b/tests/ui/async-await/in-trait/early-bound-2.rs
@@ -1,7 +1,5 @@
// check-pass
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr
deleted file mode 100644
index 1a7495149..000000000
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.next.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
- --> $DIR/fn-not-async-err2.rs:15:22
- |
-LL | fn foo(&self) -> impl Future<Output = i32> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0562`.
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.rs b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
index 5fdb7296a..78017429f 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.rs
+++ b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
index 1a7495149..37d9669c0 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.current.stderr
+++ b/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
@@ -1,5 +1,5 @@
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
- --> $DIR/fn-not-async-err2.rs:15:22
+ --> $DIR/fn-not-async-err2.rs:13:22
|
LL | fn foo(&self) -> impl Future<Output = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.current.stderr b/tests/ui/async-await/in-trait/generics-mismatch.current.stderr
deleted file mode 100644
index be23384e0..000000000
--- a/tests/ui/async-await/in-trait/generics-mismatch.current.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
- --> $DIR/generics-mismatch.rs:13:18
- |
-LL | trait Foo {
- | ---
-LL | async fn foo<T>();
- | - expected type parameter
-...
-LL | impl Foo for () {
- | ---------------
-LL | async fn foo<const N: usize>() {}
- | ^^^^^^^^^^^^^^ found const parameter of type `usize`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.next.stderr b/tests/ui/async-await/in-trait/generics-mismatch.next.stderr
deleted file mode 100644
index be23384e0..000000000
--- a/tests/ui/async-await/in-trait/generics-mismatch.next.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
- --> $DIR/generics-mismatch.rs:13:18
- |
-LL | trait Foo {
- | ---
-LL | async fn foo<T>();
- | - expected type parameter
-...
-LL | impl Foo for () {
- | ---------------
-LL | async fn foo<const N: usize>() {}
- | ^^^^^^^^^^^^^^ found const parameter of type `usize`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/async-await/in-trait/implied-bounds.rs b/tests/ui/async-await/in-trait/implied-bounds.rs
index 45ada1d84..52bceb3cc 100644
--- a/tests/ui/async-await/in-trait/implied-bounds.rs
+++ b/tests/ui/async-await/in-trait/implied-bounds.rs
@@ -1,7 +1,5 @@
// check-pass
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/issue-102138.rs b/tests/ui/async-await/in-trait/issue-102138.rs
index ced30b7e4..f61b34ed9 100644
--- a/tests/ui/async-await/in-trait/issue-102138.rs
+++ b/tests/ui/async-await/in-trait/issue-102138.rs
@@ -1,7 +1,5 @@
// check-pass
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/issue-102219.rs b/tests/ui/async-await/in-trait/issue-102219.rs
index f3fdfa345..9a35f6515 100644
--- a/tests/ui/async-await/in-trait/issue-102219.rs
+++ b/tests/ui/async-await/in-trait/issue-102219.rs
@@ -1,8 +1,6 @@
// compile-flags:--crate-type=lib
// edition:2021
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/issue-102310.rs b/tests/ui/async-await/in-trait/issue-102310.rs
index 8e5dbd08e..49c3e9fee 100644
--- a/tests/ui/async-await/in-trait/issue-102310.rs
+++ b/tests/ui/async-await/in-trait/issue-102310.rs
@@ -1,7 +1,5 @@
// check-pass
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/issue-104678.rs b/tests/ui/async-await/in-trait/issue-104678.rs
index 3d010f180..e396df4e5 100644
--- a/tests/ui/async-await/in-trait/issue-104678.rs
+++ b/tests/ui/async-await/in-trait/issue-104678.rs
@@ -1,7 +1,5 @@
// edition:2021
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr
deleted file mode 100644
index 69e7c65ee..000000000
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.next.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
- --> $DIR/lifetime-mismatch.rs:13:17
- |
-LL | async fn foo<'a>(&self);
- | ---- lifetimes in impl do not match this method in trait
-...
-LL | async fn foo(&self) {}
- | ^ lifetimes do not match method in trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0195`.
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.rs b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
index 46183f72b..bb793df5d 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.rs
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
@@ -1,6 +1,4 @@
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
index 69e7c65ee..86592269c 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.current.stderr
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
- --> $DIR/lifetime-mismatch.rs:13:17
+ --> $DIR/lifetime-mismatch.rs:11:17
|
LL | async fn foo<'a>(&self);
| ---- lifetimes in impl do not match this method in trait
diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.current.stderr b/tests/ui/async-await/in-trait/missing-feature-flag.current.stderr
deleted file mode 100644
index e6ac9bc22..000000000
--- a/tests/ui/async-await/in-trait/missing-feature-flag.current.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/missing-feature-flag.rs:14:1
- |
-LL | async fn foo(_: T) -> &'static str;
- | ----------------------------------- `foo` from trait
-...
-LL | impl<T> MyTrait<T> for MyStruct {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
-
-error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
- --> $DIR/missing-feature-flag.rs:18:5
- |
-LL | impl<T> MyTrait<T> for MyStruct {}
- | ------------------------------- parent `impl` is here
-...
-LL | async fn foo(_: i32) -> &'static str {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo`
- |
- = note: to specialize, `foo` in the parent `impl` must be marked `default`
-
-error[E0308]: mismatched types
- --> $DIR/missing-feature-flag.rs:18:42
- |
-LL | async fn foo(_: i32) -> &'static str {}
- | ^^ expected `&str`, found `()`
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0046, E0308, E0520.
-For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.rs b/tests/ui/async-await/in-trait/missing-feature-flag.rs
index 6481f4a70..34dd50a1c 100644
--- a/tests/ui/async-await/in-trait/missing-feature-flag.rs
+++ b/tests/ui/async-await/in-trait/missing-feature-flag.rs
@@ -1,6 +1,4 @@
// edition:2018
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.next.stderr b/tests/ui/async-await/in-trait/missing-feature-flag.stderr
index e6ac9bc22..f6aba1fcd 100644
--- a/tests/ui/async-await/in-trait/missing-feature-flag.next.stderr
+++ b/tests/ui/async-await/in-trait/missing-feature-flag.stderr
@@ -1,5 +1,5 @@
error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/missing-feature-flag.rs:14:1
+ --> $DIR/missing-feature-flag.rs:12:1
|
LL | async fn foo(_: T) -> &'static str;
| ----------------------------------- `foo` from trait
@@ -8,7 +8,7 @@ LL | impl<T> MyTrait<T> for MyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
- --> $DIR/missing-feature-flag.rs:18:5
+ --> $DIR/missing-feature-flag.rs:16:5
|
LL | impl<T> MyTrait<T> for MyStruct {}
| ------------------------------- parent `impl` is here
@@ -19,7 +19,7 @@ LL | async fn foo(_: i32) -> &'static str {}
= note: to specialize, `foo` in the parent `impl` must be marked `default`
error[E0308]: mismatched types
- --> $DIR/missing-feature-flag.rs:18:42
+ --> $DIR/missing-feature-flag.rs:16:42
|
LL | async fn foo(_: i32) -> &'static str {}
| ^^ expected `&str`, found `()`
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.next.stderr b/tests/ui/async-await/in-trait/missing-send-bound.next.stderr
deleted file mode 100644
index 9aa37f743..000000000
--- a/tests/ui/async-await/in-trait/missing-send-bound.next.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/missing-send-bound.rs:16:20
- |
-LL | assert_is_send(test::<T>());
- | ^^^^^^^^^^^ future returned by `test` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>`
-note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/missing-send-bound.rs:12:5
- |
-LL | T::bar().await;
- | ^^^^^^^^ await occurs here on type `impl Future<Output = ()>`, which is not `Send`
-note: required by a bound in `assert_is_send`
- --> $DIR/missing-send-bound.rs:20:27
- |
-LL | fn assert_is_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_is_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.rs b/tests/ui/async-await/in-trait/missing-send-bound.rs
index b602865cb..dbcc66576 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.rs
+++ b/tests/ui/async-await/in-trait/missing-send-bound.rs
@@ -1,6 +1,4 @@
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.current.stderr b/tests/ui/async-await/in-trait/missing-send-bound.stderr
index 9aa37f743..18185b755 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.current.stderr
+++ b/tests/ui/async-await/in-trait/missing-send-bound.stderr
@@ -1,17 +1,17 @@
error: future cannot be sent between threads safely
- --> $DIR/missing-send-bound.rs:16:20
+ --> $DIR/missing-send-bound.rs:14:20
|
LL | assert_is_send(test::<T>());
| ^^^^^^^^^^^ future returned by `test` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>`
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/missing-send-bound.rs:12:5
+ --> $DIR/missing-send-bound.rs:10:5
|
LL | T::bar().await;
| ^^^^^^^^ await occurs here on type `impl Future<Output = ()>`, which is not `Send`
note: required by a bound in `assert_is_send`
- --> $DIR/missing-send-bound.rs:20:27
+ --> $DIR/missing-send-bound.rs:18:27
|
LL | fn assert_is_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_is_send`
diff --git a/tests/ui/async-await/in-trait/object-safety.next.stderr b/tests/ui/async-await/in-trait/object-safety.next.stderr
deleted file mode 100644
index 7f7ec3914..000000000
--- a/tests/ui/async-await/in-trait/object-safety.next.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:12:12
- |
-LL | let x: &dyn Foo = todo!();
- | ^^^^^^^^ `Foo` cannot be made into an object
- |
-note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:8:14
- |
-LL | trait Foo {
- | --- this trait cannot be made into an object...
-LL | async fn foo(&self);
- | ^^^ ...because method `foo` is `async`
- = help: consider moving `foo` to another trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/async-await/in-trait/object-safety.rs b/tests/ui/async-await/in-trait/object-safety.rs
index 4edad1512..441539e5d 100644
--- a/tests/ui/async-await/in-trait/object-safety.rs
+++ b/tests/ui/async-await/in-trait/object-safety.rs
@@ -1,6 +1,4 @@
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
diff --git a/tests/ui/async-await/in-trait/object-safety.current.stderr b/tests/ui/async-await/in-trait/object-safety.stderr
index 7f7ec3914..ccdf9d887 100644
--- a/tests/ui/async-await/in-trait/object-safety.current.stderr
+++ b/tests/ui/async-await/in-trait/object-safety.stderr
@@ -1,11 +1,11 @@
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:12:12
+ --> $DIR/object-safety.rs:10:12
|
LL | let x: &dyn Foo = todo!();
| ^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:8:14
+ --> $DIR/object-safety.rs:6:14
|
LL | trait Foo {
| --- this trait cannot be made into an object...
diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.next.stderr b/tests/ui/async-await/in-trait/return-not-existing-pair.next.stderr
deleted file mode 100644
index 56973a1d1..000000000
--- a/tests/ui/async-await/in-trait/return-not-existing-pair.next.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0726]: implicit elided lifetime not allowed here
- --> $DIR/return-not-existing-pair.rs:12:20
- |
-LL | impl<'a, 'b, T, U> MyTrait<T> for U {
- | ^^^^^^^^^^ expected lifetime parameters
- |
-help: indicate the anonymous lifetimes
- |
-LL | impl<'a, 'b, T, U> MyTrait<'_, '_, T> for U {
- | +++++++
-
-error[E0412]: cannot find type `ConnImpl` in this scope
- --> $DIR/return-not-existing-pair.rs:8:48
- |
-LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
- | ^^^^^^^^ not found in this scope
-
-error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl
- --> $DIR/return-not-existing-pair.rs:14:5
- |
-LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
- | ------------------------------------------------------------ `&self` used in trait
-...
-LL | async fn foo(_: T) -> (&'a U, &'b T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl
-
-error[E0308]: mismatched types
- --> $DIR/return-not-existing-pair.rs:14:42
- |
-LL | async fn foo(_: T) -> (&'a U, &'b T) {}
- | ^^ expected `(&U, &T)`, found `()`
- |
- = note: expected tuple `(&'a U, &'b T)`
- found unit type `()`
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0186, E0308, E0412, E0726.
-For more information about an error, try `rustc --explain E0186`.
diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.rs b/tests/ui/async-await/in-trait/return-not-existing-pair.rs
index d1b3832d1..a14dfceed 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-pair.rs
+++ b/tests/ui/async-await/in-trait/return-not-existing-pair.rs
@@ -1,6 +1,4 @@
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.current.stderr b/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
index 56973a1d1..e573b8517 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-pair.current.stderr
+++ b/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
@@ -1,5 +1,5 @@
error[E0726]: implicit elided lifetime not allowed here
- --> $DIR/return-not-existing-pair.rs:12:20
+ --> $DIR/return-not-existing-pair.rs:10:20
|
LL | impl<'a, 'b, T, U> MyTrait<T> for U {
| ^^^^^^^^^^ expected lifetime parameters
@@ -10,13 +10,13 @@ LL | impl<'a, 'b, T, U> MyTrait<'_, '_, T> for U {
| +++++++
error[E0412]: cannot find type `ConnImpl` in this scope
- --> $DIR/return-not-existing-pair.rs:8:48
+ --> $DIR/return-not-existing-pair.rs:6:48
|
LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
| ^^^^^^^^ not found in this scope
error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl
- --> $DIR/return-not-existing-pair.rs:14:5
+ --> $DIR/return-not-existing-pair.rs:12:5
|
LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
| ------------------------------------------------------------ `&self` used in trait
@@ -25,7 +25,7 @@ LL | async fn foo(_: T) -> (&'a U, &'b T) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl
error[E0308]: mismatched types
- --> $DIR/return-not-existing-pair.rs:14:42
+ --> $DIR/return-not-existing-pair.rs:12:42
|
LL | async fn foo(_: T) -> (&'a U, &'b T) {}
| ^^ expected `(&U, &T)`, found `()`
diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.current.stderr b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.current.stderr
deleted file mode 100644
index 2564d68d5..000000000
--- a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.current.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0412]: cannot find type `Missing` in this scope
- --> $DIR/return-not-existing-type-wrapping-rpitit.rs:10:25
- |
-LL | fn bar() -> Wrapper<Missing<impl Sized>>;
- | ^^^^^^^ not found in this scope
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
index 37c02827e..254b9a782 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
+++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
@@ -1,6 +1,4 @@
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.next.stderr b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
index 2564d68d5..059934d24 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.next.stderr
+++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
@@ -1,5 +1,5 @@
error[E0412]: cannot find type `Missing` in this scope
- --> $DIR/return-not-existing-type-wrapping-rpitit.rs:10:25
+ --> $DIR/return-not-existing-type-wrapping-rpitit.rs:8:25
|
LL | fn bar() -> Wrapper<Missing<impl Sized>>;
| ^^^^^^^ not found in this scope
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.current.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.current.stderr
deleted file mode 100644
index 6a107d7be..000000000
--- a/tests/ui/async-await/in-trait/return-type-suggestion.current.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/return-type-suggestion.rs:9:9
- |
-LL | Ok(())
- | ^^^^^^- help: consider using a semicolon here: `;`
- | |
- | expected `()`, found `Result<(), _>`
- |
- = note: expected unit type `()`
- found enum `Result<(), _>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.rs b/tests/ui/async-await/in-trait/return-type-suggestion.rs
index d63bccefa..cdab4ea0f 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.rs
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait)]
@@ -8,7 +6,6 @@ trait A {
async fn e() {
Ok(())
//~^ ERROR mismatched types
- //~| HELP consider using a semicolon here
}
}
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.next.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
index 6a107d7be..179c9ed93 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.next.stderr
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
@@ -1,10 +1,8 @@
error[E0308]: mismatched types
- --> $DIR/return-type-suggestion.rs:9:9
+ --> $DIR/return-type-suggestion.rs:7:9
|
LL | Ok(())
- | ^^^^^^- help: consider using a semicolon here: `;`
- | |
- | expected `()`, found `Result<(), _>`
+ | ^^^^^^ expected `()`, found `Result<(), _>`
|
= note: expected unit type `()`
found enum `Result<(), _>`
diff --git a/tests/ui/async-await/issue-61452.stderr b/tests/ui/async-await/issue-61452.stderr
index bf5044328..3f623ba8a 100644
--- a/tests/ui/async-await/issue-61452.stderr
+++ b/tests/ui/async-await/issue-61452.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/issue-61452.rs:4:5
|
LL | x.take();
- | ^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/async-await/issues/issue-61187.stderr b/tests/ui/async-await/issues/issue-61187.stderr
index e58f74546..203b17550 100644
--- a/tests/ui/async-await/issues/issue-61187.stderr
+++ b/tests/ui/async-await/issues/issue-61187.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `data` as mutable, as it is not declared as mutable
--> $DIR/issue-61187.rs:6:5
|
LL | data.reverse();
- | ^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
index ade386a60..725caddae 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
@@ -2,7 +2,8 @@
// be talking about `async fn`s instead.
// run-fail
-// error-pattern: thread 'main' panicked at '`async fn` resumed after completion'
+// error-pattern: thread 'main' panicked
+// error-pattern: `async fn` resumed after completion
// edition:2018
// ignore-wasm no panic or subprocess support
// ignore-emscripten no panic or subprocess support
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
index b4ea4c9f6..5909c3a5e 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
@@ -3,7 +3,8 @@
// run-fail
// needs-unwind
-// error-pattern: thread 'main' panicked at '`async fn` resumed after panicking'
+// error-pattern: thread 'main' panicked
+// error-pattern: `async fn` resumed after panicking
// edition:2018
// ignore-wasm no panic or subprocess support
diff --git a/tests/ui/async-await/normalize-output-in-signature-deduction.rs b/tests/ui/async-await/normalize-output-in-signature-deduction.rs
new file mode 100644
index 000000000..960065a83
--- /dev/null
+++ b/tests/ui/async-await/normalize-output-in-signature-deduction.rs
@@ -0,0 +1,19 @@
+// edition:2021
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+// check-pass
+
+#![feature(type_alias_impl_trait)]
+
+struct Foo;
+
+impl Trait for Foo {}
+pub trait Trait {}
+
+pub type TAIT<T> = impl Trait;
+
+async fn foo<T>() -> TAIT<T> {
+ Foo
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.rs b/tests/ui/async-await/return-type-notation/issue-110963-early.rs
index eee31aa1f..0ecbca5c1 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.rs
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.rs
@@ -1,7 +1,5 @@
// edition: 2021
// known-bug: #110963
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_type_notation)]
#![feature(async_fn_in_trait)]
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
new file mode 100644
index 000000000..33e22dec3
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
@@ -0,0 +1,37 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/issue-110963-early.rs:4:12
+ |
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: higher-ranked lifetime error
+ --> $DIR/issue-110963-early.rs:15:5
+ |
+LL | / spawn(async move {
+LL | | let mut hc = hc;
+LL | | if !hc.check().await {
+LL | | log_health_check_failure().await;
+LL | | }
+LL | | });
+ | |______^
+ |
+ = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send`
+
+error: higher-ranked lifetime error
+ --> $DIR/issue-110963-early.rs:15:5
+ |
+LL | / spawn(async move {
+LL | | let mut hc = hc;
+LL | | if !hc.check().await {
+LL | | log_health_check_failure().await;
+LL | | }
+LL | | });
+ | |______^
+ |
+ = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send`
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.rs b/tests/ui/async-await/return-type-notation/issue-110963-late.rs
index ea047cd3b..17b5d775d 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-late.rs
+++ b/tests/ui/async-await/return-type-notation/issue-110963-late.rs
@@ -1,7 +1,5 @@
// edition: 2021
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.stderr b/tests/ui/async-await/return-type-notation/issue-110963-late.stderr
new file mode 100644
index 000000000..9c6966537
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/issue-110963-late.stderr
@@ -0,0 +1,11 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/issue-110963-late.rs:4:12
+ |
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.rs b/tests/ui/async-await/return-type-notation/super-method-bound.rs
index 0163c62f5..58ea3578d 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.rs
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.rs
@@ -1,7 +1,5 @@
// edition:2021
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait, return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.stderr
new file mode 100644
index 000000000..ac0668d3c
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.stderr
@@ -0,0 +1,11 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/super-method-bound.rs:4:31
+ |
+LL | #![feature(async_fn_in_trait, return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.rs b/tests/ui/async-await/return-type-notation/supertrait-bound.rs
index 09de32c5d..19bcfe304 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.rs
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait, return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete and may not be safe to use
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
new file mode 100644
index 000000000..c8cec4946
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
@@ -0,0 +1,11 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/supertrait-bound.rs:3:49
+ |
+LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
index 3141da1d2..7871a2fed 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
@@ -1,6 +1,4 @@
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait, return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
new file mode 100644
index 000000000..76928c5d7
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
@@ -0,0 +1,29 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/ty-or-ct-params.rs:3:31
+ |
+LL | #![feature(async_fn_in_trait, return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: return type notation is not allowed for functions that have type parameters
+ --> $DIR/ty-or-ct-params.rs:14:12
+ |
+LL | async fn bar<T>() {}
+ | - type parameter declared here
+...
+LL | T: Foo<bar(): Send, baz(): Send>,
+ | ^^^^^^^^^^^
+
+error: return type notation is not allowed for functions that have const parameters
+ --> $DIR/ty-or-ct-params.rs:14:25
+ |
+LL | async fn baz<const N: usize>() {}
+ | -------------- const parameter declared here
+...
+LL | T: Foo<bar(): Send, baz(): Send>,
+ | ^^^^^^^^^^^
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
diff --git a/tests/ui/async-await/track-caller/async-block.afn.stderr b/tests/ui/async-await/track-caller/async-block.afn.stderr
new file mode 100644
index 000000000..2302722ee
--- /dev/null
+++ b/tests/ui/async-await/track-caller/async-block.afn.stderr
@@ -0,0 +1,30 @@
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:8:13
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:15:13
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:23:17
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-block.nofeat.stderr b/tests/ui/async-await/track-caller/async-block.nofeat.stderr
new file mode 100644
index 000000000..2302722ee
--- /dev/null
+++ b/tests/ui/async-await/track-caller/async-block.nofeat.stderr
@@ -0,0 +1,30 @@
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:8:13
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:15:13
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:23:17
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-block.rs b/tests/ui/async-await/track-caller/async-block.rs
index 8ddd4ab11..24711b966 100644
--- a/tests/ui/async-await/track-caller/async-block.rs
+++ b/tests/ui/async-await/track-caller/async-block.rs
@@ -1,9 +1,27 @@
// edition:2021
+// revisions: afn nofeat
#![feature(stmt_expr_attributes)]
+#![cfg_attr(afn, feature(async_fn_track_caller))]
fn main() {
let _ = #[track_caller] async {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
}
+
+#[track_caller]
+async fn foo() {
+ let _ = #[track_caller] async {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+}
+
+#[track_caller]
+async fn foo2() {
+ let _ = async {
+ let _ = #[track_caller] async {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+ };
+}
diff --git a/tests/ui/async-await/track-caller/async-block.stderr b/tests/ui/async-await/track-caller/async-block.stderr
deleted file mode 100644
index 21d1054d2..000000000
--- a/tests/ui/async-await/track-caller/async-block.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: `#[track_caller]` on closures is currently unstable
- --> $DIR/async-block.rs:6:13
- |
-LL | let _ = #[track_caller] async {
- | ^^^^^^^^^^^^^^^
- |
- = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
- = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr b/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr
new file mode 100644
index 000000000..739c04a76
--- /dev/null
+++ b/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr
@@ -0,0 +1,57 @@
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:8:13
+ |
+LL | let _ = #[track_caller] async || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:15:13
+ |
+LL | let _ = #[track_caller] async || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:21:13
+ |
+LL | let _ = #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:28:17
+ |
+LL | let _ = #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:36:9
+ |
+LL | #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:45:13
+ |
+LL | #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr b/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr
new file mode 100644
index 000000000..739c04a76
--- /dev/null
+++ b/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr
@@ -0,0 +1,57 @@
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:8:13
+ |
+LL | let _ = #[track_caller] async || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:15:13
+ |
+LL | let _ = #[track_caller] async || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:21:13
+ |
+LL | let _ = #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:28:17
+ |
+LL | let _ = #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:36:9
+ |
+LL | #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:45:13
+ |
+LL | #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-closure-gate.rs b/tests/ui/async-await/track-caller/async-closure-gate.rs
index d9d556855..8d8d081aa 100644
--- a/tests/ui/async-await/track-caller/async-closure-gate.rs
+++ b/tests/ui/async-await/track-caller/async-closure-gate.rs
@@ -1,9 +1,50 @@
// edition:2021
+// revisions: afn nofeat
#![feature(async_closure, stmt_expr_attributes)]
+#![cfg_attr(afn, feature(async_fn_track_caller))]
fn main() {
let _ = #[track_caller] async || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
}
+
+#[track_caller]
+async fn foo() {
+ let _ = #[track_caller] async || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+}
+
+async fn foo2() {
+ let _ = #[track_caller] || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+}
+
+fn foo3() {
+ async {
+ let _ = #[track_caller] || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+ }
+}
+
+async fn foo4() {
+ let _ = || {
+ #[track_caller] || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+ };
+}
+
+fn foo5() {
+ async {
+ let _ = || {
+ #[track_caller] || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+ };
+ }
+}
diff --git a/tests/ui/async-await/track-caller/async-closure-gate.stderr b/tests/ui/async-await/track-caller/async-closure-gate.stderr
deleted file mode 100644
index 498f1b43b..000000000
--- a/tests/ui/async-await/track-caller/async-closure-gate.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: `#[track_caller]` on closures is currently unstable
- --> $DIR/async-closure-gate.rs:6:13
- |
-LL | let _ = #[track_caller] async || {
- | ^^^^^^^^^^^^^^^
- |
- = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
- = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/panic-track-caller.cls.stderr b/tests/ui/async-await/track-caller/panic-track-caller.cls.stderr
new file mode 100644
index 000000000..f3090e3b9
--- /dev/null
+++ b/tests/ui/async-await/track-caller/panic-track-caller.cls.stderr
@@ -0,0 +1,31 @@
+warning: `#[track_caller]` on async functions is a no-op
+ --> $DIR/panic-track-caller.rs:53:1
+ |
+LL | #[track_caller]
+ | ^^^^^^^^^^^^^^^
+...
+LL | / async fn bar_track_caller() {
+LL | | panic!()
+LL | | }
+ | |_- this function will not propagate the caller location
+ |
+ = note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
+ = help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
+ = note: `#[warn(ungated_async_fn_track_caller)]` on by default
+
+warning: `#[track_caller]` on async functions is a no-op
+ --> $DIR/panic-track-caller.rs:67:5
+ |
+LL | #[track_caller]
+ | ^^^^^^^^^^^^^^^
+...
+LL | / async fn bar_assoc() {
+LL | | panic!();
+LL | | }
+ | |_____- this function will not propagate the caller location
+ |
+ = note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
+ = help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr b/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr
index 51ea225f4..f3090e3b9 100644
--- a/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr
+++ b/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr
@@ -1,29 +1,31 @@
warning: `#[track_caller]` on async functions is a no-op
- --> $DIR/panic-track-caller.rs:50:1
+ --> $DIR/panic-track-caller.rs:53:1
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
+...
LL | / async fn bar_track_caller() {
LL | | panic!()
LL | | }
| |_- this function will not propagate the caller location
|
- = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
- = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+ = note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
+ = help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
= note: `#[warn(ungated_async_fn_track_caller)]` on by default
warning: `#[track_caller]` on async functions is a no-op
- --> $DIR/panic-track-caller.rs:62:5
+ --> $DIR/panic-track-caller.rs:67:5
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
+...
LL | / async fn bar_assoc() {
LL | | panic!();
LL | | }
| |_____- this function will not propagate the caller location
|
- = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
- = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+ = note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
+ = help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
warning: 2 warnings emitted
diff --git a/tests/ui/async-await/track-caller/panic-track-caller.rs b/tests/ui/async-await/track-caller/panic-track-caller.rs
index 65bb23e0b..df8290e5f 100644
--- a/tests/ui/async-await/track-caller/panic-track-caller.rs
+++ b/tests/ui/async-await/track-caller/panic-track-caller.rs
@@ -1,9 +1,12 @@
// run-pass
// edition:2021
-// revisions: feat nofeat
+// revisions: afn cls nofeat
// needs-unwind
+// gate-test-async_fn_track_caller
#![feature(async_closure, stmt_expr_attributes)]
-#![cfg_attr(feat, feature(closure_track_caller))]
+#![cfg_attr(afn, feature(async_fn_track_caller))]
+#![cfg_attr(cls, feature(closure_track_caller))]
+#![allow(unused)]
use std::future::Future;
use std::panic;
@@ -47,7 +50,9 @@ async fn foo() {
bar().await
}
-#[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op
+#[track_caller]
+//[cls]~^ WARN `#[track_caller]` on async functions is a no-op
+//[nofeat]~^^ WARN `#[track_caller]` on async functions is a no-op
async fn bar_track_caller() {
panic!()
}
@@ -59,7 +64,9 @@ async fn foo_track_caller() {
struct Foo;
impl Foo {
- #[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op
+ #[track_caller]
+ //[cls]~^ WARN `#[track_caller]` on async functions is a no-op
+ //[nofeat]~^^ WARN `#[track_caller]` on async functions is a no-op
async fn bar_assoc() {
panic!();
}
@@ -71,7 +78,7 @@ async fn foo_assoc() {
// Since compilation is expected to fail for this fn when using
// `nofeat`, we test that separately in `async-closure-gate.rs`
-#[cfg(feat)]
+#[cfg(cls)]
async fn foo_closure() {
let c = #[track_caller] async || {
panic!();
@@ -81,7 +88,7 @@ async fn foo_closure() {
// Since compilation is expected to fail for this fn when using
// `nofeat`, we test that separately in `async-block.rs`
-#[cfg(feat)]
+#[cfg(cls)]
async fn foo_block() {
let a = #[track_caller] async {
panic!();
@@ -106,21 +113,22 @@ fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 {
}
fn main() {
- assert_eq!(panicked_at(|| block_on(foo())), 43);
+ assert_eq!(panicked_at(|| block_on(foo())), 46
+);
- #[cfg(feat)]
- assert_eq!(panicked_at(|| block_on(foo_track_caller())), 56);
- #[cfg(nofeat)]
- assert_eq!(panicked_at(|| block_on(foo_track_caller())), 52);
+ #[cfg(afn)]
+ assert_eq!(panicked_at(|| block_on(foo_track_caller())), 61);
+ #[cfg(any(cls, nofeat))]
+ assert_eq!(panicked_at(|| block_on(foo_track_caller())), 57);
- #[cfg(feat)]
- assert_eq!(panicked_at(|| block_on(foo_assoc())), 69);
- #[cfg(nofeat)]
- assert_eq!(panicked_at(|| block_on(foo_assoc())), 64);
+ #[cfg(afn)]
+ assert_eq!(panicked_at(|| block_on(foo_assoc())), 76);
+ #[cfg(any(cls, nofeat))]
+ assert_eq!(panicked_at(|| block_on(foo_assoc())), 71);
- #[cfg(feat)]
- assert_eq!(panicked_at(|| block_on(foo_closure())), 79);
+ #[cfg(cls)]
+ assert_eq!(panicked_at(|| block_on(foo_closure())), 84);
- #[cfg(feat)]
- assert_eq!(panicked_at(|| block_on(foo_block())), 89);
+ #[cfg(cls)]
+ assert_eq!(panicked_at(|| block_on(foo_block())), 96);
}
diff --git a/tests/ui/attributes/auxiliary/rustc_confusables_across_crate.rs b/tests/ui/attributes/auxiliary/rustc_confusables_across_crate.rs
new file mode 100644
index 000000000..2fb2d3ad4
--- /dev/null
+++ b/tests/ui/attributes/auxiliary/rustc_confusables_across_crate.rs
@@ -0,0 +1,11 @@
+#![feature(rustc_attrs)]
+
+pub struct BTreeSet;
+
+impl BTreeSet {
+ #[rustc_confusables("push", "test_b")]
+ pub fn insert(&self) {}
+
+ #[rustc_confusables("pulled")]
+ pub fn pull(&self) {}
+}
diff --git a/tests/ui/attributes/invalid-doc-attr.rs b/tests/ui/attributes/invalid-doc-attr.rs
deleted file mode 100644
index c231e43b3..000000000
--- a/tests/ui/attributes/invalid-doc-attr.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-#![crate_type = "lib"]
-#![deny(warnings)]
-
-#[doc(test(no_crate_inject))]
-//~^ ERROR can only be applied at the crate level
-//~| WARN is being phased out
-//~| HELP to apply to the crate, use an inner attribute
-//~| SUGGESTION !
-#[doc(inline)]
-//~^ ERROR can only be applied to a `use` item
-//~| WARN is being phased out
-pub fn foo() {}
-
-pub mod bar {
- #![doc(test(no_crate_inject))]
- //~^ ERROR can only be applied at the crate level
- //~| WARN is being phased out
-
- #[doc(test(no_crate_inject))]
- //~^ ERROR can only be applied at the crate level
- //~| WARN is being phased out
- #[doc(inline)]
- //~^ ERROR can only be applied to a `use` item
- //~| WARN is being phased out
- pub fn baz() {}
-}
-
-#[doc(inline)]
-#[doc(no_inline)]
-//~^^ ERROR conflicting doc inlining attributes
-//~| HELP remove one of the conflicting attributes
-pub use bar::baz;
diff --git a/tests/ui/attributes/invalid-doc-attr.stderr b/tests/ui/attributes/invalid-doc-attr.stderr
deleted file mode 100644
index b23b8ded8..000000000
--- a/tests/ui/attributes/invalid-doc-attr.stderr
+++ /dev/null
@@ -1,78 +0,0 @@
-error: this attribute can only be applied at the crate level
- --> $DIR/invalid-doc-attr.rs:4:7
- |
-LL | #[doc(test(no_crate_inject))]
- | ^^^^^^^^^^^^^^^^^^^^^
- |
- = 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 #82730 <https://github.com/rust-lang/rust/issues/82730>
- = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
-note: the lint level is defined here
- --> $DIR/invalid-doc-attr.rs:2:9
- |
-LL | #![deny(warnings)]
- | ^^^^^^^^
- = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
-help: to apply to the crate, use an inner attribute
- |
-LL | #![doc(test(no_crate_inject))]
- | +
-
-error: this attribute can only be applied to a `use` item
- --> $DIR/invalid-doc-attr.rs:9:7
- |
-LL | #[doc(inline)]
- | ^^^^^^ only applicable on `use` items
-...
-LL | pub fn foo() {}
- | ------------ not a `use` item
- |
- = 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 #82730 <https://github.com/rust-lang/rust/issues/82730>
- = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information
-
-error: this attribute can only be applied at the crate level
- --> $DIR/invalid-doc-attr.rs:15:12
- |
-LL | #![doc(test(no_crate_inject))]
- | ^^^^^^^^^^^^^^^^^^^^^
- |
- = 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 #82730 <https://github.com/rust-lang/rust/issues/82730>
- = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
-
-error: conflicting doc inlining attributes
- --> $DIR/invalid-doc-attr.rs:28:7
- |
-LL | #[doc(inline)]
- | ^^^^^^ this attribute...
-LL | #[doc(no_inline)]
- | ^^^^^^^^^ ...conflicts with this attribute
- |
- = help: remove one of the conflicting attributes
-
-error: this attribute can only be applied at the crate level
- --> $DIR/invalid-doc-attr.rs:19:11
- |
-LL | #[doc(test(no_crate_inject))]
- | ^^^^^^^^^^^^^^^^^^^^^
- |
- = 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 #82730 <https://github.com/rust-lang/rust/issues/82730>
- = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
-
-error: this attribute can only be applied to a `use` item
- --> $DIR/invalid-doc-attr.rs:22:11
- |
-LL | #[doc(inline)]
- | ^^^^^^ only applicable on `use` items
-...
-LL | pub fn baz() {}
- | ------------ not a `use` item
- |
- = 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 #82730 <https://github.com/rust-lang/rust/issues/82730>
- = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information
-
-error: aborting due to 6 previous errors
-
diff --git a/tests/ui/attributes/macro_export_on_decl_macro.rs b/tests/ui/attributes/macro_export_on_decl_macro.rs
new file mode 100644
index 000000000..e6fe66ac6
--- /dev/null
+++ b/tests/ui/attributes/macro_export_on_decl_macro.rs
@@ -0,0 +1,9 @@
+// Using #[macro_export] on a decl macro has no effect and should warn
+
+#![feature(decl_macro)]
+#![deny(unused)]
+
+#[macro_export] //~ ERROR `#[macro_export]` has no effect on declarative macro definitions
+pub macro foo() {}
+
+fn main() {}
diff --git a/tests/ui/attributes/macro_export_on_decl_macro.stderr b/tests/ui/attributes/macro_export_on_decl_macro.stderr
new file mode 100644
index 000000000..565e07919
--- /dev/null
+++ b/tests/ui/attributes/macro_export_on_decl_macro.stderr
@@ -0,0 +1,16 @@
+error: `#[macro_export]` has no effect on declarative macro definitions
+ --> $DIR/macro_export_on_decl_macro.rs:6:1
+ |
+LL | #[macro_export]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: declarative macros follow the same exporting rules as regular items
+note: the lint level is defined here
+ --> $DIR/macro_export_on_decl_macro.rs:4:9
+ |
+LL | #![deny(unused)]
+ | ^^^^^^
+ = note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/attributes/rustc_confusables.rs b/tests/ui/attributes/rustc_confusables.rs
new file mode 100644
index 000000000..352e91d06
--- /dev/null
+++ b/tests/ui/attributes/rustc_confusables.rs
@@ -0,0 +1,47 @@
+// aux-build: rustc_confusables_across_crate.rs
+
+#![feature(rustc_attrs)]
+
+extern crate rustc_confusables_across_crate;
+
+use rustc_confusables_across_crate::BTreeSet;
+
+fn main() {
+ // Misspellings (similarly named methods) take precedence over `rustc_confusables`.
+ let x = BTreeSet {};
+ x.inser();
+ //~^ ERROR no method named
+ //~| HELP there is a method with a similar name
+ x.foo();
+ //~^ ERROR no method named
+ x.push();
+ //~^ ERROR no method named
+ //~| HELP you might have meant to use `insert`
+ x.test();
+ //~^ ERROR no method named
+ x.pulled();
+ //~^ ERROR no method named
+ //~| HELP there is a method with a similar name
+}
+
+struct Bar;
+
+impl Bar {
+ #[rustc_confusables()]
+ //~^ ERROR expected at least one confusable name
+ fn baz() {}
+
+ #[rustc_confusables]
+ //~^ ERROR malformed `rustc_confusables` attribute input
+ //~| HELP must be of the form
+ fn qux() {}
+
+ #[rustc_confusables(invalid_meta_item)]
+ //~^ ERROR expected a quoted string literal
+ //~| HELP consider surrounding this with quotes
+ fn quux() {}
+}
+
+#[rustc_confusables("blah")]
+//~^ ERROR attribute should be applied to an inherent method
+fn not_inherent_impl_method() {}
diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr
new file mode 100644
index 000000000..9fd4470cd
--- /dev/null
+++ b/tests/ui/attributes/rustc_confusables.stderr
@@ -0,0 +1,68 @@
+error: malformed `rustc_confusables` attribute input
+ --> $DIR/rustc_confusables.rs:34:5
+ |
+LL | #[rustc_confusables]
+ | ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]`
+
+error: attribute should be applied to an inherent method
+ --> $DIR/rustc_confusables.rs:45:1
+ |
+LL | #[rustc_confusables("blah")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: expected at least one confusable name
+ --> $DIR/rustc_confusables.rs:30:5
+ |
+LL | #[rustc_confusables()]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0539]: expected a quoted string literal
+ --> $DIR/rustc_confusables.rs:39:25
+ |
+LL | #[rustc_confusables(invalid_meta_item)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: consider surrounding this with quotes
+ |
+LL | #[rustc_confusables("invalid_meta_item")]
+ | + +
+
+error[E0599]: no method named `inser` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope
+ --> $DIR/rustc_confusables.rs:12:7
+ |
+LL | x.inser();
+ | ^^^^^ help: there is a method with a similar name: `insert`
+
+error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope
+ --> $DIR/rustc_confusables.rs:15:7
+ |
+LL | x.foo();
+ | ^^^ method not found in `BTreeSet`
+
+error[E0599]: no method named `push` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope
+ --> $DIR/rustc_confusables.rs:17:7
+ |
+LL | x.push();
+ | ^^^^ method not found in `BTreeSet`
+ |
+help: you might have meant to use `insert`
+ |
+LL | x.insert();
+ | ~~~~~~
+
+error[E0599]: no method named `test` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope
+ --> $DIR/rustc_confusables.rs:20:7
+ |
+LL | x.test();
+ | ^^^^ method not found in `BTreeSet`
+
+error[E0599]: no method named `pulled` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope
+ --> $DIR/rustc_confusables.rs:22:7
+ |
+LL | x.pulled();
+ | ^^^^^^ help: there is a method with a similar name: `pull`
+
+error: aborting due to 9 previous errors
+
+Some errors have detailed explanations: E0539, E0599.
+For more information about an error, try `rustc --explain E0539`.
diff --git a/tests/ui/auto-traits/issue-83857-ub.rs b/tests/ui/auto-traits/issue-83857-ub.rs
new file mode 100644
index 000000000..626e60c37
--- /dev/null
+++ b/tests/ui/auto-traits/issue-83857-ub.rs
@@ -0,0 +1,33 @@
+#![allow(suspicious_auto_trait_impls)]
+// Tests that we don't incorrectly allow overlap between a builtin auto trait
+// impl and a user written one. See #83857 for more details
+
+struct Always<T, U>(T, U);
+unsafe impl<T, U> Send for Always<T, U> {}
+struct Foo<T, U>(Always<T, U>);
+
+trait False {}
+unsafe impl<U: False> Send for Foo<u32, U> {}
+
+trait WithAssoc {
+ type Output;
+}
+impl<T: Send> WithAssoc for T {
+ type Output = Self;
+}
+impl WithAssoc for Foo<u32, ()> {
+ type Output = Box<i32>;
+}
+
+fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) {
+ //~^ ERROR `Foo<T, U>` cannot be sent between threads safely
+ f(foo(v));
+}
+
+fn foo<T: Send>(x: T) -> <T as WithAssoc>::Output {
+ x
+}
+
+fn main() {
+ generic(Foo(Always(0, ())), |b| *b);
+}
diff --git a/tests/ui/auto-traits/issue-83857-ub.stderr b/tests/ui/auto-traits/issue-83857-ub.stderr
new file mode 100644
index 000000000..23a2f62d9
--- /dev/null
+++ b/tests/ui/auto-traits/issue-83857-ub.stderr
@@ -0,0 +1,22 @@
+error[E0277]: `Foo<T, U>` cannot be sent between threads safely
+ --> $DIR/issue-83857-ub.rs:22:38
+ |
+LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo<T, U>` cannot be sent between threads safely
+ |
+ = help: the trait `Send` is not implemented for `Foo<T, U>`
+note: required for `Foo<T, U>` to implement `WithAssoc`
+ --> $DIR/issue-83857-ub.rs:15:15
+ |
+LL | impl<T: Send> WithAssoc for T {
+ | ---- ^^^^^^^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
+help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
+ |
+LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) where Foo<T, U>: Send {
+ | +++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/binop/binop-move-semantics.stderr b/tests/ui/binop/binop-move-semantics.stderr
index 8645169b9..1dd8c9a87 100644
--- a/tests/ui/binop/binop-move-semantics.stderr
+++ b/tests/ui/binop/binop-move-semantics.stderr
@@ -27,7 +27,7 @@ LL | x
| - value moved here
LL | +
LL | x.clone();
- | ^^^^^^^^^ value borrowed here after move
+ | ^ value borrowed here after move
|
help: consider cloning the value if the performance cost is acceptable
|
diff --git a/tests/ui/binop/borrow-suggestion-109352-2.rs b/tests/ui/binop/borrow-suggestion-109352-2.rs
new file mode 100644
index 000000000..43dab9529
--- /dev/null
+++ b/tests/ui/binop/borrow-suggestion-109352-2.rs
@@ -0,0 +1,27 @@
+struct Bar;
+
+impl std::ops::Mul for &mut Bar {
+ type Output = Bar;
+
+ fn mul(self, _rhs: Self) -> Self::Output {
+ unimplemented!()
+ }
+}
+
+fn main() {
+ let ref_mut_bar: &mut Bar = &mut Bar;
+ let ref_bar: &Bar = &Bar;
+ let owned_bar: Bar = Bar;
+
+ let _ = ref_mut_bar * ref_mut_bar;
+
+ // FIXME: we should be able to suggest borrowing both side
+ let _ = owned_bar * owned_bar;
+ //~^ ERROR cannot multiply
+ let _ = ref_bar * ref_bar;
+ //~^ ERROR cannot multiply
+ let _ = ref_bar * ref_mut_bar;
+ //~^ ERROR cannot multiply
+ let _ = ref_mut_bar * ref_bar;
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/binop/borrow-suggestion-109352-2.stderr b/tests/ui/binop/borrow-suggestion-109352-2.stderr
new file mode 100644
index 000000000..18ed08d73
--- /dev/null
+++ b/tests/ui/binop/borrow-suggestion-109352-2.stderr
@@ -0,0 +1,64 @@
+error[E0369]: cannot multiply `Bar` by `Bar`
+ --> $DIR/borrow-suggestion-109352-2.rs:19:23
+ |
+LL | let _ = owned_bar * owned_bar;
+ | --------- ^ --------- Bar
+ | |
+ | Bar
+ |
+note: an implementation of `Mul` might be missing for `Bar`
+ --> $DIR/borrow-suggestion-109352-2.rs:1:1
+ |
+LL | struct Bar;
+ | ^^^^^^^^^^ must implement `Mul`
+note: the trait `Mul` must be implemented
+ --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+
+error[E0369]: cannot multiply `&Bar` by `&Bar`
+ --> $DIR/borrow-suggestion-109352-2.rs:21:21
+ |
+LL | let _ = ref_bar * ref_bar;
+ | ------- ^ ------- &Bar
+ | |
+ | &Bar
+ |
+ = note: an implementation for `&mut Bar * &mut Bar` exists
+help: consider making this expression a mutable borrow
+ --> $DIR/borrow-suggestion-109352-2.rs:21:13
+ |
+LL | let _ = ref_bar * ref_bar;
+ | ^^^^^^^
+help: consider making this expression a mutable borrow
+ --> $DIR/borrow-suggestion-109352-2.rs:21:23
+ |
+LL | let _ = ref_bar * ref_bar;
+ | ^^^^^^^
+
+error[E0369]: cannot multiply `&Bar` by `&mut Bar`
+ --> $DIR/borrow-suggestion-109352-2.rs:23:21
+ |
+LL | let _ = ref_bar * ref_mut_bar;
+ | ------- ^ ----------- &mut Bar
+ | |
+ | &Bar
+ |
+ = note: an implementation for `&mut Bar * &mut Bar` exists
+help: consider making this expression a mutable borrow
+ --> $DIR/borrow-suggestion-109352-2.rs:23:13
+ |
+LL | let _ = ref_bar * ref_mut_bar;
+ | ^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/borrow-suggestion-109352-2.rs:25:27
+ |
+LL | let _ = ref_mut_bar * ref_bar;
+ | ^^^^^^^ types differ in mutability
+ |
+ = note: expected mutable reference `&mut Bar`
+ found reference `&Bar`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0308, E0369.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/binop/borrow-suggestion-109352.fixed b/tests/ui/binop/borrow-suggestion-109352.fixed
new file mode 100644
index 000000000..3374a9d78
--- /dev/null
+++ b/tests/ui/binop/borrow-suggestion-109352.fixed
@@ -0,0 +1,27 @@
+// run-rustfix
+
+struct Foo;
+
+impl std::ops::Mul for &Foo {
+ type Output = Foo;
+
+ fn mul(self, _rhs: Self) -> Self::Output {
+ unimplemented!()
+ }
+}
+
+fn main() {
+ let ref_mut_foo: &mut Foo = &mut Foo;
+ let ref_foo: &Foo = &Foo;
+ let owned_foo: Foo = Foo;
+
+ let _ = ref_foo * ref_foo;
+ let _ = ref_foo * ref_mut_foo;
+
+ let _ = &*ref_mut_foo * ref_foo;
+ //~^ ERROR cannot multiply
+ let _ = &*ref_mut_foo * &*ref_mut_foo;
+ //~^ ERROR cannot multiply
+ let _ = &*ref_mut_foo * &owned_foo;
+ //~^ ERROR cannot multiply
+}
diff --git a/tests/ui/binop/borrow-suggestion-109352.rs b/tests/ui/binop/borrow-suggestion-109352.rs
new file mode 100644
index 000000000..4e8510e0d
--- /dev/null
+++ b/tests/ui/binop/borrow-suggestion-109352.rs
@@ -0,0 +1,27 @@
+// run-rustfix
+
+struct Foo;
+
+impl std::ops::Mul for &Foo {
+ type Output = Foo;
+
+ fn mul(self, _rhs: Self) -> Self::Output {
+ unimplemented!()
+ }
+}
+
+fn main() {
+ let ref_mut_foo: &mut Foo = &mut Foo;
+ let ref_foo: &Foo = &Foo;
+ let owned_foo: Foo = Foo;
+
+ let _ = ref_foo * ref_foo;
+ let _ = ref_foo * ref_mut_foo;
+
+ let _ = ref_mut_foo * ref_foo;
+ //~^ ERROR cannot multiply
+ let _ = ref_mut_foo * ref_mut_foo;
+ //~^ ERROR cannot multiply
+ let _ = ref_mut_foo * &owned_foo;
+ //~^ ERROR cannot multiply
+}
diff --git a/tests/ui/binop/borrow-suggestion-109352.stderr b/tests/ui/binop/borrow-suggestion-109352.stderr
new file mode 100644
index 000000000..71e44f54b
--- /dev/null
+++ b/tests/ui/binop/borrow-suggestion-109352.stderr
@@ -0,0 +1,45 @@
+error[E0369]: cannot multiply `&mut Foo` by `&Foo`
+ --> $DIR/borrow-suggestion-109352.rs:21:25
+ |
+LL | let _ = ref_mut_foo * ref_foo;
+ | ----------- ^ ------- &Foo
+ | |
+ | &mut Foo
+ |
+ = note: an implementation for `&Foo * &Foo` exists
+help: consider reborrowing this side
+ |
+LL | let _ = &*ref_mut_foo * ref_foo;
+ | ++
+
+error[E0369]: cannot multiply `&mut Foo` by `&mut Foo`
+ --> $DIR/borrow-suggestion-109352.rs:23:25
+ |
+LL | let _ = ref_mut_foo * ref_mut_foo;
+ | ----------- ^ ----------- &mut Foo
+ | |
+ | &mut Foo
+ |
+ = note: an implementation for `&Foo * &Foo` exists
+help: consider reborrowing both sides
+ |
+LL | let _ = &*ref_mut_foo * &*ref_mut_foo;
+ | ++ ++
+
+error[E0369]: cannot multiply `&mut Foo` by `&Foo`
+ --> $DIR/borrow-suggestion-109352.rs:25:25
+ |
+LL | let _ = ref_mut_foo * &owned_foo;
+ | ----------- ^ ---------- &Foo
+ | |
+ | &mut Foo
+ |
+ = note: an implementation for `&Foo * &Foo` exists
+help: consider reborrowing this side
+ |
+LL | let _ = &*ref_mut_foo * &owned_foo;
+ | ++
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/tests/ui/borrowck/borrow-tuple-fields.stderr b/tests/ui/borrowck/borrow-tuple-fields.stderr
index d7d3efe49..e324ebfb5 100644
--- a/tests/ui/borrowck/borrow-tuple-fields.stderr
+++ b/tests/ui/borrowck/borrow-tuple-fields.stderr
@@ -9,7 +9,7 @@ LL | let y = x;
| ^ move out of `x` occurs here
LL |
LL | r.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
--> $DIR/borrow-tuple-fields.rs:18:13
@@ -19,7 +19,7 @@ LL | let a = &x.0;
LL | let b = &mut x.0;
| ^^^^^^^^ mutable borrow occurs here
LL | a.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
--> $DIR/borrow-tuple-fields.rs:23:13
@@ -29,7 +29,7 @@ LL | let a = &mut x.0;
LL | let b = &mut x.0;
| ^^^^^^^^ second mutable borrow occurs here
LL | a.use_ref();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/borrow-tuple-fields.rs:28:13
@@ -41,7 +41,7 @@ LL | let r = &x.0;
LL | let y = x;
| ^ move out of `x` occurs here
LL | r.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
--> $DIR/borrow-tuple-fields.rs:33:13
@@ -51,7 +51,7 @@ LL | let a = &x.0;
LL | let b = &mut x.0;
| ^^^^^^^^ mutable borrow occurs here
LL | a.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
--> $DIR/borrow-tuple-fields.rs:38:13
@@ -61,7 +61,7 @@ LL | let a = &mut x.0;
LL | let b = &mut x.0;
| ^^^^^^^^ second mutable borrow occurs here
LL | a.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to 6 previous errors
diff --git a/tests/ui/borrowck/borrowck-argument.stderr b/tests/ui/borrowck/borrowck-argument.stderr
index 1c992dfcc..8ad5623c8 100644
--- a/tests/ui/borrowck/borrowck-argument.stderr
+++ b/tests/ui/borrowck/borrowck-argument.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:10:5
|
LL | arg.mutate();
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -13,7 +13,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:15:9
|
LL | arg.mutate();
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -24,7 +24,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:21:9
|
LL | arg.mutate();
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -35,7 +35,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/borrowck-argument.rs:32:17
|
LL | (|arg: S| { arg.mutate() })(s);
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr b/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
index 19ef0301a..25d642c30 100644
--- a/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
+++ b/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:15:5
|
LL | x.printme();
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
index 3c28ff56e..a61fdbf6c 100644
--- a/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
+++ b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*a` as mutable, as `a` is not declared as mutable
--> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:12:5
|
LL | a.foo();
- | ^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr b/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
index 42b6c34cd..fa0ae318e 100644
--- a/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
+++ b/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
@@ -2,11 +2,11 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time
--> $DIR/borrowck-borrow-mut-object-twice.rs:13:5
|
LL | let y = x.f1();
- | ------ first mutable borrow occurs here
+ | - first mutable borrow occurs here
LL | x.f2();
- | ^^^^^^ second mutable borrow occurs here
+ | ^ second mutable borrow occurs here
LL | y.use_ref();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr b/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
index fdf6568d8..426d5bc47 100644
--- a/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
+++ b/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
@@ -58,7 +58,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:72:5
|
LL | x.set(0, 0);
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -66,7 +66,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:76:5
|
LL | x.set(0, 0);
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -74,7 +74,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:84:5
|
LL | x.y_mut()
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -82,7 +82,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:88:5
|
LL | x.y_mut()
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -90,7 +90,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:92:6
|
LL | *x.y_mut() = 3;
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -98,7 +98,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:96:6
|
LL | *x.y_mut() = 3;
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
@@ -106,7 +106,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref.rs:100:6
|
LL | *x.y_mut() = 3;
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>`
diff --git a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
index 4eeec09b9..6e112e270 100644
--- a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
+++ b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
@@ -8,8 +8,12 @@ LL | let x = defer(&vec!["Goodbye", "world!"]);
LL | x.x[0];
| ------ borrow later used here
|
- = note: consider using a `let` binding to create a longer lived value
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider using a `let` binding to create a longer lived value
+ |
+LL ~ let binding = vec!["Goodbye", "world!"];
+LL ~ let x = defer(&binding);
+ |
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
index c62d5f903..7ee840b34 100644
--- a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
+++ b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
@@ -7,7 +7,7 @@ LL | buggy_map.insert(42, &*Box::new(1));
| creates a temporary value which is freed while still in use
...
LL | buggy_map.insert(43, &*tmp);
- | --------------------------- borrow later used here
+ | --------- borrow later used here
|
help: consider using a `let` binding to create a longer lived value
|
diff --git a/tests/ui/borrowck/borrowck-closures-unique-imm.stderr b/tests/ui/borrowck/borrowck-closures-unique-imm.stderr
index 0c5fd39b7..b8bbb31a3 100644
--- a/tests/ui/borrowck/borrowck-closures-unique-imm.stderr
+++ b/tests/ui/borrowck/borrowck-closures-unique-imm.stderr
@@ -6,7 +6,7 @@ LL | let p = &this.x;
LL | &mut this.x;
| ^^^^^^^^^^^ mutable borrow occurs here
LL | p.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-describe-lvalue.stderr b/tests/ui/borrowck/borrowck-describe-lvalue.stderr
index cb29c9fda..11f2e42d4 100644
--- a/tests/ui/borrowck/borrowck-describe-lvalue.stderr
+++ b/tests/ui/borrowck/borrowck-describe-lvalue.stderr
@@ -45,7 +45,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:37:9
|
LL | let x = f.x();
- | ----- `f` is borrowed here
+ | - `f` is borrowed here
LL | f.x;
| ^^^ use of borrowed `f`
LL | drop(x);
@@ -55,7 +55,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:44:9
|
LL | let x = g.x();
- | ----- `g` is borrowed here
+ | - `g` is borrowed here
LL | g.0;
| ^^^ use of borrowed `g`
LL | drop(x);
@@ -75,7 +75,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:59:20
|
LL | let x = e.x();
- | ----- `e` is borrowed here
+ | - `e` is borrowed here
LL | match e {
LL | Baz::X(value) => value
| ^^^^^ use of borrowed `e`
@@ -97,7 +97,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:74:9
|
LL | let x = f.x();
- | ----- `*f` is borrowed here
+ | - `*f` is borrowed here
LL | f.x;
| ^^^ use of borrowed `*f`
LL | drop(x);
@@ -107,7 +107,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:81:9
|
LL | let x = g.x();
- | ----- `*g` is borrowed here
+ | - `*g` is borrowed here
LL | g.0;
| ^^^ use of borrowed `*g`
LL | drop(x);
@@ -127,7 +127,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed
--> $DIR/borrowck-describe-lvalue.rs:96:20
|
LL | let x = e.x();
- | ----- `*e` is borrowed here
+ | - `*e` is borrowed here
LL | match *e {
LL | Baz::X(value) => value
| ^^^^^ use of borrowed `*e`
diff --git a/tests/ui/borrowck/borrowck-insert-during-each.stderr b/tests/ui/borrowck/borrowck-insert-during-each.stderr
index 99d08e905..a1ac45795 100644
--- a/tests/ui/borrowck/borrowck-insert-during-each.stderr
+++ b/tests/ui/borrowck/borrowck-insert-during-each.stderr
@@ -16,17 +16,15 @@ LL | | })
error[E0500]: closure requires unique access to `f` but it is already borrowed
--> $DIR/borrowck-insert-during-each.rs:18:9
|
-LL | f.foo(
- | - --- first borrow later used by call
- | _____|
- | |
-LL | |
-LL | | |a| {
- | | ^^^ closure construction occurs here
-LL | | f.n.insert(*a);
- | | --- second borrow occurs due to use of `f` in closure
-LL | | })
- | |__________- borrow occurs here
+LL | f.foo(
+ | - --- first borrow later used by call
+ | |
+ | borrow occurs here
+LL |
+LL | |a| {
+ | ^^^ closure construction occurs here
+LL | f.n.insert(*a);
+ | --- second borrow occurs due to use of `f` in closure
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-issue-2657-1.stderr b/tests/ui/borrowck/borrowck-issue-2657-1.stderr
index 390bb9384..4ea4eb8f0 100644
--- a/tests/ui/borrowck/borrowck-issue-2657-1.stderr
+++ b/tests/ui/borrowck/borrowck-issue-2657-1.stderr
@@ -6,7 +6,7 @@ LL | Some(ref _y) => {
LL | let _a = x;
| ^ move out of `x` occurs here
LL | _y.use_ref();
- | ------------ borrow later used here
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-lend-flow-if.stderr b/tests/ui/borrowck/borrowck-lend-flow-if.stderr
index e47efc0e0..68a82bdb5 100644
--- a/tests/ui/borrowck/borrowck-lend-flow-if.stderr
+++ b/tests/ui/borrowck/borrowck-lend-flow-if.stderr
@@ -7,7 +7,7 @@ LL | }
LL | borrow_mut(&mut *v);
| ^^^^^^^ mutable borrow occurs here
LL | _w.use_ref();
- | ------------ immutable borrow later used here
+ | -- immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-lend-flow.stderr b/tests/ui/borrowck/borrowck-lend-flow.stderr
index 40c14f54c..07b11b3e7 100644
--- a/tests/ui/borrowck/borrowck-lend-flow.stderr
+++ b/tests/ui/borrowck/borrowck-lend-flow.stderr
@@ -6,7 +6,7 @@ LL | let _w = &v;
LL | borrow_mut(&mut *v);
| ^^^^^^^ mutable borrow occurs here
LL | _w.use_ref();
- | ------------ immutable borrow later used here
+ | -- immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr b/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
index 6eabfff90..86479043a 100644
--- a/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
+++ b/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
@@ -12,7 +12,7 @@ LL | println!("v={}", *v);
| -- move occurs due to use in closure
LL | });
LL | w.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0505]: cannot move out of `v` because it is borrowed
--> $DIR/borrowck-loan-blocks-move-cc.rs:24:19
@@ -28,7 +28,7 @@ LL | println!("v={}", *v);
| -- move occurs due to use in closure
LL | });
LL | w.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr
index 38e06fa01..de8da490c 100644
--- a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr
+++ b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr
@@ -8,7 +8,7 @@ LL | let w = &v;
LL | take(v);
| ^ move out of `v` occurs here
LL | w.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr b/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
index e1b991620..93622a0c5 100644
--- a/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
+++ b/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
@@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `x`
LL | let x = Foo(Box::new(3));
| - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
- | - ^^^^^^^^^ value borrowed here after move
+ | - ^ value borrowed here after move
| |
| value moved here
|
diff --git a/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
index f1640d3b7..bb90b2d15 100644
--- a/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
+++ b/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
@@ -17,7 +17,7 @@ LL | let q = &mut p;
| ------ mutable borrow occurs here
...
LL | p.times(3);
- | ^^^^^^^^^^ immutable borrow occurs here
+ | ^ immutable borrow occurs here
LL |
LL | *q + 3; // OK to use the new alias `q`
| -- mutable borrow later used here
diff --git a/tests/ui/borrowck/borrowck-loan-rcvr.stderr b/tests/ui/borrowck/borrowck-loan-rcvr.stderr
index 1d6bd4e2e..317423ecf 100644
--- a/tests/ui/borrowck/borrowck-loan-rcvr.stderr
+++ b/tests/ui/borrowck/borrowck-loan-rcvr.stderr
@@ -1,15 +1,13 @@
error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-loan-rcvr.rs:23:14
|
-LL | p.blockm(|| {
- | - ------ ^^ mutable borrow occurs here
- | | |
- | _____| immutable borrow later used by call
- | |
-LL | | p.x = 10;
- | | --- second borrow occurs due to use of `p` in closure
-LL | | })
- | |______- immutable borrow occurs here
+LL | p.blockm(|| {
+ | - ------ ^^ mutable borrow occurs here
+ | | |
+ | | immutable borrow later used by call
+ | immutable borrow occurs here
+LL | p.x = 10;
+ | --- second borrow occurs due to use of `p` in closure
error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-loan-rcvr.rs:34:5
@@ -17,7 +15,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta
LL | let l = &mut p;
| ------ mutable borrow occurs here
LL | p.impurem();
- | ^^^^^^^^^^^ immutable borrow occurs here
+ | ^ immutable borrow occurs here
LL |
LL | l.x += 1;
| -------- mutable borrow later used here
diff --git a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
index bd94f1a42..4f0202f38 100644
--- a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
+++ b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
@@ -9,7 +9,7 @@ LL |
LL | let z = *a;
| ^^ move out of `*a` occurs here
LL | b.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr
index cdad20c52..e1e3c7f8a 100644
--- a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr
+++ b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr
@@ -9,7 +9,7 @@ LL | let t1 = t0;
| ^^ move out of `t0` occurs here
LL | *t1 = 22;
LL | p.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr
index 87135f0bb..934dd8df1 100644
--- a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr
+++ b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr
@@ -2,9 +2,8 @@ error[E0507]: cannot move out of an `Rc`
--> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:4:14
|
LL | let _x = Rc::new(vec![1, 2]).into_iter();
- | ^^^^^^^^^^^^^^^^^^^^-----------
- | | |
- | | value moved due to this method call
+ | ^^^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call
+ | |
| move occurs because value has type `Vec<i32>`, which does not implement the `Copy` trait
|
note: `into_iter` takes ownership of the receiver `self`, which moves value
@@ -12,7 +11,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves value
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | let _x = Rc::new(vec![1, 2]).clone().into_iter();
- | ++++++++
+ | ++++++++
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr b/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
index d2b845619..3653de0e8 100644
--- a/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
+++ b/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr
@@ -5,9 +5,8 @@ LL | 1 => { addr.push(&mut x); }
| ^^^^^^ second mutable borrow occurs here
LL | 2 => { addr.push(&mut x); }
LL | _ => { addr.push(&mut x); }
- | -----------------
- | | |
- | | first mutable borrow occurs here
+ | ---- ------ first mutable borrow occurs here
+ | |
| first borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
@@ -16,18 +15,16 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
LL | 2 => { addr.push(&mut x); }
| ^^^^^^ second mutable borrow occurs here
LL | _ => { addr.push(&mut x); }
- | -----------------
- | | |
- | | first mutable borrow occurs here
+ | ---- ------ first mutable borrow occurs here
+ | |
| first borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-mut-borrow-linear-errors.rs:12:30
|
LL | _ => { addr.push(&mut x); }
- | ----------^^^^^^-
- | | |
- | | `x` was mutably borrowed here in the previous iteration of the loop
+ | ---- ^^^^^^ `x` was mutably borrowed here in the previous iteration of the loop
+ | |
| first borrow used here, in later iteration of loop
error: aborting due to 3 previous errors
diff --git a/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
index ef811b849..f2baee093 100644
--- a/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
+++ b/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
@@ -7,7 +7,7 @@ LL | let mut t2 = &mut t0;
| ^^^^^^^ mutable borrow occurs here
LL | **t2 += 1; // Mutates `*t0`
LL | p.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0499]: cannot borrow `t0` as mutable more than once at a time
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:18
@@ -18,7 +18,7 @@ LL | let mut t2 = &mut t0;
| ^^^^^^^ second mutable borrow occurs here
LL | **t2 += 1; // Mutates `*t0` but not through `*p`
LL | p.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-object-lifetime.stderr b/tests/ui/borrowck/borrowck-object-lifetime.stderr
index 215ed760a..cf94c74de 100644
--- a/tests/ui/borrowck/borrowck-object-lifetime.stderr
+++ b/tests/ui/borrowck/borrowck-object-lifetime.stderr
@@ -2,21 +2,21 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immut
--> $DIR/borrowck-object-lifetime.rs:20:13
|
LL | let y = x.borrowed();
- | ------------ immutable borrow occurs here
+ | - immutable borrow occurs here
LL | let z = x.mut_borrowed();
| ^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | y.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-object-lifetime.rs:26:13
|
LL | let y = x.borrowed();
- | ------------ immutable borrow occurs here
+ | - immutable borrow occurs here
LL | let z = &mut x;
| ^^^^^^ mutable borrow occurs here
LL | y.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr b/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
index fb7af50bc..2e7a6778d 100644
--- a/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
+++ b/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
@@ -6,7 +6,7 @@ LL | let p = &mut f[&s];
LL | let q = &f[&s];
| ^ immutable borrow occurs here
LL | p.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error[E0499]: cannot borrow `*f` as mutable more than once at a time
--> $DIR/borrowck-overloaded-index-autoderef.rs:43:18
@@ -16,7 +16,7 @@ LL | let p = &mut f[&s];
LL | let q = &mut f[&s];
| ^ second mutable borrow occurs here
LL | p.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
--> $DIR/borrowck-overloaded-index-autoderef.rs:53:18
@@ -26,7 +26,7 @@ LL | let p = &mut f.foo[&s];
LL | let q = &mut f.foo[&s];
| ^^^^^ second mutable borrow occurs here
LL | p.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-overloaded-index-autoderef.rs:65:18
@@ -36,7 +36,7 @@ LL | let p = &f.foo[&s];
LL | let q = &mut f.foo[&s];
| ^^^^^ mutable borrow occurs here
LL | p.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0506]: cannot assign to `f.foo` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:71:5
@@ -46,7 +46,7 @@ LL | let p = &f.foo[&s];
LL | f.foo = g;
| ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed
LL | p.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0506]: cannot assign to `*f` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:77:5
@@ -56,7 +56,7 @@ LL | let p = &f.foo[&s];
LL | *f = g;
| ^^^^^^ `*f` is assigned to here but it was already borrowed
LL | p.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0506]: cannot assign to `f.foo` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:83:5
@@ -66,7 +66,7 @@ LL | let p = &mut f.foo[&s];
LL | f.foo = g;
| ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed
LL | p.use_mut();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0506]: cannot assign to `*f` because it is borrowed
--> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
@@ -76,7 +76,7 @@ LL | let p = &mut f.foo[&s];
LL | *f = g;
| ^^^^^^ `*f` is assigned to here but it was already borrowed
LL | p.use_mut();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to 8 previous errors
diff --git a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
index d05996413..db73d4c04 100644
--- a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
+++ b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr
@@ -8,7 +8,7 @@ LL | let z = &x;
| ^^ immutable borrow occurs here
...
LL | y.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21
@@ -20,7 +20,7 @@ LL | let z = &mut x;
| ^^^^^^ mutable borrow occurs here
...
LL | y.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17
@@ -32,7 +32,7 @@ LL | let z = &mut x;
| ^^^^^^ second mutable borrow occurs here
...
LL | y.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to 3 previous errors
diff --git a/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
index b39215b9a..1c55953c9 100644
--- a/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
+++ b/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
@@ -7,7 +7,7 @@ LL | swap(&mut t0, &mut t1);
| ^^^^^^^ mutable borrow occurs here
LL | *t1 = 22;
LL | p.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr
index a87a14e7c..f2e549cd8 100644
--- a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr
+++ b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr
@@ -6,7 +6,7 @@ LL | let ra = &mut u.s.a;
LL | let b = u.c;
| ^^^ use of borrowed `u.s.a`
LL | ra.use_mut();
- | ------------ borrow later used here
+ | -- borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-uniq-via-lend.stderr b/tests/ui/borrowck/borrowck-uniq-via-lend.stderr
index 6dbe4c74b..923edc8ed 100644
--- a/tests/ui/borrowck/borrowck-uniq-via-lend.stderr
+++ b/tests/ui/borrowck/borrowck-uniq-via-lend.stderr
@@ -6,7 +6,7 @@ LL | let w = &mut v;
LL | borrow(&*v);
| ^^^ immutable borrow occurs here
LL | w.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-uniq-via-lend.rs:53:12
@@ -16,7 +16,7 @@ LL | x = &mut v;
LL | borrow(&*v);
| ^^^ immutable borrow occurs here
LL | x.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
index eb0f24b9b..5141fcc1b 100644
--- a/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
+++ b/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
@@ -5,9 +5,8 @@ LL | let vb: &mut [isize] = &mut v;
| ------ first mutable borrow occurs here
...
LL | v.push(tail[0] + tail[1]);
- | ^^^^^^^-------^^^^^^^^^^^
- | | |
- | | first borrow later used here
+ | ^ ------- first borrow later used here
+ | |
| second mutable borrow occurs here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr
index 70b9e4f44..024cb006c 100644
--- a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr
+++ b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr
@@ -8,7 +8,7 @@ LL | vec[0] = Box::new(4);
| ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
LL |
LL | _a.use_ref();
- | ------------ borrow later used here
+ | -- borrow later used here
error[E0506]: cannot assign to `vec[_]` because it is borrowed
--> $DIR/borrowck-vec-pattern-nesting.rs:23:13
@@ -20,7 +20,7 @@ LL | vec[0] = Box::new(4);
| ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
LL |
LL | _b.use_ref();
- | ------------ borrow later used here
+ | -- borrow later used here
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:34:11
diff --git a/tests/ui/borrowck/clone-span-on-try-operator.fixed b/tests/ui/borrowck/clone-span-on-try-operator.fixed
new file mode 100644
index 000000000..52f66e43a
--- /dev/null
+++ b/tests/ui/borrowck/clone-span-on-try-operator.fixed
@@ -0,0 +1,11 @@
+// run-rustfix
+
+#[derive(Clone)]
+struct Foo;
+impl Foo {
+ fn foo(self) {}
+}
+fn main() {
+ let foo = &Foo;
+ (*foo).clone().foo(); //~ ERROR cannot move out
+}
diff --git a/tests/ui/borrowck/clone-span-on-try-operator.rs b/tests/ui/borrowck/clone-span-on-try-operator.rs
new file mode 100644
index 000000000..031a35e20
--- /dev/null
+++ b/tests/ui/borrowck/clone-span-on-try-operator.rs
@@ -0,0 +1,11 @@
+// run-rustfix
+
+#[derive(Clone)]
+struct Foo;
+impl Foo {
+ fn foo(self) {}
+}
+fn main() {
+ let foo = &Foo;
+ (*foo).foo(); //~ ERROR cannot move out
+}
diff --git a/tests/ui/borrowck/clone-span-on-try-operator.stderr b/tests/ui/borrowck/clone-span-on-try-operator.stderr
new file mode 100644
index 000000000..85785e670
--- /dev/null
+++ b/tests/ui/borrowck/clone-span-on-try-operator.stderr
@@ -0,0 +1,21 @@
+error[E0507]: cannot move out of `*foo` which is behind a shared reference
+ --> $DIR/clone-span-on-try-operator.rs:10:5
+ |
+LL | (*foo).foo();
+ | ^^^^^^ ----- `*foo` moved due to this method call
+ | |
+ | move occurs because `*foo` has type `Foo`, which does not implement the `Copy` trait
+ |
+note: `Foo::foo` takes ownership of the receiver `self`, which moves `*foo`
+ --> $DIR/clone-span-on-try-operator.rs:6:12
+ |
+LL | fn foo(self) {}
+ | ^^^^
+help: you can `clone` the value and consume it, but this might not be your desired behavior
+ |
+LL | (*foo).clone().foo();
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.rs b/tests/ui/borrowck/copy-suggestion-region-vid.rs
index dff952834..3c5b887ce 100644
--- a/tests/ui/borrowck/copy-suggestion-region-vid.rs
+++ b/tests/ui/borrowck/copy-suggestion-region-vid.rs
@@ -1,3 +1,4 @@
+//@run-rustfix
pub struct DataStruct();
pub struct HelperStruct<'n> {
diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.stderr b/tests/ui/borrowck/copy-suggestion-region-vid.stderr
index 1685acf87..b344aa664 100644
--- a/tests/ui/borrowck/copy-suggestion-region-vid.stderr
+++ b/tests/ui/borrowck/copy-suggestion-region-vid.stderr
@@ -1,13 +1,18 @@
error[E0382]: borrow of moved value: `helpers`
- --> $DIR/copy-suggestion-region-vid.rs:12:43
+ --> $DIR/copy-suggestion-region-vid.rs:13:43
|
LL | let helpers = [vec![], vec![]];
| ------- move occurs because `helpers` has type `[Vec<&i64>; 2]`, which does not implement the `Copy` trait
LL |
LL | HelperStruct { helpers, is_empty: helpers[0].is_empty() }
- | ------- ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move
+ | ------- ^^^^^^^^^^ value borrowed here after move
| |
| value moved here
+ |
+help: consider cloning the value if the performance cost is acceptable
+ |
+LL | HelperStruct { helpers: helpers.clone(), is_empty: helpers[0].is_empty() }
+ | +++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/borrowck/index-mut-help-with-impl.stderr b/tests/ui/borrowck/index-mut-help-with-impl.stderr
index 69dca7e7b..89391f409 100644
--- a/tests/ui/borrowck/index-mut-help-with-impl.stderr
+++ b/tests/ui/borrowck/index-mut-help-with-impl.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/index-mut-help-with-impl.rs:9:5
|
LL | Index::index(&v, 1..2).make_ascii_uppercase();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/tests/ui/borrowck/index-mut-help.stderr b/tests/ui/borrowck/index-mut-help.stderr
index f42d7e015..fde2b5dc0 100644
--- a/tests/ui/borrowck/index-mut-help.stderr
+++ b/tests/ui/borrowck/index-mut-help.stderr
@@ -2,13 +2,10 @@ error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutab
--> $DIR/index-mut-help.rs:10:5
|
LL | map["peter"].clear();
- | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^^ 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());
- | ~~~~~~~~~ ~~~~~~~~~~~~~~~ +
+ = help: to modify a `HashMap<&str, String>`, use `.get_mut()`, `.insert()` or the entry API
error[E0594]: cannot assign to data in an index of `HashMap<&str, String>`
--> $DIR/index-mut-help.rs:11:5
diff --git a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
index 25974e0d0..4e3bf1d70 100644
--- a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
+++ b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
@@ -26,9 +26,8 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time
--> $DIR/issue-109271-pass-self-into-closure.rs:21:12
|
LL | v.call(|(), this: &mut S| v.set());
- | -------^^^^^^^^^^^^^^^^^^---------
- | | | | |
- | | | | second borrow occurs due to use of `v` in closure
+ | - ---- ^^^^^^^^^^^^^^^^^^ - second borrow occurs due to use of `v` in closure
+ | | | |
| | | second mutable borrow occurs here
| | first borrow later used by call
| first mutable borrow occurs here
@@ -63,21 +62,14 @@ LL ~ S::get(&this);
error[E0499]: cannot borrow `v` as mutable more than once at a time
--> $DIR/issue-109271-pass-self-into-closure.rs:25:12
|
-LL | v.call(|(), this: &mut S| {
- | - ---- ^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
- | | |
- | _____| first borrow later used by call
- | |
-LL | |
-LL | |
-LL | |
-LL | | _ = v;
-LL | | v.set();
- | | - second borrow occurs due to use of `v` in closure
-... |
-LL | | _ = v.add(3);
-LL | | });
- | |______- first mutable borrow occurs here
+LL | v.call(|(), this: &mut S| {
+ | - ---- ^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+...
+LL | v.set();
+ | - second borrow occurs due to use of `v` in closure
error: aborting due to 5 previous errors
diff --git a/tests/ui/borrowck/issue-42344.stderr b/tests/ui/borrowck/issue-42344.stderr
index 29b4c8c38..5cffa1b51 100644
--- a/tests/ui/borrowck/issue-42344.stderr
+++ b/tests/ui/borrowck/issue-42344.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable stati
--> $DIR/issue-42344.rs:4:5
|
LL | TAB[0].iter_mut();
- | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/tests/ui/borrowck/issue-47646.stderr b/tests/ui/borrowck/issue-47646.stderr
index 84cf9237a..d82e1f908 100644
--- a/tests/ui/borrowck/issue-47646.stderr
+++ b/tests/ui/borrowck/issue-47646.stderr
@@ -2,7 +2,7 @@ error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as m
--> $DIR/issue-47646.rs:9:30
|
LL | let borrow = heap.peek_mut();
- | --------------- mutable borrow occurs here
+ | ---- mutable borrow occurs here
LL |
LL | match (borrow, ()) {
| ------------ a temporary with access to the mutable borrow is created here ...
diff --git a/tests/ui/borrowck/issue-51117.stderr b/tests/ui/borrowck/issue-51117.stderr
index ef1a16ea9..f8a9608ad 100644
--- a/tests/ui/borrowck/issue-51117.stderr
+++ b/tests/ui/borrowck/issue-51117.stderr
@@ -4,7 +4,7 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time
LL | Some(baz) => {
| --- first mutable borrow occurs here
LL | bar.take();
- | ^^^^^^^^^^ second mutable borrow occurs here
+ | ^^^ second mutable borrow occurs here
LL | drop(baz);
| --- first borrow later used here
diff --git a/tests/ui/borrowck/issue-81365-10.stderr b/tests/ui/borrowck/issue-81365-10.stderr
index d0986e9f9..2bbde82fa 100644
--- a/tests/ui/borrowck/issue-81365-10.stderr
+++ b/tests/ui/borrowck/issue-81365-10.stderr
@@ -2,7 +2,7 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-10.rs:21:9
|
LL | let first = &self.deref().target_field;
- | ------------ `self.container_field` is borrowed here
+ | ---- `self.container_field` is borrowed here
LL | self.container_field = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
LL | first;
diff --git a/tests/ui/borrowck/issue-81365-5.stderr b/tests/ui/borrowck/issue-81365-5.stderr
index c00e48288..094cec021 100644
--- a/tests/ui/borrowck/issue-81365-5.stderr
+++ b/tests/ui/borrowck/issue-81365-5.stderr
@@ -2,7 +2,7 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed
--> $DIR/issue-81365-5.rs:28:9
|
LL | let first = self.get();
- | ---------- `self.container_field` is borrowed here
+ | ---- `self.container_field` is borrowed here
LL | self.container_field = true;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed
LL | first;
diff --git a/tests/ui/borrowck/issue-82032.stderr b/tests/ui/borrowck/issue-82032.stderr
index 25f343117..f272477a9 100644
--- a/tests/ui/borrowck/issue-82032.stderr
+++ b/tests/ui/borrowck/issue-82032.stderr
@@ -7,7 +7,7 @@ LL | for v in self.0.values() {
| | help: use mutable method: `values_mut()`
| this iterator yields `&` references
LL | v.flush();
- | ^^^^^^^^^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable
error: aborting due to previous error
diff --git a/tests/ui/borrowck/issue-85581.stderr b/tests/ui/borrowck/issue-85581.stderr
index 59ca4867f..29c0429f2 100644
--- a/tests/ui/borrowck/issue-85581.stderr
+++ b/tests/ui/borrowck/issue-85581.stderr
@@ -7,7 +7,7 @@ LL | match heap.peek_mut() {
| first mutable borrow occurs here
| a temporary with access to the first borrow is created here ...
LL | Some(_) => { heap.pop(); },
- | ^^^^^^^^^^ second mutable borrow occurs here
+ | ^^^^ second mutable borrow occurs here
...
LL | }
| - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<PeekMut<'_, i32>>`
diff --git a/tests/ui/borrowck/issue-85765-closure.rs b/tests/ui/borrowck/issue-85765-closure.rs
new file mode 100644
index 000000000..f2d1dd0fb
--- /dev/null
+++ b/tests/ui/borrowck/issue-85765-closure.rs
@@ -0,0 +1,31 @@
+fn main() {
+ let _ = || {
+ let mut test = Vec::new();
+ let rofl: &Vec<Vec<i32>> = &mut test;
+ //~^ HELP consider changing this binding's type
+ rofl.push(Vec::new());
+ //~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference
+ //~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+ let mut mutvar = 42;
+ let r = &mutvar;
+ //~^ HELP consider changing this to be a mutable reference
+ *r = 0;
+ //~^ ERROR cannot assign to `*r`, which is behind a `&` reference
+ //~| NOTE `r` is a `&` reference, so the data it refers to cannot be written
+
+ #[rustfmt::skip]
+ let x: &usize = &mut{0};
+ //~^ HELP consider changing this binding's type
+ *x = 1;
+ //~^ ERROR cannot assign to `*x`, which is behind a `&` reference
+ //~| NOTE `x` is a `&` reference, so the data it refers to cannot be written
+
+ #[rustfmt::skip]
+ let y: &usize = &mut(0);
+ //~^ HELP consider changing this binding's type
+ *y = 1;
+ //~^ ERROR cannot assign to `*y`, which is behind a `&` reference
+ //~| NOTE `y` is a `&` reference, so the data it refers to cannot be written
+ };
+}
diff --git a/tests/ui/borrowck/issue-85765-closure.stderr b/tests/ui/borrowck/issue-85765-closure.stderr
new file mode 100644
index 000000000..936ddd67b
--- /dev/null
+++ b/tests/ui/borrowck/issue-85765-closure.stderr
@@ -0,0 +1,48 @@
+error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference
+ --> $DIR/issue-85765-closure.rs:6:9
+ |
+LL | rofl.push(Vec::new());
+ | ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ |
+help: consider changing this binding's type
+ |
+LL | let rofl: &mut Vec<Vec<i32>> = &mut test;
+ | ~~~~~~~~~~~~~~~~~~
+
+error[E0594]: cannot assign to `*r`, which is behind a `&` reference
+ --> $DIR/issue-85765-closure.rs:13:9
+ |
+LL | *r = 0;
+ | ^^^^^^ `r` is a `&` reference, so the data it refers to cannot be written
+ |
+help: consider changing this to be a mutable reference
+ |
+LL | let r = &mut mutvar;
+ | +++
+
+error[E0594]: cannot assign to `*x`, which is behind a `&` reference
+ --> $DIR/issue-85765-closure.rs:20:9
+ |
+LL | *x = 1;
+ | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
+ |
+help: consider changing this binding's type
+ |
+LL | let x: &mut usize = &mut{0};
+ | ~~~~~~~~~~
+
+error[E0594]: cannot assign to `*y`, which is behind a `&` reference
+ --> $DIR/issue-85765-closure.rs:27:9
+ |
+LL | *y = 1;
+ | ^^^^^^ `y` is a `&` reference, so the data it refers to cannot be written
+ |
+help: consider changing this binding's type
+ |
+LL | let y: &mut usize = &mut(0);
+ | ~~~~~~~~~~
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/tests/ui/borrowck/issue-85765.stderr b/tests/ui/borrowck/issue-85765.stderr
index 2985a658f..57900bfb6 100644
--- a/tests/ui/borrowck/issue-85765.stderr
+++ b/tests/ui/borrowck/issue-85765.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference
--> $DIR/issue-85765.rs:5:5
|
LL | rofl.push(Vec::new());
- | ^^^^^^^^^^^^^^^^^^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this binding's type
|
diff --git a/tests/ui/borrowck/issue-91206.stderr b/tests/ui/borrowck/issue-91206.stderr
index 6653d4978..30f836565 100644
--- a/tests/ui/borrowck/issue-91206.stderr
+++ b/tests/ui/borrowck/issue-91206.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*inner` as mutable, as it is behind a `&` reference
--> $DIR/issue-91206.rs:13:5
|
LL | inner.clear();
- | ^^^^^^^^^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider specifying this binding's type
|
diff --git a/tests/ui/borrowck/issue-93078.stderr b/tests/ui/borrowck/issue-93078.stderr
index 771a652a1..bcbcbe724 100644
--- a/tests/ui/borrowck/issue-93078.stderr
+++ b/tests/ui/borrowck/issue-93078.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
--> $DIR/issue-93078.rs:11:9
|
LL | self.modify();
- | ^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^ cannot borrow as mutable
|
= note: as `Self` may be unsized, this call attempts to take `&mut &mut self`
= note: however, `&mut self` expands to `self: &mut Self`, therefore `self` cannot be borrowed mutably
diff --git a/tests/ui/borrowck/many-mutable-borrows.stderr b/tests/ui/borrowck/many-mutable-borrows.stderr
index aa0cbcffd..0f808ac92 100644
--- a/tests/ui/borrowck/many-mutable-borrows.stderr
+++ b/tests/ui/borrowck/many-mutable-borrows.stderr
@@ -4,23 +4,23 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
LL | let v = Vec::new();
| ^ not mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
LL | v.push(0);
- | --------- cannot borrow as mutable
+ | - cannot borrow as mutable
|
= note: ...and 5 other attempted mutable borrows
help: consider changing this to be mutable
diff --git a/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr b/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr
index c6f75b1c0..f448e009b 100644
--- a/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr
+++ b/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr
@@ -47,7 +47,7 @@ error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
--> $DIR/mut-borrow-of-mut-ref.rs:34:5
|
LL | f.bar();
- | ^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider making the binding mutable
|
diff --git a/tests/ui/borrowck/mut-borrow-outside-loop.stderr b/tests/ui/borrowck/mut-borrow-outside-loop.stderr
index e6895b27f..4fcb693f1 100644
--- a/tests/ui/borrowck/mut-borrow-outside-loop.stderr
+++ b/tests/ui/borrowck/mut-borrow-outside-loop.stderr
@@ -6,7 +6,7 @@ LL | let first = &mut void;
LL | let second = &mut void;
| ^^^^^^^^^ second mutable borrow occurs here
LL | first.use_mut();
- | --------------- first borrow later used here
+ | ----- first borrow later used here
error[E0499]: cannot borrow `inner_void` as mutable more than once at a time
--> $DIR/mut-borrow-outside-loop.rs:15:28
@@ -17,7 +17,7 @@ LL | let inner_second = &mut inner_void;
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
LL | inner_second.use_mut();
LL | inner_first.use_mut();
- | --------------------- first borrow later used here
+ | ----------- first borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr b/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr
index 4621d8793..bada08368 100644
--- a/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr
+++ b/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr
@@ -2,9 +2,8 @@ error[E0507]: cannot move out of `*cb` which is behind a mutable reference
--> $DIR/suggest-as-ref-on-mut-closure.rs:7:5
|
LL | cb.map(|cb| cb());
- | ^^^--------------
- | | |
- | | `*cb` moved due to this method call
+ | ^^ -------------- `*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
|
diff --git a/tests/ui/borrowck/suggest-local-var-double-mut.stderr b/tests/ui/borrowck/suggest-local-var-double-mut.stderr
index 3a43c18a7..8bec0788f 100644
--- a/tests/ui/borrowck/suggest-local-var-double-mut.stderr
+++ b/tests/ui/borrowck/suggest-local-var-double-mut.stderr
@@ -2,9 +2,8 @@ error[E0499]: cannot borrow `*self` as mutable more than once at a time
--> $DIR/suggest-local-var-double-mut.rs:12:22
|
LL | self.foo(self.bar());
- | ---------^^^^^^^^^^-
- | | | |
- | | | second mutable borrow occurs here
+ | ---- --- ^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
|
diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-local-var-for-vector.stderr
index 615fffcd5..c8d00f7b2 100644
--- a/tests/ui/borrowck/suggest-local-var-for-vector.stderr
+++ b/tests/ui/borrowck/suggest-local-var-for-vector.stderr
@@ -2,11 +2,11 @@ error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mu
--> $DIR/suggest-local-var-for-vector.rs:3:9
|
LL | vec[vec.len() - 1] = 123;
- | ----^^^^^^^^^-----
- | | |
- | | immutable borrow occurs here
+ | ----^^^-----------
+ | | ||
+ | | |immutable borrow occurs here
+ | | mutable borrow later used here
| mutable borrow occurs here
- | mutable borrow later used here
|
help: try adding a local storing this...
--> $DIR/suggest-local-var-for-vector.rs:3:9
@@ -14,10 +14,10 @@ help: try adding a local storing this...
LL | vec[vec.len() - 1] = 123;
| ^^^^^^^^^
help: ...and then using that local here
- --> $DIR/suggest-local-var-for-vector.rs:3:5
+ --> $DIR/suggest-local-var-for-vector.rs:3:8
|
LL | vec[vec.len() - 1] = 123;
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr b/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr
index eb934e7b7..1ef643e21 100644
--- a/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr
+++ b/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr
@@ -2,9 +2,8 @@ error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as im
--> $DIR/suggest-local-var-imm-and-mut.rs:12:22
|
LL | self.foo(self.bar());
- | ---------^^^^^^^^^^-
- | | | |
- | | | mutable borrow occurs here
+ | ---- --- ^^^^^^^^^^ mutable borrow occurs here
+ | | |
| | immutable borrow later used by call
| immutable borrow occurs here
diff --git a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr
index e3a16eddf..368d72810 100644
--- a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr
+++ b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr
@@ -2,11 +2,11 @@ error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mu
--> $DIR/suggest-storing-local-var-for-vector.rs:3:9
|
LL | vec[vec.len() - 1] = 123;
- | ----^^^^^^^^^-----
- | | |
- | | immutable borrow occurs here
+ | ----^^^-----------
+ | | ||
+ | | |immutable borrow occurs here
+ | | mutable borrow later used here
| mutable borrow occurs here
- | mutable borrow later used here
|
help: try adding a local storing this...
--> $DIR/suggest-storing-local-var-for-vector.rs:3:9
@@ -14,10 +14,10 @@ help: try adding a local storing this...
LL | vec[vec.len() - 1] = 123;
| ^^^^^^^^^
help: ...and then using that local here
- --> $DIR/suggest-storing-local-var-for-vector.rs:3:5
+ --> $DIR/suggest-storing-local-var-for-vector.rs:3:8
|
LL | vec[vec.len() - 1] = 123;
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/borrowck/two-phase-across-loop.stderr b/tests/ui/borrowck/two-phase-across-loop.stderr
index 22f9b39df..d7c0210cc 100644
--- a/tests/ui/borrowck/two-phase-across-loop.stderr
+++ b/tests/ui/borrowck/two-phase-across-loop.stderr
@@ -2,9 +2,8 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time
--> $DIR/two-phase-across-loop.rs:17:22
|
LL | strings.push(foo.get_string());
- | -------------^^^^^^^^^^^^^^^^-
- | | |
- | | `foo` was mutably borrowed here in the previous iteration of the loop
+ | ------- ^^^ `foo` was mutably borrowed here in the previous iteration of the loop
+ | |
| first borrow used here, in later iteration of loop
error: aborting due to previous error
diff --git a/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr b/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr
index 21b0eddb9..2c3f1c18a 100644
--- a/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr
+++ b/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr
@@ -1,18 +1,13 @@
error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
--> $DIR/two-phase-cannot-nest-mut-self-calls.rs:14:9
|
-LL | vec.get({
- | - --- immutable borrow later used by call
- | _____|
- | |
-LL | |
-LL | | vec.push(2);
- | | ^^^^^^^^^^^ mutable borrow occurs here
-LL | |
-LL | |
-LL | | 0
-LL | | });
- | |______- immutable borrow occurs here
+LL | vec.get({
+ | --- --- immutable borrow later used by call
+ | |
+ | immutable borrow occurs here
+LL |
+LL | vec.push(2);
+ | ^^^^^^^^^^^ mutable borrow occurs here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/two-phase-multi-mut.stderr b/tests/ui/borrowck/two-phase-multi-mut.stderr
index 2e53e17a3..33fa4a3a1 100644
--- a/tests/ui/borrowck/two-phase-multi-mut.stderr
+++ b/tests/ui/borrowck/two-phase-multi-mut.stderr
@@ -12,9 +12,8 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time
--> $DIR/two-phase-multi-mut.rs:11:16
|
LL | foo.method(&mut foo);
- | -----------^^^^^^^^-
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------ ^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
diff --git a/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr b/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr
index efd63a08a..e122977b9 100644
--- a/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr
+++ b/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr
@@ -50,42 +50,42 @@ error[E0502]: cannot borrow `i` as immutable because it is also borrowed as muta
|
LL | i[i[3]] = 4;
| --^----
- | | |
- | | immutable borrow occurs here
+ | |||
+ | ||immutable borrow occurs here
+ | |mutable borrow later used here
| mutable borrow occurs here
- | mutable borrow later used here
|
help: try adding a local storing this...
- --> $DIR/two-phase-nonrecv-autoref.rs:132:7
+ --> $DIR/two-phase-nonrecv-autoref.rs:132:8
|
LL | i[i[3]] = 4;
- | ^^^^
+ | ^^^
help: ...and then using that local here
- --> $DIR/two-phase-nonrecv-autoref.rs:132:5
+ --> $DIR/two-phase-nonrecv-autoref.rs:132:6
|
LL | i[i[3]] = 4;
- | ^^^^^^^
+ | ^^^^^^
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-nonrecv-autoref.rs:138:7
|
LL | i[i[3]] = i[4];
| --^----
- | | |
- | | immutable borrow occurs here
+ | |||
+ | ||immutable borrow occurs here
+ | |mutable borrow later used here
| mutable borrow occurs here
- | mutable borrow later used here
|
help: try adding a local storing this...
- --> $DIR/two-phase-nonrecv-autoref.rs:138:7
+ --> $DIR/two-phase-nonrecv-autoref.rs:138:8
|
LL | i[i[3]] = i[4];
- | ^^^^
+ | ^^^
help: ...and then using that local here
- --> $DIR/two-phase-nonrecv-autoref.rs:138:5
+ --> $DIR/two-phase-nonrecv-autoref.rs:138:6
|
LL | i[i[3]] = i[4];
- | ^^^^^^^
+ | ^^^^^^
error: aborting due to 7 previous errors
diff --git a/tests/ui/borrowck/two-phase-sneaky.stderr b/tests/ui/borrowck/two-phase-sneaky.stderr
index 117d7ceae..4db970c1d 100644
--- a/tests/ui/borrowck/two-phase-sneaky.stderr
+++ b/tests/ui/borrowck/two-phase-sneaky.stderr
@@ -7,7 +7,7 @@ LL | v[0].push_str({
| first mutable borrow occurs here
LL |
LL | v.push(format!("foo"));
- | ^^^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | ^ second mutable borrow occurs here
error: aborting due to previous error
diff --git a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
index e75094d4f..9f9d4bd8d 100644
--- a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
+++ b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr
@@ -13,7 +13,7 @@ error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as im
--> $DIR/two-phase-surprise-no-conflict.rs:57:17
|
LL | self.hash_expr(&self.cx_mut.body(eid).value);
- | ^^^^^---------^^---------------------^^^^^^^
+ | ^^^^^---------^^-----------^^^^^^^^^^^^^^^^^
| | | |
| | | immutable borrow occurs here
| | immutable borrow later used by call
@@ -23,9 +23,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:119:51
|
LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
- | ----------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -33,9 +32,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:122:54
|
LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | -------------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -43,9 +41,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:125:53
|
LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
- | ------------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -53,9 +50,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:128:44
|
LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
- | ---------------------------------------^^^^^^^^^^^^^^^^^--
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -106,9 +102,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:154:54
|
LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | -------------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -129,9 +124,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:158:53
|
LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
- | ------------------------------------------------^^^^^^^^^^^^^^^^^---
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
@@ -149,9 +143,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
--> $DIR/two-phase-surprise-no-conflict.rs:162:44
|
LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
- | ---------------------------------------^^^^^^^^^^^^^^^^^--
- | | | |
- | | | second mutable borrow occurs here
+ | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
diff --git a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
index f033d53bf..a2f6365b7 100644
--- a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
+++ b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
@@ -15,7 +15,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `y`
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | y.clone().into_iter();
- | ++++++++
+ | ++++++++
error: aborting due to previous error
diff --git a/tests/ui/box/leak-alloc.stderr b/tests/ui/box/leak-alloc.stderr
index 5140b5893..feda8841f 100644
--- a/tests/ui/box/leak-alloc.stderr
+++ b/tests/ui/box/leak-alloc.stderr
@@ -4,7 +4,7 @@ error[E0505]: cannot move out of `alloc` because it is borrowed
LL | let alloc = Alloc {};
| ----- binding `alloc` declared here
LL | let boxed = Box::new_in(10, alloc.by_ref());
- | -------------- borrow of `alloc` occurs here
+ | ----- borrow of `alloc` occurs here
LL | let theref = Box::leak(boxed);
LL | drop(alloc);
| ^^^^^ move out of `alloc` occurs here
diff --git a/tests/ui/btreemap/btreemap-index-mut-2.rs b/tests/ui/btreemap/btreemap-index-mut-2.rs
new file mode 100644
index 000000000..fe676210a
--- /dev/null
+++ b/tests/ui/btreemap/btreemap-index-mut-2.rs
@@ -0,0 +1,8 @@
+use std::collections::BTreeMap;
+
+fn main() {
+ let _ = || {
+ let mut map = BTreeMap::<u32, u32>::new();
+ map[&0] = 1; //~ ERROR cannot assign
+ };
+}
diff --git a/tests/ui/btreemap/btreemap-index-mut-2.stderr b/tests/ui/btreemap/btreemap-index-mut-2.stderr
new file mode 100644
index 000000000..c8d4fd595
--- /dev/null
+++ b/tests/ui/btreemap/btreemap-index-mut-2.stderr
@@ -0,0 +1,19 @@
+error[E0594]: cannot assign to data in an index of `BTreeMap<u32, u32>`
+ --> $DIR/btreemap-index-mut-2.rs:6:9
+ |
+LL | map[&0] = 1;
+ | ^^^^^^^^^^^ cannot assign
+ |
+ = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap<u32, u32>`
+help: to modify a `BTreeMap<u32, u32>`, 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/tests/ui/cannot-mutate-captured-non-mut-var.stderr b/tests/ui/cannot-mutate-captured-non-mut-var.stderr
index 06b5ca407..2d6e83c9e 100644
--- a/tests/ui/cannot-mutate-captured-non-mut-var.stderr
+++ b/tests/ui/cannot-mutate-captured-non-mut-var.stderr
@@ -12,7 +12,7 @@ error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
LL | let s = std::io::stdin();
| - help: consider changing this to be mutable: `mut s`
LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
error: aborting due to 2 previous errors
diff --git a/tests/ui/check-cfg/compact-values.stderr b/tests/ui/check-cfg/compact-values.stderr
index 70a967c0e..b7269a652 100644
--- a/tests/ui/check-cfg/compact-values.stderr
+++ b/tests/ui/check-cfg/compact-values.stderr
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition value
LL | #[cfg(target(os = "linux", arch = "X"))]
| ^^^^^^^^^^
|
- = note: expected values for `target_arch` are: `aarch64`, `arm`, `avr`, `bpf`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips64`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`
+ = note: expected values for `target_arch` are: `aarch64`, `arm`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/check-cfg/values-target-json.stderr b/tests/ui/check-cfg/values-target-json.stderr
index eb81535e3..e773d5d83 100644
--- a/tests/ui/check-cfg/values-target-json.stderr
+++ b/tests/ui/check-cfg/values-target-json.stderr
@@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
| |
| help: there is a expected value with a similar name: `"linux"`
|
- = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
+ = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr
index 2d18cb82e..1f7758146 100644
--- a/tests/ui/check-cfg/well-known-values.stderr
+++ b/tests/ui/check-cfg/well-known-values.stderr
@@ -6,7 +6,7 @@ LL | #[cfg(target_os = "linuz")]
| |
| help: there is a expected value with a similar name: `"linux"`
|
- = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
+ = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value
diff --git a/tests/ui/closures/binder/nested-closures-regions.stderr b/tests/ui/closures/binder/nested-closures-regions.stderr
index 381aadb15..a30339ac6 100644
--- a/tests/ui/closures/binder/nested-closures-regions.stderr
+++ b/tests/ui/closures/binder/nested-closures-regions.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | for<'a> || -> () { for<'c> |_: &'a ()| -> () {}; };
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: defining type: main::{closure#0}::{closure#0} with closure substs [
+ = note: defining type: main::{closure#0}::{closure#0} with closure args [
i8,
extern "rust-call" fn((&(),)),
(),
@@ -21,7 +21,7 @@ note: no external requirements
LL | for<'a> || -> () { for<'c> |_: &'a ()| -> () {}; };
| ^^^^^^^^^^^^^^^^
|
- = note: defining type: main::{closure#0} with closure substs [
+ = note: defining type: main::{closure#0} with closure args [
i8,
extern "rust-call" fn(()),
(),
diff --git a/tests/ui/closures/multiple-fn-bounds.stderr b/tests/ui/closures/multiple-fn-bounds.stderr
index 32a1edb00..d94c902f7 100644
--- a/tests/ui/closures/multiple-fn-bounds.stderr
+++ b/tests/ui/closures/multiple-fn-bounds.stderr
@@ -18,7 +18,7 @@ note: required by a bound in `foo`
|
LL | fn foo<F: Fn(&char) -> bool + Fn(char) -> bool>(f: F) {
| ^^^^^^^^^^^^^^^^ required by this bound in `foo`
-help: do not borrow the argument
+help: consider adjusting the signature so it does not borrow its argument
|
LL | foo(move |char| v);
| ~~~~
diff --git a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
index 381bb0c08..49453b053 100644
--- a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
+++ b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr
@@ -9,7 +9,7 @@ LL | let c1 : () = c;
| expected due to this
|
= note: expected unit type `()`
- found closure `[mod1::f<T>::{closure#0} closure_substs=(unavailable) substs=[T, ?16t, extern "rust-call" fn(()), ?15t]]`
+ found closure `[mod1::f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]]`
help: use parentheses to call this closure
|
LL | let c1 : () = c();
diff --git a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr
index 2a4d16c48..d2deba3dd 100644
--- a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr
+++ b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr
@@ -9,7 +9,7 @@ LL | let c1 : () = c;
| expected due to this
|
= note: expected unit type `()`
- found closure `[f<T>::{closure#0} closure_substs=(unavailable) substs=[T, ?16t, extern "rust-call" fn(()), ?15t]]`
+ found closure `[f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]]`
help: use parentheses to call this closure
|
LL | let c1 : () = c();
diff --git a/tests/ui/closures/print/closure-print-verbose.stderr b/tests/ui/closures/print/closure-print-verbose.stderr
index 9e219435e..acc81f5e4 100644
--- a/tests/ui/closures/print/closure-print-verbose.stderr
+++ b/tests/ui/closures/print/closure-print-verbose.stderr
@@ -7,7 +7,7 @@ LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
| expected due to this
|
= note: expected fn pointer `fn(u8) -> u8`
- found closure `[main::{closure#0} closure_substs=(unavailable) substs=[i8, extern "rust-call" fn((u8,)) -> u8, ?6t]]`
+ found closure `[main::{closure#0} closure_args=(unavailable) args=[i8, extern "rust-call" fn((u8,)) -> u8, ?6t]]`
note: closures can only be coerced to `fn` types if they do not capture any variables
--> $DIR/closure-print-verbose.rs:10:39
|
diff --git a/tests/ui/codegen/issue-55976.rs b/tests/ui/codegen/issue-55976.rs
index 3142704b7..fee54fc62 100644
--- a/tests/ui/codegen/issue-55976.rs
+++ b/tests/ui/codegen/issue-55976.rs
@@ -1,7 +1,5 @@
// run-pass
// ^-- The above is needed as this issue is related to LLVM/codegen.
-// min-llvm-version:15.0.0
-// ^-- The above is needed as this issue is fixed by the opaque pointers.
fn main() {
type_error(|x| &x);
diff --git a/tests/ui/codegen/target-cpus.rs b/tests/ui/codegen/target-cpus.rs
new file mode 100644
index 000000000..1dff3ee60
--- /dev/null
+++ b/tests/ui/codegen/target-cpus.rs
@@ -0,0 +1,4 @@
+// needs-llvm-components: webassembly
+// min-llvm-version: 17
+// compile-flags: --print=target-cpus --target=wasm32-unknown-unknown
+// check-pass
diff --git a/tests/ui/codegen/target-cpus.stdout b/tests/ui/codegen/target-cpus.stdout
new file mode 100644
index 000000000..f60ba0f50
--- /dev/null
+++ b/tests/ui/codegen/target-cpus.stdout
@@ -0,0 +1,4 @@
+Available CPUs for this target:
+ bleeding-edge
+ generic - This is the default target CPU for the current build target (currently wasm32-unknown-unknown).
+ mvp
diff --git a/tests/ui/codemap_tests/issue-11715.stderr b/tests/ui/codemap_tests/issue-11715.stderr
index a6b2b2e50..d0c29c768 100644
--- a/tests/ui/codemap_tests/issue-11715.stderr
+++ b/tests/ui/codemap_tests/issue-11715.stderr
@@ -7,7 +7,7 @@ LL | let z = &mut x;
| ^^^^^^ second mutable borrow occurs here
LL | z.use_mut();
LL | y.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/codemap_tests/one_line.stderr b/tests/ui/codemap_tests/one_line.stderr
index 6fe6e2613..75fbbada7 100644
--- a/tests/ui/codemap_tests/one_line.stderr
+++ b/tests/ui/codemap_tests/one_line.stderr
@@ -2,9 +2,8 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time
--> $DIR/one_line.rs:3:12
|
LL | v.push(v.pop().unwrap());
- | -------^^^^^^^----------
- | | | |
- | | | second mutable borrow occurs here
+ | - ---- ^ second mutable borrow occurs here
+ | | |
| | first borrow later used by call
| first mutable borrow occurs here
|
diff --git a/tests/ui/codemap_tests/tab_3.stderr b/tests/ui/codemap_tests/tab_3.stderr
index 17bea2f36..b17159be6 100644
--- a/tests/ui/codemap_tests/tab_3.stderr
+++ b/tests/ui/codemap_tests/tab_3.stderr
@@ -15,7 +15,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `some_vec`
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | some_vec.clone().into_iter();
- | ++++++++
+ | ++++++++
error: aborting due to previous error
diff --git a/tests/ui/coercion/coerce-block-tail-83783.fixed b/tests/ui/coercion/coerce-block-tail-83783.fixed
new file mode 100644
index 000000000..0df0a64ac
--- /dev/null
+++ b/tests/ui/coercion/coerce-block-tail-83783.fixed
@@ -0,0 +1,13 @@
+// run-rustfix
+// edition:2018
+fn _consume_reference<T: ?Sized>(_: &T) {}
+
+async fn _foo() {
+ _consume_reference::<i32>(&Box::new(7_i32));
+ _consume_reference::<i32>(&*async { Box::new(7_i32) }.await);
+ //~^ ERROR mismatched types
+ _consume_reference::<[i32]>(&vec![7_i32]);
+ _consume_reference::<[i32]>(&async { vec![7_i32] }.await);
+}
+
+fn main() { }
diff --git a/tests/ui/coercion/coerce-block-tail-83783.rs b/tests/ui/coercion/coerce-block-tail-83783.rs
index 18c8ae3bb..ee6036b4d 100644
--- a/tests/ui/coercion/coerce-block-tail-83783.rs
+++ b/tests/ui/coercion/coerce-block-tail-83783.rs
@@ -1,4 +1,4 @@
-// check-fail
+// run-rustfix
// edition:2018
fn _consume_reference<T: ?Sized>(_: &T) {}
diff --git a/tests/ui/coercion/coerce-block-tail-83783.stderr b/tests/ui/coercion/coerce-block-tail-83783.stderr
index d556d013b..da3c38777 100644
--- a/tests/ui/coercion/coerce-block-tail-83783.stderr
+++ b/tests/ui/coercion/coerce-block-tail-83783.stderr
@@ -6,6 +6,10 @@ LL | _consume_reference::<i32>(&async { Box::new(7_i32) }.await);
|
= note: expected type `i32`
found struct `Box<i32>`
+help: consider unboxing the value
+ |
+LL | _consume_reference::<i32>(&*async { Box::new(7_i32) }.await);
+ | +
error: aborting due to previous error
diff --git a/tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.rs b/tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.rs
new file mode 100644
index 000000000..063826f1d
--- /dev/null
+++ b/tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.rs
@@ -0,0 +1,24 @@
+// check-pass
+// issue: 113415
+
+// Makes sure that coherence doesn't call any of the `predicate_may_hold`-esque fns,
+// since they are using a different infcx which doesn't preserve the intercrate flag.
+
+#![feature(specialization)]
+//~^ WARN the feature `specialization` is incomplete
+
+trait Assoc {
+ type Output;
+}
+
+default impl<T> Assoc for T {
+ type Output = bool;
+}
+
+impl Assoc for u8 {}
+
+trait Foo {}
+impl Foo for u32 {}
+impl Foo for <u8 as Assoc>::Output {}
+
+fn main() {}
diff --git a/tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.stderr b/tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.stderr
new file mode 100644
index 000000000..56eb21cd2
--- /dev/null
+++ b/tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.stderr
@@ -0,0 +1,12 @@
+warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/coherence-doesnt-use-infcx-evaluate.rs:7:12
+ |
+LL | #![feature(specialization)]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
+ = help: consider using `min_specialization` instead, which is more stable and complete
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr b/tests/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr
index 7bd50649d..684e52822 100644
--- a/tests/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr
+++ b/tests/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr
@@ -20,6 +20,7 @@ note: cycle used when coherence checking all impls of trait `Trait`
|
LL | trait Trait<T> { type Assoc; }
| ^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs
new file mode 100644
index 000000000..01f7d6ce9
--- /dev/null
+++ b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.rs
@@ -0,0 +1,35 @@
+#![deny(coinductive_overlap_in_coherence)]
+
+use std::borrow::Borrow;
+use std::cmp::Ordering;
+use std::marker::PhantomData;
+
+#[derive(PartialEq, Default)]
+pub(crate) struct Interval<T>(PhantomData<T>);
+
+// This impl overlaps with the `derive` unless we reject the nested
+// `Interval<?1>: PartialOrd<Interval<?1>>` candidate which results
+// in a - currently inductive - cycle.
+impl<T, Q> PartialEq<Q> for Interval<T>
+//~^ ERROR implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future
+//~| WARN this was previously accepted by the compiler but is being phased out
+where
+ T: Borrow<Q>,
+ Q: ?Sized + PartialOrd,
+{
+ fn eq(&self, _: &Q) -> bool {
+ true
+ }
+}
+
+impl<T, Q> PartialOrd<Q> for Interval<T>
+where
+ T: Borrow<Q>,
+ Q: ?Sized + PartialOrd,
+{
+ fn partial_cmp(&self, _: &Q) -> Option<Ordering> {
+ None
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
new file mode 100644
index 000000000..f315ba821
--- /dev/null
+++ b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
@@ -0,0 +1,23 @@
+error: implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future
+ --> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1
+ |
+LL | #[derive(PartialEq, Default)]
+ | --------- the second impl is here
+...
+LL | impl<T, Q> PartialEq<Q> for Interval<T>
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here
+...
+LL | Q: ?Sized + PartialOrd,
+ | ---------- `Interval<_>: PartialOrd` may be considered to hold in future releases, causing the impls to overlap
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114040 <https://github.com/rust-lang/rust/issues/114040>
+ = note: impls that are not considered to overlap may be considered to overlap in the future
+note: the lint level is defined here
+ --> $DIR/warn-when-cycle-is-error-in-coherence.rs:1:9
+ |
+LL | #![deny(coinductive_overlap_in_coherence)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/command/need-crate-arg-ignore-tidy.x.rs b/tests/ui/command/need-crate-arg-ignore-tidy.x.rs
new file mode 100644
index 000000000..b1ac4a4ae
--- /dev/null
+++ b/tests/ui/command/need-crate-arg-ignore-tidy.x.rs
@@ -0,0 +1,2 @@
+// issue: 113981
+pub fn main() {}
diff --git a/tests/ui/command/need-crate-arg-ignore-tidy.x.stderr b/tests/ui/command/need-crate-arg-ignore-tidy.x.stderr
new file mode 100644
index 000000000..305f76694
--- /dev/null
+++ b/tests/ui/command/need-crate-arg-ignore-tidy.x.stderr
@@ -0,0 +1,6 @@
+error: invalid character `'.'` in crate name: `need_crate_arg_ignore_tidy.x`
+ |
+ = help: you can either pass `--crate-name` on the command line or add `#![crate_name="…"]` to set the crate name
+
+error: aborting due to previous error
+
diff --git a/tests/ui/conditional-compilation/cfg-arg-invalid-1.rs b/tests/ui/conditional-compilation/cfg-arg-invalid-1.rs
index d20e79b9d..0898ca9cd 100644
--- a/tests/ui/conditional-compilation/cfg-arg-invalid-1.rs
+++ b/tests/ui/conditional-compilation/cfg-arg-invalid-1.rs
@@ -1,3 +1,3 @@
-// compile-flags: --cfg a(b=c)
+// compile-flags: --error-format=human --cfg a(b=c)
// error-pattern: invalid `--cfg` argument: `a(b=c)` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")
fn main() {}
diff --git a/tests/ui/conditional-compilation/cfg-arg-invalid-2.rs b/tests/ui/conditional-compilation/cfg-arg-invalid-2.rs
index 48d656a4a..70e425600 100644
--- a/tests/ui/conditional-compilation/cfg-arg-invalid-2.rs
+++ b/tests/ui/conditional-compilation/cfg-arg-invalid-2.rs
@@ -1,3 +1,3 @@
-// compile-flags: --cfg a{b}
+// compile-flags: --error-format=human --cfg a{b}
// error-pattern: invalid `--cfg` argument: `a{b}` (expected `key` or `key="value"`)
fn main() {}
diff --git a/tests/ui/conditional-compilation/cfg-arg-invalid-4.rs b/tests/ui/conditional-compilation/cfg-arg-invalid-4.rs
index e7dfa17b4..2adc27eb9 100644
--- a/tests/ui/conditional-compilation/cfg-arg-invalid-4.rs
+++ b/tests/ui/conditional-compilation/cfg-arg-invalid-4.rs
@@ -1,3 +1,3 @@
-// compile-flags: --cfg a(b)
+// compile-flags: --error-format=human --cfg a(b)
// error-pattern: invalid `--cfg` argument: `a(b)` (expected `key` or `key="value"`)
fn main() {}
diff --git a/tests/ui/conditional-compilation/cfg-arg-invalid-6.rs b/tests/ui/conditional-compilation/cfg-arg-invalid-6.rs
index 9fa726f93..be3ded7dd 100644
--- a/tests/ui/conditional-compilation/cfg-arg-invalid-6.rs
+++ b/tests/ui/conditional-compilation/cfg-arg-invalid-6.rs
@@ -1,3 +1,3 @@
-// compile-flags: --cfg a{
+// compile-flags: --error-format=human --cfg a{
// error-pattern: invalid `--cfg` argument: `a{` (expected `key` or `key="value"`)
fn main() {}
diff --git a/tests/ui/conditional-compilation/cfg-arg-invalid-8.rs b/tests/ui/conditional-compilation/cfg-arg-invalid-8.rs
index 1d7fa7885..4a2f16f11 100644
--- a/tests/ui/conditional-compilation/cfg-arg-invalid-8.rs
+++ b/tests/ui/conditional-compilation/cfg-arg-invalid-8.rs
@@ -1,3 +1,3 @@
-// compile-flags: --cfg )
+// compile-flags: --error-format=human --cfg )
// error-pattern: invalid `--cfg` argument: `)` (expected `key` or `key="value"`)
fn main() {}
diff --git a/tests/ui/conditional-compilation/cfg-arg-invalid-9.rs b/tests/ui/conditional-compilation/cfg-arg-invalid-9.rs
index 628b335c8..a61989a3e 100644
--- a/tests/ui/conditional-compilation/cfg-arg-invalid-9.rs
+++ b/tests/ui/conditional-compilation/cfg-arg-invalid-9.rs
@@ -1,4 +1,4 @@
// Test for missing quotes around value, issue #66450.
-// compile-flags: --cfg key=value
+// compile-flags: --error-format=human --cfg key=value
// error-pattern: invalid `--cfg` argument: `key=value` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")
fn main() {}
diff --git a/tests/ui/conditional-compilation/cfg-empty-codemap.rs b/tests/ui/conditional-compilation/cfg-empty-codemap.rs
index 9e34cacf7..c7aded733 100644
--- a/tests/ui/conditional-compilation/cfg-empty-codemap.rs
+++ b/tests/ui/conditional-compilation/cfg-empty-codemap.rs
@@ -1,6 +1,6 @@
// Tests that empty source_maps don't ICE (#23301)
-// compile-flags: --cfg ""
+// compile-flags: --error-format=human --cfg ""
// error-pattern: invalid `--cfg` argument: `""` (expected `key` or `key="value"`)
diff --git a/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr b/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr
index 0ed370b83..a345c48b0 100644
--- a/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr
+++ b/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr
@@ -2,7 +2,7 @@ error[E0381]: used binding `s` isn't initialized
--> $DIR/const-generic-default-wont-borrowck.rs:2:26
|
LL | let s: &'static str; s.len()
- | - ^^^^^^^ `*s` used here but it isn't initialized
+ | - ^ `*s` used here but it isn't initialized
| |
| binding declared here but left uninitialized
|
diff --git a/tests/ui/const-generics/const_trait_fn-issue-88433.rs b/tests/ui/const-generics/const_trait_fn-issue-88433.rs
index 6e04cfaec..88dff9192 100644
--- a/tests/ui/const-generics/const_trait_fn-issue-88433.rs
+++ b/tests/ui/const-generics/const_trait_fn-issue-88433.rs
@@ -1,6 +1,6 @@
// build-pass
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#[const_trait]
trait Func<T> {
diff --git a/tests/ui/const-generics/generic_const_exprs/closures.stderr b/tests/ui/const-generics/generic_const_exprs/closures.stderr
index a7d891d77..45d7922bd 100644
--- a/tests/ui/const-generics/generic_const_exprs/closures.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/closures.stderr
@@ -20,6 +20,7 @@ note: cycle used when checking that `test` is well-formed
|
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr b/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr
index f61edd60e..8b8489ac2 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr
@@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*self.0` as mutable, as it is behind a `&` referenc
--> $DIR/issue-109141.rs:6:9
|
LL | self.0.iter_mut()
- | ^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs
index 275f69953..6b2a0153f 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs
+++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs
@@ -1,4 +1,9 @@
// check-fail
+// known-bug: #97477
+// failure-status: 101
+// normalize-stderr-test "note: .*\n\n" -> ""
+// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
+// rustc-env:RUST_BACKTRACE=0
// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place
@@ -27,6 +32,5 @@ where
}
fn main() {
- let dst = Inline::<dyn Debug>::new(0); //~ ERROR
- //~^ ERROR
+ let dst = Inline::<dyn Debug>::new(0);
}
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
index dc3a400cb..79ed82e02 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
@@ -1,71 +1,10 @@
-error[E0080]: evaluation of `Inline::<dyn Debug>::{constant#0}` failed
+error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:272:21: SizeOf MIR operator called for unsized type dyn Debug
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
- |
- = note: size_of called on unsized type `dyn Debug`
- |
-note: inside `std::mem::size_of::<dyn Debug>`
- --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
-note: inside `Inline::<dyn Debug>::{constant#0}`
- --> $DIR/issue-80742.rs:22:10
- |
-LL | [u8; size_of::<T>() + 1]: ,
- | ^^^^^^^^^^^^^^
-
-error[E0599]: the function or associated item `new` exists for struct `Inline<dyn Debug>`, but its trait bounds were not satisfied
- --> $DIR/issue-80742.rs:30:36
- |
-LL | struct Inline<T>
- | ---------------- function or associated item `new` not found for this struct
-...
-LL | let dst = Inline::<dyn Debug>::new(0);
- | ^^^ function or associated item cannot be called on `Inline<dyn Debug>` due to unsatisfied trait bounds
- --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
- |
- = note: doesn't satisfy `dyn Debug: Sized`
- |
-note: trait bound `dyn Debug: Sized` was not satisfied
- --> $DIR/issue-80742.rs:20:6
- |
-LL | impl<T> Inline<T>
- | ^ ---------
- | |
- | unsatisfied trait bound introduced here
-help: consider relaxing the type parameter's implicit `Sized` bound
- |
-LL | impl<T: ?Sized> Inline<T>
- | ++++++++
-
-error[E0080]: evaluation of `Inline::<dyn Debug>::{constant#0}` failed
- --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
- |
- = note: size_of called on unsized type `dyn Debug`
- |
-note: inside `std::mem::size_of::<dyn Debug>`
- --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
-note: inside `Inline::<dyn Debug>::{constant#0}`
- --> $DIR/issue-80742.rs:14:10
- |
-LL | [u8; size_of::<T>() + 1]: ,
- | ^^^^^^^^^^^^^^
-
-error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time
- --> $DIR/issue-80742.rs:30:15
- |
-LL | let dst = Inline::<dyn Debug>::new(0);
- | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `Sized` is not implemented for `dyn Debug`
-note: required by a bound in `Inline`
- --> $DIR/issue-80742.rs:12:15
- |
-LL | struct Inline<T>
- | ^ required by this bound in `Inline`
-help: consider relaxing the implicit `Sized` restriction
- |
-LL | struct Inline<T: ?Sized>
- | ++++++++
-error: aborting due to 4 previous errors
+Box<dyn Any>
+query stack during panic:
+#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:25:1: 25:18>::{constant#0}`
+#1 [eval_to_valtree] evaluating type-level constant
+end of query stack
+error: aborting due to previous error
-Some errors have detailed explanations: E0080, E0277, E0599.
-For more information about an error, try `rustc --explain E0080`.
diff --git a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr
index 7f28771ce..eb71ebb62 100644
--- a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr
@@ -1,11 +1,39 @@
-error: const `impl` for trait `Add` which is not marked with `#[const_trait]`
- --> $DIR/unify-op-with-fn-call.rs:10:12
+error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
+ --> $DIR/unify-op-with-fn-call.rs:18:29
|
-LL | impl const std::ops::Add for Foo {
- | ^^^^^^^^^^^^^
+LL | struct Evaluatable<const N: Foo>;
+ | ^^^
+ |
+help: add `#[derive(ConstParamTy)]` to the struct
+ |
+LL + #[derive(ConstParamTy)]
+LL | struct Foo(u8);
+ |
+
+error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
+ --> $DIR/unify-op-with-fn-call.rs:20:17
+ |
+LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
+ | ^^^
+ |
+help: add `#[derive(ConstParamTy)]` to the struct
+ |
+LL + #[derive(ConstParamTy)]
+LL | struct Foo(u8);
+ |
+
+error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
+ --> $DIR/unify-op-with-fn-call.rs:24:17
+ |
+LL | fn bar<const N: Foo>() {}
+ | ^^^
+ |
+help: add `#[derive(ConstParamTy)]` to the struct
+ |
+LL + #[derive(ConstParamTy)]
+LL | struct Foo(u8);
|
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
-error: aborting due to previous error
+error: aborting due to 3 previous errors
+For more information about this error, try `rustc --explain E0741`.
diff --git a/tests/ui/const-generics/issue-93647.rs b/tests/ui/const-generics/issue-93647.rs
index a0083a0c6..806540e17 100644
--- a/tests/ui/const-generics/issue-93647.rs
+++ b/tests/ui/const-generics/issue-93647.rs
@@ -1,7 +1,6 @@
struct X<const N: usize = {
(||1usize)()
//~^ ERROR cannot call non-const closure
- //~| ERROR the trait bound
}>;
fn main() {}
diff --git a/tests/ui/const-generics/issue-93647.stderr b/tests/ui/const-generics/issue-93647.stderr
index 20a6af5c5..18370eea5 100644
--- a/tests/ui/const-generics/issue-93647.stderr
+++ b/tests/ui/const-generics/issue-93647.stderr
@@ -1,17 +1,3 @@
-error[E0277]: the trait bound `[closure@$DIR/issue-93647.rs:2:6: 2:8]: Fn<()>` is not satisfied
- --> $DIR/issue-93647.rs:2:5
- |
-LL | (||1usize)()
- | ^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-93647.rs:2:6: 2:8]`
- |
- = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-93647.rs:2:6: 2:8]`
-note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-93647.rs:2:6: 2:8]`, but that implementation is not `const`
- --> $DIR/issue-93647.rs:2:5
- |
-LL | (||1usize)()
- | ^^^^^^^^^^^^
- = note: wrap the `[closure@$DIR/issue-93647.rs:2:6: 2:8]` in a closure with no arguments: `|| { /* code */ }`
-
error[E0015]: cannot call non-const closure in constants
--> $DIR/issue-93647.rs:2:5
|
@@ -22,7 +8,6 @@ LL | (||1usize)()
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/const-generics/issues/issue-100313.rs b/tests/ui/const-generics/issues/issue-100313.rs
index 4e9d3626a..9af9b5ca4 100644
--- a/tests/ui/const-generics/issues/issue-100313.rs
+++ b/tests/ui/const-generics/issues/issue-100313.rs
@@ -9,6 +9,7 @@ impl <const B: &'static bool> T<B> {
unsafe {
*(B as *const bool as *mut bool) = false;
//~^ ERROR evaluation of constant value failed [E0080]
+ //~| ERROR assigning to `&T` is undefined behavior
}
}
}
diff --git a/tests/ui/const-generics/issues/issue-100313.stderr b/tests/ui/const-generics/issues/issue-100313.stderr
index d4b486376..42ad4d61c 100644
--- a/tests/ui/const-generics/issues/issue-100313.stderr
+++ b/tests/ui/const-generics/issues/issue-100313.stderr
@@ -1,3 +1,11 @@
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/issue-100313.rs:10:13
+ |
+LL | *(B as *const bool as *mut bool) = false;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[deny(invalid_reference_casting)]` on by default
+
error[E0080]: evaluation of constant value failed
--> $DIR/issue-100313.rs:10:13
|
@@ -10,11 +18,11 @@ note: inside `T::<&true>::set_false`
LL | *(B as *const bool as *mut bool) = false;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `_`
- --> $DIR/issue-100313.rs:18:5
+ --> $DIR/issue-100313.rs:19:5
|
LL | x.set_false();
| ^^^^^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/const-generics/issues/issue-67375.full.stderr b/tests/ui/const-generics/issues/issue-67375.full.stderr
index 0cf69879a..13cb8d1cd 100644
--- a/tests/ui/const-generics/issues/issue-67375.full.stderr
+++ b/tests/ui/const-generics/issues/issue-67375.full.stderr
@@ -2,7 +2,7 @@ error: overly complex generic constant
--> $DIR/issue-67375.rs:7:17
|
LL | inner: [(); { [|_: &T| {}; 0].len() }],
- | ^^---------------------^^
+ | ^^---------------^^^^^^^^
| |
| pointer casts are not allowed in generic constants
|
diff --git a/tests/ui/const-generics/issues/issue-83765.stderr b/tests/ui/const-generics/issues/issue-83765.stderr
index d7b2b006c..df734933c 100644
--- a/tests/ui/const-generics/issues/issue-83765.stderr
+++ b/tests/ui/const-generics/issues/issue-83765.stderr
@@ -15,6 +15,7 @@ note: cycle used when computing candidate for `<LazyUpdim<'_, T, { T::DIM }, DIM
|
LL | trait TensorDimension {
| ^^^^^^^^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.rs b/tests/ui/const-generics/late-bound-vars/in_closure.rs
index 00fb535f0..4fdf603b0 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.rs
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.rs
@@ -8,13 +8,15 @@
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
-// normalize-stderr-test "thread.*panicked.*\n" -> ""
+// normalize-stderr-test "thread.*panicked.*:\n.*\n" -> ""
// normalize-stderr-test "stack backtrace:\n" -> ""
// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
// normalize-stderr-test "\s at .*\n" -> ""
// normalize-stderr-test ".*note: Some details.*\n" -> ""
-// normalize-stderr-test "\n\n[ ]*\n" -> ""
+// normalize-stderr-test "\n[ ]*\n" -> ""
// normalize-stderr-test "compiler/.*: projection" -> "projection"
+// normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
+// normalize-stderr-test "error: [\s\n]*query stack during panic:\n" -> ""
// this should run-pass
#![feature(generic_const_exprs)]
diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.stderr b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
index 557fbea2e..ac406bf2b 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.stderr
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
@@ -1,4 +1,3 @@
-error: query stack during panic:
#0 [mir_borrowck] borrow-checking `test::{closure#0}::{constant#1}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{closure#0}::{constant#1}`
#2 [mir_for_ctfe] caching mir of `test::{closure#0}::{constant#1}` for CTFE
@@ -6,8 +5,6 @@ error: query stack during panic:
#4 [eval_to_allocation_raw] const-evaluating + checking `test::{closure#0}::{constant#1}`
#5 [eval_to_valtree] evaluating type-level constant
#6 [typeck] type-checking `test`
-#7 [used_trait_imports] finding used_trait_imports `test`
-#8 [analysis] running analysis passes on this crate
+#7 [analysis] running analysis passes on this crate
end of query stack
-error: aborting due to previous error
-
+error: aborting due to previous error \ No newline at end of file
diff --git a/tests/ui/const-generics/late-bound-vars/simple.rs b/tests/ui/const-generics/late-bound-vars/simple.rs
index 5d19aaf0b..544073b5a 100644
--- a/tests/ui/const-generics/late-bound-vars/simple.rs
+++ b/tests/ui/const-generics/late-bound-vars/simple.rs
@@ -8,13 +8,15 @@
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
-// normalize-stderr-test "thread.*panicked.*\n" -> ""
+// normalize-stderr-test "thread.*panicked.*:\n.*\n" -> ""
// normalize-stderr-test "stack backtrace:\n" -> ""
// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
// normalize-stderr-test "\s at .*\n" -> ""
// normalize-stderr-test ".*note: Some details.*\n" -> ""
// normalize-stderr-test "\n\n[ ]*\n" -> ""
// normalize-stderr-test "compiler/.*: projection" -> "projection"
+// normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
+// normalize-stderr-test "error: [\s\n]*query stack" -> "error: query stack"
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
diff --git a/tests/ui/const-generics/late-bound-vars/simple.stderr b/tests/ui/const-generics/late-bound-vars/simple.stderr
index c0568f5a5..c9f2164b6 100644
--- a/tests/ui/const-generics/late-bound-vars/simple.stderr
+++ b/tests/ui/const-generics/late-bound-vars/simple.stderr
@@ -6,8 +6,7 @@ error: query stack during panic:
#4 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}`
#5 [eval_to_valtree] evaluating type-level constant
#6 [typeck] type-checking `test`
-#7 [used_trait_imports] finding used_trait_imports `test`
-#8 [analysis] running analysis passes on this crate
+#7 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
diff --git a/tests/ui/const-generics/lifetime-in-const-param.rs b/tests/ui/const-generics/lifetime-in-const-param.rs
new file mode 100644
index 000000000..be90dbb21
--- /dev/null
+++ b/tests/ui/const-generics/lifetime-in-const-param.rs
@@ -0,0 +1,9 @@
+// https://github.com/rust-lang/rust/issues/113462
+
+struct S2<'b>(&'b ());
+
+struct S<'a, const N: S2>(&'a ());
+//~^ ERROR missing lifetime specifier [E0106]
+//~| ERROR `S2<'_>` is forbidden as the type of a const generic parameter
+
+fn main() {}
diff --git a/tests/ui/const-generics/lifetime-in-const-param.stderr b/tests/ui/const-generics/lifetime-in-const-param.stderr
new file mode 100644
index 000000000..8fd9068e8
--- /dev/null
+++ b/tests/ui/const-generics/lifetime-in-const-param.stderr
@@ -0,0 +1,18 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/lifetime-in-const-param.rs:5:23
+ |
+LL | struct S<'a, const N: S2>(&'a ());
+ | ^^ expected named lifetime parameter
+
+error: `S2<'_>` is forbidden as the type of a const generic parameter
+ --> $DIR/lifetime-in-const-param.rs:5:23
+ |
+LL | struct S<'a, const N: S2>(&'a ());
+ | ^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: more complex types are supported with `#![feature(adt_const_params)]`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/tests/ui/const-generics/slice-const-param.rs b/tests/ui/const-generics/slice-const-param.rs
index 05d21e08d..90c573ab3 100644
--- a/tests/ui/const-generics/slice-const-param.rs
+++ b/tests/ui/const-generics/slice-const-param.rs
@@ -11,9 +11,30 @@ pub fn function_with_bytes<const BYTES: &'static [u8]>() -> &'static [u8] {
BYTES
}
+// Also check the codepaths for custom DST
+#[derive(PartialEq, Eq)]
+struct MyStr(str);
+impl std::marker::ConstParamTy for MyStr {}
+
+fn function_with_my_str<const S: &'static MyStr>() -> &'static MyStr {
+ S
+}
+
+impl MyStr {
+ const fn new(s: &'static str) -> &'static MyStr {
+ unsafe { std::mem::transmute(s) }
+ }
+
+ fn as_str(&self) -> &str {
+ &self.0
+ }
+}
+
pub fn main() {
assert_eq!(function_with_str::<"Rust">(), "Rust");
assert_eq!(function_with_str::<"ℇ㇈↦">(), "ℇ㇈↦");
assert_eq!(function_with_bytes::<b"AAAA">(), &[0x41, 0x41, 0x41, 0x41]);
assert_eq!(function_with_bytes::<{&[0x41, 0x41, 0x41, 0x41]}>(), b"AAAA");
+
+ assert_eq!(function_with_my_str::<{ MyStr::new("hello") }>().as_str(), "hello");
}
diff --git a/tests/ui/const-generics/transmute-fail.stderr b/tests/ui/const-generics/transmute-fail.stderr
index 9e308620a..12644b9f3 100644
--- a/tests/ui/const-generics/transmute-fail.stderr
+++ b/tests/ui/const-generics/transmute-fail.stderr
@@ -16,18 +16,6 @@ LL | std::mem::transmute(v)
= note: source type: `[[u32; H]; W]` (this type does not have a fixed size)
= note: target type: `[[u32; W]; H]` (size can vary because of [u32; W])
-error[E0308]: mismatched types
- --> $DIR/transmute-fail.rs:12:53
- |
-LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
- | ^ expected `usize`, found `bool`
-
-error[E0308]: mismatched types
- --> $DIR/transmute-fail.rs:12:67
- |
-LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
- | ^ expected `usize`, found `bool`
-
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/transmute-fail.rs:23:5
|
@@ -46,6 +34,18 @@ LL | std::mem::transmute(v)
= note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[u32; 8888888]; 9999999]` are too big for the current architecture)
= note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type `[[u32; 9999999]; 777777777]` are too big for the current architecture)
+error[E0308]: mismatched types
+ --> $DIR/transmute-fail.rs:12:53
+ |
+LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
+ | ^ expected `usize`, found `bool`
+
+error[E0308]: mismatched types
+ --> $DIR/transmute-fail.rs:12:67
+ |
+LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
+ | ^ expected `usize`, found `bool`
+
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0308, E0512.
diff --git a/tests/ui/const-generics/type_mismatch.stderr b/tests/ui/const-generics/type_mismatch.stderr
index 394dd44d4..07476ae76 100644
--- a/tests/ui/const-generics/type_mismatch.stderr
+++ b/tests/ui/const-generics/type_mismatch.stderr
@@ -11,12 +11,6 @@ LL | fn bar<const N: u8>() -> [u8; N] {}
| ^^^^^^^^^^^ required by this bound in `bar`
error[E0308]: mismatched types
- --> $DIR/type_mismatch.rs:2:11
- |
-LL | bar::<N>()
- | ^ expected `u8`, found `usize`
-
-error[E0308]: mismatched types
--> $DIR/type_mismatch.rs:6:26
|
LL | fn bar<const N: u8>() -> [u8; N] {}
@@ -25,6 +19,12 @@ LL | fn bar<const N: u8>() -> [u8; N] {}
| implicitly returns `()` as its body has no tail or `return` expression
error[E0308]: mismatched types
+ --> $DIR/type_mismatch.rs:2:11
+ |
+LL | bar::<N>()
+ | ^ expected `u8`, found `usize`
+
+error[E0308]: mismatched types
--> $DIR/type_mismatch.rs:6:31
|
LL | fn bar<const N: u8>() -> [u8; N] {}
diff --git a/tests/ui/const-ptr/forbidden_slices.stderr b/tests/ui/const-ptr/forbidden_slices.stderr
index 22c3dfa64..294bc77aa 100644
--- a/tests/ui/const-ptr/forbidden_slices.stderr
+++ b/tests/ui/const-ptr/forbidden_slices.stderr
@@ -41,7 +41,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:26:1
|
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -52,8 +52,9 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:28:1
|
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
- | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
@@ -75,7 +76,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:33:1
|
LL | pub static S7: &[u16] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized bytes
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -143,7 +144,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:53:1
|
LL | pub static R4: &[u8] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -154,8 +155,9 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:58:1
|
LL | pub static R5: &[u8] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
diff --git a/tests/ui/const_prop/apfloat-f64-roundtrip.rs b/tests/ui/const_prop/apfloat-f64-roundtrip.rs
new file mode 100644
index 000000000..9fb2ac96b
--- /dev/null
+++ b/tests/ui/const_prop/apfloat-f64-roundtrip.rs
@@ -0,0 +1,9 @@
+// run-pass
+// compile-flags: -O -Zmir-opt-level=3 -Cno-prepopulate-passes
+// min-llvm-version: 16.0 (requires APFloat fixes in LLVM)
+
+// Regression test for a broken MIR optimization (issue #113407).
+pub fn main() {
+ let f = f64::from_bits(0x19873cc2) as f32;
+ assert_eq!(f.to_bits(), 0);
+}
diff --git a/tests/ui/const_prop/apfloat-remainder-regression.rs b/tests/ui/const_prop/apfloat-remainder-regression.rs
new file mode 100644
index 000000000..08932c333
--- /dev/null
+++ b/tests/ui/const_prop/apfloat-remainder-regression.rs
@@ -0,0 +1,15 @@
+// run-pass
+// compile-flags: -O -Zmir-opt-level=3 -Cno-prepopulate-passes
+
+// Regression test for a broken MIR optimization (issue #102403).
+pub fn f() -> f64 {
+ std::hint::black_box(-1.0) % std::hint::black_box(-1.0)
+}
+
+pub fn g() -> f64 {
+ -1.0 % -1.0
+}
+
+pub fn main() {
+ assert_eq!(f().signum(), g().signum());
+}
diff --git a/tests/ui/const_prop/ice-issue-111353.rs b/tests/ui/const_prop/ice-issue-111353.rs
new file mode 100644
index 000000000..99d1b792f
--- /dev/null
+++ b/tests/ui/const_prop/ice-issue-111353.rs
@@ -0,0 +1,7 @@
+// build-pass
+#![crate_type = "lib"]
+#![feature(unsized_fn_params)]
+
+pub fn f(mut x: [i32]) {
+ x[0] = 1;
+}
diff --git a/tests/ui/const_prop/ice-issue-96944.rs b/tests/ui/const_prop/ice-issue-96944.rs
new file mode 100644
index 000000000..74baffddd
--- /dev/null
+++ b/tests/ui/const_prop/ice-issue-96944.rs
@@ -0,0 +1,26 @@
+// build-pass
+#![crate_type = "lib"]
+#![allow(arithmetic_overflow)]
+
+pub trait BitSplit {
+ type Half;
+ fn merge(halves: [Self::Half; 2]) -> Self;
+}
+
+macro_rules! impl_ints {
+ ($int:ty => $half:ty; $mask:expr) => {
+ impl BitSplit for $int {
+ type Half = $half;
+ #[inline]
+ fn merge(halves: [Self::Half; 2]) -> Self {
+ const HALF_SIZE: usize = std::mem::size_of::<$half>() * 8;
+ (halves[0] << HALF_SIZE) as $int | halves[1] as $int
+ }
+ }
+ };
+}
+
+impl_ints!(u128 => u64; 0x0000_0000_0000_0000_FFFF_FFFF_FFFF_FFFF);
+impl_ints!( u64 => u32; 0x0000_0000_FFFF_FFFF);
+impl_ints!( u32 => u16; 0x0000_FFFF);
+impl_ints!( u16 => u8; 0x00FF);
diff --git a/tests/ui/consts/const-block-const-bound.rs b/tests/ui/consts/const-block-const-bound.rs
index 3704a1a5a..123e5cb1b 100644
--- a/tests/ui/consts/const-block-const-bound.rs
+++ b/tests/ui/consts/const-block-const-bound.rs
@@ -1,3 +1,5 @@
+// known-bug: #103507
+
#![allow(unused)]
#![feature(const_trait_impl, inline_const, negative_impls)]
@@ -14,6 +16,6 @@ impl Drop for UnconstDrop {
fn main() {
const {
f(UnconstDrop);
- //~^ ERROR can't drop
+ //FIXME ~^ ERROR can't drop
}
}
diff --git a/tests/ui/consts/const-block-const-bound.stderr b/tests/ui/consts/const-block-const-bound.stderr
index caf24e7af..b402f0ea9 100644
--- a/tests/ui/consts/const-block-const-bound.stderr
+++ b/tests/ui/consts/const-block-const-bound.stderr
@@ -1,17 +1,11 @@
-error[E0277]: can't drop `UnconstDrop` in const contexts
- --> $DIR/const-block-const-bound.rs:16:9
+error[E0493]: destructor of `T` cannot be evaluated at compile-time
+ --> $DIR/const-block-const-bound.rs:8:32
|
-LL | f(UnconstDrop);
- | ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `UnconstDrop`
- |
- = note: the trait bound `UnconstDrop: ~const Destruct` is not satisfied
-help: consider borrowing here
- |
-LL | &f(UnconstDrop);
- | +
-LL | &mut f(UnconstDrop);
- | ++++
+LL | const fn f<T: ~const Destruct>(x: T) {}
+ | ^ - value is dropped here
+ | |
+ | the destructor for this type cannot be evaluated in constant functions
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/consts/const-compare-bytes-ub.rs b/tests/ui/consts/const-compare-bytes-ub.rs
new file mode 100644
index 000000000..2b4062fd2
--- /dev/null
+++ b/tests/ui/consts/const-compare-bytes-ub.rs
@@ -0,0 +1,41 @@
+// check-fail
+
+#![feature(core_intrinsics)]
+#![feature(const_intrinsic_compare_bytes)]
+use std::intrinsics::compare_bytes;
+use std::mem::MaybeUninit;
+
+fn main() {
+ const LHS_NULL: i32 = unsafe {
+ compare_bytes(0 as *const u8, 2 as *const u8, 0)
+ //~^ ERROR evaluation of constant value failed
+ };
+ const RHS_NULL: i32 = unsafe {
+ compare_bytes(1 as *const u8, 0 as *const u8, 0)
+ //~^ ERROR evaluation of constant value failed
+ };
+ const DANGLING_PTR_NON_ZERO_LENGTH: i32 = unsafe {
+ compare_bytes(1 as *const u8, 2 as *const u8, 1)
+ //~^ ERROR evaluation of constant value failed
+ };
+ const LHS_OUT_OF_BOUNDS: i32 = unsafe {
+ compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4)
+ //~^ ERROR evaluation of constant value failed
+ };
+ const RHS_OUT_OF_BOUNDS: i32 = unsafe {
+ compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4)
+ //~^ ERROR evaluation of constant value failed
+ };
+ const LHS_UNINIT: i32 = unsafe {
+ compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1)
+ //~^ ERROR evaluation of constant value failed
+ };
+ const RHS_UNINIT: i32 = unsafe {
+ compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1)
+ //~^ ERROR evaluation of constant value failed
+ };
+ const WITH_PROVENANCE: i32 = unsafe {
+ compare_bytes([&1].as_ptr().cast(), [&2].as_ptr().cast(), std::mem::size_of::<usize>())
+ //~^ ERROR evaluation of constant value failed
+ };
+}
diff --git a/tests/ui/consts/const-compare-bytes-ub.stderr b/tests/ui/consts/const-compare-bytes-ub.stderr
new file mode 100644
index 000000000..54fafded0
--- /dev/null
+++ b/tests/ui/consts/const-compare-bytes-ub.stderr
@@ -0,0 +1,54 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const-compare-bytes-ub.rs:10:9
+ |
+LL | compare_bytes(0 as *const u8, 2 as *const u8, 0)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const-compare-bytes-ub.rs:14:9
+ |
+LL | compare_bytes(1 as *const u8, 0 as *const u8, 0)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const-compare-bytes-ub.rs:18:9
+ |
+LL | compare_bytes(1 as *const u8, 2 as *const u8, 1)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x1[noalloc] is a dangling pointer (it has no provenance)
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const-compare-bytes-ub.rs:22:9
+ |
+LL | compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc6 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const-compare-bytes-ub.rs:26:9
+ |
+LL | compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc13 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const-compare-bytes-ub.rs:30:9
+ |
+LL | compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc17[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const-compare-bytes-ub.rs:34:9
+ |
+LL | compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc25[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const-compare-bytes-ub.rs:38:9
+ |
+LL | compare_bytes([&1].as_ptr().cast(), [&2].as_ptr().cast(), std::mem::size_of::<usize>())
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-compare-bytes.rs b/tests/ui/consts/const-compare-bytes.rs
new file mode 100644
index 000000000..74e29f813
--- /dev/null
+++ b/tests/ui/consts/const-compare-bytes.rs
@@ -0,0 +1,27 @@
+// run-pass
+
+#![feature(core_intrinsics)]
+#![feature(const_intrinsic_compare_bytes)]
+use std::intrinsics::compare_bytes;
+
+fn main() {
+ const A: i32 = unsafe {
+ compare_bytes(1 as *const u8, 2 as *const u8, 0)
+ };
+ assert_eq!(A, 0);
+
+ const B: i32 = unsafe {
+ compare_bytes([1, 2].as_ptr(), [1, 3].as_ptr(), 1)
+ };
+ assert_eq!(B, 0);
+
+ const C: i32 = unsafe {
+ compare_bytes([1, 2, 9].as_ptr(), [1, 3, 8].as_ptr(), 2)
+ };
+ assert!(C < 0);
+
+ const D: i32 = unsafe {
+ compare_bytes([1, 3, 8].as_ptr(), [1, 2, 9].as_ptr(), 2)
+ };
+ assert!(D > 0);
+}
diff --git a/tests/ui/consts/const-eval/const-eval-query-stack.rs b/tests/ui/consts/const-eval/const-eval-query-stack.rs
index 81f28c175..4eaff4947 100644
--- a/tests/ui/consts/const-eval/const-eval-query-stack.rs
+++ b/tests/ui/consts/const-eval/const-eval-query-stack.rs
@@ -5,12 +5,12 @@
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
-// normalize-stderr-test "thread.*panicked.*\n" -> ""
+// normalize-stderr-test "thread.*panicked.*:\n.*\n" -> ""
// normalize-stderr-test "stack backtrace:\n" -> ""
// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
// normalize-stderr-test "\s at .*\n" -> ""
// normalize-stderr-test ".*note: Some details.*\n" -> ""
-
+// normalize-stderr-test ".*omitted \d{1,} frame.*\n" -> ""
#![allow(unconditional_panic)]
const X: i32 = 1 / 0; //~ERROR constant
diff --git a/tests/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr
index bf98d0394..f099bc7ef 100644
--- a/tests/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr
+++ b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:26:49
|
LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -11,7 +11,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:29:43
|
LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:32:45
|
LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -29,7 +29,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:35:45
|
LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -38,7 +38,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:38:45
|
LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -53,7 +53,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:45:43
|
LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -62,7 +62,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:48:45
|
LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -71,7 +71,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:51:45
|
LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -80,7 +80,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:54:45
|
LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -95,7 +95,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:61:45
|
LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -104,7 +104,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:64:45
|
LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -113,7 +113,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:67:47
|
LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -122,7 +122,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:70:47
|
LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -131,7 +131,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:73:39
|
LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -140,7 +140,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:76:41
|
LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -149,7 +149,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:79:41
|
LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -158,7 +158,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:82:41
|
LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -167,7 +167,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:85:43
|
LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -176,7 +176,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:88:39
|
LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -185,7 +185,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:91:41
|
LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -194,7 +194,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:94:41
|
LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -203,7 +203,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:97:41
|
LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -212,7 +212,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:100:43
|
LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -221,7 +221,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:103:41
|
LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -230,7 +230,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:106:41
|
LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -239,7 +239,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:109:43
|
LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -248,7 +248,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-pointer-values-in-various-types.rs:112:43
|
LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
diff --git a/tests/ui/consts/const-eval/const_fn_target_feature.rs b/tests/ui/consts/const-eval/const_fn_target_feature.rs
new file mode 100644
index 000000000..5d02ce3f2
--- /dev/null
+++ b/tests/ui/consts/const-eval/const_fn_target_feature.rs
@@ -0,0 +1,17 @@
+// only-x86_64
+// compile-flags:-C target-feature=+ssse3
+
+#![crate_type = "lib"]
+
+// ok (ssse3 enabled at compile time)
+const A: () = unsafe { ssse3_fn() };
+
+// error (avx2 not enabled at compile time)
+const B: () = unsafe { avx2_fn() };
+//~^ ERROR evaluation of constant value failed
+
+#[target_feature(enable = "ssse3")]
+const unsafe fn ssse3_fn() {}
+
+#[target_feature(enable = "avx2")]
+const unsafe fn avx2_fn() {}
diff --git a/tests/ui/consts/const-eval/const_fn_target_feature.stderr b/tests/ui/consts/const-eval/const_fn_target_feature.stderr
new file mode 100644
index 000000000..36918b52c
--- /dev/null
+++ b/tests/ui/consts/const-eval/const_fn_target_feature.stderr
@@ -0,0 +1,9 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/const_fn_target_feature.rs:10:24
+ |
+LL | const B: () = unsafe { avx2_fn() };
+ | ^^^^^^^^^ calling a function that requires unavailable target features: avx2
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
index 4eb1c42e1..b50ef0c68 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
@@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_dangling.rs:10:5
|
LL | &*ptr
- | ^^^^^ pointer to alloc2 was dereferenced after this allocation got freed
+ | ^^^^^ dereferencing pointer failed: alloc2 has been freed, so this pointer is dangling
error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_dangling.rs:18:5
|
LL | *reference
- | ^^^^^^^^^^ pointer to alloc4 was dereferenced after this allocation got freed
+ | ^^^^^^^^^^ dereferencing pointer failed: alloc4 has been freed, so this pointer is dangling
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
index 8177a0850..0884ade45 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_duplicate.rs:9:5
|
LL | intrinsics::const_deallocate(ptr, 4, 4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer to alloc2 was dereferenced after this allocation got freed
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc2 has been freed, so this pointer is dangling
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/issue-49296.stderr b/tests/ui/consts/const-eval/issue-49296.stderr
index cc4f1594c..45ba0ea18 100644
--- a/tests/ui/consts/const-eval/issue-49296.stderr
+++ b/tests/ui/consts/const-eval/issue-49296.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-49296.rs:9:16
|
LL | const X: u64 = *wat(42);
- | ^^^^^^^^ pointer to alloc3 was dereferenced after this allocation got freed
+ | ^^^^^^^^ dereferencing pointer failed: alloc3 has been freed, so this pointer is dangling
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/nonnull_as_ref.rs b/tests/ui/consts/const-eval/nonnull_as_ref.rs
new file mode 100644
index 000000000..eb4683e2c
--- /dev/null
+++ b/tests/ui/consts/const-eval/nonnull_as_ref.rs
@@ -0,0 +1,8 @@
+// check-pass
+
+use std::ptr::NonNull;
+
+const NON_NULL: NonNull<u8> = unsafe { NonNull::new_unchecked((&42u8 as *const u8).cast_mut()) };
+const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() });
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs b/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs
new file mode 100644
index 000000000..3b48e9729
--- /dev/null
+++ b/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs
@@ -0,0 +1,6 @@
+use std::ptr::NonNull;
+
+const NON_NULL: NonNull<u8> = unsafe { NonNull::dangling() };
+const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() });
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
new file mode 100644
index 000000000..de93cb0c3
--- /dev/null
+++ b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
@@ -0,0 +1,16 @@
+error[E0080]: evaluation of constant value failed
+ --> $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ |
+ = note: dereferencing pointer failed: 0x1[noalloc] is a dangling pointer (it has no provenance)
+ |
+note: inside `NonNull::<u8>::as_ref::<'_>`
+ --> $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+note: inside `_`
+ --> $DIR/nonnull_as_ref_ub.rs:4:39
+ |
+LL | const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() });
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
index c0ddaceea..e087a0ebe 100644
--- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
@@ -24,7 +24,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:42:1
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
|
= 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) {
@@ -35,7 +35,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:44:1
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type `Never`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
|
= 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) {
@@ -266,7 +266,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:144:1
|
LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized data in `str`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized memory, but expected a string
|
= 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) {
@@ -277,7 +277,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:146:1
|
LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized data in `str`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized memory, but expected a string
|
= 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) {
@@ -288,8 +288,9 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:148:1
|
LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered a pointer, but expected a string
|
+ = 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) {
╾ALLOC_ID╼ 01 00 00 00 │ ╾──╼....
}
@@ -516,7 +517,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:215:1
|
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -527,8 +528,9 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:218:1
|
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
- | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, 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: 4) {
╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
}
@@ -550,7 +552,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:225:1
|
LL | pub static S7: &[u16] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized bytes
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -561,7 +563,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:232:1
|
LL | pub static R4: &[u8] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -572,8 +574,9 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:237:1
|
LL | pub static R5: &[u8] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, 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: 4) {
╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
}
diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
index 20c905878..4c655161f 100644
--- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
@@ -24,7 +24,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:42:1
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
|
= 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) {
@@ -35,7 +35,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:44:1
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type `Never`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
|
= 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) {
@@ -266,7 +266,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:144:1
|
LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized data in `str`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized memory, but expected a string
|
= 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) {
@@ -277,7 +277,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:146:1
|
LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized data in `str`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized memory, but expected a string
|
= 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) {
@@ -288,8 +288,9 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:148:1
|
LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered a pointer, but expected a string
|
+ = 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) {
╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
}
@@ -516,7 +517,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:215:1
|
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -527,8 +528,9 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:218:1
|
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
- | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, 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: 16, align: 8) {
╾ALLOC_ID╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
}
@@ -550,7 +552,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:225:1
|
LL | pub static S7: &[u16] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized bytes
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -561,7 +563,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:232:1
|
LL | pub static R4: &[u8] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -572,8 +574,9 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:237:1
|
LL | pub static R5: &[u8] = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, 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: 16, align: 8) {
╾ALLOC_ID╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
}
diff --git a/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr b/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr
index eaa2d6b27..8175fe601 100644
--- a/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr
+++ b/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ref_to_int_match.rs:24:27
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
- | ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
diff --git a/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr b/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr
index eaa2d6b27..8175fe601 100644
--- a/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr
+++ b/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ref_to_int_match.rs:24:27
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
- | ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
diff --git a/tests/ui/consts/const-eval/ub-enum.32bit.stderr b/tests/ui/consts/const-eval/ub-enum.32bit.stderr
index 1810600b7..c0ad6caec 100644
--- a/tests/ui/consts/const-eval/ub-enum.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-enum.32bit.stderr
@@ -13,7 +13,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:30:1
|
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -22,7 +22,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:33:1
|
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -42,7 +42,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:47:1
|
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -51,7 +51,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:50:1
|
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -66,7 +66,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:64:1
|
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -75,7 +75,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-enum.rs:81:1
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -86,7 +86,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-enum.rs:83:1
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type `Never`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -108,14 +108,27 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:96:77
|
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of uninhabited type `Never`
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:98:77
|
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of the never type `!`
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
-error: aborting due to 13 previous errors
+error[E0080]: evaluation of constant value failed
+ --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ |
+ = note: read discriminant of an uninhabited enum variant
+ |
+note: inside `discriminant::<Never>`
+ --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+note: inside `TEST_ICE_89765`
+ --> $DIR/ub-enum.rs:103:14
+ |
+LL | unsafe { std::mem::discriminant(&*(&() as *const () as *const Never)); };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-enum.64bit.stderr b/tests/ui/consts/const-eval/ub-enum.64bit.stderr
index fb40babb0..6db43d379 100644
--- a/tests/ui/consts/const-eval/ub-enum.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-enum.64bit.stderr
@@ -13,7 +13,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:30:1
|
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -22,7 +22,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:33:1
|
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -42,7 +42,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:47:1
|
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -51,7 +51,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:50:1
|
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -66,7 +66,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:64:1
|
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -75,7 +75,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-enum.rs:81:1
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -86,7 +86,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-enum.rs:83:1
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type `Never`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -108,14 +108,27 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:96:77
|
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of uninhabited type `Never`
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:98:77
|
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
- | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of the never type `!`
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
-error: aborting due to 13 previous errors
+error[E0080]: evaluation of constant value failed
+ --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ |
+ = note: read discriminant of an uninhabited enum variant
+ |
+note: inside `discriminant::<Never>`
+ --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+note: inside `TEST_ICE_89765`
+ --> $DIR/ub-enum.rs:103:14
+ |
+LL | unsafe { std::mem::discriminant(&*(&() as *const () as *const Never)); };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-enum.rs b/tests/ui/consts/const-eval/ub-enum.rs
index 8f26d9a00..078283fbd 100644
--- a/tests/ui/consts/const-eval/ub-enum.rs
+++ b/tests/ui/consts/const-eval/ub-enum.rs
@@ -2,7 +2,7 @@
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
-#![feature(never_type)]
+#![feature(never_type, const_discriminant)]
#![allow(invalid_value)]
use std::mem;
@@ -66,8 +66,8 @@ const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
// # valid discriminant for uninhabited variant
-// An enum with 3 variants of which some are uninhabited -- so the uninhabited variants *do*
-// have a discriminant.
+// An enum with uninhabited variants but also at least 2 inhabited variants -- so the uninhabited
+// variants *do* have a discriminant.
enum UninhDiscriminant {
A,
B(!),
@@ -98,5 +98,11 @@ const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem:
const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
//~^ ERROR evaluation of constant value failed
+const TEST_ICE_89765: () = {
+ // This is a regression test for https://github.com/rust-lang/rust/issues/89765.
+ unsafe { std::mem::discriminant(&*(&() as *const () as *const Never)); };
+ //~^ inside `TEST_ICE_89765`
+};
+
fn main() {
}
diff --git a/tests/ui/consts/const-eval/ub-int-array.32bit.stderr b/tests/ui/consts/const-eval/ub-int-array.32bit.stderr
index edcde13b0..b3df41304 100644
--- a/tests/ui/consts/const-eval/ub-int-array.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-int-array.32bit.stderr
@@ -1,20 +1,35 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-int-array.rs:15:9
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-int-array.rs:19:1
|
-LL | MaybeUninit { uninit: () }.init,
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+LL | const UNINIT_INT_0: [u32; 3] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized memory, but expected an integer
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 12, align: 4) {
+ __ __ __ __ 01 00 00 00 02 00 00 00 │ ░░░░........
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-int-array.rs:30:13
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-int-array.rs:24:1
+ |
+LL | const UNINIT_INT_1: [u32; 3] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized memory, but expected an integer
|
-LL | MaybeUninit { uninit: () }.init,
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 12, align: 4) {
+ 00 00 00 00 01 __ 01 01 02 02 __ 02 │ .....░....░.
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-int-array.rs:56:13
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-int-array.rs:42:1
+ |
+LL | const UNINIT_INT_2: [u32; 3] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized memory, but expected an integer
|
-LL | MaybeUninit { uninit: () }.init,
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 12, align: 4) {
+ 00 00 00 00 01 01 01 01 02 02 02 __ │ ...........░
+ }
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/const-eval/ub-int-array.64bit.stderr b/tests/ui/consts/const-eval/ub-int-array.64bit.stderr
index edcde13b0..b3df41304 100644
--- a/tests/ui/consts/const-eval/ub-int-array.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-int-array.64bit.stderr
@@ -1,20 +1,35 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-int-array.rs:15:9
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-int-array.rs:19:1
|
-LL | MaybeUninit { uninit: () }.init,
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+LL | const UNINIT_INT_0: [u32; 3] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered uninitialized memory, but expected an integer
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 12, align: 4) {
+ __ __ __ __ 01 00 00 00 02 00 00 00 │ ░░░░........
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-int-array.rs:30:13
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-int-array.rs:24:1
+ |
+LL | const UNINIT_INT_1: [u32; 3] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [1]: encountered uninitialized memory, but expected an integer
|
-LL | MaybeUninit { uninit: () }.init,
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 12, align: 4) {
+ 00 00 00 00 01 __ 01 01 02 02 __ 02 │ .....░....░.
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-int-array.rs:56:13
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-int-array.rs:42:1
+ |
+LL | const UNINIT_INT_2: [u32; 3] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [2]: encountered uninitialized memory, but expected an integer
|
-LL | MaybeUninit { uninit: () }.init,
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 12, align: 4) {
+ 00 00 00 00 01 01 01 01 02 02 02 __ │ ...........░
+ }
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/const-eval/ub-int-array.rs b/tests/ui/consts/const-eval/ub-int-array.rs
index a68d3fb17..adcf376b9 100644
--- a/tests/ui/consts/const-eval/ub-int-array.rs
+++ b/tests/ui/consts/const-eval/ub-int-array.rs
@@ -10,54 +10,52 @@ union MaybeUninit<T: Copy> {
init: T,
}
+impl<T: Copy> MaybeUninit<T> {
+ const fn new(t: T) -> Self {
+ MaybeUninit { init: t }
+ }
+}
+
const UNINIT_INT_0: [u32; 3] = unsafe {
- [
- MaybeUninit { uninit: () }.init,
- //~^ ERROR evaluation of constant value failed
- //~| uninitialized
- 1,
- 2,
- ]
+ //~^ ERROR it is undefined behavior to use this value
+ //~| invalid value at [0]
+ mem::transmute([MaybeUninit { uninit: () }, MaybeUninit::new(1), MaybeUninit::new(2)])
};
const UNINIT_INT_1: [u32; 3] = unsafe {
- mem::transmute(
- [
- 0u8,
- 0u8,
- 0u8,
- 0u8,
- 1u8,
- MaybeUninit { uninit: () }.init,
- //~^ ERROR evaluation of constant value failed
- //~| uninitialized
- 1u8,
- 1u8,
- 2u8,
- 2u8,
- MaybeUninit { uninit: () }.init,
- 2u8,
- ]
- )
+ //~^ ERROR it is undefined behavior to use this value
+ //~| invalid value at [1]
+ mem::transmute([
+ MaybeUninit::new(0u8),
+ MaybeUninit::new(0u8),
+ MaybeUninit::new(0u8),
+ MaybeUninit::new(0u8),
+ MaybeUninit::new(1u8),
+ MaybeUninit { uninit: () },
+ MaybeUninit::new(1u8),
+ MaybeUninit::new(1u8),
+ MaybeUninit::new(2u8),
+ MaybeUninit::new(2u8),
+ MaybeUninit { uninit: () },
+ MaybeUninit::new(2u8),
+ ])
};
const UNINIT_INT_2: [u32; 3] = unsafe {
- mem::transmute(
- [
- 0u8,
- 0u8,
- 0u8,
- 0u8,
- 1u8,
- 1u8,
- 1u8,
- 1u8,
- 2u8,
- 2u8,
- 2u8,
- MaybeUninit { uninit: () }.init,
- //~^ ERROR evaluation of constant value failed
- //~| uninitialized
- ]
- )
+ //~^ ERROR it is undefined behavior to use this value
+ //~| invalid value at [2]
+ mem::transmute([
+ MaybeUninit::new(0u8),
+ MaybeUninit::new(0u8),
+ MaybeUninit::new(0u8),
+ MaybeUninit::new(0u8),
+ MaybeUninit::new(1u8),
+ MaybeUninit::new(1u8),
+ MaybeUninit::new(1u8),
+ MaybeUninit::new(1u8),
+ MaybeUninit::new(2u8),
+ MaybeUninit::new(2u8),
+ MaybeUninit::new(2u8),
+ MaybeUninit { uninit: () },
+ ])
};
fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
index 1d19dfff5..0ee1e6087 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
@@ -46,7 +46,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-ref-ptr.rs:33:1
|
LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -55,7 +55,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-ref-ptr.rs:36:39
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -70,7 +70,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-ref-ptr.rs:39:86
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
- | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -141,7 +141,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:59:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc39, but expected a function pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
index f38e7916b..02bbbf504 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
@@ -24,7 +24,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:43:1
|
LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -33,7 +33,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:46:1
|
LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -53,7 +53,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:52:1
|
LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized data in `str`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized memory, but expected a string
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -64,7 +64,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:55:1
|
LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized data in `str`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized memory, but expected a string
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -103,7 +103,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:75:1
|
LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= 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
@@ -123,7 +123,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:81:1
|
LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
diff --git a/tests/ui/consts/const-float-classify.rs b/tests/ui/consts/const-float-classify.rs
index 3a5d5bb46..877ce0219 100644
--- a/tests/ui/consts/const-float-classify.rs
+++ b/tests/ui/consts/const-float-classify.rs
@@ -1,5 +1,6 @@
// compile-flags: -Zmir-opt-level=0
-// run-pass
+// known-bug: #110395
+// FIXME run-pass
#![feature(const_float_bits_conv)]
#![feature(const_float_classify)]
diff --git a/tests/ui/consts/const-float-classify.stderr b/tests/ui/consts/const-float-classify.stderr
new file mode 100644
index 000000000..a23d81c0e
--- /dev/null
+++ b/tests/ui/consts/const-float-classify.stderr
@@ -0,0 +1,11 @@
+error[E0015]: cannot call non-const fn `<A as MyEq<B>>::eq` in constant functions
+ --> $DIR/const-float-classify.rs:31:7
+ |
+LL | x.eq(y)
+ | ^^^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const-size_of-cycle.stderr b/tests/ui/consts/const-size_of-cycle.stderr
index 17088d999..46b432357 100644
--- a/tests/ui/consts/const-size_of-cycle.stderr
+++ b/tests/ui/consts/const-size_of-cycle.stderr
@@ -23,6 +23,7 @@ note: cycle used when checking that `Foo` is well-formed
|
LL | struct Foo {
| ^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/consts/const-try.stderr b/tests/ui/consts/const-try.stderr
index 37014f9b8..94f4153a2 100644
--- a/tests/ui/consts/const-try.stderr
+++ b/tests/ui/consts/const-try.stderr
@@ -1,20 +1,29 @@
-error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]`
- --> $DIR/const-try.rs:15:12
+error[E0015]: `?` cannot determine the branch of `TryMe` in constant functions
+ --> $DIR/const-try.rs:33:5
|
-LL | impl const FromResidual<Error> for TryMe {
- | ^^^^^^^^^^^^^^^^^^^
+LL | TryMe?;
+ | ^^^^^^
|
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
-
-error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
- --> $DIR/const-try.rs:21:12
+note: impl defined here, but it is not `const`
+ --> $DIR/const-try.rs:21:1
|
LL | impl const Try for TryMe {
- | ^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error[E0015]: `?` cannot convert from residual of `TryMe` in constant functions
+ --> $DIR/const-try.rs:33:5
|
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
+LL | TryMe?;
+ | ^^^^^^
+ |
+note: impl defined here, but it is not `const`
+ --> $DIR/const-try.rs:15:1
+ |
+LL | impl const FromResidual<Error> for TryMe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const_cmp_type_id.stderr b/tests/ui/consts/const_cmp_type_id.stderr
index dc2c702d8..0d915cec0 100644
--- a/tests/ui/consts/const_cmp_type_id.stderr
+++ b/tests/ui/consts/const_cmp_type_id.stderr
@@ -1,16 +1,3 @@
-error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
- --> $DIR/const_cmp_type_id.rs:8:13
- |
-LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId == TypeId`
- |
- = help: the trait `~const PartialEq` is not implemented for `TypeId`
-note: the trait `PartialEq` is implemented for `TypeId`, but that implementation is not `const`
- --> $DIR/const_cmp_type_id.rs:8:13
- |
-LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
error[E0015]: cannot call non-const operator in constant functions
--> $DIR/const_cmp_type_id.rs:8:13
|
@@ -21,19 +8,6 @@ note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
- --> $DIR/const_cmp_type_id.rs:9:13
- |
-LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId == TypeId`
- |
- = help: the trait `~const PartialEq` is not implemented for `TypeId`
-note: the trait `PartialEq` is implemented for `TypeId`, but that implementation is not `const`
- --> $DIR/const_cmp_type_id.rs:9:13
- |
-LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
error[E0015]: cannot call non-const operator in constant functions
--> $DIR/const_cmp_type_id.rs:9:13
|
@@ -44,19 +18,6 @@ note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
- --> $DIR/const_cmp_type_id.rs:10:22
- |
-LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId < TypeId` and `TypeId > TypeId`
- |
- = help: the trait `~const PartialOrd` is not implemented for `TypeId`
-note: the trait `PartialOrd` is implemented for `TypeId`, but that implementation is not `const`
- --> $DIR/const_cmp_type_id.rs:10:22
- |
-LL | const _A: bool = TypeId::of::<u8>() < TypeId::of::<u16>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
error[E0015]: cannot call non-const operator in constants
--> $DIR/const_cmp_type_id.rs:10:22
|
@@ -68,7 +29,6 @@ note: impl defined here, but it is not `const`
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 6 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const_discriminant.rs b/tests/ui/consts/const_discriminant.rs
index 79e68590e..b1180faa6 100644
--- a/tests/ui/consts/const_discriminant.rs
+++ b/tests/ui/consts/const_discriminant.rs
@@ -24,13 +24,6 @@ enum SingleVariant {
const TEST_V: Discriminant<SingleVariant> = discriminant(&SingleVariant::V);
-pub const TEST_VOID: () = {
- // This is UB, but CTFE does not check validity so it does not detect this.
- // This is a regression test for https://github.com/rust-lang/rust/issues/89765.
- unsafe { std::mem::discriminant(&*(&() as *const () as *const Void)); };
-};
-
-
fn main() {
assert_eq!(TEST_A, TEST_A_OTHER);
assert_eq!(TEST_A, discriminant(black_box(&Test::A(17))));
diff --git a/tests/ui/consts/const_let_assign3.stderr b/tests/ui/consts/const_let_assign3.stderr
index b550ac545..89073f975 100644
--- a/tests/ui/consts/const_let_assign3.stderr
+++ b/tests/ui/consts/const_let_assign3.stderr
@@ -11,7 +11,7 @@ error[E0658]: mutable references are not allowed in constants
--> $DIR/const_let_assign3.rs:14:5
|
LL | s.foo(3);
- | ^^^^^^^^
+ | ^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
diff --git a/tests/ui/consts/constifconst-call-in-const-position.stderr b/tests/ui/consts/constifconst-call-in-const-position.stderr
index d4a445120..6eee46661 100644
--- a/tests/ui/consts/constifconst-call-in-const-position.stderr
+++ b/tests/ui/consts/constifconst-call-in-const-position.stderr
@@ -7,12 +7,22 @@ LL | #![feature(const_trait_impl, generic_const_exprs)]
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default
-error[E0080]: evaluation of `foo::<()>::{constant#0}` failed
+error[E0015]: cannot call non-const fn `<T as Tr>::a` in constants
+ --> $DIR/constifconst-call-in-const-position.rs:17:9
+ |
+LL | [0; T::a()]
+ | ^^^^^^
+ |
+ = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+
+error[E0015]: cannot call non-const fn `<T as Tr>::a` in constants
--> $DIR/constifconst-call-in-const-position.rs:16:38
|
LL | const fn foo<T: ~const Tr>() -> [u8; T::a()] {
- | ^^^^^^ calling non-const function `<() as Tr>::a`
+ | ^^^^^^
+ |
+ = note: calls in constants are limited to constant functions, tuple structs and tuple variants
-error: aborting due to previous error; 1 warning emitted
+error: aborting due to 2 previous errors; 1 warning emitted
-For more information about this error, try `rustc --explain E0080`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/drop-maybe_uninit.rs b/tests/ui/consts/drop-maybe_uninit.rs
new file mode 100644
index 000000000..2fdeae5f1
--- /dev/null
+++ b/tests/ui/consts/drop-maybe_uninit.rs
@@ -0,0 +1,17 @@
+// build-pass
+
+pub const fn f<T, const N: usize>(_: [std::mem::MaybeUninit<T>; N]) {}
+
+pub struct Blubb<T>(*const T);
+
+pub const fn g<T, const N: usize>(_: [Blubb<T>; N]) {}
+
+pub struct Blorb<const N: usize>([String; N]);
+
+pub const fn h(_: Blorb<0>) {}
+
+pub struct Wrap(Blorb<0>);
+
+pub const fn i(_: Wrap) {}
+
+fn main() {}
diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs
index 6a3c93ce7..37b37e965 100644
--- a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs
+++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs
@@ -1,8 +1,29 @@
// revisions: no_flag with_flag
// [no_flag] check-pass
// [with_flag] compile-flags: -Zextra-const-ub-checks
+#![feature(never_type, pointer_byte_offsets)]
use std::mem::transmute;
+use std::ptr::addr_of;
+
+#[derive(Clone, Copy)]
+enum E { A, B }
+
+#[derive(Clone, Copy)]
+enum Never {}
+
+#[repr(usize)]
+enum PtrSizedEnum { V }
+
+// An enum with uninhabited variants but also at least 2 inhabited variants -- so the uninhabited
+// variants *do* have a discriminant.
+#[derive(Clone, Copy)]
+enum UninhDiscriminant {
+ A,
+ B(!),
+ C,
+ D(Never),
+}
const INVALID_BOOL: () = unsafe {
let _x: bool = transmute(3u8);
@@ -13,12 +34,20 @@ const INVALID_BOOL: () = unsafe {
const INVALID_PTR_IN_INT: () = unsafe {
let _x: usize = transmute(&3u8);
//[with_flag]~^ ERROR: evaluation of constant value failed
+ //[with_flag]~| invalid value
+};
+
+const INVALID_PTR_IN_ENUM: () = unsafe {
+ let _x: PtrSizedEnum = transmute(&3u8);
+ //[with_flag]~^ ERROR: evaluation of constant value failed
+ //[with_flag]~| invalid value
};
const INVALID_SLICE_TO_USIZE_TRANSMUTE: () = unsafe {
let x: &[u8] = &[0; 32];
let _x: (usize, usize) = transmute(x);
//[with_flag]~^ ERROR: evaluation of constant value failed
+ //[with_flag]~| invalid value
};
const UNALIGNED_PTR: () = unsafe {
@@ -27,4 +56,36 @@ const UNALIGNED_PTR: () = unsafe {
//[with_flag]~| invalid value
};
+const UNINHABITED_VARIANT: () = unsafe {
+ let data = [1u8];
+ // Not using transmute, we want to hit the ImmTy code path.
+ let v = *addr_of!(data).cast::<UninhDiscriminant>();
+ //[with_flag]~^ ERROR: evaluation of constant value failed
+ //[with_flag]~| invalid value
+};
+
+const PARTIAL_POINTER: () = unsafe {
+ #[repr(C, packed)]
+ struct Packed {
+ pad1: u8,
+ ptr: *const u8,
+ pad2: [u8; 7],
+ }
+ // `Align` ensures that the entire thing has pointer alignment again.
+ #[repr(C)]
+ struct Align {
+ p: Packed,
+ align: usize,
+ }
+ let mem = Packed { pad1: 0, ptr: &0u8 as *const u8, pad2: [0; 7] };
+ let mem = Align { p: mem, align: 0 };
+ let _val = *(&mem as *const Align as *const [*const u8; 2]);
+ //[with_flag]~^ ERROR: evaluation of constant value failed
+ //[with_flag]~| invalid value
+};
+
+// Regression tests for an ICE (related to <https://github.com/rust-lang/rust/issues/113988>).
+const VALID_ENUM1: E = { let e = E::A; e };
+const VALID_ENUM2: Result<&'static [u8], ()> = { let e = Err(()); e };
+
fn main() {}
diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
index 3970baefc..4ee12d501 100644
--- a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
+++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
@@ -1,33 +1,57 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/detect-extra-ub.rs:8:20
+ --> $DIR/detect-extra-ub.rs:29:20
|
LL | let _x: bool = transmute(3u8);
| ^^^^^^^^^^^^^^ constructing invalid value: encountered 0x03, but expected a boolean
error[E0080]: evaluation of constant value failed
- --> $DIR/detect-extra-ub.rs:14:21
+ --> $DIR/detect-extra-ub.rs:35:21
|
LL | let _x: usize = transmute(&3u8);
- | ^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^^^^ constructing invalid value: encountered a pointer, but expected an integer
|
= 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:20:30
+ --> $DIR/detect-extra-ub.rs:41:28
+ |
+LL | let _x: PtrSizedEnum = transmute(&3u8);
+ | ^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered a pointer, but expected an integer
+ |
+ = 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:48:30
|
LL | let _x: (usize, usize) = transmute(x);
- | ^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ | ^^^^^^^^^^^^ constructing invalid value at .0: encountered a pointer, but expected an integer
|
= 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:25:20
+ --> $DIR/detect-extra-ub.rs:54:20
|
LL | let _x: &u32 = transmute(&[0u8; 4]);
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 4 byte alignment but found 1)
-error: aborting due to 4 previous errors
+error[E0080]: evaluation of constant value failed
+ --> $DIR/detect-extra-ub.rs:62:13
+ |
+LL | let v = *addr_of!(data).cast::<UninhDiscriminant>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/detect-extra-ub.rs:82:16
+ |
+LL | let _val = *(&mem as *const Align as *const [*const u8; 2]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a partial pointer or a mix of pointers
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+
+error: aborting due to 7 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/invalid-inline-const-in-match-arm.rs b/tests/ui/consts/invalid-inline-const-in-match-arm.rs
index 17acb2d9d..4d2d8fb13 100644
--- a/tests/ui/consts/invalid-inline-const-in-match-arm.rs
+++ b/tests/ui/consts/invalid-inline-const-in-match-arm.rs
@@ -5,6 +5,5 @@ fn main() {
match () {
const { (|| {})() } => {}
//~^ ERROR cannot call non-const closure in constants
- //~| ERROR the trait bound
}
}
diff --git a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr
index ac174849f..257ecd7f3 100644
--- a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr
+++ b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr
@@ -1,17 +1,3 @@
-error[E0277]: the trait bound `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]: Fn<()>` is not satisfied
- --> $DIR/invalid-inline-const-in-match-arm.rs:6:17
- |
-LL | const { (|| {})() } => {}
- | ^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`
- |
- = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`
-note: the trait `Fn<()>` is implemented for `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`, but that implementation is not `const`
- --> $DIR/invalid-inline-const-in-match-arm.rs:6:17
- |
-LL | const { (|| {})() } => {}
- | ^^^^^^^^^
- = note: wrap the `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]` in a closure with no arguments: `|| { /* code */ }`
-
error[E0015]: cannot call non-const closure in constants
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17
|
@@ -22,7 +8,6 @@ LL | const { (|| {})() } => {}
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-103790.stderr b/tests/ui/consts/issue-103790.stderr
index 34d8ee281..67334469d 100644
--- a/tests/ui/consts/issue-103790.stderr
+++ b/tests/ui/consts/issue-103790.stderr
@@ -34,6 +34,7 @@ note: cycle used when computing type of `S`
|
LL | struct S<const S: (), const S: S = { S }>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0391]: cycle detected when computing type of `S`
--> $DIR/issue-103790.rs:4:1
@@ -58,6 +59,7 @@ LL | | struct S<const S: (), const S: S = { S }>;
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to 4 previous errors
diff --git a/tests/ui/consts/issue-28113.rs b/tests/ui/consts/issue-28113.rs
index e45c009d6..f8131c9f3 100644
--- a/tests/ui/consts/issue-28113.rs
+++ b/tests/ui/consts/issue-28113.rs
@@ -3,7 +3,6 @@
const X: u8 =
|| -> u8 { 5 }()
//~^ ERROR cannot call non-const closure
- //~| ERROR the trait bound
;
fn main() {}
diff --git a/tests/ui/consts/issue-28113.stderr b/tests/ui/consts/issue-28113.stderr
index e177a3585..1294cc99b 100644
--- a/tests/ui/consts/issue-28113.stderr
+++ b/tests/ui/consts/issue-28113.stderr
@@ -1,17 +1,3 @@
-error[E0277]: the trait bound `[closure@$DIR/issue-28113.rs:4:5: 4:13]: Fn<()>` is not satisfied
- --> $DIR/issue-28113.rs:4:5
- |
-LL | || -> u8 { 5 }()
- | ^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-28113.rs:4:5: 4:13]`
- |
- = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-28113.rs:4:5: 4:13]`
-note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-28113.rs:4:5: 4:13]`, but that implementation is not `const`
- --> $DIR/issue-28113.rs:4:5
- |
-LL | || -> u8 { 5 }()
- | ^^^^^^^^^^^^^^^^
- = note: wrap the `[closure@$DIR/issue-28113.rs:4:5: 4:13]` in a closure with no arguments: `|| { /* code */ }`
-
error[E0015]: cannot call non-const closure in constants
--> $DIR/issue-28113.rs:4:5
|
@@ -22,7 +8,6 @@ LL | || -> u8 { 5 }()
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-36163.stderr b/tests/ui/consts/issue-36163.stderr
index 7137c0538..190b41062 100644
--- a/tests/ui/consts/issue-36163.stderr
+++ b/tests/ui/consts/issue-36163.stderr
@@ -15,6 +15,7 @@ note: cycle used when simplifying constant for the type system `Foo::B::{constan
|
LL | B = A,
| ^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/consts/issue-44415.stderr b/tests/ui/consts/issue-44415.stderr
index ec64b956d..01d24a620 100644
--- a/tests/ui/consts/issue-44415.stderr
+++ b/tests/ui/consts/issue-44415.stderr
@@ -23,6 +23,7 @@ note: cycle used when checking that `Foo` is well-formed
|
LL | struct Foo {
| ^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/consts/issue-56164.rs b/tests/ui/consts/issue-56164.rs
index 00875c4b5..22c257d0b 100644
--- a/tests/ui/consts/issue-56164.rs
+++ b/tests/ui/consts/issue-56164.rs
@@ -1,6 +1,5 @@
const fn foo() { (||{})() }
//~^ ERROR cannot call non-const closure
-//~| ERROR the trait bound
const fn bad(input: fn()) {
input()
diff --git a/tests/ui/consts/issue-56164.stderr b/tests/ui/consts/issue-56164.stderr
index e46c649fa..1b267214a 100644
--- a/tests/ui/consts/issue-56164.stderr
+++ b/tests/ui/consts/issue-56164.stderr
@@ -1,17 +1,3 @@
-error[E0277]: the trait bound `[closure@$DIR/issue-56164.rs:1:19: 1:21]: Fn<()>` is not satisfied
- --> $DIR/issue-56164.rs:1:18
- |
-LL | const fn foo() { (||{})() }
- | ^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-56164.rs:1:19: 1:21]`
- |
- = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-56164.rs:1:19: 1:21]`
-note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-56164.rs:1:19: 1:21]`, but that implementation is not `const`
- --> $DIR/issue-56164.rs:1:18
- |
-LL | const fn foo() { (||{})() }
- | ^^^^^^^^
- = note: wrap the `[closure@$DIR/issue-56164.rs:1:19: 1:21]` in a closure with no arguments: `|| { /* code */ }`
-
error[E0015]: cannot call non-const closure in constant functions
--> $DIR/issue-56164.rs:1:18
|
@@ -23,12 +9,11 @@ LL | const fn foo() { (||{})() }
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
error: function pointer calls are not allowed in constant functions
- --> $DIR/issue-56164.rs:6:5
+ --> $DIR/issue-56164.rs:5:5
|
LL | input()
| ^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-68542-closure-in-array-len.rs b/tests/ui/consts/issue-68542-closure-in-array-len.rs
index a88e0cc60..37958e791 100644
--- a/tests/ui/consts/issue-68542-closure-in-array-len.rs
+++ b/tests/ui/consts/issue-68542-closure-in-array-len.rs
@@ -4,7 +4,6 @@
struct Bug {
a: [(); (|| { 0 })()] //~ ERROR cannot call non-const closure
- //~^ ERROR the trait bound
}
fn main() {}
diff --git a/tests/ui/consts/issue-68542-closure-in-array-len.stderr b/tests/ui/consts/issue-68542-closure-in-array-len.stderr
index ace62f09d..d23513ed7 100644
--- a/tests/ui/consts/issue-68542-closure-in-array-len.stderr
+++ b/tests/ui/consts/issue-68542-closure-in-array-len.stderr
@@ -1,17 +1,3 @@
-error[E0277]: the trait bound `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]: Fn<()>` is not satisfied
- --> $DIR/issue-68542-closure-in-array-len.rs:6:13
- |
-LL | a: [(); (|| { 0 })()]
- | ^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`
- |
- = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`
-note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`, but that implementation is not `const`
- --> $DIR/issue-68542-closure-in-array-len.rs:6:13
- |
-LL | a: [(); (|| { 0 })()]
- | ^^^^^^^^^^^^
- = note: wrap the `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]` in a closure with no arguments: `|| { /* code */ }`
-
error[E0015]: cannot call non-const closure in constants
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
|
@@ -22,7 +8,6 @@ LL | a: [(); (|| { 0 })()]
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-73976-monomorphic.stderr b/tests/ui/consts/issue-73976-monomorphic.stderr
index 09661d3f3..b23796db4 100644
--- a/tests/ui/consts/issue-73976-monomorphic.stderr
+++ b/tests/ui/consts/issue-73976-monomorphic.stderr
@@ -1,16 +1,3 @@
-error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
- --> $DIR/issue-73976-monomorphic.rs:21:5
- |
-LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `TypeId == TypeId`
- |
- = help: the trait `~const PartialEq` is not implemented for `TypeId`
-note: the trait `PartialEq` is implemented for `TypeId`, but that implementation is not `const`
- --> $DIR/issue-73976-monomorphic.rs:21:5
- |
-LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
error[E0015]: cannot call non-const operator in constant functions
--> $DIR/issue-73976-monomorphic.rs:21:5
|
@@ -21,7 +8,6 @@ note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-83182.rs b/tests/ui/consts/issue-83182.rs
deleted file mode 100644
index b62f903bd..000000000
--- a/tests/ui/consts/issue-83182.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Strip out raw byte dumps to make comparison platform-independent:
-// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
-// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
-
-use std::mem;
-struct MyStr(str);
-const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
-//~^ ERROR: it is undefined behavior to use this value
-fn main() {}
diff --git a/tests/ui/consts/issue-83182.stderr b/tests/ui/consts/issue-83182.stderr
deleted file mode 100644
index ca4e0f7aa..000000000
--- a/tests/ui/consts/issue-83182.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/issue-83182.rs:7:1
- |
-LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
- |
- = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
- HEX_DUMP
- }
- = help: this code performed an operation that depends on the underlying bytes representing a pointer
- = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/issue-94675.rs b/tests/ui/consts/issue-94675.rs
index 38c8129b8..2358175fe 100644
--- a/tests/ui/consts/issue-94675.rs
+++ b/tests/ui/consts/issue-94675.rs
@@ -1,3 +1,5 @@
+// known-bug: #103507
+
#![feature(const_trait_impl, const_mut_refs)]
struct Foo<'a> {
@@ -7,9 +9,9 @@ struct Foo<'a> {
impl<'a> Foo<'a> {
const fn spam(&mut self, baz: &mut Vec<u32>) {
self.bar[0] = baz.len();
- //~^ ERROR: cannot call
- //~| ERROR: cannot call
- //~| ERROR: the trait bound
+ //FIXME ~^ ERROR: cannot call
+ //FIXME ~| ERROR: cannot call
+ //FIXME ~| ERROR: the trait bound
}
}
diff --git a/tests/ui/consts/issue-94675.stderr b/tests/ui/consts/issue-94675.stderr
index b4e5db44e..f51f305ac 100644
--- a/tests/ui/consts/issue-94675.stderr
+++ b/tests/ui/consts/issue-94675.stderr
@@ -1,35 +1,21 @@
error[E0015]: cannot call non-const fn `Vec::<u32>::len` in constant functions
- --> $DIR/issue-94675.rs:9:27
+ --> $DIR/issue-94675.rs:11:27
|
LL | self.bar[0] = baz.len();
| ^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-error[E0277]: the trait bound `Vec<usize>: ~const IndexMut<usize>` is not satisfied
- --> $DIR/issue-94675.rs:9:9
- |
-LL | self.bar[0] = baz.len();
- | ^^^^^^^^^^^ vector indices are of type `usize` or ranges of `usize`
- |
- = help: the trait `~const IndexMut<usize>` is not implemented for `Vec<usize>`
-note: the trait `IndexMut<usize>` is implemented for `Vec<usize>`, but that implementation is not `const`
- --> $DIR/issue-94675.rs:9:9
- |
-LL | self.bar[0] = baz.len();
- | ^^^^^^^^^^^
-
error[E0015]: cannot call non-const operator in constant functions
- --> $DIR/issue-94675.rs:9:9
+ --> $DIR/issue-94675.rs:11:17
|
LL | self.bar[0] = baz.len();
- | ^^^^^^^^^^^
+ | ^^^
|
note: impl defined here, but it is not `const`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-miri-1910.stderr b/tests/ui/consts/issue-miri-1910.stderr
index 67797e6fb..af0f77c67 100644
--- a/tests/ui/consts/issue-miri-1910.stderr
+++ b/tests/ui/consts/issue-miri-1910.stderr
@@ -1,7 +1,7 @@
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: unable to turn pointer into raw bytes
+ = note: unable to turn pointer into integer
|
note: inside `std::ptr::read::<u8>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
diff --git a/tests/ui/consts/miri_unleashed/ptr_arith.rs b/tests/ui/consts/miri_unleashed/ptr_arith.rs
index 4d12960b8..5cda3c411 100644
--- a/tests/ui/consts/miri_unleashed/ptr_arith.rs
+++ b/tests/ui/consts/miri_unleashed/ptr_arith.rs
@@ -1,5 +1,5 @@
// compile-flags: -Zunleash-the-miri-inside-of-you
-#![feature(core_intrinsics)]
+#![feature(core_intrinsics, pointer_byte_offsets)]
// During CTFE, we prevent pointer-to-int casts.
// Pointer comparisons are prevented in the trait system.
@@ -15,7 +15,7 @@ static PTR_INT_TRANSMUTE: () = unsafe {
let x: usize = std::mem::transmute(&0);
let _v = x + 0;
//~^ ERROR could not evaluate static initializer
- //~| unable to turn pointer into raw bytes
+ //~| unable to turn pointer into integer
};
// I'd love to test pointer comparison, but that is not possible since
diff --git a/tests/ui/consts/miri_unleashed/ptr_arith.stderr b/tests/ui/consts/miri_unleashed/ptr_arith.stderr
index 30fd3a55e..25ca6bc4e 100644
--- a/tests/ui/consts/miri_unleashed/ptr_arith.stderr
+++ b/tests/ui/consts/miri_unleashed/ptr_arith.stderr
@@ -8,7 +8,7 @@ error[E0080]: could not evaluate static initializer
--> $DIR/ptr_arith.rs:16:14
|
LL | let _v = x + 0;
- | ^ unable to turn pointer into raw bytes
+ | ^ unable to turn pointer into integer
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
diff --git a/tests/ui/consts/precise-drop-with-promoted.rs b/tests/ui/consts/precise-drop-with-promoted.rs
index 6f2317a5a..0c0514dd9 100644
--- a/tests/ui/consts/precise-drop-with-promoted.rs
+++ b/tests/ui/consts/precise-drop-with-promoted.rs
@@ -1,6 +1,12 @@
// Regression test for issue #89938.
-// check-pass
// compile-flags: --crate-type=lib
+// known-bug: #103507
+// failure-status: 101
+// normalize-stderr-test "note: .*\n\n" -> ""
+// normalize-stderr-test "thread 'rustc' panicked.*\n.*\n" -> ""
+// normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
+// rustc-env:RUST_BACKTRACE=0
+
#![feature(const_precise_live_drops)]
pub const fn f() {
diff --git a/tests/ui/consts/precise-drop-with-promoted.stderr b/tests/ui/consts/precise-drop-with-promoted.stderr
new file mode 100644
index 000000000..a56672048
--- /dev/null
+++ b/tests/ui/consts/precise-drop-with-promoted.stderr
@@ -0,0 +1,6 @@
+error: the compiler unexpectedly panicked. this is a bug.
+
+query stack during panic:
+#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `f`
+#1 [analysis] running analysis passes on this crate
+end of query stack
diff --git a/tests/ui/consts/promoted_const_call.rs b/tests/ui/consts/promoted_const_call.rs
index dae6cafae..d6e48266f 100644
--- a/tests/ui/consts/promoted_const_call.rs
+++ b/tests/ui/consts/promoted_const_call.rs
@@ -1,3 +1,5 @@
+// known-bug: #103507
+
#![feature(const_mut_refs)]
#![feature(const_trait_impl)]
@@ -7,15 +9,15 @@ impl const Drop for Panic { fn drop(&mut self) { panic!(); } }
pub const fn id<T>(x: T) -> T { x }
pub const C: () = {
let _: &'static _ = &id(&Panic);
- //~^ ERROR: temporary value dropped while borrowed
- //~| ERROR: temporary value dropped while borrowed
+ //FIXME ~^ ERROR: temporary value dropped while borrowed
+ //FIXME ~| ERROR: temporary value dropped while borrowed
};
fn main() {
let _: &'static _ = &id(&Panic);
- //~^ ERROR: temporary value dropped while borrowed
- //~| ERROR: temporary value dropped while borrowed
+ //FIXME ~^ ERROR: temporary value dropped while borrowed
+ //FIXME ~| ERROR: temporary value dropped while borrowed
let _: &'static _ = &&(Panic, 0).1;
- //~^ ERROR: temporary value dropped while borrowed
- //~| ERROR: temporary value dropped while borrowed
+ //FIXME~^ ERROR: temporary value dropped while borrowed
+ //FIXME~| ERROR: temporary value dropped while borrowed
}
diff --git a/tests/ui/consts/promoted_const_call.stderr b/tests/ui/consts/promoted_const_call.stderr
index 1cbd8cbe6..1f6abc0ce 100644
--- a/tests/ui/consts/promoted_const_call.stderr
+++ b/tests/ui/consts/promoted_const_call.stderr
@@ -1,5 +1,13 @@
+error[E0493]: destructor of `Panic` cannot be evaluated at compile-time
+ --> $DIR/promoted_const_call.rs:11:30
+ |
+LL | let _: &'static _ = &id(&Panic);
+ | ^^^^^ - value is dropped here
+ | |
+ | the destructor for this type cannot be evaluated in constants
+
error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_const_call.rs:9:26
+ --> $DIR/promoted_const_call.rs:11:26
|
LL | let _: &'static _ = &id(&Panic);
| ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -10,7 +18,7 @@ LL | };
| - temporary value is freed at the end of this statement
error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_const_call.rs:9:30
+ --> $DIR/promoted_const_call.rs:11:30
|
LL | let _: &'static _ = &id(&Panic);
| ---------- ^^^^^ - temporary value is freed at the end of this statement
@@ -19,7 +27,7 @@ LL | let _: &'static _ = &id(&Panic);
| type annotation requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_const_call.rs:15:26
+ --> $DIR/promoted_const_call.rs:17:26
|
LL | let _: &'static _ = &id(&Panic);
| ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -30,7 +38,7 @@ LL | }
| - temporary value is freed at the end of this statement
error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_const_call.rs:15:30
+ --> $DIR/promoted_const_call.rs:17:30
|
LL | let _: &'static _ = &id(&Panic);
| ---------- ^^^^^ - temporary value is freed at the end of this statement
@@ -39,7 +47,7 @@ LL | let _: &'static _ = &id(&Panic);
| type annotation requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_const_call.rs:18:26
+ --> $DIR/promoted_const_call.rs:20:26
|
LL | let _: &'static _ = &&(Panic, 0).1;
| ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -50,7 +58,7 @@ LL | }
| - temporary value is freed at the end of this statement
error[E0716]: temporary value dropped while borrowed
- --> $DIR/promoted_const_call.rs:18:27
+ --> $DIR/promoted_const_call.rs:20:27
|
LL | let _: &'static _ = &&(Panic, 0).1;
| ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -60,6 +68,7 @@ LL | let _: &'static _ = &&(Panic, 0).1;
LL | }
| - temporary value is freed at the end of this statement
-error: aborting due to 6 previous errors
+error: aborting due to 7 previous errors
-For more information about this error, try `rustc --explain E0716`.
+Some errors have detailed explanations: E0493, E0716.
+For more information about an error, try `rustc --explain E0493`.
diff --git a/tests/ui/consts/ptr_comparisons.rs b/tests/ui/consts/ptr_comparisons.rs
index f442e6138..a5b6cd9d2 100644
--- a/tests/ui/consts/ptr_comparisons.rs
+++ b/tests/ui/consts/ptr_comparisons.rs
@@ -1,8 +1,5 @@
// compile-flags: --crate-type=lib
-// normalize-stderr-32bit: "8 bytes" -> "$$TWO_WORDS bytes"
-// normalize-stderr-64bit: "16 bytes" -> "$$TWO_WORDS bytes"
-// normalize-stderr-32bit: "size 4" -> "size $$WORD"
-// normalize-stderr-64bit: "size 8" -> "size $$WORD"
+// check-pass
#![feature(
core_intrinsics,
@@ -34,30 +31,13 @@ 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.
+// compare equal: they don't necessarily do at runtime).
check!(!, FOO as *const _, FOO as *const _);
+// aside from 0, these pointers might end up pretty much anywhere.
+check!(!, FOO as *const _, 1); // this one could be `ne` by taking into account alignment
+check!(!, FOO as *const _, 1024);
-///////////////////////////////////////////////////////////////////////////////
-// If any of the below start compiling, make sure to add a `check` test for it.
-// These invocations exist as canaries so we don't forget to check that the
-// behaviour of `guaranteed_eq` and `guaranteed_ne` is still correct.
-// All of these try to obtain an out of bounds pointer in some manner. If we
-// can create out of bounds pointers, we can offset a pointer far enough that
-// at runtime it would be zero and at compile-time it would not be zero.
-
-const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
-
-const _: *const u8 =
- unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) };
-//~^ ERROR evaluation of constant value failed
-//~| out-of-bounds
-
-const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 };
-//~^ ERROR evaluation of constant value failed
-//~| unable to turn pointer into raw bytes
-
-const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 };
-//~^ ERROR evaluation of constant value failed
-//~| unable to turn pointer into raw bytes
+// When pointers go out-of-bounds, they *might* become null, so these comparions cannot work.
+check!(!, unsafe { (FOO as *const usize).wrapping_add(2) }, 0);
+check!(!, unsafe { (FOO as *const usize).wrapping_sub(1) }, 0);
diff --git a/tests/ui/consts/ptr_comparisons.stderr b/tests/ui/consts/ptr_comparisons.stderr
deleted file mode 100644
index fea924d12..000000000
--- a/tests/ui/consts/ptr_comparisons.stderr
+++ /dev/null
@@ -1,40 +0,0 @@
-error[E0080]: evaluation of constant value failed
- --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
- |
- = note: out-of-bounds pointer arithmetic: alloc3 has size $WORD, so pointer to $TWO_WORDS bytes starting at offset 0 is out-of-bounds
- |
-note: inside `ptr::const_ptr::<impl *const usize>::offset`
- --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
-note: inside `_`
- --> $DIR/ptr_comparisons.rs:50:34
- |
-LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0080]: evaluation of constant value failed
- --> $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[E0080]: evaluation of constant value failed
- --> $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
- |
- = 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/ptr_comparisons.rs:61:27
- |
-LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
- |
- = help: this code performed an operation that depends on the underlying bytes representing a pointer
- = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/ptr_is_null.rs b/tests/ui/consts/ptr_is_null.rs
index 8babb6858..43b9767db 100644
--- a/tests/ui/consts/ptr_is_null.rs
+++ b/tests/ui/consts/ptr_is_null.rs
@@ -2,6 +2,7 @@
// check-pass
#![feature(const_ptr_is_null)]
+#![allow(useless_ptr_null_checks)]
const FOO: &usize = &42;
diff --git a/tests/ui/consts/recursive-zst-static.default.stderr b/tests/ui/consts/recursive-zst-static.default.stderr
index d68960b09..d592b5aee 100644
--- a/tests/ui/consts/recursive-zst-static.default.stderr
+++ b/tests/ui/consts/recursive-zst-static.default.stderr
@@ -19,6 +19,7 @@ LL | | fn main() {
LL | | FOO
LL | | }
| |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/consts/recursive-zst-static.unleash.stderr b/tests/ui/consts/recursive-zst-static.unleash.stderr
index d68960b09..d592b5aee 100644
--- a/tests/ui/consts/recursive-zst-static.unleash.stderr
+++ b/tests/ui/consts/recursive-zst-static.unleash.stderr
@@ -19,6 +19,7 @@ LL | | fn main() {
LL | | FOO
LL | | }
| |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/consts/rustc-impl-const-stability.rs b/tests/ui/consts/rustc-impl-const-stability.rs
index a1a741e80..2b67c2f2c 100644
--- a/tests/ui/consts/rustc-impl-const-stability.rs
+++ b/tests/ui/consts/rustc-impl-const-stability.rs
@@ -2,7 +2,7 @@
#![crate_type = "lib"]
#![feature(staged_api)]
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#![stable(feature = "foo", since = "1.0.0")]
#[stable(feature = "potato", since = "1.27.0")]
diff --git a/tests/ui/consts/rustc-impl-const-stability.stderr b/tests/ui/consts/rustc-impl-const-stability.stderr
index e6930da71..ba8e6c155 100644
--- a/tests/ui/consts/rustc-impl-const-stability.stderr
+++ b/tests/ui/consts/rustc-impl-const-stability.stderr
@@ -7,5 +7,15 @@ LL | impl const Default for Data {
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change
-error: aborting due to previous error
+error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/rustc-impl-const-stability.rs:15:6
+ |
+LL | impl const Default for Data {
+ | ^^^^^ unconstrained const parameter
+ |
+ = note: expressions using a const parameter must map each value to a distinct output value
+ = note: proving the result of expressions other than the parameter are unique is not supported
+
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0207`.
diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.rs b/tests/ui/consts/unstable-const-fn-in-libcore.rs
index ca4ed8f0b..61e28117e 100644
--- a/tests/ui/consts/unstable-const-fn-in-libcore.rs
+++ b/tests/ui/consts/unstable-const-fn-in-libcore.rs
@@ -20,6 +20,7 @@ impl<T> Opt<T> {
match self {
Opt::Some(t) => t,
Opt::None => f(),
+ //~^ ERROR cannot call
}
}
}
diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr
index e5b00dd07..95d7b7e85 100644
--- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr
+++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr
@@ -1,3 +1,15 @@
+error[E0015]: cannot call non-const closure in constant functions
+ --> $DIR/unstable-const-fn-in-libcore.rs:22:26
+ |
+LL | Opt::None => f(),
+ | ^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+help: consider further restricting this bound
+ |
+LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const std::ops::FnOnce<()>>(self, f: F) -> T {
+ | +++++++++++++++++++++++++++++
+
error[E0493]: destructor of `F` cannot be evaluated at compile-time
--> $DIR/unstable-const-fn-in-libcore.rs:17:60
|
@@ -16,6 +28,7 @@ LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
LL | }
| - value is dropped here
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0493`.
+Some errors have detailed explanations: E0015, E0493.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/write-to-static-mut-in-static.stderr b/tests/ui/consts/write-to-static-mut-in-static.stderr
index 395b2d42f..5665e5643 100644
--- a/tests/ui/consts/write-to-static-mut-in-static.stderr
+++ b/tests/ui/consts/write-to-static-mut-in-static.stderr
@@ -27,6 +27,7 @@ LL | |
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to 2 previous errors
diff --git a/tests/ui/cross-crate/auxiliary/static_init_aux.rs b/tests/ui/cross-crate/auxiliary/static_init_aux.rs
index 3b664f436..5e172ef31 100644
--- a/tests/ui/cross-crate/auxiliary/static_init_aux.rs
+++ b/tests/ui/cross-crate/auxiliary/static_init_aux.rs
@@ -1,10 +1,14 @@
pub static V: &u32 = &X;
pub static F: fn() = f;
+pub static G: fn() = G0;
static X: u32 = 42;
+static G0: fn() = g;
pub fn v() -> *const u32 {
V
}
fn f() {}
+
+fn g() {}
diff --git a/tests/ui/cross-crate/static-init.rs b/tests/ui/cross-crate/static-init.rs
index 2e893c5d9..0b50c41fc 100644
--- a/tests/ui/cross-crate/static-init.rs
+++ b/tests/ui/cross-crate/static-init.rs
@@ -1,9 +1,11 @@
+// Regression test for #84455 and #115052.
// run-pass
// aux-build:static_init_aux.rs
extern crate static_init_aux as aux;
static V: &u32 = aux::V;
static F: fn() = aux::F;
+static G: fn() = aux::G;
fn v() -> *const u32 {
V
@@ -12,4 +14,5 @@ fn v() -> *const u32 {
fn main() {
assert_eq!(aux::v(), crate::v());
F();
+ G();
}
diff --git a/tests/ui/cycle-trait/cycle-trait-default-type-trait.stderr b/tests/ui/cycle-trait/cycle-trait-default-type-trait.stderr
index 9d715f494..3b66704d6 100644
--- a/tests/ui/cycle-trait/cycle-trait-default-type-trait.stderr
+++ b/tests/ui/cycle-trait/cycle-trait-default-type-trait.stderr
@@ -14,6 +14,7 @@ LL | | }
LL | |
LL | | fn main() { }
| |_____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr b/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr
index e2b2aac05..03cb5015a 100644
--- a/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr
+++ b/tests/ui/cycle-trait/cycle-trait-supertrait-direct.stderr
@@ -12,6 +12,7 @@ LL | / trait Chromosome: Chromosome {
LL | |
LL | | }
| |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr b/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr
index c903e1146..c7cc31435 100644
--- a/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr
+++ b/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr
@@ -15,6 +15,7 @@ note: cycle used when computing the super predicates of `A`
|
LL | trait A: B {
| ^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/cycle-trait/issue-12511.stderr b/tests/ui/cycle-trait/issue-12511.stderr
index 558aad109..f5e4f8347 100644
--- a/tests/ui/cycle-trait/issue-12511.stderr
+++ b/tests/ui/cycle-trait/issue-12511.stderr
@@ -17,6 +17,7 @@ LL | / trait T1 : T2 {
LL | |
LL | | }
| |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/debuginfo/sroa-fragment-debuginfo.rs b/tests/ui/debuginfo/sroa-fragment-debuginfo.rs
new file mode 100644
index 000000000..9c3c359e3
--- /dev/null
+++ b/tests/ui/debuginfo/sroa-fragment-debuginfo.rs
@@ -0,0 +1,31 @@
+// Verify that we do not trigger a LLVM assertion by creating zero-sized DWARF fragments.
+//
+// build-pass
+// compile-flags: -g -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates
+// compile-flags: -Cno-prepopulate-passes
+
+#![crate_type = "lib"]
+
+pub struct ExtraSlice<'input> {
+ slice: &'input [u8],
+ extra: u32,
+}
+
+#[no_mangle]
+pub fn extra(s: &[u8]) {
+ let slice = ExtraSlice { slice: s, extra: s.len() as u32 };
+}
+
+struct Zst;
+
+pub struct ZstSlice<'input> {
+ slice: &'input [u8],
+ extra: Zst,
+}
+
+#[no_mangle]
+pub fn zst(s: &[u8]) {
+ // The field `extra` is a ZST. The fragment for the field `slice` encompasses the whole
+ // variable, so is not a fragment. In that case, the variable must have no fragment.
+ let slice = ZstSlice { slice: s, extra: Zst };
+}
diff --git a/tests/ui/deriving/deriving-all-codegen.stdout b/tests/ui/deriving/deriving-all-codegen.stdout
index d6a2c80cc..6bfc859bf 100644
--- a/tests/ui/deriving/deriving-all-codegen.stdout
+++ b/tests/ui/deriving/deriving-all-codegen.stdout
@@ -798,14 +798,14 @@ impl ::core::marker::Copy for Enum0 { }
#[automatically_derived]
impl ::core::fmt::Debug for Enum0 {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
- unsafe { ::core::intrinsics::unreachable() }
+ match *self {}
}
}
#[automatically_derived]
impl ::core::hash::Hash for Enum0 {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
- unsafe { ::core::intrinsics::unreachable() }
+ match *self {}
}
}
#[automatically_derived]
@@ -813,9 +813,7 @@ impl ::core::marker::StructuralPartialEq for Enum0 { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Enum0 {
#[inline]
- fn eq(&self, other: &Enum0) -> bool {
- unsafe { ::core::intrinsics::unreachable() }
- }
+ fn eq(&self, other: &Enum0) -> bool { match *self {} }
}
#[automatically_derived]
impl ::core::marker::StructuralEq for Enum0 { }
@@ -831,15 +829,13 @@ impl ::core::cmp::PartialOrd for Enum0 {
#[inline]
fn partial_cmp(&self, other: &Enum0)
-> ::core::option::Option<::core::cmp::Ordering> {
- unsafe { ::core::intrinsics::unreachable() }
+ match *self {}
}
}
#[automatically_derived]
impl ::core::cmp::Ord for Enum0 {
#[inline]
- fn cmp(&self, other: &Enum0) -> ::core::cmp::Ordering {
- unsafe { ::core::intrinsics::unreachable() }
- }
+ fn cmp(&self, other: &Enum0) -> ::core::cmp::Ordering { match *self {} }
}
// A single-variant enum.
diff --git a/tests/ui/destructuring-assignment/slice_destructure_fail.rs b/tests/ui/destructuring-assignment/slice_destructure_fail.rs
index 33b09eb34..e5bb50030 100644
--- a/tests/ui/destructuring-assignment/slice_destructure_fail.rs
+++ b/tests/ui/destructuring-assignment/slice_destructure_fail.rs
@@ -1,6 +1,8 @@
fn main() {
- let (mut a, mut b);
- [a, .., b, ..] = [0, 1]; //~ ERROR `..` can only be used once per slice pattern
- [a, a, b] = [1, 2]; //~ ERROR pattern requires 3 elements but array has 2
- [_] = [1, 2]; //~ ERROR pattern requires 1 element but array has 2
+ let (mut a, mut b);
+ [a, .., b, ..] = [0, 1]; //~ ERROR `..` can only be used once per slice pattern
+ [a, a, b] = [1, 2];
+ //~^ ERROR pattern requires 3 elements but array has 2
+ [_] = [1, 2];
+ //~^ ERROR pattern requires 1 element but array has 2
}
diff --git a/tests/ui/destructuring-assignment/slice_destructure_fail.stderr b/tests/ui/destructuring-assignment/slice_destructure_fail.stderr
index 92c86feba..acf44ceb1 100644
--- a/tests/ui/destructuring-assignment/slice_destructure_fail.stderr
+++ b/tests/ui/destructuring-assignment/slice_destructure_fail.stderr
@@ -1,22 +1,22 @@
error: `..` can only be used once per slice pattern
- --> $DIR/slice_destructure_fail.rs:3:14
+ --> $DIR/slice_destructure_fail.rs:3:16
|
-LL | [a, .., b, ..] = [0, 1];
- | -- ^^ can only be used once per slice pattern
- | |
- | previously used here
+LL | [a, .., b, ..] = [0, 1];
+ | -- ^^ can only be used once per slice pattern
+ | |
+ | previously used here
error[E0527]: pattern requires 3 elements but array has 2
- --> $DIR/slice_destructure_fail.rs:4:3
+ --> $DIR/slice_destructure_fail.rs:4:5
|
-LL | [a, a, b] = [1, 2];
- | ^^^^^^^^^ expected 2 elements
+LL | [a, a, b] = [1, 2];
+ | ^^^^^^^^^ expected 2 elements
error[E0527]: pattern requires 1 element but array has 2
- --> $DIR/slice_destructure_fail.rs:5:3
+ --> $DIR/slice_destructure_fail.rs:6:5
|
-LL | [_] = [1, 2];
- | ^^^ expected 2 elements
+LL | [_] = [1, 2];
+ | ^^^ expected 2 elements
error: aborting due to 3 previous errors
diff --git a/tests/ui/diagnostic-flags/colored-session-opt-error.rs b/tests/ui/diagnostic-flags/colored-session-opt-error.rs
new file mode 100644
index 000000000..b9f47285c
--- /dev/null
+++ b/tests/ui/diagnostic-flags/colored-session-opt-error.rs
@@ -0,0 +1,4 @@
+// check-pass
+// ignore-windows
+// compile-flags: -Cremark=foo --error-format=human --color always
+fn main() {}
diff --git a/tests/ui/diagnostic-flags/colored-session-opt-error.stderr b/tests/ui/diagnostic-flags/colored-session-opt-error.stderr
new file mode 100644
index 000000000..ef79d5b0f
--- /dev/null
+++ b/tests/ui/diagnostic-flags/colored-session-opt-error.stderr
@@ -0,0 +1,2 @@
+warning: -C remark requires "-C debuginfo=n" to show source locations
+
diff --git a/tests/ui/diagnostic-width/E0271.stderr b/tests/ui/diagnostic-width/E0271.stderr
index 52f415037..c1b8b3207 100644
--- a/tests/ui/diagnostic-width/E0271.stderr
+++ b/tests/ui/diagnostic-width/E0271.stderr
@@ -15,8 +15,7 @@ note: expected this to be `Foo`
|
LL | type Error = E;
| ^
- = note: required for the cast from `Box<Result<..., ...>>` to `Box<(dyn Future<Error = Foo> + 'static)>`
- = note: the full name for the source type has been written to '$TEST_BUILD_DIR/diagnostic-width/E0271/E0271.long-type-hash.txt'
+ = note: required for the cast from `Box<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ()>>, ()>>, ()>>` to `Box<(dyn Future<Error = Foo> + 'static)>`
error: aborting due to previous error
diff --git a/tests/ui/diagnostic-width/long-E0308.rs b/tests/ui/diagnostic-width/long-E0308.rs
index f021f1029..0ae5e19ab 100644
--- a/tests/ui/diagnostic-width/long-E0308.rs
+++ b/tests/ui/diagnostic-width/long-E0308.rs
@@ -1,4 +1,4 @@
-// compile-flags: --diagnostic-width=60
+// compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
// normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
mod a {
diff --git a/tests/ui/diagnostic_namespace/auxiliary/proc-macro-helper.rs b/tests/ui/diagnostic_namespace/auxiliary/proc-macro-helper.rs
new file mode 100644
index 000000000..759c32c84
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/auxiliary/proc-macro-helper.rs
@@ -0,0 +1,12 @@
+// force-host
+// no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn diagnostic(i: TokenStream, _: TokenStream) -> TokenStream {
+ i
+}
diff --git a/tests/ui/diagnostic_namespace/can_use_the_diagnostic_name_in_other_places.rs b/tests/ui/diagnostic_namespace/can_use_the_diagnostic_name_in_other_places.rs
new file mode 100644
index 000000000..08b4d6877
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/can_use_the_diagnostic_name_in_other_places.rs
@@ -0,0 +1,13 @@
+// check-pass
+
+mod diagnostic {}
+
+macro_rules! diagnostic{
+ () => {}
+}
+
+#[allow(non_upper_case_globals)]
+const diagnostic: () = ();
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/existing_proc_macros.rs b/tests/ui/diagnostic_namespace/existing_proc_macros.rs
new file mode 100644
index 000000000..d6d1fb014
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/existing_proc_macros.rs
@@ -0,0 +1,24 @@
+#![feature(diagnostic_namespace)]
+// check-pass
+// aux-build:proc-macro-helper.rs
+
+extern crate proc_macro_helper;
+
+mod test1 {
+ use proc_macro_helper::diagnostic;
+
+ #[diagnostic]
+ struct Foo;
+
+}
+
+mod test2 {
+ mod diagnostic {
+ pub use proc_macro_helper::diagnostic as on_unimplemented;
+ }
+
+ #[diagnostic::on_unimplemented]
+ trait Foo {}
+}
+
+fn main() {}
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
new file mode 100644
index 000000000..a686ed9c8
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
@@ -0,0 +1,13 @@
+#[diagnostic::non_existing_attribute]
+//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
+//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+pub trait Bar {
+}
+
+#[diagnostic::non_existing_attribute(with_option = "foo")]
+//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
+//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+struct Foo;
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
new file mode 100644
index 000000000..45c95cbb3
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
@@ -0,0 +1,35 @@
+error[E0658]: `#[diagnostic]` attribute name space is experimental
+ --> $DIR/feature-gate-diagnostic_namespace.rs:1:3
+ |
+LL | #[diagnostic::non_existing_attribute]
+ | ^^^^^^^^^^
+ |
+ = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+ = help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
+
+error[E0658]: `#[diagnostic]` attribute name space is experimental
+ --> $DIR/feature-gate-diagnostic_namespace.rs:7:3
+ |
+LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
+ | ^^^^^^^^^^
+ |
+ = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+ = help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
+
+warning: unknown diagnostic attribute
+ --> $DIR/feature-gate-diagnostic_namespace.rs:1:15
+ |
+LL | #[diagnostic::non_existing_attribute]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+
+warning: unknown diagnostic attribute
+ --> $DIR/feature-gate-diagnostic_namespace.rs:7:15
+ |
+LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors; 2 warnings emitted
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.rs b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.rs
new file mode 100644
index 000000000..677bd5a73
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.rs
@@ -0,0 +1,13 @@
+#![feature(diagnostic_namespace)]
+// check-pass
+#[diagnostic::non_existing_attribute]
+//~^WARN unknown diagnostic attribute
+pub trait Bar {
+}
+
+#[diagnostic::non_existing_attribute(with_option = "foo")]
+//~^WARN unknown diagnostic attribute
+struct Foo;
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
new file mode 100644
index 000000000..4f9b7ba2b
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
@@ -0,0 +1,16 @@
+warning: unknown diagnostic attribute
+ --> $DIR/non_existing_attributes_accepted.rs:3:15
+ |
+LL | #[diagnostic::non_existing_attribute]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+
+warning: unknown diagnostic attribute
+ --> $DIR/non_existing_attributes_accepted.rs:8:15
+ |
+LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/diagnostic_namespace/requires_path.rs b/tests/ui/diagnostic_namespace/requires_path.rs
new file mode 100644
index 000000000..e8d6ca73a
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/requires_path.rs
@@ -0,0 +1,9 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic]
+//~^ERROR cannot find attribute `diagnostic` in this scope
+pub struct Bar;
+
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/requires_path.stderr b/tests/ui/diagnostic_namespace/requires_path.stderr
new file mode 100644
index 000000000..ce867621d
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/requires_path.stderr
@@ -0,0 +1,8 @@
+error: cannot find attribute `diagnostic` in this scope
+ --> $DIR/requires_path.rs:3:3
+ |
+LL | #[diagnostic]
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/did_you_mean/compatible-variants.stderr b/tests/ui/did_you_mean/compatible-variants.stderr
index 7b88d93ea..f2bbd8ced 100644
--- a/tests/ui/did_you_mean/compatible-variants.stderr
+++ b/tests/ui/did_you_mean/compatible-variants.stderr
@@ -61,6 +61,8 @@ LL + Some(())
error[E0308]: `?` operator has incompatible types
--> $DIR/compatible-variants.rs:35:5
|
+LL | fn d() -> Option<()> {
+ | ---------- expected `Option<()>` because of return type
LL | c()?
| ^^^^ expected `Option<()>`, found `()`
|
diff --git a/tests/ui/did_you_mean/issue-114112.rs b/tests/ui/did_you_mean/issue-114112.rs
new file mode 100644
index 000000000..0fde12ecd
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-114112.rs
@@ -0,0 +1,11 @@
+enum E<T> {
+ A(T)
+}
+
+fn main() {
+ match E::<i32>::A(1) {
+ E<i32>::A(v) => { //~ ERROR generic args in patterns require the turbofish syntax
+ println!("{v:?}");
+ },
+ }
+}
diff --git a/tests/ui/did_you_mean/issue-114112.stderr b/tests/ui/did_you_mean/issue-114112.stderr
new file mode 100644
index 000000000..d76b5f72e
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-114112.stderr
@@ -0,0 +1,13 @@
+error: generic args in patterns require the turbofish syntax
+ --> $DIR/issue-114112.rs:7:10
+ |
+LL | E<i32>::A(v) => {
+ | ^
+ |
+help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
+ |
+LL | E::<i32>::A(v) => {
+ | ++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/did_you_mean/issue-34126.stderr b/tests/ui/did_you_mean/issue-34126.stderr
index 5343acea4..9f7920706 100644
--- a/tests/ui/did_you_mean/issue-34126.stderr
+++ b/tests/ui/did_you_mean/issue-34126.stderr
@@ -19,9 +19,8 @@ error[E0502]: cannot borrow `self` as mutable because it is also borrowed as imm
--> $DIR/issue-34126.rs:6:18
|
LL | self.run(&mut self);
- | ---------^^^^^^^^^-
- | | | |
- | | | mutable borrow occurs here
+ | ---- --- ^^^^^^^^^ mutable borrow occurs here
+ | | |
| | immutable borrow later used by call
| immutable borrow occurs here
diff --git a/tests/ui/did_you_mean/issue-35937.stderr b/tests/ui/did_you_mean/issue-35937.stderr
index 1670da559..3081f2cec 100644
--- a/tests/ui/did_you_mean/issue-35937.stderr
+++ b/tests/ui/did_you_mean/issue-35937.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `f.v` as mutable, as `f` is not declared as mutable
--> $DIR/issue-35937.rs:7:5
|
LL | f.v.push("cat".to_string());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/did_you_mean/issue-38147-1.stderr b/tests/ui/did_you_mean/issue-38147-1.stderr
index 74fb1c2ec..790ad54a5 100644
--- a/tests/ui/did_you_mean/issue-38147-1.stderr
+++ b/tests/ui/did_you_mean/issue-38147-1.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc
--> $DIR/issue-38147-1.rs:17:9
|
LL | self.s.push('x');
- | ^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
diff --git a/tests/ui/did_you_mean/issue-38147-2.stderr b/tests/ui/did_you_mean/issue-38147-2.stderr
index 7c287a7db..d708be3d3 100644
--- a/tests/ui/did_you_mean/issue-38147-2.stderr
+++ b/tests/ui/did_you_mean/issue-38147-2.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc
--> $DIR/issue-38147-2.rs:9:9
|
LL | self.s.push('x');
- | ^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*self.longer_name` as mutable, as it is behind a `&
--> $DIR/issue-38147-2.rs:12:9
|
LL | self.longer_name.push(13);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/did_you_mean/issue-38147-3.stderr b/tests/ui/did_you_mean/issue-38147-3.stderr
index 94ffe17f1..5b32b5a78 100644
--- a/tests/ui/did_you_mean/issue-38147-3.stderr
+++ b/tests/ui/did_you_mean/issue-38147-3.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc
--> $DIR/issue-38147-3.rs:7:9
|
LL | self.s.push('x');
- | ^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/did_you_mean/issue-38147-4.stderr b/tests/ui/did_you_mean/issue-38147-4.stderr
index 43647fa56..38ab3c54d 100644
--- a/tests/ui/did_you_mean/issue-38147-4.stderr
+++ b/tests/ui/did_you_mean/issue-38147-4.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*f.s` as mutable, as it is behind a `&` reference
--> $DIR/issue-38147-4.rs:6:5
|
LL | f.s.push('x');
- | ^^^^^^^^^^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
diff --git a/tests/ui/did_you_mean/issue-40823.stderr b/tests/ui/did_you_mean/issue-40823.stderr
index ba94a5702..6f1ed3554 100644
--- a/tests/ui/did_you_mean/issue-40823.stderr
+++ b/tests/ui/did_you_mean/issue-40823.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*buf` as mutable, as it is behind a `&` reference
--> $DIR/issue-40823.rs:3:5
|
LL | buf.iter_mut();
- | ^^^^^^^^^^^^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
diff --git a/tests/ui/dropck/drop-with-active-borrows-1.stderr b/tests/ui/dropck/drop-with-active-borrows-1.stderr
index 4585b2297..0409ffa02 100644
--- a/tests/ui/dropck/drop-with-active-borrows-1.stderr
+++ b/tests/ui/dropck/drop-with-active-borrows-1.stderr
@@ -4,7 +4,7 @@ error[E0505]: cannot move out of `a` because it is borrowed
LL | let a = "".to_string();
| - binding `a` declared here
LL | let b: Vec<&str> = a.lines().collect();
- | --------- borrow of `a` occurs here
+ | - borrow of `a` occurs here
LL | drop(a);
| ^ move out of `a` occurs here
LL | for s in &b {
diff --git a/tests/ui/dropck/drop-with-active-borrows-2.stderr b/tests/ui/dropck/drop-with-active-borrows-2.stderr
index 24650dfac..ffec9306b 100644
--- a/tests/ui/dropck/drop-with-active-borrows-2.stderr
+++ b/tests/ui/dropck/drop-with-active-borrows-2.stderr
@@ -2,7 +2,7 @@ error[E0515]: cannot return value referencing local variable `raw_lines`
--> $DIR/drop-with-active-borrows-2.rs:3:5
|
LL | raw_lines.iter().map(|l| l.trim()).collect()
- | ----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| returns a value referencing data owned by the current function
| `raw_lines` is borrowed here
diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr
index 3b506c7e7..3ef11e2c0 100644
--- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr
+++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr
@@ -15,10 +15,10 @@ LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply
| ~~~~~~~~~~~~~~~~~~~~~~
error[E0277]: the trait bound `T: Copy` is not satisfied
- --> $DIR/explicit-drop-bounds.rs:32:13
+ --> $DIR/explicit-drop-bounds.rs:32:18
|
LL | fn drop(&mut self) {}
- | ^^^^^^^^^ the trait `Copy` is not implemented for `T`
+ | ^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18
diff --git a/tests/ui/dropck/explicit-drop-bounds.bad2.stderr b/tests/ui/dropck/explicit-drop-bounds.bad2.stderr
index 832af3e52..8138b86dd 100644
--- a/tests/ui/dropck/explicit-drop-bounds.bad2.stderr
+++ b/tests/ui/dropck/explicit-drop-bounds.bad2.stderr
@@ -15,10 +15,10 @@ LL | impl<T: std::marker::Copy> Drop for DropMe<T>
| +++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
- --> $DIR/explicit-drop-bounds.rs:40:13
+ --> $DIR/explicit-drop-bounds.rs:40:18
|
LL | fn drop(&mut self) {}
- | ^^^^^^^^^ the trait `Copy` is not implemented for `T`
+ | ^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18
diff --git a/tests/ui/dst/issue-113447.fixed b/tests/ui/dst/issue-113447.fixed
new file mode 100644
index 000000000..536f680f6
--- /dev/null
+++ b/tests/ui/dst/issue-113447.fixed
@@ -0,0 +1,25 @@
+// run-rustfix
+
+pub struct Bytes;
+
+impl Bytes {
+ pub fn as_slice(&self) -> &[u8] {
+ todo!()
+ }
+}
+
+impl PartialEq<[u8]> for Bytes {
+ fn eq(&self, other: &[u8]) -> bool {
+ self.as_slice() == other
+ }
+}
+
+impl PartialEq<Bytes> for &[u8] {
+ fn eq(&self, other: &Bytes) -> bool {
+ *other == **self
+ }
+}
+
+fn main() {
+ let _ = &[0u8] == &[0xAA][..]; //~ ERROR can't compare `&[u8; 1]` with `[{integer}; 1]`
+}
diff --git a/tests/ui/dst/issue-113447.rs b/tests/ui/dst/issue-113447.rs
new file mode 100644
index 000000000..c10a4f2ff
--- /dev/null
+++ b/tests/ui/dst/issue-113447.rs
@@ -0,0 +1,25 @@
+// run-rustfix
+
+pub struct Bytes;
+
+impl Bytes {
+ pub fn as_slice(&self) -> &[u8] {
+ todo!()
+ }
+}
+
+impl PartialEq<[u8]> for Bytes {
+ fn eq(&self, other: &[u8]) -> bool {
+ self.as_slice() == other
+ }
+}
+
+impl PartialEq<Bytes> for &[u8] {
+ fn eq(&self, other: &Bytes) -> bool {
+ *other == **self
+ }
+}
+
+fn main() {
+ let _ = &[0u8] == [0xAA]; //~ ERROR can't compare `&[u8; 1]` with `[{integer}; 1]`
+}
diff --git a/tests/ui/dst/issue-113447.stderr b/tests/ui/dst/issue-113447.stderr
new file mode 100644
index 000000000..240553a67
--- /dev/null
+++ b/tests/ui/dst/issue-113447.stderr
@@ -0,0 +1,25 @@
+error[E0277]: can't compare `&[u8; 1]` with `[{integer}; 1]`
+ --> $DIR/issue-113447.rs:24:20
+ |
+LL | let _ = &[0u8] == [0xAA];
+ | ^^ no implementation for `&[u8; 1] == [{integer}; 1]`
+ |
+ = help: the trait `PartialEq<[{integer}; 1]>` is not implemented for `&[u8; 1]`
+ = help: the following other types implement trait `PartialEq<Rhs>`:
+ <[A; N] as PartialEq<[B; N]>>
+ <[A; N] as PartialEq<[B]>>
+ <[A; N] as PartialEq<&[B]>>
+ <[A; N] as PartialEq<&mut [B]>>
+ <[T] as PartialEq<Vec<U, A>>>
+ <[A] as PartialEq<[B]>>
+ <[B] as PartialEq<[A; N]>>
+ <&[u8] as PartialEq<Bytes>>
+ and 4 others
+help: convert the array to a `&[u8]` slice instead
+ |
+LL | let _ = &[0u8] == &[0xAA][..];
+ | + ++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.rs b/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.rs
new file mode 100644
index 000000000..c6ef8379f
--- /dev/null
+++ b/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.rs
@@ -0,0 +1,13 @@
+trait Test {}
+impl Test for &[u8] {}
+
+fn needs_test<T: Test>() -> T {
+ panic!()
+}
+
+fn main() {
+ needs_test::<[u8; 1]>();
+ //~^ ERROR the trait bound
+ let x: [u8; 1] = needs_test();
+ //~^ ERROR the trait bound
+}
diff --git a/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.stderr b/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.stderr
new file mode 100644
index 000000000..6752a4844
--- /dev/null
+++ b/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.stderr
@@ -0,0 +1,29 @@
+error[E0277]: the trait bound `[u8; 1]: Test` is not satisfied
+ --> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:9:18
+ |
+LL | needs_test::<[u8; 1]>();
+ | ^^^^^^^ the trait `Test` is not implemented for `[u8; 1]`
+ |
+ = help: the trait `Test` is implemented for `&[u8]`
+note: required by a bound in `needs_test`
+ --> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:4:18
+ |
+LL | fn needs_test<T: Test>() -> T {
+ | ^^^^ required by this bound in `needs_test`
+
+error[E0277]: the trait bound `[u8; 1]: Test` is not satisfied
+ --> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:11:22
+ |
+LL | let x: [u8; 1] = needs_test();
+ | ^^^^^^^^^^ the trait `Test` is not implemented for `[u8; 1]`
+ |
+ = help: the trait `Test` is implemented for `&[u8]`
+note: required by a bound in `needs_test`
+ --> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:4:18
+ |
+LL | fn needs_test<T: Test>() -> T {
+ | ^^^^ required by this bound in `needs_test`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/dyn-star/llvm-old-style-ptrs.rs b/tests/ui/dyn-star/llvm-old-style-ptrs.rs
deleted file mode 100644
index d35519632..000000000
--- a/tests/ui/dyn-star/llvm-old-style-ptrs.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// run-pass
-// compile-flags: -Copt-level=0 -Cllvm-args=-opaque-pointers=0
-
-// (opaque-pointers flag is called force-opaque-pointers in LLVM 13...)
-// min-llvm-version: 14.0
-
-// This test can be removed once non-opaque pointers are gone from LLVM, maybe.
-
-#![feature(dyn_star, pointer_like_trait)]
-#![allow(incomplete_features)]
-
-use std::fmt::Debug;
-use std::marker::PointerLike;
-
-fn make_dyn_star<'a>(t: impl PointerLike + Debug + 'a) -> dyn* Debug + 'a {
- t as _
-}
-
-fn main() {
- println!("{:?}", make_dyn_star(Box::new(1i32)));
- println!("{:?}", make_dyn_star(2usize));
- println!("{:?}", make_dyn_star((3usize,)));
-}
diff --git a/tests/ui/dyn-star/param-env-region-infer.current.stderr b/tests/ui/dyn-star/param-env-region-infer.current.stderr
index 902053ecf..b982be451 100644
--- a/tests/ui/dyn-star/param-env-region-infer.current.stderr
+++ b/tests/ui/dyn-star/param-env-region-infer.current.stderr
@@ -1,5 +1,5 @@
error[E0282]: type annotations needed
- --> $DIR/param-env-region-infer.rs:18:10
+ --> $DIR/param-env-region-infer.rs:19:10
|
LL | t as _
| ^ cannot infer type
diff --git a/tests/ui/dyn-star/param-env-region-infer.next.stderr b/tests/ui/dyn-star/param-env-region-infer.next.stderr
deleted file mode 100644
index dd724a659..000000000
--- a/tests/ui/dyn-star/param-env-region-infer.next.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error[E0391]: cycle detected when computing type of `make_dyn_star::{opaque#0}`
- --> $DIR/param-env-region-infer.rs:16:60
- |
-LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires type-checking `make_dyn_star`...
- --> $DIR/param-env-region-infer.rs:16:1
- |
-LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which requires computing layout of `make_dyn_star::{opaque#0}`...
- = note: ...which requires normalizing `make_dyn_star::{opaque#0}`...
- = note: ...which again requires computing type of `make_dyn_star::{opaque#0}`, completing the cycle
-note: cycle used when checking item types in top-level module
- --> $DIR/param-env-region-infer.rs:10:1
- |
-LL | / #![feature(dyn_star, pointer_like_trait)]
-LL | | #![allow(incomplete_features)]
-LL | |
-LL | | use std::fmt::Debug;
-... |
-LL | |
-LL | | fn main() {}
- | |____________^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/dyn-star/param-env-region-infer.rs b/tests/ui/dyn-star/param-env-region-infer.rs
index 537473abc..50dec94d2 100644
--- a/tests/ui/dyn-star/param-env-region-infer.rs
+++ b/tests/ui/dyn-star/param-env-region-infer.rs
@@ -1,9 +1,10 @@
-// revisions: current next
-// Need `-Zdeduplicate-diagnostics=yes` because the number of cycle errors
-// emitted is for some horrible reason platform-specific.
-//[next] compile-flags: -Ztrait-solver=next -Zdeduplicate-diagnostics=yes
+// revisions: current
// incremental
+// FIXME(-Ztrait-solver=next): THis currently results in unstable query results:
+// `normalizes-to(opaque, opaque)` changes from `Maybe(Ambiguous)` to `Maybe(Overflow)`
+// once the hidden type of the opaque is already defined to be itself.
+
// checks that we don't ICE if there are region inference variables in the environment
// when computing `PointerLike` builtin candidates.
diff --git a/tests/ui/error-codes/E0161.base.stderr b/tests/ui/error-codes/E0161.base.stderr
index 15d98b657..ae82e6702 100644
--- a/tests/ui/error-codes/E0161.base.stderr
+++ b/tests/ui/error-codes/E0161.base.stderr
@@ -2,7 +2,7 @@ error[E0161]: cannot move a value of type `dyn Bar`
--> $DIR/E0161.rs:16:5
|
LL | x.f();
- | ^^^^^ the size of `dyn Bar` cannot be statically determined
+ | ^ the size of `dyn Bar` cannot be statically determined
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0275.stderr b/tests/ui/error-codes/E0275.stderr
index 03c37d6f0..c702c3790 100644
--- a/tests/ui/error-codes/E0275.stderr
+++ b/tests/ui/error-codes/E0275.stderr
@@ -5,12 +5,11 @@ LL | impl<T> Foo for T where Bar<T>: Foo {}
| ^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`)
-note: required for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<...>>>>>>>>>>>>>>>>>>>>>` to implement `Foo`
+note: required for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Foo`
--> $DIR/E0275.rs:6:9
|
LL | impl<T> Foo for T where Bar<T>: Foo {}
| ^^^ ^ --- unsatisfied trait bound introduced here
- = note: the full type name has been written to '$TEST_BUILD_DIR/error-codes/E0275/E0275.long-type-hash.txt'
= note: 126 redundant requirements hidden
= note: required for `Bar<T>` to implement `Foo`
diff --git a/tests/ui/error-codes/E0283.stderr b/tests/ui/error-codes/E0283.stderr
index 89e634a70..fa8d4b6e0 100644
--- a/tests/ui/error-codes/E0283.stderr
+++ b/tests/ui/error-codes/E0283.stderr
@@ -7,7 +7,7 @@ LL | fn create() -> u32;
LL | let cont: u32 = Generator::create();
| ^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
-help: use a fully-qualified path to a specific available implementation (2 found)
+help: use a fully-qualified path to a specific available implementation
|
LL | let cont: u32 = </* self type */ as Generator>::create();
| +++++++++++++++++++ +
diff --git a/tests/ui/error-codes/E0499.stderr b/tests/ui/error-codes/E0499.stderr
index af5a1e186..d56baf722 100644
--- a/tests/ui/error-codes/E0499.stderr
+++ b/tests/ui/error-codes/E0499.stderr
@@ -7,7 +7,7 @@ LL | let mut a = &mut i;
| ^^^^^^ second mutable borrow occurs here
LL | a.use_mut();
LL | x.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0502.stderr b/tests/ui/error-codes/E0502.stderr
index 94cc89754..cade6d718 100644
--- a/tests/ui/error-codes/E0502.stderr
+++ b/tests/ui/error-codes/E0502.stderr
@@ -6,7 +6,7 @@ LL | let ref y = a;
LL | bar(a);
| ^^^^^^ mutable borrow occurs here
LL | y.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0503.stderr b/tests/ui/error-codes/E0503.stderr
index 2f02e3b1a..275abb23f 100644
--- a/tests/ui/error-codes/E0503.stderr
+++ b/tests/ui/error-codes/E0503.stderr
@@ -6,7 +6,7 @@ LL | let _borrow = &mut value;
LL | let _sum = value + 1;
| ^^^^^ use of borrowed `value`
LL | _borrow.use_mut();
- | ----------------- borrow later used here
+ | ------- borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0505.stderr b/tests/ui/error-codes/E0505.stderr
index 2ecb4a75c..1a85e0317 100644
--- a/tests/ui/error-codes/E0505.stderr
+++ b/tests/ui/error-codes/E0505.stderr
@@ -9,7 +9,7 @@ LL | let _ref_to_val: &Value = &x;
LL | eat(x);
| ^ move out of `x` occurs here
LL | _ref_to_val.use_ref();
- | --------------------- borrow later used here
+ | ----------- borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0507.stderr b/tests/ui/error-codes/E0507.stderr
index 03630f389..089939516 100644
--- a/tests/ui/error-codes/E0507.stderr
+++ b/tests/ui/error-codes/E0507.stderr
@@ -2,9 +2,8 @@ error[E0507]: cannot move out of dereference of `Ref<'_, TheDarkKnight>`
--> $DIR/E0507.rs:12:5
|
LL | x.borrow().nothing_is_true();
- | ^^^^^^^^^^^-----------------
- | | |
- | | value moved due to this method call
+ | ^^^^^^^^^^ ----------------- value moved due to this method call
+ | |
| move occurs because value has type `TheDarkKnight`, which does not implement the `Copy` trait
|
note: `TheDarkKnight::nothing_is_true` takes ownership of the receiver `self`, which moves value
diff --git a/tests/ui/error-codes/E0608.stderr b/tests/ui/error-codes/E0608.stderr
index 3aec50993..f23f9977b 100644
--- a/tests/ui/error-codes/E0608.stderr
+++ b/tests/ui/error-codes/E0608.stderr
@@ -1,8 +1,8 @@
error[E0608]: cannot index into a value of type `u8`
- --> $DIR/E0608.rs:2:5
+ --> $DIR/E0608.rs:2:8
|
LL | 0u8[2];
- | ^^^^^^
+ | ^^^
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0790.stderr b/tests/ui/error-codes/E0790.stderr
index 724876628..f559abae3 100644
--- a/tests/ui/error-codes/E0790.stderr
+++ b/tests/ui/error-codes/E0790.stderr
@@ -63,7 +63,7 @@ LL | fn my_fn();
LL | MyTrait2::my_fn();
| ^^^^^^^^^^^^^^^ cannot call associated function of trait
|
-help: use a fully-qualified path to a specific available implementation (2 found)
+help: use a fully-qualified path to a specific available implementation
|
LL | </* self type */ as MyTrait2>::my_fn();
| +++++++++++++++++++ +
diff --git a/tests/ui/extern/extern-thiscall.rs b/tests/ui/extern/extern-thiscall.rs
index 717df57ec..c491c156a 100644
--- a/tests/ui/extern/extern-thiscall.rs
+++ b/tests/ui/extern/extern-thiscall.rs
@@ -1,8 +1,6 @@
// run-pass
// only-x86
-#![feature(abi_thiscall)]
-
trait A {
extern "thiscall" fn test1(i: i32);
}
diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs
new file mode 100644
index 000000000..7755a46da
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs
@@ -0,0 +1,33 @@
+// needs-llvm-components: riscv
+// compile-flags: --target=riscv32imc-unknown-none-elf --crate-type=rlib
+#![no_core]
+#![feature(no_core, lang_items)]
+#[lang = "sized"]
+trait Sized {}
+
+// Test that the riscv interrupt ABIs cannot be used when riscv_interrupt
+// feature gate is not used.
+
+extern "riscv-interrupt-m" fn f() {}
+//~^ ERROR riscv-interrupt ABIs are experimental
+extern "riscv-interrupt-s" fn f_s() {}
+//~^ ERROR riscv-interrupt ABIs are experimental
+
+trait T {
+ extern "riscv-interrupt-m" fn m();
+ //~^ ERROR riscv-interrupt ABIs are experimental
+}
+
+struct S;
+impl T for S {
+ extern "riscv-interrupt-m" fn m() {}
+ //~^ ERROR riscv-interrupt ABIs are experimental
+}
+
+impl S {
+ extern "riscv-interrupt-m" fn im() {}
+ //~^ ERROR riscv-interrupt ABIs are experimental
+}
+
+type TA = extern "riscv-interrupt-m" fn();
+//~^ ERROR riscv-interrupt ABIs are experimental
diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr
new file mode 100644
index 000000000..60c7fa0ea
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr
@@ -0,0 +1,57 @@
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:11:8
+ |
+LL | extern "riscv-interrupt-m" fn f() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:13:8
+ |
+LL | extern "riscv-interrupt-s" fn f_s() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:17:12
+ |
+LL | extern "riscv-interrupt-m" fn m();
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:23:12
+ |
+LL | extern "riscv-interrupt-m" fn m() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:28:12
+ |
+LL | extern "riscv-interrupt-m" fn im() {}
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error[E0658]: riscv-interrupt ABIs are experimental and subject to change
+ --> $DIR/feature-gate-abi-riscv-interrupt.rs:32:18
+ |
+LL | type TA = extern "riscv-interrupt-m" fn();
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #111889 <https://github.com/rust-lang/rust/issues/111889> for more information
+ = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-cfg-relocation-model.rs b/tests/ui/feature-gates/feature-gate-cfg-relocation-model.rs
new file mode 100644
index 000000000..7529014ec
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-cfg-relocation-model.rs
@@ -0,0 +1,4 @@
+#[cfg(relocation_model = "pic")] //~ ERROR
+fn _foo() {}
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-cfg-relocation-model.stderr b/tests/ui/feature-gates/feature-gate-cfg-relocation-model.stderr
new file mode 100644
index 000000000..592768a42
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-cfg-relocation-model.stderr
@@ -0,0 +1,12 @@
+error[E0658]: `cfg(relocation_model)` is experimental and subject to change
+ --> $DIR/feature-gate-cfg-relocation-model.rs:1:7
+ |
+LL | #[cfg(relocation_model = "pic")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #114929 <https://github.com/rust-lang/rust/issues/114929> for more information
+ = help: add `#![feature(cfg_relocation_model)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
index 3bae23a4a..7de67da9b 100644
--- a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
+++ b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
@@ -13,6 +13,15 @@ LL | let _: u8 = ::core::default::Default();
| ^^^^ maybe a missing crate `core`?
|
= help: consider adding `extern crate core` to use the `core` crate
+help: consider importing this module
+ |
+LL + use std::default;
+ |
+help: if you import `default`, refer to it directly
+ |
+LL - let _: u8 = ::core::default::Default();
+LL + let _: u8 = default::Default();
+ |
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.rs b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
index 7e8c1eb95..ae12495b5 100644
--- a/tests/ui/feature-gates/feature-gate-return_type_notation.rs
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
@@ -1,10 +1,7 @@
// edition: 2021
-// revisions: cfg_current cfg_next no_current no_next
-// [cfg_next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// [no_next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
+// revisions: cfg no
-// [no_current] check-pass
-// [no_next] check-pass
+// [no] check-pass
// Since we're not adding new syntax, `cfg`'d out RTN must pass.
#![feature(async_fn_in_trait)]
@@ -13,17 +10,12 @@ trait Trait {
async fn m();
}
-#[cfg(any(cfg_current, cfg_next))]
+#[cfg(cfg)]
fn foo<T: Trait<m(): Send>>() {}
-//[cfg_current]~^ ERROR return type notation is experimental
-//[cfg_current]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
-//[cfg_current]~| ERROR associated type `m` not found for `Trait`
-//[cfg_next]~^^^^ ERROR return type notation is experimental
-//[cfg_next]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
-//[cfg_next]~| ERROR associated type `m` not found for `Trait`
-//[no_current]~^^^^^^^ WARN return type notation is experimental
-//[no_current]~| WARN unstable syntax can change at any point in the future, causing a hard error!
-//[no_next]~^^^^^^^^^ WARN return type notation is experimental
-//[no_next]~| WARN unstable syntax can change at any point in the future, causing a hard error!
+//[cfg]~^ ERROR return type notation is experimental
+//[cfg]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
+//[cfg]~| ERROR associated type `m` not found for `Trait`
+//[no]~^^^^ WARN return type notation is experimental
+//[no]~| WARN unstable syntax can change at any point in the future, causing a hard error!
fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-thiscall.rs b/tests/ui/feature-gates/feature-gate-thiscall.rs
deleted file mode 100644
index 97a732bcf..000000000
--- a/tests/ui/feature-gates/feature-gate-thiscall.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// gate-test-abi_thiscall
-// needs-llvm-components: x86
-// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib
-#![no_core]
-#![feature(no_core, lang_items)]
-#[lang="sized"]
-trait Sized { }
-
-// Test that the "thiscall" ABI is feature-gated, and cannot be used when
-// the `abi_thiscall` feature gate is not used.
-
-extern "thiscall-unwind" fn fu() {} //~ ERROR thiscall-unwind ABI is experimental
-extern "thiscall" fn f() {} //~ ERROR thiscall is experimental
-
-trait T {
- extern "thiscall" fn m(); //~ ERROR thiscall is experimental
- extern "thiscall-unwind" fn mu(); //~ ERROR thiscall-unwind ABI is experimental
-
- extern "thiscall" fn dm() {} //~ ERROR thiscall is experimental
- extern "thiscall-unwind" fn dmu() {} //~ ERROR thiscall-unwind ABI is experimental
-}
-
-struct S;
-impl T for S {
- extern "thiscall" fn m() {} //~ ERROR thiscall is experimental
- extern "thiscall-unwind" fn mu() {} //~ ERROR thiscall-unwind ABI is experimental
-}
-
-impl S {
- extern "thiscall" fn im() {} //~ ERROR thiscall is experimental
- extern "thiscall-unwind" fn imu() {} //~ ERROR thiscall-unwind ABI is experimental
-}
-
-type TA = extern "thiscall" fn(); //~ ERROR thiscall is experimental
-type TAU = extern "thiscall-unwind" fn(); //~ ERROR thiscall-unwind ABI is experimental
-
-extern "thiscall" {} //~ ERROR thiscall is experimental
-extern "thiscall-unwind" {} //~ ERROR thiscall-unwind ABI is experimental
diff --git a/tests/ui/feature-gates/feature-gate-thiscall.stderr b/tests/ui/feature-gates/feature-gate-thiscall.stderr
deleted file mode 100644
index 346e45952..000000000
--- a/tests/ui/feature-gates/feature-gate-thiscall.stderr
+++ /dev/null
@@ -1,115 +0,0 @@
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:12:8
- |
-LL | extern "thiscall-unwind" fn fu() {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:13:8
- |
-LL | extern "thiscall" fn f() {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:16:12
- |
-LL | extern "thiscall" fn m();
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:17:12
- |
-LL | extern "thiscall-unwind" fn mu();
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:19:12
- |
-LL | extern "thiscall" fn dm() {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:20:12
- |
-LL | extern "thiscall-unwind" fn dmu() {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:25:12
- |
-LL | extern "thiscall" fn m() {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:26:12
- |
-LL | extern "thiscall-unwind" fn mu() {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:30:12
- |
-LL | extern "thiscall" fn im() {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:31:12
- |
-LL | extern "thiscall-unwind" fn imu() {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:34:18
- |
-LL | type TA = extern "thiscall" fn();
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:35:19
- |
-LL | type TAU = extern "thiscall-unwind" fn();
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:37:8
- |
-LL | extern "thiscall" {}
- | ^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` to the crate attributes to enable
-
-error[E0658]: thiscall-unwind ABI is experimental and subject to change
- --> $DIR/feature-gate-thiscall.rs:38:8
- |
-LL | extern "thiscall-unwind" {}
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(abi_thiscall)]` 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/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
index dce94c9ea..134ea25b7 100644
--- a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
+++ b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
@@ -1,7 +1,7 @@
// edition:2018
-#![forbid(incomplete_features, unsafe_code)]
+#![forbid(internal_features, unsafe_code)]
#![feature(unsafe_pin_internals)]
-//~^ ERROR the feature `unsafe_pin_internals` is incomplete and may not be safe to use
+//~^ ERROR the feature `unsafe_pin_internals` is internal to the compiler or standard library
use core::{marker::PhantomPinned, pin::Pin};
diff --git a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr
index 4d0c931b4..39afbf2db 100644
--- a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr
+++ b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr
@@ -1,14 +1,15 @@
-error: the feature `unsafe_pin_internals` is incomplete and may not be safe to use and/or cause compiler crashes
+error: the feature `unsafe_pin_internals` is internal to the compiler or standard library
--> $DIR/feature-gate-unsafe_pin_internals.rs:3:12
|
LL | #![feature(unsafe_pin_internals)]
| ^^^^^^^^^^^^^^^^^^^^
|
+ = note: using it is strongly discouraged
note: the lint level is defined here
--> $DIR/feature-gate-unsafe_pin_internals.rs:2:11
|
-LL | #![forbid(incomplete_features, unsafe_code)]
- | ^^^^^^^^^^^^^^^^^^^
+LL | #![forbid(internal_features, unsafe_code)]
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/feature-gates/print-with-path.cfg.stderr b/tests/ui/feature-gates/print-with-path.cfg.stderr
new file mode 100644
index 000000000..a6c51baa3
--- /dev/null
+++ b/tests/ui/feature-gates/print-with-path.cfg.stderr
@@ -0,0 +1,2 @@
+error: the `-Z unstable-options` flag must also be passed to enable the path print option
+
diff --git a/tests/ui/feature-gates/print-with-path.rs b/tests/ui/feature-gates/print-with-path.rs
new file mode 100644
index 000000000..f929c14c2
--- /dev/null
+++ b/tests/ui/feature-gates/print-with-path.rs
@@ -0,0 +1,7 @@
+// check-fail
+// revisions: cfg target-features target-cpus
+// [cfg]compile-flags: --print cfg=cfg.txt
+// [target-cpus]compile-flags: --print target-cpu=target_cpu.txt
+// [target-features]compile-flags: --print target-features=target_features.txt
+
+fn main() {}
diff --git a/tests/ui/feature-gates/print-with-path.target-cpus.stderr b/tests/ui/feature-gates/print-with-path.target-cpus.stderr
new file mode 100644
index 000000000..a6c51baa3
--- /dev/null
+++ b/tests/ui/feature-gates/print-with-path.target-cpus.stderr
@@ -0,0 +1,2 @@
+error: the `-Z unstable-options` flag must also be passed to enable the path print option
+
diff --git a/tests/ui/feature-gates/print-with-path.target-features.stderr b/tests/ui/feature-gates/print-with-path.target-features.stderr
new file mode 100644
index 000000000..a6c51baa3
--- /dev/null
+++ b/tests/ui/feature-gates/print-with-path.target-features.stderr
@@ -0,0 +1,2 @@
+error: the `-Z unstable-options` flag must also be passed to enable the path print option
+
diff --git a/tests/ui/fmt/closing-brace-as-fill.rs b/tests/ui/fmt/closing-brace-as-fill.rs
new file mode 100644
index 000000000..6ad257f94
--- /dev/null
+++ b/tests/ui/fmt/closing-brace-as-fill.rs
@@ -0,0 +1,8 @@
+// issue: 112732
+
+// `}` is typoed since it is interpreted as a fill character rather than a closing bracket
+
+fn main() {
+ println!("Hello, world! {0:}<3", 2);
+ //~^ ERROR invalid format string: expected `'}'` but string was terminated
+}
diff --git a/tests/ui/fmt/closing-brace-as-fill.stderr b/tests/ui/fmt/closing-brace-as-fill.stderr
new file mode 100644
index 000000000..aa1e5aff6
--- /dev/null
+++ b/tests/ui/fmt/closing-brace-as-fill.stderr
@@ -0,0 +1,12 @@
+error: invalid format string: expected `'}'` but string was terminated
+ --> $DIR/closing-brace-as-fill.rs:6:35
+ |
+LL | println!("Hello, world! {0:}<3", 2);
+ | - ^ expected `'}'` in format string
+ | |
+ | this is not interpreted as a formatting closing brace
+ |
+ = note: the character `'}'` is interpreted as a fill character because of the `:` that precedes it
+
+error: aborting due to previous error
+
diff --git a/tests/ui/fmt/format-string-error-2.stderr b/tests/ui/fmt/format-string-error-2.stderr
index 76cdfbb93..dfd24bf60 100644
--- a/tests/ui/fmt/format-string-error-2.stderr
+++ b/tests/ui/fmt/format-string-error-2.stderr
@@ -10,7 +10,7 @@ error: invalid format string: expected `'}'`, found `'a'`
LL | format!("{
| - because of this opening brace
LL | a");
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
@@ -21,7 +21,7 @@ LL | format!("{ \
| - because of this opening brace
LL | \
LL | b");
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
@@ -29,7 +29,7 @@ error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error-2.rs:11:18
|
LL | format!(r#"{ \
- | - ^ expected `}` in format string
+ | - ^ expected `'}'` in format string
| |
| because of this opening brace
|
@@ -39,7 +39,7 @@ error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error-2.rs:15:18
|
LL | format!(r#"{ \n
- | - ^ expected `}` in format string
+ | - ^ expected `'}'` in format string
| |
| because of this opening brace
|
@@ -52,7 +52,7 @@ LL | format!("{ \n
| - because of this opening brace
LL | \n
LL | e");
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
@@ -62,7 +62,7 @@ error: invalid format string: expected `'}'`, found `'a'`
LL | {
| - because of this opening brace
LL | a");
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
@@ -72,7 +72,7 @@ error: invalid format string: expected `'}'`, found `'a'`
LL | {
| - because of this opening brace
LL | a
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
@@ -83,7 +83,7 @@ LL | { \
| - because of this opening brace
LL | \
LL | b");
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
@@ -94,7 +94,7 @@ LL | { \
| - because of this opening brace
LL | \
LL | b \
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
@@ -102,7 +102,7 @@ error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error-2.rs:45:8
|
LL | raw { \
- | - ^ expected `}` in format string
+ | - ^ expected `'}'` in format string
| |
| because of this opening brace
|
@@ -112,7 +112,7 @@ error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error-2.rs:50:8
|
LL | raw { \n
- | - ^ expected `}` in format string
+ | - ^ expected `'}'` in format string
| |
| because of this opening brace
|
@@ -125,7 +125,7 @@ LL | { \n
| - because of this opening brace
LL | \n
LL | e");
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
@@ -135,7 +135,7 @@ error: invalid format string: expected `'}'`, found `'a'`
LL | {
| - because of this opening brace
LL | asdf}
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
diff --git a/tests/ui/fmt/format-string-error.stderr b/tests/ui/fmt/format-string-error.stderr
index 8a32c2254..37a181e6f 100644
--- a/tests/ui/fmt/format-string-error.stderr
+++ b/tests/ui/fmt/format-string-error.stderr
@@ -62,7 +62,7 @@ error: invalid format string: expected `'}'`, found `'\'`
--> $DIR/format-string-error.rs:19:23
|
LL | let _ = format!("{\}");
- | -^ expected `}` in format string
+ | -^ expected `'}'` in format string
| |
| because of this opening brace
|
diff --git a/tests/ui/fmt/format-string-wrong-order.stderr b/tests/ui/fmt/format-string-wrong-order.stderr
index 461af354a..0a2e04026 100644
--- a/tests/ui/fmt/format-string-wrong-order.stderr
+++ b/tests/ui/fmt/format-string-wrong-order.stderr
@@ -26,7 +26,7 @@ error: invalid format string: expected `'}'`, found `'?'`
--> $DIR/format-string-wrong-order.rs:9:15
|
LL | format!("{??}", bar);
- | -^ expected `}` in format string
+ | -^ expected `'}'` in format string
| |
| because of this opening brace
|
@@ -36,7 +36,7 @@ error: invalid format string: expected `'}'`, found `'?'`
--> $DIR/format-string-wrong-order.rs:11:15
|
LL | format!("{?;bar}");
- | -^ expected `}` in format string
+ | -^ expected `'}'` in format string
| |
| because of this opening brace
|
diff --git a/tests/ui/fmt/ifmt-bad-arg.stderr b/tests/ui/fmt/ifmt-bad-arg.stderr
index ed008c454..09ce3dca4 100644
--- a/tests/ui/fmt/ifmt-bad-arg.stderr
+++ b/tests/ui/fmt/ifmt-bad-arg.stderr
@@ -178,7 +178,7 @@ error: invalid format string: expected `'}'`, found `'t'`
LL | ninth number: {
| - because of this opening brace
LL | tenth number: {}",
- | ^ expected `}` in format string
+ | ^ expected `'}'` in format string
|
= note: if you intended to print `{`, you can escape it using `{{`
diff --git a/tests/ui/fmt/suggest-inline-args.rs b/tests/ui/fmt/suggest-inline-args.rs
new file mode 100644
index 000000000..515335ed9
--- /dev/null
+++ b/tests/ui/fmt/suggest-inline-args.rs
@@ -0,0 +1,28 @@
+mod foo {
+ pub fn bar() -> i32 {
+ 1
+ }
+}
+
+fn bar() -> i32 {
+ 2
+}
+
+fn main() {
+ let stderr = 3;
+ eprintln!({stderr});
+ //~^ ERROR format argument must be a string literal
+ //~| HELP quote your inlined format argument to use as string literal
+ eprintln!({1});
+ //~^ ERROR format argument must be a string literal
+ //~| HELP you might be missing a string literal to format with
+ eprintln!({foo::bar()});
+ //~^ ERROR format argument must be a string literal
+ //~| HELP you might be missing a string literal to format with
+ eprintln!({bar()});
+ //~^ ERROR format argument must be a string literal
+ //~| HELP you might be missing a string literal to format with
+ eprintln!({1; 2});
+ //~^ ERROR format argument must be a string literal
+ //~| HELP you might be missing a string literal to format with
+}
diff --git a/tests/ui/fmt/suggest-inline-args.stderr b/tests/ui/fmt/suggest-inline-args.stderr
new file mode 100644
index 000000000..cf70568cf
--- /dev/null
+++ b/tests/ui/fmt/suggest-inline-args.stderr
@@ -0,0 +1,57 @@
+error: format argument must be a string literal
+ --> $DIR/suggest-inline-args.rs:13:15
+ |
+LL | eprintln!({stderr});
+ | ^^^^^^^^
+ |
+help: quote your inlined format argument to use as string literal
+ |
+LL | eprintln!("{stderr}");
+ | + +
+
+error: format argument must be a string literal
+ --> $DIR/suggest-inline-args.rs:16:15
+ |
+LL | eprintln!({1});
+ | ^^^
+ |
+help: you might be missing a string literal to format with
+ |
+LL | eprintln!("{}", {1});
+ | +++++
+
+error: format argument must be a string literal
+ --> $DIR/suggest-inline-args.rs:19:15
+ |
+LL | eprintln!({foo::bar()});
+ | ^^^^^^^^^^^^
+ |
+help: you might be missing a string literal to format with
+ |
+LL | eprintln!("{}", {foo::bar()});
+ | +++++
+
+error: format argument must be a string literal
+ --> $DIR/suggest-inline-args.rs:22:15
+ |
+LL | eprintln!({bar()});
+ | ^^^^^^^
+ |
+help: you might be missing a string literal to format with
+ |
+LL | eprintln!("{}", {bar()});
+ | +++++
+
+error: format argument must be a string literal
+ --> $DIR/suggest-inline-args.rs:25:15
+ |
+LL | eprintln!({1; 2});
+ | ^^^^^^
+ |
+help: you might be missing a string literal to format with
+ |
+LL | eprintln!("{}", {1; 2});
+ | +++++
+
+error: aborting due to 5 previous errors
+
diff --git a/tests/ui/for/issue-20605.next.stderr b/tests/ui/for/issue-20605.next.stderr
index d55efedfc..0955efdbb 100644
--- a/tests/ui/for/issue-20605.next.stderr
+++ b/tests/ui/for/issue-20605.next.stderr
@@ -34,12 +34,6 @@ error: the type `&mut <dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIte
LL | for item in *things { *item = 0 }
| ^^^^^^^
-error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
- --> $DIR/issue-20605.rs:5:27
- |
-LL | for item in *things { *item = 0 }
- | ^^^^^
-
error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
--> $DIR/issue-20605.rs:5:9
|
@@ -66,6 +60,12 @@ LL | for item in *things { *item = 0 }
note: required by a bound in `None`
--> $SRC_DIR/core/src/option.rs:LL:COL
+error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
+ --> $DIR/issue-20605.rs:5:27
+ |
+LL | for item in *things { *item = 0 }
+ | ^^^^^
+
error: aborting due to 9 previous errors
Some errors have detailed explanations: E0277, E0614.
diff --git a/tests/ui/generator/auto-trait-regions.rs b/tests/ui/generator/auto-trait-regions.rs
index fd13e4131..350f3cc34 100644
--- a/tests/ui/generator/auto-trait-regions.rs
+++ b/tests/ui/generator/auto-trait-regions.rs
@@ -26,7 +26,7 @@ fn assert_foo<T: Foo>(f: T) {}
fn main() {
// Make sure 'static is erased for generator interiors so we can't match it in trait selection
let x: &'static _ = &OnlyFooIfStaticRef(No);
- let gen = || {
+ let gen = move || {
let x = x;
yield;
assert_foo(x);
@@ -36,7 +36,7 @@ fn main() {
// Allow impls which matches any lifetime
let x = &OnlyFooIfRef(No);
- let gen = || {
+ let gen = move || {
let x = x;
yield;
assert_foo(x);
@@ -44,7 +44,7 @@ fn main() {
assert_foo(gen); // ok
// Disallow impls which relates lifetimes in the generator interior
- let gen = || {
+ let gen = move || {
let a = A(&mut true, &mut true, No);
//~^ temporary value dropped while borrowed
//~| temporary value dropped while borrowed
diff --git a/tests/ui/generator/dropck-resume.stderr b/tests/ui/generator/dropck-resume.stderr
index b0756eb55..ecf92e7e3 100644
--- a/tests/ui/generator/dropck-resume.stderr
+++ b/tests/ui/generator/dropck-resume.stderr
@@ -5,7 +5,7 @@ LL | let z = &mut y;
| ------ mutable borrow occurs here
...
LL | r = y.as_ref().unwrap();
- | ^^^^^^^^^^ immutable borrow occurs here
+ | ^ immutable borrow occurs here
LL |
LL | }
| - mutable borrow might be used here, when `g` is dropped and runs the destructor for generator
diff --git a/tests/ui/generator/dropck.stderr b/tests/ui/generator/dropck.stderr
index b9a3a124a..246ac99f8 100644
--- a/tests/ui/generator/dropck.stderr
+++ b/tests/ui/generator/dropck.stderr
@@ -5,7 +5,7 @@ LL | let (mut gen, cell);
| ---- binding `cell` declared here
LL | cell = Box::new(RefCell::new(0));
LL | let ref_ = Box::leak(Box::new(Some(cell.borrow_mut())));
- | ^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
+ | ^^^^ borrowed value does not live long enough
...
LL | }
| -
diff --git a/tests/ui/generator/issue-113279.rs b/tests/ui/generator/issue-113279.rs
new file mode 100644
index 000000000..f69f804b7
--- /dev/null
+++ b/tests/ui/generator/issue-113279.rs
@@ -0,0 +1,27 @@
+#![feature(generators)]
+
+// `foo` attempts to dereference `""`, which results in an error being reported. Later, the
+// generator transform for `foo` then produces a union which contains a `str` type - unions should
+// not contain unsized types, but this is okay because an error has been reported already.
+// When const propagation happens later in compilation, it attempts to compute the layout of the
+// generator (as part of checking whether something can be const propagated) and in turn attempts
+// to compute the layout of `str` in the context of a union - where this caused an ICE. This test
+// makes sure that doesn't happen again.
+
+fn foo() {
+ let _y = static || {
+ let x = &mut 0;
+ *{
+ yield;
+ x
+ } += match { *"" }.len() {
+ //~^ ERROR cannot move a value of type `str` [E0161]
+ //~^^ ERROR cannot move out of a shared reference [E0507]
+ _ => 0,
+ };
+ };
+}
+
+fn main() {
+ foo()
+}
diff --git a/tests/ui/generator/issue-113279.stderr b/tests/ui/generator/issue-113279.stderr
new file mode 100644
index 000000000..cc9b64ef9
--- /dev/null
+++ b/tests/ui/generator/issue-113279.stderr
@@ -0,0 +1,16 @@
+error[E0161]: cannot move a value of type `str`
+ --> $DIR/issue-113279.rs:17:20
+ |
+LL | } += match { *"" }.len() {
+ | ^^^^^^^ the size of `str` cannot be statically determined
+
+error[E0507]: cannot move out of a shared reference
+ --> $DIR/issue-113279.rs:17:22
+ |
+LL | } += match { *"" }.len() {
+ | ^^^ move occurs because value has type `str`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0161, E0507.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/tests/ui/generic-associated-types/issue-102114.stderr b/tests/ui/generic-associated-types/issue-102114.current.stderr
index 8e41dee54..6e7a0b1f6 100644
--- a/tests/ui/generic-associated-types/issue-102114.stderr
+++ b/tests/ui/generic-associated-types/issue-102114.current.stderr
@@ -1,5 +1,5 @@
error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters
- --> $DIR/issue-102114.rs:11:12
+ --> $DIR/issue-102114.rs:14:12
|
LL | type B<'b>;
| -- expected 0 type parameters
diff --git a/tests/ui/generic-associated-types/issue-102114.next.stderr b/tests/ui/generic-associated-types/issue-102114.next.stderr
new file mode 100644
index 000000000..6e7a0b1f6
--- /dev/null
+++ b/tests/ui/generic-associated-types/issue-102114.next.stderr
@@ -0,0 +1,12 @@
+error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters
+ --> $DIR/issue-102114.rs:14:12
+ |
+LL | type B<'b>;
+ | -- expected 0 type parameters
+...
+LL | type B<T> = Wrapper<T>;
+ | ^ found 1 type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0049`.
diff --git a/tests/ui/generic-associated-types/issue-102114.rs b/tests/ui/generic-associated-types/issue-102114.rs
index de31737ef..bb6622c0a 100644
--- a/tests/ui/generic-associated-types/issue-102114.rs
+++ b/tests/ui/generic-associated-types/issue-102114.rs
@@ -1,3 +1,6 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
trait A {
type B<'b>;
fn a() -> Self::B<'static>;
diff --git a/tests/ui/generic-associated-types/issue-86218.rs b/tests/ui/generic-associated-types/issue-86218.rs
index 61cfdd35a..397a0f2c6 100644
--- a/tests/ui/generic-associated-types/issue-86218.rs
+++ b/tests/ui/generic-associated-types/issue-86218.rs
@@ -17,7 +17,6 @@ trait Yay<AdditionalValue> {
impl<'a> Yay<&'a ()> for () {
type InnerStream<'s> = impl Stream<Item = i32> + 's;
- //^ ERROR does not fulfill the required lifetime
fn foo<'s>() -> Self::InnerStream<'s> {
()
}
diff --git a/tests/ui/generic-associated-types/issue-90014-tait.rs b/tests/ui/generic-associated-types/issue-90014-tait.rs
index bc3a4e129..1ce5cd319 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait.rs
+++ b/tests/ui/generic-associated-types/issue-90014-tait.rs
@@ -13,7 +13,6 @@ struct Foo<'a>(&'a mut ());
impl Foo<'_> {
type Fut<'a> = impl Future<Output = ()>;
- //^ ERROR: the type `&mut ()` does not fulfill the required lifetime
fn make_fut<'a>(&'a self) -> Self::Fut<'a> {
async { () }
diff --git a/tests/ui/generic-associated-types/issue-90014-tait.stderr b/tests/ui/generic-associated-types/issue-90014-tait.stderr
index 8330a387e..1dec7edce 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait.stderr
+++ b/tests/ui/generic-associated-types/issue-90014-tait.stderr
@@ -1,18 +1,18 @@
error[E0308]: mismatched types
- --> $DIR/issue-90014-tait.rs:19:9
+ --> $DIR/issue-90014-tait.rs:18:9
|
LL | type Fut<'a> = impl Future<Output = ()>;
| ------------------------ the expected future
-...
+LL |
LL | fn make_fut<'a>(&'a self) -> Self::Fut<'a> {
| ------------- expected `Foo<'_>::Fut<'a>` because of return type
LL | async { () }
| ^^^^^^^^^^^^ expected future, found `async` block
|
= note: expected opaque type `Foo<'_>::Fut<'a>`
- found `async` block `[async block@$DIR/issue-90014-tait.rs:19:9: 19:21]`
+ found `async` block `[async block@$DIR/issue-90014-tait.rs:18:9: 18:21]`
note: this item must have the opaque type in its signature in order to be able to register hidden types
- --> $DIR/issue-90014-tait.rs:18:8
+ --> $DIR/issue-90014-tait.rs:17:8
|
LL | fn make_fut<'a>(&'a self) -> Self::Fut<'a> {
| ^^^^^^^^
diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.rs b/tests/ui/generic-associated-types/issue-90014-tait2.rs
index dacbc93de..7fb14eddc 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait2.rs
+++ b/tests/ui/generic-associated-types/issue-90014-tait2.rs
@@ -1,24 +1,9 @@
//! This test checks that opaque type collection doesn't try to normalize the projection
//! without respecting its binders (which would ICE).
//! Unfortunately we don't even reach opaque type collection, as we ICE in typeck before that.
-// known-bug: #109281
-// failure-status: 101
-// error-pattern:internal compiler error
-// normalize-stderr-test "internal compiler error.*" -> ""
-// normalize-stderr-test "DefId\([^)]*\)" -> "..."
-// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
-// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
-// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
-// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
-// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
-// normalize-stderr-test "thread.*panicked.*\n" -> ""
-// normalize-stderr-test "stack backtrace:\n" -> ""
-// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
-// normalize-stderr-test "\s at .*\n" -> ""
-// normalize-stderr-test ".*note: Some details.*\n" -> ""
-// normalize-stderr-test "\n\n[ ]*\n" -> ""
-// normalize-stderr-test "compiler/.*: projection" -> "projection"
+//! See #109281 for the original report.
// edition:2018
+// error-pattern: expected generic lifetime parameter, found `'a`
#![feature(type_alias_impl_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.stderr b/tests/ui/generic-associated-types/issue-90014-tait2.stderr
index 3187be333..d04788a91 100644
--- a/tests/ui/generic-associated-types/issue-90014-tait2.stderr
+++ b/tests/ui/generic-associated-types/issue-90014-tait2.stderr
@@ -1,12 +1,5 @@
-error:
- --> $DIR/issue-90014-tait2.rs:41:27
- |
-LL | fn make_fut(&self) -> Box<dyn for<'a> Trait<'a, Thing = Fut<'a>>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^query stack during panic:
-#0 [typeck] type-checking `<impl at $DIR/issue-90014-tait2.rs:40:1: 40:13>::make_fut`
-#1 [type_of] computing type of `Fut::{opaque#0}`
-#2 [check_mod_item_types] checking item types in top-level module
-#3 [analysis] running analysis passes on this crate
-end of query stack
+error[E0792]: expected generic lifetime parameter, found `'a`
+
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/generic-associated-types/streaming_iterator.rs b/tests/ui/generic-associated-types/streaming_iterator.rs
index 408b8dc99..656fb743e 100644
--- a/tests/ui/generic-associated-types/streaming_iterator.rs
+++ b/tests/ui/generic-associated-types/streaming_iterator.rs
@@ -15,8 +15,7 @@ struct Foo<T: StreamingIterator + 'static> {
// Users can bound parameters by the type constructed by that trait's associated type constructor
// of a trait using HRTB. Both type equality bounds and trait bounds of this kind are valid:
-//FIXME(#44265): This next line should parse and be valid
-//fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(_iter: T) { /* ... */ }
+fn _bar<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(_iter: T) { /* ... */ }
fn _foo<T>(_iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ }
// Full example of enumerate iterator
diff --git a/tests/ui/generic-const-items/associated-const-equality.rs b/tests/ui/generic-const-items/associated-const-equality.rs
new file mode 100644
index 000000000..785d3aa50
--- /dev/null
+++ b/tests/ui/generic-const-items/associated-const-equality.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+#![feature(generic_const_items, associated_const_equality)]
+#![allow(incomplete_features)]
+
+trait Owner {
+ const C<const N: u32>: u32;
+ const K<const N: u32>: u32;
+}
+
+impl Owner for () {
+ const C<const N: u32>: u32 = N;
+ const K<const N: u32>: u32 = N + 1;
+}
+
+fn take0<const N: u32>(_: impl Owner<C<N> = { N }>) {}
+fn take1(_: impl Owner<K<99> = 100>) {}
+
+fn main() {
+ take0::<128>(());
+ take1(());
+}
diff --git a/tests/ui/generic-const-items/basic.rs b/tests/ui/generic-const-items/basic.rs
new file mode 100644
index 000000000..73bfa803a
--- /dev/null
+++ b/tests/ui/generic-const-items/basic.rs
@@ -0,0 +1,61 @@
+// check-pass
+
+// Basic usage patterns of free & associated generic const items.
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+fn main() {
+ const NULL<T>: Option<T> = None::<T>;
+ const NOTHING<T>: Option<T> = None; // arg inferred
+
+ let _ = NOTHING::<String>;
+ let _: Option<u8> = NULL; // arg inferred
+
+ const IDENTITY<const X: u64>: u64 = X;
+
+ const COUNT: u64 = IDENTITY::<48>;
+ const AMOUNT: u64 = IDENTITY::<COUNT>;
+ const NUMBER: u64 = IDENTITY::<{ AMOUNT * 2 }>;
+ let _ = NUMBER;
+ let _ = IDENTITY::<0>;
+
+ let _ = match 0 {
+ IDENTITY::<1> => 2,
+ IDENTITY::<{ 1 + 1 }> => 4,
+ _ => 0,
+ };
+
+ const CREATE<I: Inhabited>: I = I::PROOF;
+ let _ = CREATE::<u64>;
+ let _: u64 = CREATE; // arg inferred
+
+ let _ = <() as Main<u64>>::MAKE::<u64>;
+ let _: (u64, u64) = <()>::MAKE; // args inferred
+}
+
+pub fn usage<'any>() {
+ const REGION_POLY<'a>: &'a () = &();
+
+ let _: &'any () = REGION_POLY::<'any>;
+ let _: &'any () = REGION_POLY::<'_>;
+ let _: &'static () = REGION_POLY;
+}
+
+trait Main<O> {
+ type Output<I>;
+ const MAKE<I: Inhabited>: Self::Output<I>;
+}
+
+impl<O: Inhabited> Main<O> for () {
+ type Output<I> = (O, I);
+ const MAKE<I: Inhabited>: Self::Output<I> = (O::PROOF, I::PROOF);
+}
+
+trait Inhabited {
+ const PROOF: Self;
+}
+
+impl Inhabited for u64 {
+ const PROOF: Self = 512;
+}
diff --git a/tests/ui/generic-const-items/compare-impl-item.rs b/tests/ui/generic-const-items/compare-impl-item.rs
new file mode 100644
index 000000000..01e4477c6
--- /dev/null
+++ b/tests/ui/generic-const-items/compare-impl-item.rs
@@ -0,0 +1,30 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+trait Trait<P> {
+ const A: ();
+ const B<const K: u64, const Q: u64>: u64;
+ const C<T>: T;
+ const D<const N: usize>: usize;
+
+ const E: usize;
+ const F<T: PartialEq>: ();
+}
+
+impl<P> Trait<P> for () {
+ const A<T>: () = ();
+ //~^ ERROR const `A` has 1 type parameter but its trait declaration has 0 type parameters
+ const B<const K: u64>: u64 = 0;
+ //~^ ERROR const `B` has 1 const parameter but its trait declaration has 2 const parameters
+ const C<'a>: &'a str = "";
+ //~^ ERROR const `C` has 0 type parameters but its trait declaration has 1 type parameter
+ const D<const N: u16>: u16 = N;
+ //~^ ERROR const `D` has an incompatible generic parameter for trait `Trait`
+
+ const E: usize = 1024
+ where
+ P: Copy; //~ ERROR impl has stricter requirements than trait
+ const F<T: Eq>: () = (); //~ ERROR impl has stricter requirements than trait
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/compare-impl-item.stderr b/tests/ui/generic-const-items/compare-impl-item.stderr
new file mode 100644
index 000000000..8610d8cba
--- /dev/null
+++ b/tests/ui/generic-const-items/compare-impl-item.stderr
@@ -0,0 +1,66 @@
+error[E0049]: const `A` has 1 type parameter but its trait declaration has 0 type parameters
+ --> $DIR/compare-impl-item.rs:15:13
+ |
+LL | const A: ();
+ | - expected 0 type parameters
+...
+LL | const A<T>: () = ();
+ | ^ found 1 type parameter
+
+error[E0049]: const `B` has 1 const parameter but its trait declaration has 2 const parameters
+ --> $DIR/compare-impl-item.rs:17:13
+ |
+LL | const B<const K: u64, const Q: u64>: u64;
+ | ------------ ------------
+ | |
+ | expected 2 const parameters
+...
+LL | const B<const K: u64>: u64 = 0;
+ | ^^^^^^^^^^^^ found 1 const parameter
+
+error[E0049]: const `C` has 0 type parameters but its trait declaration has 1 type parameter
+ --> $DIR/compare-impl-item.rs:19:13
+ |
+LL | const C<T>: T;
+ | - expected 1 type parameter
+...
+LL | const C<'a>: &'a str = "";
+ | ^^ found 0 type parameters
+
+error[E0053]: const `D` has an incompatible generic parameter for trait `Trait`
+ --> $DIR/compare-impl-item.rs:21:13
+ |
+LL | trait Trait<P> {
+ | -----
+...
+LL | const D<const N: usize>: usize;
+ | -------------- expected const parameter of type `usize`
+...
+LL | impl<P> Trait<P> for () {
+ | -----------------------
+...
+LL | const D<const N: u16>: u16 = N;
+ | ^^^^^^^^^^^^ found const parameter of type `u16`
+
+error[E0276]: impl has stricter requirements than trait
+ --> $DIR/compare-impl-item.rs:26:12
+ |
+LL | const E: usize;
+ | -------------- definition of `E` from trait
+...
+LL | P: Copy;
+ | ^^^^ impl has extra requirement `P: Copy`
+
+error[E0276]: impl has stricter requirements than trait
+ --> $DIR/compare-impl-item.rs:27:16
+ |
+LL | const F<T: PartialEq>: ();
+ | ------------------------- definition of `F` from trait
+...
+LL | const F<T: Eq>: () = ();
+ | ^^ impl has extra requirement `T: Eq`
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0049, E0053, E0276.
+For more information about an error, try `rustc --explain E0049`.
diff --git a/tests/ui/generic-const-items/const-trait-impl.rs b/tests/ui/generic-const-items/const-trait-impl.rs
new file mode 100644
index 000000000..d30f7af17
--- /dev/null
+++ b/tests/ui/generic-const-items/const-trait-impl.rs
@@ -0,0 +1,25 @@
+// known-bug: #110395
+// FIXME check-pass
+
+// Test that we can call methods from const trait impls inside of generic const items.
+
+#![feature(generic_const_items, const_trait_impl)]
+#![allow(incomplete_features)]
+#![crate_type = "lib"]
+
+// FIXME(generic_const_items): Interpret `~const` as always-const.
+const CREATE<T: ~const Create>: T = T::create();
+
+pub const K0: i32 = CREATE::<i32>;
+pub const K1: i32 = CREATE; // arg inferred
+
+#[const_trait]
+trait Create {
+ fn create() -> Self;
+}
+
+impl const Create for i32 {
+ fn create() -> i32 {
+ 4096
+ }
+}
diff --git a/tests/ui/generic-const-items/const-trait-impl.stderr b/tests/ui/generic-const-items/const-trait-impl.stderr
new file mode 100644
index 000000000..34360c581
--- /dev/null
+++ b/tests/ui/generic-const-items/const-trait-impl.stderr
@@ -0,0 +1,11 @@
+error[E0015]: cannot call non-const fn `<T as Create>::create` in constants
+ --> $DIR/const-trait-impl.rs:11:37
+ |
+LL | const CREATE<T: ~const Create>: T = T::create();
+ | ^^^^^^^^^^^
+ |
+ = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/generic-const-items/duplicate-where-clause.rs b/tests/ui/generic-const-items/duplicate-where-clause.rs
new file mode 100644
index 000000000..68da4073f
--- /dev/null
+++ b/tests/ui/generic-const-items/duplicate-where-clause.rs
@@ -0,0 +1,27 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+trait Tr<P> {
+ const K: ()
+ where
+ P: Copy
+ where
+ P: Eq;
+ //~^ ERROR cannot define duplicate `where` clauses on an item
+}
+
+// Test that we error on the first where-clause but also that we don't suggest to swap it with the
+// body as it would conflict with the second where-clause.
+// FIXME(generic_const_items): We should provide a structured sugg to merge the 1st into the 2nd WC.
+
+impl<P> Tr<P> for () {
+ const K: ()
+ where
+ P: Eq
+ = ()
+ where
+ P: Copy;
+ //~^^^^^ ERROR where clauses are not allowed before const item bodies
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/duplicate-where-clause.stderr b/tests/ui/generic-const-items/duplicate-where-clause.stderr
new file mode 100644
index 000000000..5fa61b01e
--- /dev/null
+++ b/tests/ui/generic-const-items/duplicate-where-clause.stderr
@@ -0,0 +1,27 @@
+error: cannot define duplicate `where` clauses on an item
+ --> $DIR/duplicate-where-clause.rs:9:9
+ |
+LL | P: Copy
+ | - previous `where` clause starts here
+LL | where
+LL | P: Eq;
+ | ^
+ |
+help: consider joining the two `where` clauses into one
+ |
+LL | P: Copy,
+ | ~
+
+error: where clauses are not allowed before const item bodies
+ --> $DIR/duplicate-where-clause.rs:19:5
+ |
+LL | const K: ()
+ | - while parsing this const item
+LL | / where
+LL | | P: Eq
+ | |_____________^ unexpected where clause
+LL | = ()
+ | -- the item body
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/generic-const-items/elided-lifetimes.rs b/tests/ui/generic-const-items/elided-lifetimes.rs
new file mode 100644
index 000000000..cca73e2e8
--- /dev/null
+++ b/tests/ui/generic-const-items/elided-lifetimes.rs
@@ -0,0 +1,18 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// Check that we forbid elided lifetimes inside the generics of const items.
+
+const K<T>: () = ()
+where
+ &T: Copy; //~ ERROR `&` without an explicit lifetime name cannot be used here
+
+const I<const S: &str>: &str = "";
+//~^ ERROR `&` without an explicit lifetime name cannot be used here
+//~| ERROR `&str` is forbidden as the type of a const generic parameter
+
+const B<T: Trait<'_>>: () = (); //~ ERROR `'_` cannot be used here
+
+trait Trait<'a> {}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/elided-lifetimes.stderr b/tests/ui/generic-const-items/elided-lifetimes.stderr
new file mode 100644
index 000000000..8cd3f9ee7
--- /dev/null
+++ b/tests/ui/generic-const-items/elided-lifetimes.stderr
@@ -0,0 +1,35 @@
+error[E0637]: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/elided-lifetimes.rs:8:5
+ |
+LL | &T: Copy;
+ | ^ explicit lifetime name needed here
+ |
+help: consider introducing a higher-ranked lifetime here
+ |
+LL | for<'a> &'a T: Copy;
+ | +++++++ ++
+
+error[E0637]: `&` without an explicit lifetime name cannot be used here
+ --> $DIR/elided-lifetimes.rs:10:18
+ |
+LL | const I<const S: &str>: &str = "";
+ | ^ explicit lifetime name needed here
+
+error[E0637]: `'_` cannot be used here
+ --> $DIR/elided-lifetimes.rs:14:18
+ |
+LL | const B<T: Trait<'_>>: () = ();
+ | ^^ `'_` is a reserved lifetime name
+
+error: `&str` is forbidden as the type of a const generic parameter
+ --> $DIR/elided-lifetimes.rs:10:18
+ |
+LL | const I<const S: &str>: &str = "";
+ | ^^^^
+ |
+ = note: the only supported types are integers, `bool` and `char`
+ = help: more complex types are supported with `#![feature(adt_const_params)]`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0637`.
diff --git a/tests/ui/generic-const-items/evaluatable-bounds.rs b/tests/ui/generic-const-items/evaluatable-bounds.rs
new file mode 100644
index 000000000..cdcfcf918
--- /dev/null
+++ b/tests/ui/generic-const-items/evaluatable-bounds.rs
@@ -0,0 +1,31 @@
+// This is a regression test for issue #104400.
+
+// revisions: unconstrained constrained
+//[constrained] check-pass
+
+// Test that we can constrain generic const items that appear inside associated consts by
+// adding a (makeshift) "evaluatable"-bound to the item.
+
+#![feature(generic_const_items, generic_const_exprs)]
+#![allow(incomplete_features)]
+
+trait Trait {
+ const LEN: usize;
+
+ #[cfg(unconstrained)]
+ const ARRAY: [i32; Self::LEN]; //[unconstrained]~ ERROR unconstrained generic constant
+
+ #[cfg(constrained)]
+ const ARRAY: [i32; Self::LEN]
+ where
+ [(); Self::LEN]:;
+}
+
+impl Trait for () {
+ const LEN: usize = 2;
+ const ARRAY: [i32; Self::LEN] = [360, 720];
+}
+
+fn main() {
+ let [_, _] = <() as Trait>::ARRAY;
+}
diff --git a/tests/ui/generic-const-items/evaluatable-bounds.unconstrained.stderr b/tests/ui/generic-const-items/evaluatable-bounds.unconstrained.stderr
new file mode 100644
index 000000000..930080f7c
--- /dev/null
+++ b/tests/ui/generic-const-items/evaluatable-bounds.unconstrained.stderr
@@ -0,0 +1,10 @@
+error: unconstrained generic constant
+ --> $DIR/evaluatable-bounds.rs:16:5
+ |
+LL | const ARRAY: [i32; Self::LEN];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: try adding a `where` bound using this expression: `where [(); Self::LEN]:`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/generic-const-items/feature-gate-generic_const_items.rs b/tests/ui/generic-const-items/feature-gate-generic_const_items.rs
new file mode 100644
index 000000000..5c241f256
--- /dev/null
+++ b/tests/ui/generic-const-items/feature-gate-generic_const_items.rs
@@ -0,0 +1,37 @@
+pub trait Trait<A> {
+ const ONE<T>: i32;
+ //~^ ERROR generic const items are experimental
+
+ const TWO: ()
+ where
+ A: Copy;
+ //~^^ ERROR generic const items are experimental
+}
+
+const CONST<T>: i32 = 0;
+//~^ ERROR generic const items are experimental
+
+const EMPTY<>: i32 = 0;
+//~^ ERROR generic const items are experimental
+
+const TRUE: () = ()
+where
+ String: Clone;
+//~^^ ERROR generic const items are experimental
+
+// Ensure that we flag generic const items inside macro calls as well:
+
+macro_rules! discard {
+ ($item:item) => {}
+}
+
+discard! { const FREE<T>: () = (); }
+//~^ ERROR generic const items are experimental
+
+discard! { impl () { const ASSOC<const N: ()>: () = (); } }
+//~^ ERROR generic const items are experimental
+
+discard! { impl () { const ASSOC: i32 = 0 where String: Copy; } }
+//~^ ERROR generic const items are experimental
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/feature-gate-generic_const_items.stderr b/tests/ui/generic-const-items/feature-gate-generic_const_items.stderr
new file mode 100644
index 000000000..a1fdf5f6e
--- /dev/null
+++ b/tests/ui/generic-const-items/feature-gate-generic_const_items.stderr
@@ -0,0 +1,77 @@
+error[E0658]: generic const items are experimental
+ --> $DIR/feature-gate-generic_const_items.rs:2:14
+ |
+LL | const ONE<T>: i32;
+ | ^^^
+ |
+ = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+ = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+ --> $DIR/feature-gate-generic_const_items.rs:6:5
+ |
+LL | / where
+LL | | A: Copy;
+ | |_______________^
+ |
+ = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+ = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+ --> $DIR/feature-gate-generic_const_items.rs:11:12
+ |
+LL | const CONST<T>: i32 = 0;
+ | ^^^
+ |
+ = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+ = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+ --> $DIR/feature-gate-generic_const_items.rs:14:12
+ |
+LL | const EMPTY<>: i32 = 0;
+ | ^^
+ |
+ = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+ = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+ --> $DIR/feature-gate-generic_const_items.rs:18:1
+ |
+LL | / where
+LL | | String: Clone;
+ | |_________________^
+ |
+ = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+ = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+ --> $DIR/feature-gate-generic_const_items.rs:28:22
+ |
+LL | discard! { const FREE<T>: () = (); }
+ | ^^^
+ |
+ = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+ = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+ --> $DIR/feature-gate-generic_const_items.rs:31:33
+ |
+LL | discard! { impl () { const ASSOC<const N: ()>: () = (); } }
+ | ^^^^^^^^^^^^^
+ |
+ = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+ = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+ --> $DIR/feature-gate-generic_const_items.rs:34:43
+ |
+LL | discard! { impl () { const ASSOC: i32 = 0 where String: Copy; } }
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+ = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/generic-const-items/inference-failure.rs b/tests/ui/generic-const-items/inference-failure.rs
new file mode 100644
index 000000000..fd4f424dd
--- /dev/null
+++ b/tests/ui/generic-const-items/inference-failure.rs
@@ -0,0 +1,15 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+const NONE<T>: Option<T> = None::<T>;
+const IGNORE<T>: () = ();
+
+fn none() {
+ let _ = NONE; //~ ERROR type annotations needed
+}
+
+fn ignore() {
+ let _ = IGNORE; //~ ERROR type annotations needed
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/inference-failure.stderr b/tests/ui/generic-const-items/inference-failure.stderr
new file mode 100644
index 000000000..22ff1b9ba
--- /dev/null
+++ b/tests/ui/generic-const-items/inference-failure.stderr
@@ -0,0 +1,20 @@
+error[E0282]: type annotations needed for `Option<T>`
+ --> $DIR/inference-failure.rs:8:9
+ |
+LL | let _ = NONE;
+ | ^
+ |
+help: consider giving this pattern a type, where the type for type parameter `T` is specified
+ |
+LL | let _: Option<T> = NONE;
+ | +++++++++++
+
+error[E0282]: type annotations needed
+ --> $DIR/inference-failure.rs:12:13
+ |
+LL | let _ = IGNORE;
+ | ^^^^^^ cannot infer type for type parameter `T` declared on the constant `IGNORE`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/generic-const-items/misplaced-where-clause.fixed b/tests/ui/generic-const-items/misplaced-where-clause.fixed
new file mode 100644
index 000000000..bff470c28
--- /dev/null
+++ b/tests/ui/generic-const-items/misplaced-where-clause.fixed
@@ -0,0 +1,18 @@
+// run-rustfix
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features, dead_code)]
+
+const K<T>: u64
+= T::K where
+ T: Tr<()>;
+//~^^^ ERROR where clauses are not allowed before const item bodies
+
+trait Tr<P> {
+ const K: u64
+ = 0 where
+ P: Copy;
+ //~^^^ ERROR where clauses are not allowed before const item bodies
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/misplaced-where-clause.rs b/tests/ui/generic-const-items/misplaced-where-clause.rs
new file mode 100644
index 000000000..b14c6d594
--- /dev/null
+++ b/tests/ui/generic-const-items/misplaced-where-clause.rs
@@ -0,0 +1,20 @@
+// run-rustfix
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features, dead_code)]
+
+const K<T>: u64
+where
+ T: Tr<()>
+= T::K;
+//~^^^ ERROR where clauses are not allowed before const item bodies
+
+trait Tr<P> {
+ const K: u64
+ where
+ P: Copy
+ = 0;
+ //~^^^ ERROR where clauses are not allowed before const item bodies
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/misplaced-where-clause.stderr b/tests/ui/generic-const-items/misplaced-where-clause.stderr
new file mode 100644
index 000000000..431741d87
--- /dev/null
+++ b/tests/ui/generic-const-items/misplaced-where-clause.stderr
@@ -0,0 +1,36 @@
+error: where clauses are not allowed before const item bodies
+ --> $DIR/misplaced-where-clause.rs:7:1
+ |
+LL | const K<T>: u64
+ | - while parsing this const item
+LL | / where
+LL | | T: Tr<()>
+ | |_____________^ unexpected where clause
+LL | = T::K;
+ | ---- the item body
+ |
+help: move the body before the where clause
+ |
+LL ~ = T::K where
+LL ~ T: Tr<()>;
+ |
+
+error: where clauses are not allowed before const item bodies
+ --> $DIR/misplaced-where-clause.rs:14:5
+ |
+LL | const K: u64
+ | - while parsing this const item
+LL | / where
+LL | | P: Copy
+ | |_______________^ unexpected where clause
+LL | = 0;
+ | - the item body
+ |
+help: move the body before the where clause
+ |
+LL ~ = 0 where
+LL ~ P: Copy;
+ |
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/generic-const-items/parameter-defaults.rs b/tests/ui/generic-const-items/parameter-defaults.rs
new file mode 100644
index 000000000..a6f82c249
--- /dev/null
+++ b/tests/ui/generic-const-items/parameter-defaults.rs
@@ -0,0 +1,14 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// Check that we emit a *hard* error (not just a lint warning or error for example) for generic
+// parameter defaults on free const items since we are not limited by backward compatibility.
+#![allow(invalid_type_param_default)] // Should have no effect here.
+
+// FIXME(default_type_parameter_fallback): Consider reallowing them once they work properly.
+
+const NONE<T = ()>: Option<T> = None::<T>; //~ ERROR defaults for type parameters are only allowed
+
+fn main() {
+ let _ = NONE;
+}
diff --git a/tests/ui/generic-const-items/parameter-defaults.stderr b/tests/ui/generic-const-items/parameter-defaults.stderr
new file mode 100644
index 000000000..62da45e55
--- /dev/null
+++ b/tests/ui/generic-const-items/parameter-defaults.stderr
@@ -0,0 +1,8 @@
+error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+ --> $DIR/parameter-defaults.rs:10:12
+ |
+LL | const NONE<T = ()>: Option<T> = None::<T>;
+ | ^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/generic-const-items/recursive.rs b/tests/ui/generic-const-items/recursive.rs
new file mode 100644
index 000000000..3266b37d3
--- /dev/null
+++ b/tests/ui/generic-const-items/recursive.rs
@@ -0,0 +1,12 @@
+// FIXME(generic_const_items): This leads to a stack overflow in the compiler!
+// known-bug: unknown
+// ignore-test
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+const RECUR<T>: () = RECUR::<(T,)>;
+
+fn main() {
+ let _ = RECUR::<()>;
+}
diff --git a/tests/ui/generic-const-items/reference-outlives-referent.rs b/tests/ui/generic-const-items/reference-outlives-referent.rs
new file mode 100644
index 000000000..13e4eaac3
--- /dev/null
+++ b/tests/ui/generic-const-items/reference-outlives-referent.rs
@@ -0,0 +1,9 @@
+// Test that we catch that the reference outlives the referent and we
+// successfully emit a diagnostic. Regression test for issue #114714.
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+const Q<'a, 'b>: &'a &'b () = &&(); //~ ERROR reference has a longer lifetime than the data it references
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/reference-outlives-referent.stderr b/tests/ui/generic-const-items/reference-outlives-referent.stderr
new file mode 100644
index 000000000..2b57713b5
--- /dev/null
+++ b/tests/ui/generic-const-items/reference-outlives-referent.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references
+ --> $DIR/reference-outlives-referent.rs:7:18
+ |
+LL | const Q<'a, 'b>: &'a &'b () = &&();
+ | ^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime `'a` as defined here
+ --> $DIR/reference-outlives-referent.rs:7:9
+ |
+LL | const Q<'a, 'b>: &'a &'b () = &&();
+ | ^^
+note: but the referenced data is only valid for the lifetime `'b` as defined here
+ --> $DIR/reference-outlives-referent.rs:7:13
+ |
+LL | const Q<'a, 'b>: &'a &'b () = &&();
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs
new file mode 100644
index 000000000..dd00b327d
--- /dev/null
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs
@@ -0,0 +1,12 @@
+#![feature(generic_const_items, trivial_bounds)]
+#![allow(incomplete_features)]
+
+// Ensure that we check if trivial bounds on const items hold or not.
+
+const UNUSABLE: () = ()
+where
+ String: Copy;
+
+fn main() {
+ let _ = UNUSABLE; //~ ERROR the trait bound `String: Copy` is not satisfied
+}
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr
new file mode 100644
index 000000000..c3ef94529
--- /dev/null
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/trivially-unsatisfied-bounds-0.rs:11:13
+ |
+LL | let _ = UNUSABLE;
+ | ^^^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+note: required by a bound in `UNUSABLE`
+ --> $DIR/trivially-unsatisfied-bounds-0.rs:8:13
+ |
+LL | const UNUSABLE: () = ()
+ | -------- required by a bound in this constant
+LL | where
+LL | String: Copy;
+ | ^^^^ required by this bound in `UNUSABLE`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.rs b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.rs
new file mode 100644
index 000000000..9243deac8
--- /dev/null
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.rs
@@ -0,0 +1,12 @@
+#![feature(generic_const_items, trivial_bounds)]
+#![allow(incomplete_features, dead_code, trivial_bounds)]
+
+// FIXME(generic_const_items): This looks like a bug to me. I expected that we wouldn't emit any
+// errors. I thought we'd skip the evaluation of consts whose bounds don't hold.
+
+const UNUSED: () = ()
+where
+ String: Copy;
+//~^^^ ERROR evaluation of constant value failed
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.stderr b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.stderr
new file mode 100644
index 000000000..a68400798
--- /dev/null
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.stderr
@@ -0,0 +1,11 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/trivially-unsatisfied-bounds-1.rs:7:1
+ |
+LL | / const UNUSED: () = ()
+LL | | where
+LL | | String: Copy;
+ | |_________________^ entering unreachable code
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.rs b/tests/ui/generic-const-items/unsatisfied-bounds.rs
new file mode 100644
index 000000000..058799001
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-bounds.rs
@@ -0,0 +1,34 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// Ensure that we check if bounds on const items hold or not.
+
+use std::convert::Infallible;
+
+const C<T: Copy>: () = ();
+
+const K<T>: () = ()
+where
+ Infallible: From<T>;
+
+trait Trait<P> {
+ const A: u32
+ where
+ P: Copy;
+
+ const B<T>: u32
+ where
+ Infallible: From<T>;
+}
+
+impl<P> Trait<P> for () {
+ const A: u32 = 0;
+ const B<T>: u32 = 1;
+}
+
+fn main() {
+ let () = C::<String>; //~ ERROR the trait bound `String: Copy` is not satisfied
+ let () = K::<()>; //~ ERROR the trait bound `Infallible: From<()>` is not satisfied
+ let _ = <() as Trait<Vec<u8>>>::A; //~ ERROR the trait bound `Vec<u8>: Copy` is not satisfied
+ let _ = <() as Trait<&'static str>>::B::<()>; //~ ERROR the trait bound `Infallible: From<()>` is not satisfied
+}
diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
new file mode 100644
index 000000000..1fda46037
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
@@ -0,0 +1,62 @@
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/unsatisfied-bounds.rs:30:18
+ |
+LL | let () = C::<String>;
+ | ^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+note: required by a bound in `C`
+ --> $DIR/unsatisfied-bounds.rs:8:12
+ |
+LL | const C<T: Copy>: () = ();
+ | ^^^^ required by this bound in `C`
+
+error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
+ --> $DIR/unsatisfied-bounds.rs:31:18
+ |
+LL | let () = K::<()>;
+ | ^^ the trait `From<()>` is not implemented for `Infallible`
+ |
+ = help: the trait `From<!>` is implemented for `Infallible`
+note: required by a bound in `K`
+ --> $DIR/unsatisfied-bounds.rs:12:17
+ |
+LL | const K<T>: () = ()
+ | - required by a bound in this constant
+LL | where
+LL | Infallible: From<T>;
+ | ^^^^^^^ required by this bound in `K`
+
+error[E0277]: the trait bound `Vec<u8>: Copy` is not satisfied
+ --> $DIR/unsatisfied-bounds.rs:32:13
+ |
+LL | let _ = <() as Trait<Vec<u8>>>::A;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<u8>`
+ |
+note: required by a bound in `Trait::A`
+ --> $DIR/unsatisfied-bounds.rs:17:12
+ |
+LL | const A: u32
+ | - required by a bound in this associated constant
+LL | where
+LL | P: Copy;
+ | ^^^^ required by this bound in `Trait::A`
+
+error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
+ --> $DIR/unsatisfied-bounds.rs:33:46
+ |
+LL | let _ = <() as Trait<&'static str>>::B::<()>;
+ | ^^ the trait `From<()>` is not implemented for `Infallible`
+ |
+ = help: the trait `From<!>` is implemented for `Infallible`
+note: required by a bound in `Trait::B`
+ --> $DIR/unsatisfied-bounds.rs:21:21
+ |
+LL | const B<T>: u32
+ | - required by a bound in this associated constant
+LL | where
+LL | Infallible: From<T>;
+ | ^^^^^^^ required by this bound in `Trait::B`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.rs b/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.rs
new file mode 100644
index 000000000..961e5b4ae
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.rs
@@ -0,0 +1,12 @@
+#![feature(generic_const_items, generic_const_exprs)]
+#![allow(incomplete_features)]
+
+// Ensure that we check if (makeshift) "evaluatable"-bounds on const items hold or not.
+
+const POSITIVE<const N: usize>: usize = N
+where
+ [(); N - 1]:; //~ ERROR evaluation of `POSITIVE::<0>::{constant#0}` failed
+
+fn main() {
+ let _ = POSITIVE::<0>;
+}
diff --git a/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.stderr
new file mode 100644
index 000000000..bed213b0c
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.stderr
@@ -0,0 +1,9 @@
+error[E0080]: evaluation of `POSITIVE::<0>::{constant#0}` failed
+ --> $DIR/unsatisfied-evaluatable-bounds.rs:8:10
+ |
+LL | [(); N - 1]:;
+ | ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/generic-const-items/unsatisfied-outlives-bounds.rs b/tests/ui/generic-const-items/unsatisfied-outlives-bounds.rs
new file mode 100644
index 000000000..204cf9def
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-outlives-bounds.rs
@@ -0,0 +1,17 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// Ensure that we check if outlives-bounds on const items hold or not.
+
+const C<'a, T: 'a>: () = ();
+const K<'a, 'b: 'a>: () = ();
+
+fn parametrized0<'any>() {
+ let () = C::<'static, &'any ()>; //~ ERROR lifetime may not live long enough
+}
+
+fn parametrized1<'any>() {
+ let () = K::<'static, 'any>; //~ ERROR lifetime may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/unsatisfied-outlives-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-outlives-bounds.stderr
new file mode 100644
index 000000000..72e4265b3
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-outlives-bounds.stderr
@@ -0,0 +1,18 @@
+error: lifetime may not live long enough
+ --> $DIR/unsatisfied-outlives-bounds.rs:10:14
+ |
+LL | fn parametrized0<'any>() {
+ | ---- lifetime `'any` defined here
+LL | let () = C::<'static, &'any ()>;
+ | ^^^^^^^^^^^^^^^^^^^^^^ requires that `'any` must outlive `'static`
+
+error: lifetime may not live long enough
+ --> $DIR/unsatisfied-outlives-bounds.rs:14:14
+ |
+LL | fn parametrized1<'any>() {
+ | ---- lifetime `'any` defined here
+LL | let () = K::<'static, 'any>;
+ | ^^^^^^^^^^^^^^^^^^ requires that `'any` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/generics/issue-94923.rs b/tests/ui/generics/issue-94923.rs
index d337a5dff..893bac0d5 100644
--- a/tests/ui/generics/issue-94923.rs
+++ b/tests/ui/generics/issue-94923.rs
@@ -1,6 +1,5 @@
// run-pass
// regression test for issue #94923
-// min-llvm-version: 15.0.0
// compile-flags: -C opt-level=3
fn f0<T>(mut x: usize) -> usize {
diff --git a/tests/ui/hashmap/hashmap-iter-value-lifetime.stderr b/tests/ui/hashmap/hashmap-iter-value-lifetime.stderr
index d6e7a1d45..de2591329 100644
--- a/tests/ui/hashmap/hashmap-iter-value-lifetime.stderr
+++ b/tests/ui/hashmap/hashmap-iter-value-lifetime.stderr
@@ -2,7 +2,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as
--> $DIR/hashmap-iter-value-lifetime.rs:7:5
|
LL | let (_, thing) = my_stuff.iter().next().unwrap();
- | --------------- immutable borrow occurs here
+ | -------- immutable borrow occurs here
LL |
LL | my_stuff.clear();
| ^^^^^^^^^^^^^^^^ mutable borrow occurs here
diff --git a/tests/ui/hashmap/hashmap-lifetimes.stderr b/tests/ui/hashmap/hashmap-lifetimes.stderr
index d1bcd53ae..497c7d121 100644
--- a/tests/ui/hashmap/hashmap-lifetimes.stderr
+++ b/tests/ui/hashmap/hashmap-lifetimes.stderr
@@ -2,7 +2,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as
--> $DIR/hashmap-lifetimes.rs:6:5
|
LL | let mut it = my_stuff.iter();
- | --------------- immutable borrow occurs here
+ | -------- immutable borrow occurs here
LL | my_stuff.insert(1, 43);
| ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
LL | it;
diff --git a/tests/ui/hello_world/main.rs b/tests/ui/hello_world/main.rs
index 22ce47414..39cb74b70 100644
--- a/tests/ui/hello_world/main.rs
+++ b/tests/ui/hello_world/main.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// build-pass
// Test that compiling hello world succeeds with no output of any kind.
diff --git a/tests/ui/higher-ranked/subtype/placeholder-pattern-fail.stderr b/tests/ui/higher-ranked/subtype/placeholder-pattern-fail.stderr
index 73b0a3173..5241b475d 100644
--- a/tests/ui/higher-ranked/subtype/placeholder-pattern-fail.stderr
+++ b/tests/ui/higher-ranked/subtype/placeholder-pattern-fail.stderr
@@ -2,7 +2,9 @@ error[E0308]: mismatched types
--> $DIR/placeholder-pattern-fail.rs:9:47
|
LL | let _: for<'a, 'b> fn(Inv<'a>, Inv<'b>) = sub;
- | ^^^ one type is more general than the other
+ | -------------------------------- ^^^ one type is more general than the other
+ | |
+ | expected due to this
|
= note: expected fn pointer `for<'a, 'b> fn(Inv<'a>, Inv<'b>)`
found fn pointer `for<'a> fn(Inv<'a>, Inv<'a>)`
diff --git a/tests/ui/higher-ranked/trait-bounds/future.rs b/tests/ui/higher-ranked/trait-bounds/future.rs
index da7ee0343..61d86a9cb 100644
--- a/tests/ui/higher-ranked/trait-bounds/future.rs
+++ b/tests/ui/higher-ranked/trait-bounds/future.rs
@@ -7,7 +7,7 @@
//[classic] build-fail
//[classic] failure-status: 101
//[classic] normalize-stderr-test "note: .*\n\n" -> ""
-//[classic] normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
+//[classic] normalize-stderr-test "thread 'rustc' panicked.*\n.*\n" -> ""
//[classic] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
//[classic] rustc-env:RUST_BACKTRACE=0
diff --git a/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr b/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr
index a9d649b82..139c844d8 100644
--- a/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr
@@ -13,8 +13,7 @@ LL | | ) {
LL | f
| ^ expected `&dyn Fn(&dyn Fn(&dyn Fn(&...)))`, found `&dyn Fn(u32)`
|
- = note: expected reference `&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&...)))))))))))`
- the full type name has been written to '$TEST_BUILD_DIR/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn/hang-on-deeply-nested-dyn.long-type-hash.txt'
+ = note: expected reference `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn Fn(u32) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))`
found reference `&dyn Fn(u32)`
error: aborting due to previous error
diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-debruijn-in-receiver.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-debruijn-in-receiver.stderr
index fa391ecba..70d5b3c2e 100644
--- a/tests/ui/higher-ranked/trait-bounds/hrtb-debruijn-in-receiver.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/hrtb-debruijn-in-receiver.stderr
@@ -2,9 +2,9 @@ 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
+ | --- first mutable borrow occurs here
LL | foo.insert();
- | ^^^^^^^^^^^^
+ | ^^^
| |
| second mutable borrow occurs here
| first borrow later used here
diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-fn.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-fn.stderr
index 9914783d9..db5fc4bf1 100644
--- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-fn.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-fn.stderr
@@ -2,7 +2,9 @@ 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
+ | ------------------- ^^^^^ one type is more general than the other
+ | |
+ | expected due to this
|
= note: expected fn pointer `for<'b> fn(&'b u32)`
found fn pointer `fn(&u32)`
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr b/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr
index f32ba5720..957082b60 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/issue-30786.stderr
@@ -31,7 +31,6 @@ LL | pub struct Filter<S, F> {
LL | let count = filter.countx();
| ^^^^^^ method cannot be called due to unsatisfied trait bounds
|
- = note: the full type name has been written to '$TEST_BUILD_DIR/higher-ranked/trait-bounds/issue-30786/issue-30786.long-type-hash.txt'
note: the following trait bounds were not satisfied:
`&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
`&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs
new file mode 100644
index 000000000..40c5eacee
--- /dev/null
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs
@@ -0,0 +1,29 @@
+// edition:2018
+#![feature(decl_macro)]
+
+macro a() {
+ extern crate core as my_core;
+ mod v {
+ // Early resolution.
+ use my_core; //~ ERROR unresolved import `my_core`
+ }
+ mod u {
+ // Late resolution.
+ fn f() { my_core::mem::drop(0); }
+ //~^ ERROR failed to resolve: use of undeclared crate or module `my_core`
+ }
+}
+
+a!();
+
+mod v {
+ // Early resolution.
+ use my_core; //~ ERROR unresolved import `my_core`
+}
+mod u {
+ // Late resolution.
+ fn f() { my_core::mem::drop(0); }
+ //~^ ERROR failed to resolve: use of undeclared crate or module `my_core`
+}
+
+fn main() {}
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr
new file mode 100644
index 000000000..7ed15e89c
--- /dev/null
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr
@@ -0,0 +1,53 @@
+error[E0432]: unresolved import `my_core`
+ --> $DIR/extern-prelude-from-opaque-fail-2018.rs:21:9
+ |
+LL | use my_core;
+ | ^^^^^^^ no external crate `my_core`
+
+error[E0432]: unresolved import `my_core`
+ --> $DIR/extern-prelude-from-opaque-fail-2018.rs:8:13
+ |
+LL | use my_core;
+ | ^^^^^^^ no external crate `my_core`
+...
+LL | a!();
+ | ---- in this macro invocation
+ |
+ = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
+ --> $DIR/extern-prelude-from-opaque-fail-2018.rs:12:18
+ |
+LL | fn f() { my_core::mem::drop(0); }
+ | ^^^^^^^ use of undeclared crate or module `my_core`
+...
+LL | a!();
+ | ---- in this macro invocation
+ |
+ = help: consider importing one of these items:
+ std::mem
+ core::mem
+ = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
+ --> $DIR/extern-prelude-from-opaque-fail-2018.rs:25:14
+ |
+LL | fn f() { my_core::mem::drop(0); }
+ | ^^^^^^^ use of undeclared crate or module `my_core`
+ |
+help: consider importing one of these items
+ |
+LL + use core::mem;
+ |
+LL + use std::mem;
+ |
+help: if you import `mem`, refer to it directly
+ |
+LL - fn f() { my_core::mem::drop(0); }
+LL + fn f() { mem::drop(0); }
+ |
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0432, E0433.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs b/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs
index 571017df4..f3fa2ddda 100644
--- a/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs
@@ -1,3 +1,4 @@
+// edition:2015
#![feature(decl_macro)]
macro a() {
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr
index f1f4caee3..13b2827ef 100644
--- a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr
@@ -1,11 +1,11 @@
error[E0432]: unresolved import `my_core`
- --> $DIR/extern-prelude-from-opaque-fail.rs:20:9
+ --> $DIR/extern-prelude-from-opaque-fail.rs:21:9
|
LL | use my_core;
| ^^^^^^^ no `my_core` in the root
error[E0432]: unresolved import `my_core`
- --> $DIR/extern-prelude-from-opaque-fail.rs:7:13
+ --> $DIR/extern-prelude-from-opaque-fail.rs:8:13
|
LL | use my_core;
| ^^^^^^^ no `my_core` in the root
@@ -16,7 +16,7 @@ LL | a!();
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
- --> $DIR/extern-prelude-from-opaque-fail.rs:11:18
+ --> $DIR/extern-prelude-from-opaque-fail.rs:12:18
|
LL | fn f() { my_core::mem::drop(0); }
| ^^^^^^^ use of undeclared crate or module `my_core`
@@ -24,13 +24,25 @@ LL | fn f() { my_core::mem::drop(0); }
LL | a!();
| ---- in this macro invocation
|
+ = help: consider importing this module:
+ my_core::mem
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
- --> $DIR/extern-prelude-from-opaque-fail.rs:24:14
+ --> $DIR/extern-prelude-from-opaque-fail.rs:25:14
|
LL | fn f() { my_core::mem::drop(0); }
| ^^^^^^^ use of undeclared crate or module `my_core`
+ |
+help: consider importing this module
+ |
+LL + use my_core::mem;
+ |
+help: if you import `mem`, refer to it directly
+ |
+LL - fn f() { my_core::mem::drop(0); }
+LL + fn f() { mem::drop(0); }
+ |
error: aborting due to 4 previous errors
diff --git a/tests/ui/hygiene/fields-numeric-borrowck.stderr b/tests/ui/hygiene/fields-numeric-borrowck.stderr
index bc13aa62f..fb90825c0 100644
--- a/tests/ui/hygiene/fields-numeric-borrowck.stderr
+++ b/tests/ui/hygiene/fields-numeric-borrowck.stderr
@@ -7,7 +7,7 @@ LL | let S { 0: ref mut borrow2 } = s;
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here
...
LL | borrow1.use_mut();
- | ----------------- first borrow later used here
+ | ------- first borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr
index a7252a400..5ed0d9fcf 100644
--- a/tests/ui/hygiene/panic-location.run.stderr
+++ b/tests/ui/hygiene/panic-location.run.stderr
@@ -1,2 +1,3 @@
-thread 'main' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:524:5
+thread 'main' panicked at library/alloc/src/raw_vec.rs:534:5:
+capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/impl-trait/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leak.stderr
index 92a9763bc..a024cff0b 100644
--- a/tests/ui/impl-trait/auto-trait-leak.stderr
+++ b/tests/ui/impl-trait/auto-trait-leak.stderr
@@ -33,6 +33,7 @@ LL | | fn send<T: Send>(_: T) {}
LL | | Rc::new(String::from("foo"))
LL | | }
| |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
--> $DIR/auto-trait-leak.rs:11:16
@@ -68,6 +69,7 @@ LL | | fn send<T: Send>(_: T) {}
LL | | Rc::new(String::from("foo"))
LL | | }
| |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of opaque type satisfies auto traits
--> $DIR/auto-trait-leak.rs:21:10
diff --git a/tests/ui/impl-trait/autoderef.rs b/tests/ui/impl-trait/autoderef.rs
index 0d07a5496..cd2cdd9e3 100644
--- a/tests/ui/impl-trait/autoderef.rs
+++ b/tests/ui/impl-trait/autoderef.rs
@@ -1,5 +1,5 @@
// revisions: current next
-//[next] compile-flag: -Ztrait-solver=next
+//[next] compile-flags: -Ztrait-solver=next
// check-pass
use std::path::Path;
diff --git a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.rs b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.rs
new file mode 100644
index 000000000..57d688492
--- /dev/null
+++ b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.rs
@@ -0,0 +1,22 @@
+// edition:2015
+// check-pass
+// issue: 114664
+
+fn ice() -> impl AsRef<Fn(&())> {
+ //~^ WARN trait objects without an explicit `dyn` are deprecated
+ //~| WARN trait objects without an explicit `dyn` are deprecated
+ //~| WARN trait objects without an explicit `dyn` are deprecated
+ //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ Foo
+}
+
+struct Foo;
+impl AsRef<dyn Fn(&())> for Foo {
+ fn as_ref(&self) -> &(dyn for<'a> Fn(&'a ()) + 'static) {
+ todo!()
+ }
+}
+
+pub fn main() {}
diff --git a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
new file mode 100644
index 000000000..fad0b812d
--- /dev/null
+++ b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
@@ -0,0 +1,42 @@
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/fresh-lifetime-from-bare-trait-obj-114664.rs:5:24
+ |
+LL | fn ice() -> impl AsRef<Fn(&())> {
+ | ^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: `#[warn(bare_trait_objects)]` on by default
+help: use `dyn`
+ |
+LL | fn ice() -> impl AsRef<dyn Fn(&())> {
+ | +++
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/fresh-lifetime-from-bare-trait-obj-114664.rs:5:24
+ |
+LL | fn ice() -> impl AsRef<Fn(&())> {
+ | ^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL | fn ice() -> impl AsRef<dyn Fn(&())> {
+ | +++
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/fresh-lifetime-from-bare-trait-obj-114664.rs:5:24
+ |
+LL | fn ice() -> impl AsRef<Fn(&())> {
+ | ^^^^^^^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL | fn ice() -> impl AsRef<dyn Fn(&())> {
+ | +++
+
+warning: 3 warnings emitted
+
diff --git a/tests/ui/impl-trait/hidden-type-is-opaque-2.rs b/tests/ui/impl-trait/hidden-type-is-opaque-2.rs
index 970d84120..212e7b108 100644
--- a/tests/ui/impl-trait/hidden-type-is-opaque-2.rs
+++ b/tests/ui/impl-trait/hidden-type-is-opaque-2.rs
@@ -6,7 +6,8 @@
fn reify_as() -> Thunk<impl FnOnce(Continuation) -> Continuation> {
Thunk::new(|mut cont| {
- cont.reify_as(); //~ ERROR type annotations needed
+ //~^ ERROR type annotations needed
+ cont.reify_as();
cont
})
}
@@ -15,7 +16,8 @@ type Tait = impl FnOnce(Continuation) -> Continuation;
fn reify_as_tait() -> Thunk<Tait> {
Thunk::new(|mut cont| {
- cont.reify_as(); //~ ERROR type annotations needed
+ //~^ ERROR type annotations needed
+ cont.reify_as();
cont
})
}
diff --git a/tests/ui/impl-trait/hidden-type-is-opaque-2.stderr b/tests/ui/impl-trait/hidden-type-is-opaque-2.stderr
index 957052feb..39bf22142 100644
--- a/tests/ui/impl-trait/hidden-type-is-opaque-2.stderr
+++ b/tests/ui/impl-trait/hidden-type-is-opaque-2.stderr
@@ -1,14 +1,30 @@
error[E0282]: type annotations needed
- --> $DIR/hidden-type-is-opaque-2.rs:9:9
+ --> $DIR/hidden-type-is-opaque-2.rs:8:17
|
+LL | Thunk::new(|mut cont| {
+ | ^^^^^^^^
+LL |
LL | cont.reify_as();
- | ^^^^ cannot infer type
+ | ---- type must be known at this point
+ |
+help: consider giving this closure parameter an explicit type
+ |
+LL | Thunk::new(|mut cont: /* Type */| {
+ | ++++++++++++
error[E0282]: type annotations needed
- --> $DIR/hidden-type-is-opaque-2.rs:18:9
+ --> $DIR/hidden-type-is-opaque-2.rs:18:17
|
+LL | Thunk::new(|mut cont| {
+ | ^^^^^^^^
+LL |
LL | cont.reify_as();
- | ^^^^ cannot infer type
+ | ---- type must be known at this point
+ |
+help: consider giving this closure parameter an explicit type
+ |
+LL | Thunk::new(|mut cont: /* Type */| {
+ | ++++++++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
new file mode 100644
index 000000000..2a61c5cc8
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
@@ -0,0 +1,29 @@
+// check-pass
+// edition: 2021
+// issue: 113796
+
+#![feature(async_fn_in_trait)]
+
+trait AsyncLendingIterator {
+ type Item<'a>
+ where
+ Self: 'a;
+
+ async fn next(&mut self) -> Option<Self::Item<'_>>;
+}
+
+struct Lend<I>(I);
+impl<I> AsyncLendingIterator for Lend<I> {
+ type Item<'a> = &'a I
+ where
+ Self: 'a;
+
+ // Checking that the synthetic `<Self as AsyncLendingIterator>::next()` GAT
+ // is well-formed requires being able to assume the WF types of `next`.
+
+ async fn next(&mut self) -> Option<Self::Item<'_>> {
+ todo!()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
index 776006124..cfc2193f6 100644
--- a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
@@ -1,5 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-
#![feature(return_position_impl_trait_in_trait)]
use std::ops::Deref;
@@ -10,5 +8,7 @@ pub trait Foo {
pub struct Foreign;
impl Foo for Foreign {
- fn bar(self) -> &'static () { &() }
+ fn bar(self) -> &'static () {
+ &()
+ }
}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
new file mode 100644
index 000000000..3a93dfee5
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
@@ -0,0 +1,11 @@
+// issue: 114146
+
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Foo {
+ fn bar<'other: 'a>() -> impl Sized + 'a {}
+ //~^ ERROR use of undeclared lifetime name `'a`
+ //~| ERROR use of undeclared lifetime name `'a`
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
new file mode 100644
index 000000000..3a1f8f908
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
@@ -0,0 +1,33 @@
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/bad-item-bound-within-rpitit-2.rs:6:20
+ |
+LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
+ | ^^ undeclared lifetime
+ |
+help: consider introducing lifetime `'a` here
+ |
+LL | fn bar<'a, 'other: 'a>() -> impl Sized + 'a {}
+ | +++
+help: consider introducing lifetime `'a` here
+ |
+LL | trait Foo<'a> {
+ | ++++
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/bad-item-bound-within-rpitit-2.rs:6:42
+ |
+LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
+ | ^^ undeclared lifetime
+ |
+help: consider introducing lifetime `'a` here
+ |
+LL | fn bar<'a, 'other: 'a>() -> impl Sized + 'a {}
+ | +++
+help: consider introducing lifetime `'a` here
+ |
+LL | trait Foo<'a> {
+ | ++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0261`.
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
new file mode 100644
index 000000000..ff7ad4bf3
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
@@ -0,0 +1,24 @@
+// issue: 114145
+
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Iterable {
+ type Item<'a>
+ where
+ Self: 'a;
+
+ fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
+}
+
+impl<'a, I: 'a + Iterable> Iterable for &'a I {
+ type Item<'b> = I::Item<'a>
+ where
+ 'b: 'a;
+ //~^ ERROR impl has stricter requirements than trait
+
+ fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
+ (*self).iter()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
new file mode 100644
index 000000000..106b8a7c8
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
@@ -0,0 +1,17 @@
+error[E0276]: impl has stricter requirements than trait
+ --> $DIR/bad-item-bound-within-rpitit.rs:16:13
+ |
+LL | type Item<'a>
+ | ------------- definition of `Item` from trait
+...
+LL | 'b: 'a;
+ | ^^ impl has extra requirement `'b: 'a`
+ |
+help: copy the `where` clause predicates from the trait
+ |
+LL | where Self: 'b;
+ | ~~~~~~~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0276`.
diff --git a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
index f5290a5f4..f5ee4690f 100644
--- a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
+++ b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
new file mode 100644
index 000000000..742537ffc
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
@@ -0,0 +1,10 @@
+#![feature(return_position_impl_trait_in_trait)]
+
+struct Wrapper<G: Send>(G);
+
+trait Foo {
+ fn bar() -> Wrapper<impl Sized>;
+ //~^ ERROR `impl Sized` cannot be sent between threads safely
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
new file mode 100644
index 000000000..dee87d082
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
@@ -0,0 +1,16 @@
+error[E0277]: `impl Sized` cannot be sent between threads safely
+ --> $DIR/check-wf-on-non-defaulted-rpitit.rs:6:17
+ |
+LL | fn bar() -> Wrapper<impl Sized>;
+ | ^^^^^^^^^^^^^^^^^^^ `impl Sized` cannot be sent between threads safely
+ |
+ = help: the trait `Send` is not implemented for `impl Sized`
+note: required by a bound in `Wrapper`
+ --> $DIR/check-wf-on-non-defaulted-rpitit.rs:3:19
+ |
+LL | struct Wrapper<G: Send>(G);
+ | ^^^^ required by this bound in `Wrapper`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/in-trait/deep-match-works.rs b/tests/ui/impl-trait/in-trait/deep-match-works.rs
index 5c9d2e356..78cff97c6 100644
--- a/tests/ui/impl-trait/in-trait/deep-match-works.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match-works.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/deep-match.next.stderr b/tests/ui/impl-trait/in-trait/deep-match.next.stderr
deleted file mode 100644
index 400db20c7..000000000
--- a/tests/ui/impl-trait/in-trait/deep-match.next.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0053]: method `bar` has an incompatible return type for trait
- --> $DIR/deep-match.rs:14:17
- |
-LL | fn bar() -> i32 {
- | ^^^
- | |
- | expected `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/tests/ui/impl-trait/in-trait/deep-match.rs b/tests/ui/impl-trait/in-trait/deep-match.rs
index 413d054e1..0cae88f34 100644
--- a/tests/ui/impl-trait/in-trait/deep-match.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/deep-match.current.stderr b/tests/ui/impl-trait/in-trait/deep-match.stderr
index 400db20c7..f0ad3c16e 100644
--- a/tests/ui/impl-trait/in-trait/deep-match.current.stderr
+++ b/tests/ui/impl-trait/in-trait/deep-match.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `bar` has an incompatible return type for trait
- --> $DIR/deep-match.rs:14:17
+ --> $DIR/deep-match.rs:11:17
|
LL | fn bar() -> i32 {
| ^^^
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.next.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.next.stderr
deleted file mode 100644
index 85450e3b0..000000000
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.next.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/default-body-type-err-2.rs:10:9
- |
-LL | 42
- | ^^- help: try using a conversion method: `.to_string()`
- | |
- | expected `String`, found integer
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
index 623237763..45ae2b8ad 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
@@ -1,6 +1,4 @@
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![allow(incomplete_features)]
#![feature(async_fn_in_trait)]
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.current.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
index 85450e3b0..cc3bdf0e5 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.current.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/default-body-type-err-2.rs:10:9
+ --> $DIR/default-body-type-err-2.rs:8:9
|
LL | 42
| ^^- help: try using a conversion method: `.to_string()`
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.next.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err.next.stderr
deleted file mode 100644
index c949168a3..000000000
--- a/tests/ui/impl-trait/in-trait/default-body-type-err.next.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String`
- --> $DIR/default-body-type-err.rs:10:22
- |
-LL | fn lol(&self) -> impl Deref<Target = String> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String`
-LL |
-LL | &1i32
- | ----- return type was inferred to be `&i32` here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0271`.
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.rs b/tests/ui/impl-trait/in-trait/default-body-type-err.rs
index 9bd5b7779..ac9baf91c 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![allow(incomplete_features)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.current.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
index c949168a3..4742eb37d 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err.current.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
@@ -1,5 +1,5 @@
error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String`
- --> $DIR/default-body-type-err.rs:10:22
+ --> $DIR/default-body-type-err.rs:7:22
|
LL | fn lol(&self) -> impl Deref<Target = String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String`
diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.current.stderr b/tests/ui/impl-trait/in-trait/default-body-with-rpit.current.stderr
deleted file mode 100644
index 3c24eff9a..000000000
--- a/tests/ui/impl-trait/in-trait/default-body-with-rpit.current.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error: concrete type differs from previous defining opaque type use
- --> $DIR/default-body-with-rpit.rs:13:9
- |
-LL | ""
- | ^^ expected `impl Debug`, got `&'static str`
- |
-note: previous use here
- --> $DIR/default-body-with-rpit.rs:12:39
- |
-LL | async fn baz(&self) -> impl Debug {
- | _______________________________________^
-LL | | ""
-LL | | }
- | |_____^
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/default-body-with-rpit.rs:12:28
- |
-LL | async fn baz(&self) -> impl Debug {
- | ^^^^^^^^^^ cannot resolve opaque type
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0720`.
diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.next.stderr b/tests/ui/impl-trait/in-trait/default-body-with-rpit.next.stderr
deleted file mode 100644
index 3c24eff9a..000000000
--- a/tests/ui/impl-trait/in-trait/default-body-with-rpit.next.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error: concrete type differs from previous defining opaque type use
- --> $DIR/default-body-with-rpit.rs:13:9
- |
-LL | ""
- | ^^ expected `impl Debug`, got `&'static str`
- |
-note: previous use here
- --> $DIR/default-body-with-rpit.rs:12:39
- |
-LL | async fn baz(&self) -> impl Debug {
- | _______________________________________^
-LL | | ""
-LL | | }
- | |_____^
-
-error[E0720]: cannot resolve opaque type
- --> $DIR/default-body-with-rpit.rs:12:28
- |
-LL | async fn baz(&self) -> impl Debug {
- | ^^^^^^^^^^ cannot resolve opaque type
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0720`.
diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
index 6bcc7b9ef..25133214d 100644
--- a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
@@ -1,7 +1,5 @@
// edition:2021
-// known-bug: #108304
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
+// check-pass
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/default-body.rs b/tests/ui/impl-trait/in-trait/default-body.rs
index ab6a51c6b..b0baf5bb1 100644
--- a/tests/ui/impl-trait/in-trait/default-body.rs
+++ b/tests/ui/impl-trait/in-trait/default-body.rs
@@ -1,7 +1,5 @@
// check-pass
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
index 187039f44..817a4d7db 100644
--- a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
+++ b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.rs b/tests/ui/impl-trait/in-trait/default-method-constraint.rs
index 4f0bf2e7d..28d76241f 100644
--- a/tests/ui/impl-trait/in-trait/default-method-constraint.rs
+++ b/tests/ui/impl-trait/in-trait/default-method-constraint.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
// This didn't work in the previous default RPITIT method hack attempt
diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.current.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.current.stderr
deleted file mode 100644
index 653016cf0..000000000
--- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.current.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0277]: `()` doesn't implement `std::fmt::Display`
- --> $DIR/doesnt-satisfy.rs:12: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:8: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/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
index fcd0b51ee..bb4e0d44f 100644
--- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
+++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.next.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
index f0cd43bcf..7c56ffa10 100644
--- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.next.stderr
+++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
@@ -1,5 +1,5 @@
error[E0277]: `()` doesn't implement `std::fmt::Display`
- --> $DIR/doesnt-satisfy.rs:12:17
+ --> $DIR/doesnt-satisfy.rs:9:17
|
LL | fn bar() -> () {}
| ^^ `()` cannot be formatted with the default formatter
@@ -7,7 +7,7 @@ LL | fn bar() -> () {}
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `Foo::{opaque#0}`
- --> $DIR/doesnt-satisfy.rs:8:22
+ --> $DIR/doesnt-satisfy.rs:5:22
|
LL | fn bar() -> impl std::fmt::Display;
| ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}`
diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.current.stderr b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.current.stderr
deleted file mode 100644
index d4d0124a6..000000000
--- a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.current.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/dont-project-to-rpitit-with-no-value.rs:11:1
- |
-LL | fn foo(&self) -> impl Sized;
- | ---------------------------- `foo` from trait
-...
-LL | impl MyTrait for i32 {
- | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0046`.
diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
index 4d50b8c92..4719d5d3c 100644
--- a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
+++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
trait MyTrait {
diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.next.stderr b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
index d4d0124a6..66ee142cc 100644
--- a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.next.stderr
+++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
@@ -1,5 +1,5 @@
error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/dont-project-to-rpitit-with-no-value.rs:11:1
+ --> $DIR/dont-project-to-rpitit-with-no-value.rs:8:1
|
LL | fn foo(&self) -> impl Sized;
| ---------------------------- `foo` from trait
diff --git a/tests/ui/impl-trait/in-trait/early.rs b/tests/ui/impl-trait/in-trait/early.rs
index 831033a58..9c1c2b503 100644
--- a/tests/ui/impl-trait/in-trait/early.rs
+++ b/tests/ui/impl-trait/in-trait/early.rs
@@ -1,7 +1,5 @@
// check-pass
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/encode.rs b/tests/ui/impl-trait/in-trait/encode.rs
index 98aaf4a65..efb9f6498 100644
--- a/tests/ui/impl-trait/in-trait/encode.rs
+++ b/tests/ui/impl-trait/in-trait/encode.rs
@@ -1,7 +1,5 @@
// build-pass
// compile-flags: --crate-type=lib
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
index 6eef392c0..bfb2be8cb 100644
--- a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
+++ b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
@@ -5,7 +5,7 @@ LL | let _: &dyn rpitit::Foo = todo!();
| ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/auxiliary/rpitit.rs:8:21
+ --> $DIR/auxiliary/rpitit.rs:6:21
|
LL | fn bar(self) -> impl Deref<Target = impl Sized>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait cannot be made into an object because method `bar` references an `impl Trait` type in its return type
diff --git a/tests/ui/impl-trait/in-trait/foreign.rs b/tests/ui/impl-trait/in-trait/foreign.rs
index b0fbe3a3d..b0c93a029 100644
--- a/tests/ui/impl-trait/in-trait/foreign.rs
+++ b/tests/ui/impl-trait/in-trait/foreign.rs
@@ -1,7 +1,5 @@
// check-pass
// aux-build: rpitit.rs
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
extern crate rpitit;
@@ -11,7 +9,9 @@ use std::sync::Arc;
// Implement an RPITIT from another crate.
struct Local;
impl Foo for Local {
- fn bar(self) -> Arc<String> { Arc::new(String::new()) }
+ fn bar(self) -> Arc<String> {
+ Arc::new(String::new())
+ }
}
fn generic(f: impl Foo) {
diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.current.stderr b/tests/ui/impl-trait/in-trait/generics-mismatch.current.stderr
deleted file mode 100644
index 310edbcb6..000000000
--- a/tests/ui/impl-trait/in-trait/generics-mismatch.current.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters
- --> $DIR/generics-mismatch.rs:14:12
- |
-LL | fn bar(&self) -> impl Sized;
- | - expected 0 type parameters
-...
-LL | fn bar<T>(&self) {}
- | ^ found 1 type parameter
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0049`.
diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.rs b/tests/ui/impl-trait/in-trait/generics-mismatch.rs
index 9259ca193..cc0fc720e 100644
--- a/tests/ui/impl-trait/in-trait/generics-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/generics-mismatch.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.next.stderr b/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
index 310edbcb6..cd42683e0 100644
--- a/tests/ui/impl-trait/in-trait/generics-mismatch.next.stderr
+++ b/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters
- --> $DIR/generics-mismatch.rs:14:12
+ --> $DIR/generics-mismatch.rs:11:12
|
LL | fn bar(&self) -> impl Sized;
| - expected 0 type parameters
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.current.stderr b/tests/ui/impl-trait/in-trait/issue-102140.current.stderr
deleted file mode 100644
index 7aa7880e2..000000000
--- a/tests/ui/impl-trait/in-trait/issue-102140.current.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:26:22
- |
-LL | MyTrait::foo(&self)
- | ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
- | |
- | required by a bound introduced by this call
- |
-help: consider removing the leading `&`-reference
- |
-LL - MyTrait::foo(&self)
-LL + MyTrait::foo(self)
- |
-
-error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:26:9
- |
-LL | MyTrait::foo(&self)
- | ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
- |
- = help: the trait `MyTrait` is implemented for `Outer`
-
-error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:26:9
- |
-LL | MyTrait::foo(&self)
- | ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
- |
- = help: the trait `MyTrait` is implemented for `Outer`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.rs b/tests/ui/impl-trait/in-trait/issue-102140.rs
index 4dcac4f5b..be1e012ac 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102140.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.next.stderr b/tests/ui/impl-trait/in-trait/issue-102140.stderr
index 94893c9e7..5d55b9fa4 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.next.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102140.stderr
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:26:22
+ --> $DIR/issue-102140.rs:23:22
|
LL | MyTrait::foo(&self)
| ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
@@ -9,7 +9,7 @@ LL | MyTrait::foo(&self)
= help: the trait `MyTrait` is implemented for `Outer`
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:26:9
+ --> $DIR/issue-102140.rs:23:9
|
LL | MyTrait::foo(&self)
| ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
@@ -17,7 +17,7 @@ LL | MyTrait::foo(&self)
= help: the trait `MyTrait` is implemented for `Outer`
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:26:9
+ --> $DIR/issue-102140.rs:23:9
|
LL | MyTrait::foo(&self)
| ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
diff --git a/tests/ui/impl-trait/in-trait/issue-102301.rs b/tests/ui/impl-trait/in-trait/issue-102301.rs
index 1329ca29d..a93714a65 100644
--- a/tests/ui/impl-trait/in-trait/issue-102301.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102301.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.next.stderr b/tests/ui/impl-trait/in-trait/issue-102571.next.stderr
deleted file mode 100644
index cac9a29f6..000000000
--- a/tests/ui/impl-trait/in-trait/issue-102571.next.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/issue-102571.rs:23:9
- |
-LL | let () = t.bar();
- | ^^ ------- this expression has type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
- | |
- | expected associated type, found `()`
- |
- = note: expected associated type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
- found unit type `()`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.rs b/tests/ui/impl-trait/in-trait/issue-102571.rs
index f0ddab5e7..61c91e644 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102571.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.current.stderr b/tests/ui/impl-trait/in-trait/issue-102571.stderr
index cac9a29f6..87219941d 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.current.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102571.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/issue-102571.rs:23:9
+ --> $DIR/issue-102571.rs:20:9
|
LL | let () = t.bar();
| ^^ ------- this expression has type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
new file mode 100644
index 000000000..abc845d3a
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
@@ -0,0 +1,12 @@
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Iterable {
+ type Item<'a>
+ where
+ Self: 'a;
+
+ fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>;
+ //~^ ERROR use of undeclared lifetime name `'missing`
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
new file mode 100644
index 000000000..0d74c0b69
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
@@ -0,0 +1,23 @@
+error[E0261]: use of undeclared lifetime name `'missing`
+ --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:55
+ |
+LL | fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>;
+ | ^^^^^^^^ undeclared lifetime
+ |
+ = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
+help: consider making the bound lifetime-generic with a new `'missing` lifetime
+ |
+LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>>;
+ | +++++++++++++
+help: consider introducing lifetime `'missing` here
+ |
+LL | fn iter<'missing>(&self) -> impl Iterator<Item = Self::Item<'missing>>;
+ | ++++++++++
+help: consider introducing lifetime `'missing` here
+ |
+LL | trait Iterable<'missing> {
+ | ++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0261`.
diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit.rs b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
index 360207537..65285e3a3 100644
--- a/tests/ui/impl-trait/in-trait/nested-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/object-safety.next.stderr b/tests/ui/impl-trait/in-trait/object-safety.next.stderr
deleted file mode 100644
index 2c340a023..000000000
--- a/tests/ui/impl-trait/in-trait/object-safety.next.stderr
+++ /dev/null
@@ -1,49 +0,0 @@
-error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:33
- |
-LL | let i = Box::new(42_u32) as Box<dyn Foo>;
- | ^^^^^^^^^^^^ `Foo` cannot be made into an object
- |
-note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:10:22
- |
-LL | trait Foo {
- | --- this trait cannot be made into an object...
-LL | fn baz(&self) -> impl Debug;
- | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
- = help: consider moving `baz` to another trait
-
-error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:23:13
- |
-LL | let s = i.baz();
- | ^^^^^^^ `Foo` cannot be made into an object
- |
-note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:10:22
- |
-LL | trait Foo {
- | --- this trait cannot be made into an object...
-LL | fn baz(&self) -> impl Debug;
- | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
- = help: consider moving `baz` to another trait
-
-error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:13
- |
-LL | let i = Box::new(42_u32) as Box<dyn Foo>;
- | ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
- |
-note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:10:22
- |
-LL | trait Foo {
- | --- this trait cannot be made into an object...
-LL | fn baz(&self) -> impl Debug;
- | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
- = help: consider moving `baz` to another trait
- = note: required for the cast from `Box<u32>` to `Box<dyn Foo>`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/impl-trait/in-trait/object-safety.rs b/tests/ui/impl-trait/in-trait/object-safety.rs
index 016a0aaae..dd35b9a2d 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.rs
+++ b/tests/ui/impl-trait/in-trait/object-safety.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/object-safety.current.stderr b/tests/ui/impl-trait/in-trait/object-safety.stderr
index 2c340a023..4a3b3b114 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.current.stderr
+++ b/tests/ui/impl-trait/in-trait/object-safety.stderr
@@ -1,11 +1,11 @@
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:33
+ --> $DIR/object-safety.rs:17:33
|
LL | let i = Box::new(42_u32) as Box<dyn Foo>;
| ^^^^^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:10:22
+ --> $DIR/object-safety.rs:7:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
@@ -14,13 +14,13 @@ LL | fn baz(&self) -> impl Debug;
= help: consider moving `baz` to another trait
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:23:13
+ --> $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 <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:10:22
+ --> $DIR/object-safety.rs:7:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
@@ -29,13 +29,13 @@ LL | fn baz(&self) -> impl Debug;
= help: consider moving `baz` to another trait
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:13
+ --> $DIR/object-safety.rs:17:13
|
LL | let i = Box::new(42_u32) as Box<dyn Foo>;
| ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:10:22
+ --> $DIR/object-safety.rs:7:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.next.stderr b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.next.stderr
deleted file mode 100644
index a57653b2c..000000000
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.next.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/opaque-in-impl-is-opaque.rs:20: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/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
index c07ece15a..3ac264e8e 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.current.stderr b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
index a57653b2c..15edda483 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.current.stderr
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/opaque-in-impl-is-opaque.rs:20:19
+ --> $DIR/opaque-in-impl-is-opaque.rs:17:19
|
LL | fn bar(&self) -> impl Display {
| ------------ the found opaque type
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
index f48d9fa26..2e0662969 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs b/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
new file mode 100644
index 000000000..6330242ce
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
@@ -0,0 +1,11 @@
+// check-pass
+
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Foo {
+ fn early<'a, T: 'a>(x: &'a T) -> impl Iterator<Item = impl Into<&'a T>>;
+
+ fn late<'a, T>(x: &'a T) -> impl Iterator<Item = impl Into<&'a T>>;
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.current.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.current.stderr
deleted file mode 100644
index ff30103b7..000000000
--- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.current.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0277]: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied
- --> $DIR/return-dont-satisfy-bounds.rs:13:34
- |
-LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
- | ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>`
- |
- = help: the trait `Foo<char>` is implemented for `Bar`
-note: required by a bound in `Foo::foo::{opaque#0}`
- --> $DIR/return-dont-satisfy-bounds.rs:7:30
- |
-LL | fn foo<F2>(self) -> impl Foo<T>;
- | ^^^^^^ required by this bound in `Foo::foo::{opaque#0}`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
index 65528f212..5d9a224cc 100644
--- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
+++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
trait Foo<T> {
diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.next.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
index 7c7f7feaa..668fc6cbe 100644
--- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.next.stderr
+++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
@@ -1,12 +1,12 @@
error[E0277]: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied
- --> $DIR/return-dont-satisfy-bounds.rs:13:34
+ --> $DIR/return-dont-satisfy-bounds.rs:10:34
|
LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
| ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>`
|
= help: the trait `Foo<char>` is implemented for `Bar`
note: required by a bound in `Foo::{opaque#0}`
- --> $DIR/return-dont-satisfy-bounds.rs:7:30
+ --> $DIR/return-dont-satisfy-bounds.rs:4:30
|
LL | fn foo<F2>(self) -> impl Foo<T>;
| ^^^^^^ required by this bound in `Foo::{opaque#0}`
diff --git a/tests/ui/impl-trait/in-trait/reveal.rs b/tests/ui/impl-trait/in-trait/reveal.rs
index 1f42ec744..d6ede1cc4 100644
--- a/tests/ui/impl-trait/in-trait/reveal.rs
+++ b/tests/ui/impl-trait/in-trait/reveal.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
new file mode 100644
index 000000000..7682884f8
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
@@ -0,0 +1,18 @@
+// issue: 113903
+
+#![feature(return_position_impl_trait_in_trait)]
+
+use std::ops::Deref;
+
+pub trait Tr {
+ fn w() -> impl Deref<Target = Missing<impl Sized>>;
+ //~^ ERROR cannot find type `Missing` in this scope
+}
+
+impl Tr for () {
+ fn w() -> &'static () {
+ &()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.stderr b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.stderr
new file mode 100644
index 000000000..6e4a5bb5d
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `Missing` in this scope
+ --> $DIR/rpitit-shadowed-by-missing-adt.rs:8:35
+ |
+LL | fn w() -> impl Deref<Target = Missing<impl Sized>>;
+ | ^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr
deleted file mode 100644
index 8c9dd4031..000000000
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr
+++ /dev/null
@@ -1,61 +0,0 @@
-error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:36:47
- |
-LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:17:40
- |
-LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a`
-
-error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:41:57
- |
-LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:18:57
- |
-LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a`
-
-error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:49:10
- |
-LL | fn async_fn_multiple<'a, 'b>(
- | -- this lifetime was captured
-...
-LL | ) -> impl Future<Output = Vec<u8>> + Captures2<'a, 'b> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:20:12
- |
-LL | -> impl Future<Output = Vec<u8>> + Captures<'a>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + Captures2<'a, 'b>`
-
-error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/signature-mismatch.rs:58:10
- |
-LL | ) -> impl Future<Output = Vec<u8>> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `impl Future<Output = Vec<u8>>` will meet its required lifetime bounds...
- |
-note: ...that is required by this bound
- --> $DIR/signature-mismatch.rs:25:42
- |
-LL | ) -> impl Future<Output = Vec<u8>> + 'a;
- | ^^
-help: consider adding an explicit lifetime bound...
- |
-LL | fn async_fn_reduce_outlive<'a, 'b, T: 'a>(
- | ++++
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0309`.
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
index 23dd71ace..1d63a6f3c 100644
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
@@ -1,6 +1,4 @@
// edition:2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.stderr
index 8c9dd4031..616f1ac35 100644
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr
+++ b/tests/ui/impl-trait/in-trait/signature-mismatch.stderr
@@ -1,31 +1,31 @@
error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:36:47
+ --> $DIR/signature-mismatch.rs:34:47
|
LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
| -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:17:40
+ --> $DIR/signature-mismatch.rs:15:40
|
LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a`
error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:41:57
+ --> $DIR/signature-mismatch.rs:39:57
|
LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
| -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:18:57
+ --> $DIR/signature-mismatch.rs:16:57
|
LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a`
error: return type captures more lifetimes than trait definition
- --> $DIR/signature-mismatch.rs:49:10
+ --> $DIR/signature-mismatch.rs:47:10
|
LL | fn async_fn_multiple<'a, 'b>(
| -- this lifetime was captured
@@ -34,20 +34,20 @@ LL | ) -> impl Future<Output = Vec<u8>> + Captures2<'a, 'b> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: hidden type must only reference lifetimes captured by this impl trait
- --> $DIR/signature-mismatch.rs:20:12
+ --> $DIR/signature-mismatch.rs:18:12
|
LL | -> impl Future<Output = Vec<u8>> + Captures<'a>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: hidden type inferred to be `impl Future<Output = Vec<u8>> + Captures2<'a, 'b>`
error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/signature-mismatch.rs:58:10
+ --> $DIR/signature-mismatch.rs:56:10
|
LL | ) -> impl Future<Output = Vec<u8>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `impl Future<Output = Vec<u8>>` will meet its required lifetime bounds...
|
note: ...that is required by this bound
- --> $DIR/signature-mismatch.rs:25:42
+ --> $DIR/signature-mismatch.rs:23:42
|
LL | ) -> impl Future<Output = Vec<u8>> + 'a;
| ^^
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.current.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.current.stderr
deleted file mode 100644
index f48e7a1ed..000000000
--- a/tests/ui/impl-trait/in-trait/specialization-broken.current.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0053]: method `bar` has an incompatible type for trait
- --> $DIR/specialization-broken.rs:19:22
- |
-LL | default impl<U> Foo for U
- | - this type parameter
-...
-LL | fn bar(&self) -> U {
- | ^
- | |
- | expected associated type, found type parameter `U`
- | help: change the output type to match the trait: `impl Sized`
- |
-note: type in trait
- --> $DIR/specialization-broken.rs:12:22
- |
-LL | fn bar(&self) -> impl Sized;
- | ^^^^^^^^^^
- = note: expected signature `fn(&U) -> impl Sized`
- found signature `fn(&U) -> U`
-
-error: method with return-position `impl Trait` in trait cannot be specialized
- --> $DIR/specialization-broken.rs:19:5
- |
-LL | fn bar(&self) -> U {
- | ^^^^^^^^^^^^^^^^^^
- |
- = note: specialization behaves in inconsistent and surprising ways with `#![feature(return_position_impl_trait_in_trait)]`, and for now is disallowed
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.rs b/tests/ui/impl-trait/in-trait/specialization-broken.rs
index 658d07097..2fcffdf3f 100644
--- a/tests/ui/impl-trait/in-trait/specialization-broken.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-broken.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
// FIXME(compiler-errors): I'm not exactly sure if this is expected to pass or not.
// But we fixed an ICE anyways.
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.next.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
index f48e7a1ed..dc621d6b8 100644
--- a/tests/ui/impl-trait/in-trait/specialization-broken.next.stderr
+++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `bar` has an incompatible type for trait
- --> $DIR/specialization-broken.rs:19:22
+ --> $DIR/specialization-broken.rs:16:22
|
LL | default impl<U> Foo for U
| - this type parameter
@@ -11,7 +11,7 @@ LL | fn bar(&self) -> U {
| help: change the output type to match the trait: `impl Sized`
|
note: type in trait
- --> $DIR/specialization-broken.rs:12:22
+ --> $DIR/specialization-broken.rs:9:22
|
LL | fn bar(&self) -> impl Sized;
| ^^^^^^^^^^
@@ -19,7 +19,7 @@ LL | fn bar(&self) -> impl Sized;
found signature `fn(&U) -> U`
error: method with return-position `impl Trait` in trait cannot be specialized
- --> $DIR/specialization-broken.rs:19:5
+ --> $DIR/specialization-broken.rs:16:5
|
LL | fn bar(&self) -> U {
| ^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
index dbc5d38f1..c9ee877db 100644
--- a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(specialization)]
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/impl-trait/in-trait/success.rs b/tests/ui/impl-trait/in-trait/success.rs
index 0e69e0490..4cbe682b4 100644
--- a/tests/ui/impl-trait/in-trait/success.rs
+++ b/tests/ui/impl-trait/in-trait/success.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.current.stderr b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.current.stderr
deleted file mode 100644
index 64c942705..000000000
--- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.current.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter
- --> $DIR/trait-more-generics-than-impl.rs:14:11
- |
-LL | fn bar<T>() -> impl Sized;
- | - expected 1 type parameter
-...
-LL | fn bar() -> impl Sized {}
- | ^ found 0 type parameters
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0049`.
diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
index c2e394a1f..0bbe50ea6 100644
--- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
+++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.next.stderr b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
index 64c942705..8ff54cad9 100644
--- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.next.stderr
+++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
@@ -1,5 +1,5 @@
error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter
- --> $DIR/trait-more-generics-than-impl.rs:14:11
+ --> $DIR/trait-more-generics-than-impl.rs:11:11
|
LL | fn bar<T>() -> impl Sized;
| - expected 1 type parameter
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
index f966be43a..07c8606f9 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
trait Foo {
@@ -10,7 +7,9 @@ trait Foo {
impl<'a, T> Foo for T {
//~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
- fn test() -> &'a () { &() }
+ fn test() -> &'a () {
+ &()
+ }
}
fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.current.stderr b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
index bf088ae8b..cfce35567 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.current.stderr
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
@@ -1,5 +1,5 @@
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
- --> $DIR/unconstrained-lt.rs:10:6
+ --> $DIR/unconstrained-lt.rs:7:6
|
LL | impl<'a, T> Foo for T {
| ^^ unconstrained lifetime parameter
diff --git a/tests/ui/impl-trait/in-trait/variances-of-gat.rs b/tests/ui/impl-trait/in-trait/variances-of-gat.rs
index 4008ece94..0d19e1ff4 100644
--- a/tests/ui/impl-trait/in-trait/variances-of-gat.rs
+++ b/tests/ui/impl-trait/in-trait/variances-of-gat.rs
@@ -1,6 +1,4 @@
// check-pass
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr
deleted file mode 100644
index 74c84c012..000000000
--- a/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr
+++ /dev/null
@@ -1,57 +0,0 @@
-error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:17:22
- |
-LL | fn nya() -> impl Wf<Vec<[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 `Vec`
- --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-
-error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:20: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:10:10
- |
-LL | trait Wf<T> {
- | ^ required by this bound in `Wf`
-help: consider relaxing the implicit `Sized` restriction
- |
-LL | trait Wf<T: ?Sized> {
- | ++++++++
-
-error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:23:44
- |
-LL | fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[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 `Vec`
- --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-
-error[E0277]: `T` doesn't implement `std::fmt::Display`
- --> $DIR/wf-bounds.rs:26:26
- |
-LL | fn nya4<T>() -> impl Wf<NeedsDisplay<T>>;
- | ^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
- |
- = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
-note: required by a bound in `NeedsDisplay`
- --> $DIR/wf-bounds.rs:14:24
- |
-LL | struct NeedsDisplay<T: Display>(T);
- | ^^^^^^^ required by this bound in `NeedsDisplay`
-help: consider restricting type parameter `T`
- |
-LL | fn nya4<T: std::fmt::Display>() -> impl Wf<NeedsDisplay<T>>;
- | +++++++++++++++++++
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.rs b/tests/ui/impl-trait/in-trait/wf-bounds.rs
index f8c1e561d..ee873f94b 100644
--- a/tests/ui/impl-trait/in-trait/wf-bounds.rs
+++ b/tests/ui/impl-trait/in-trait/wf-bounds.rs
@@ -1,6 +1,4 @@
// issue #101663
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.current.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.stderr
index 74c84c012..4d60b1330 100644
--- a/tests/ui/impl-trait/in-trait/wf-bounds.current.stderr
+++ b/tests/ui/impl-trait/in-trait/wf-bounds.stderr
@@ -1,5 +1,5 @@
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:17:22
+ --> $DIR/wf-bounds.rs:15:22
|
LL | fn nya() -> impl Wf<Vec<[u8]>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -9,14 +9,14 @@ note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:20:23
+ --> $DIR/wf-bounds.rs:18: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:10:10
+ --> $DIR/wf-bounds.rs:8:10
|
LL | trait Wf<T> {
| ^ required by this bound in `Wf`
@@ -26,7 +26,7 @@ LL | trait Wf<T: ?Sized> {
| ++++++++
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:23:44
+ --> $DIR/wf-bounds.rs:21:44
|
LL | fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[u8]>>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -36,21 +36,17 @@ note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
error[E0277]: `T` doesn't implement `std::fmt::Display`
- --> $DIR/wf-bounds.rs:26:26
+ --> $DIR/wf-bounds.rs:24:26
|
LL | fn nya4<T>() -> impl Wf<NeedsDisplay<T>>;
| ^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
|
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `NeedsDisplay`
- --> $DIR/wf-bounds.rs:14:24
+ --> $DIR/wf-bounds.rs:12:24
|
LL | struct NeedsDisplay<T: Display>(T);
| ^^^^^^^ required by this bound in `NeedsDisplay`
-help: consider restricting type parameter `T`
- |
-LL | fn nya4<T: std::fmt::Display>() -> impl Wf<NeedsDisplay<T>>;
- | +++++++++++++++++++
error: aborting due to 4 previous errors
diff --git a/tests/ui/impl-trait/in-trait/where-clause.rs b/tests/ui/impl-trait/in-trait/where-clause.rs
index 88d86e2b5..87bac519c 100644
--- a/tests/ui/impl-trait/in-trait/where-clause.rs
+++ b/tests/ui/impl-trait/in-trait/where-clause.rs
@@ -1,7 +1,5 @@
// check-pass
// edition: 2021
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/impl-trait/issue-102605.stderr b/tests/ui/impl-trait/issue-102605.stderr
index dfe18e43e..dcb227971 100644
--- a/tests/ui/impl-trait/issue-102605.stderr
+++ b/tests/ui/impl-trait/issue-102605.stderr
@@ -1,3 +1,11 @@
+error[E0277]: `main` has invalid return type `Option<()>`
+ --> $DIR/issue-102605.rs:11:14
+ |
+LL | fn main() -> Option<()> {
+ | ^^^^^^^^^^ `main` can only return types that implement `Termination`
+ |
+ = help: consider using `()`, or a `Result`
+
error[E0308]: mismatched types
--> $DIR/issue-102605.rs:13:20
|
@@ -25,14 +33,6 @@ help: try wrapping the expression in `Err`
LL | convert_result(Err(foo()))
| ++++ +
-error[E0277]: `main` has invalid return type `Option<()>`
- --> $DIR/issue-102605.rs:11:14
- |
-LL | fn main() -> Option<()> {
- | ^^^^^^^^^^ `main` can only return types that implement `Termination`
- |
- = help: consider using `()`, or a `Result`
-
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0308.
diff --git a/tests/ui/impl-trait/issue-99073-2.rs b/tests/ui/impl-trait/issue-99073-2.rs
index 14ac68880..37ea211be 100644
--- a/tests/ui/impl-trait/issue-99073-2.rs
+++ b/tests/ui/impl-trait/issue-99073-2.rs
@@ -8,6 +8,7 @@ fn test<T: Display>(t: T, recurse: bool) -> impl Display {
let f = || {
let i: u32 = test::<i32>(-1, false);
//~^ ERROR concrete type differs from previous defining opaque type use
+ //~| ERROR expected generic type parameter, found `i32`
println!("{i}");
};
if recurse {
diff --git a/tests/ui/impl-trait/issue-99073-2.stderr b/tests/ui/impl-trait/issue-99073-2.stderr
index 913bc8f56..06b2b8456 100644
--- a/tests/ui/impl-trait/issue-99073-2.stderr
+++ b/tests/ui/impl-trait/issue-99073-2.stderr
@@ -1,3 +1,12 @@
+error[E0792]: expected generic type parameter, found `i32`
+ --> $DIR/issue-99073-2.rs:9:22
+ |
+LL | fn test<T: Display>(t: T, recurse: bool) -> impl Display {
+ | - this generic parameter must be used with a generic type parameter
+LL | let f = || {
+LL | let i: u32 = test::<i32>(-1, false);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
error: concrete type differs from previous defining opaque type use
--> $DIR/issue-99073-2.rs:9:22
|
@@ -5,10 +14,11 @@ LL | let i: u32 = test::<i32>(-1, false);
| ^^^^^^^^^^^^^^^^^^^^^^ expected `T`, got `u32`
|
note: previous use here
- --> $DIR/issue-99073-2.rs:16:5
+ --> $DIR/issue-99073-2.rs:7:45
|
-LL | t
- | ^
+LL | fn test<T: Display>(t: T, recurse: bool) -> impl Display {
+ | ^^^^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/issue-99073.rs b/tests/ui/impl-trait/issue-99073.rs
index 7798e247d..b4ef3e66f 100644
--- a/tests/ui/impl-trait/issue-99073.rs
+++ b/tests/ui/impl-trait/issue-99073.rs
@@ -5,4 +5,5 @@ fn main() {
fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() {
move || f(fix(&f))
//~^ ERROR concrete type differs from previous defining opaque type use
+ //~| ERROR expected generic type parameter, found `&F`
}
diff --git a/tests/ui/impl-trait/issue-99073.stderr b/tests/ui/impl-trait/issue-99073.stderr
index 546367953..a8400080e 100644
--- a/tests/ui/impl-trait/issue-99073.stderr
+++ b/tests/ui/impl-trait/issue-99073.stderr
@@ -1,14 +1,23 @@
-error: concrete type differs from previous defining opaque type use
+error[E0792]: expected generic type parameter, found `&F`
--> $DIR/issue-99073.rs:6:11
|
+LL | fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() {
+ | - this generic parameter must be used with a generic type parameter
+LL | move || f(fix(&f))
+ | ^^^^^^^^^^
+
+error: concrete type differs from previous defining opaque type use
+ --> $DIR/issue-99073.rs:6:13
+ |
LL | move || f(fix(&f))
- | ^^^^^^^^^^ expected `[closure@$DIR/issue-99073.rs:6:3: 6:10]`, got `G`
+ | ^^^^^^^ expected `[closure@$DIR/issue-99073.rs:6:3: 6:10]`, got `G`
|
note: previous use here
- --> $DIR/issue-99073.rs:6:3
+ --> $DIR/issue-99073.rs:5:36
|
-LL | move || f(fix(&f))
- | ^^^^^^^^^^^^^^^^^^
+LL | fn fix<F: Fn(G), G: Fn()>(f: F) -> impl Fn() {
+ | ^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/issues/issue-86800.rs b/tests/ui/impl-trait/issues/issue-86800.rs
index ec4fda322..df70b324c 100644
--- a/tests/ui/impl-trait/issues/issue-86800.rs
+++ b/tests/ui/impl-trait/issues/issue-86800.rs
@@ -5,7 +5,7 @@
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
// failure-status:101
// normalize-stderr-test ".*note: .*\n\n" -> ""
-// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
+// normalize-stderr-test "thread 'rustc' panicked.*:\n.*\n" -> ""
// rustc-env:RUST_BACKTRACE=0
use std::future::Future;
diff --git a/tests/ui/impl-trait/lifetime-ambiguity-regression.rs b/tests/ui/impl-trait/lifetime-ambiguity-regression.rs
new file mode 100644
index 000000000..ce6ae3786
--- /dev/null
+++ b/tests/ui/impl-trait/lifetime-ambiguity-regression.rs
@@ -0,0 +1,13 @@
+//! This test shows a situation where through subtle compiler changes we can
+//! suddenly infer a different lifetime in the hidden type, and thus not meet
+//! the opaque type bounds anymore. In this case `'a` and `'b` are equal, so
+//! picking either is fine, but then we'll fail an identity check of the hidden
+//! type and the expected hidden type.
+
+// check-pass
+
+fn test<'a: 'b, 'b: 'a>() -> impl IntoIterator<Item = (&'a u8, impl Into<(&'b u8, &'a u8)>)> {
+ None::<(_, (_, _))>
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/mapping-duplicated-lifetimes-issue-114597.rs b/tests/ui/impl-trait/mapping-duplicated-lifetimes-issue-114597.rs
new file mode 100644
index 000000000..a2dd0a930
--- /dev/null
+++ b/tests/ui/impl-trait/mapping-duplicated-lifetimes-issue-114597.rs
@@ -0,0 +1,15 @@
+// check-pass
+// issue: 114597
+// edition: 2021
+
+struct A<'a> {
+ dat: &'a (),
+}
+
+impl<'a> A<'a> {
+ async fn a(&self) -> impl Iterator<Item = std::iter::Repeat<()>> {
+ std::iter::repeat(()).map(|()| std::iter::repeat(()))
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/nested-rpit-hrtb-2.rs b/tests/ui/impl-trait/nested-rpit-hrtb-2.rs
new file mode 100644
index 000000000..4d7296215
--- /dev/null
+++ b/tests/ui/impl-trait/nested-rpit-hrtb-2.rs
@@ -0,0 +1,9 @@
+// The nested impl Trait references a higher-ranked region
+
+trait Trait<'a> { type Assoc; }
+impl<'a> Trait<'a> for () { type Assoc = &'a str; }
+
+fn test() -> impl for<'a> Trait<'a, Assoc = impl Sized> {}
+//~^ ERROR captures lifetime that does not appear in bounds
+
+fn main() {}
diff --git a/tests/ui/impl-trait/nested-rpit-hrtb-2.stderr b/tests/ui/impl-trait/nested-rpit-hrtb-2.stderr
new file mode 100644
index 000000000..71d1d45f4
--- /dev/null
+++ b/tests/ui/impl-trait/nested-rpit-hrtb-2.stderr
@@ -0,0 +1,12 @@
+error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
+ --> $DIR/nested-rpit-hrtb-2.rs:6:57
+ |
+LL | fn test() -> impl for<'a> Trait<'a, Assoc = impl Sized> {}
+ | -- ---------- ^^
+ | | |
+ | | opaque type defined here
+ | hidden type `&'a str` captures the lifetime `'a` as defined here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/normalize-tait-in-const.rs b/tests/ui/impl-trait/normalize-tait-in-const.rs
index d2e34c00b..dd03fd3f7 100644
--- a/tests/ui/impl-trait/normalize-tait-in-const.rs
+++ b/tests/ui/impl-trait/normalize-tait-in-const.rs
@@ -1,9 +1,4 @@
// known-bug: #103507
-// failure-status: 101
-// normalize-stderr-test "note: .*\n\n" -> ""
-// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
-// normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
-// rustc-env:RUST_BACKTRACE=0
#![feature(type_alias_impl_trait)]
#![feature(const_trait_impl)]
diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr
index 84b009187..5fbba9a85 100644
--- a/tests/ui/impl-trait/normalize-tait-in-const.stderr
+++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr
@@ -1,8 +1,25 @@
-error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:LL:CC: Failed to normalize <for<'a, 'b> fn(&'a Alias<'b>) {foo} as std::ops::FnOnce<(&&S,)>>::Output, maybe try to call `try_normalize_erasing_regions` instead
+error[E0015]: cannot call non-const closure in constant functions
+ --> $DIR/normalize-tait-in-const.rs:26:5
+ |
+LL | fun(filter_positive());
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+help: consider further restricting this bound
+ |
+LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct + ~const std::ops::Fn<(&Alias<'_>,)>>(fun: F) {
+ | ++++++++++++++++++++++++++++++++++++
-query stack during panic:
-#0 [eval_to_allocation_raw] const-evaluating + checking `BAR`
-#1 [eval_to_const_value_raw] simplifying constant for the type system `BAR`
-end of query stack
-error: aborting due to previous error
+error[E0493]: destructor of `F` cannot be evaluated at compile-time
+ --> $DIR/normalize-tait-in-const.rs:25:79
+ |
+LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
+ | ^^^ the destructor for this type cannot be evaluated in constant functions
+LL | fun(filter_positive());
+LL | }
+ | - value is dropped here
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0015, E0493.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/impl-trait/opaque-cast-field-access-in-future.rs b/tests/ui/impl-trait/opaque-cast-field-access-in-future.rs
new file mode 100644
index 000000000..3e3bc09a6
--- /dev/null
+++ b/tests/ui/impl-trait/opaque-cast-field-access-in-future.rs
@@ -0,0 +1,27 @@
+// edition: 2021
+
+use std::future::Future;
+
+async fn bop() {
+ fold(run(), |mut foo| async move {
+ &mut foo.bar;
+ })
+}
+
+fn fold<Fut, F, U>(_: Foo<U>, f: F)
+where
+ F: FnMut(Foo<U>) -> Fut,
+{
+ loop {}
+}
+
+struct Foo<F> {
+ bar: Vec<F>,
+}
+
+fn run() -> Foo<impl Future<Output = ()>> {
+ //~^ ERROR type annotations needed
+ loop {}
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
new file mode 100644
index 000000000..ee4343b11
--- /dev/null
+++ b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
@@ -0,0 +1,9 @@
+error[E0282]: type annotations needed
+ --> $DIR/opaque-cast-field-access-in-future.rs:22:17
+ |
+LL | fn run() -> Foo<impl Future<Output = ()>> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/impl-trait/recursive-auto-trait.rs b/tests/ui/impl-trait/recursive-auto-trait.rs
new file mode 100644
index 000000000..d7b68144f
--- /dev/null
+++ b/tests/ui/impl-trait/recursive-auto-trait.rs
@@ -0,0 +1,10 @@
+// check-pass
+fn is_send<T: Send>(_: T) {}
+fn foo() -> impl Send {
+ if false {
+ is_send(foo());
+ }
+ ()
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs b/tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs
new file mode 100644
index 000000000..6207381c7
--- /dev/null
+++ b/tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+// related to #113916, check that using RPITs in functions with lifetime params
+// which are constrained to be equal compiles.
+
+trait Trait<'a, 'b> {}
+impl Trait<'_, '_> for () {}
+fn pass<'a: 'b, 'b: 'a>() -> impl Trait<'a, 'b> {
+ (|| {})()
+}
+
+struct Foo<'a>(&'a ());
+impl<'a> Foo<'a> {
+ fn bar<'b: 'a>(&'b self) -> impl Trait<'a, 'b> {
+ let _: &'a &'b &'a ();
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/rpit/non-defining-use.rs b/tests/ui/impl-trait/rpit/non-defining-use.rs
new file mode 100644
index 000000000..255a8929a
--- /dev/null
+++ b/tests/ui/impl-trait/rpit/non-defining-use.rs
@@ -0,0 +1,14 @@
+// Regression test for #111935 that non-defining uses of RPIT result in errors
+#![allow(unconditional_recursion)]
+fn foo<T>() -> impl Sized {
+ let _: () = foo::<u8>(); //~ ERROR expected generic type parameter, found `u8`
+}
+
+fn bar<T>(val: T) -> impl Sized {
+ let _: u8 = bar(0u8);
+ //~^ ERROR concrete type differs from previous defining opaque type use
+ //~| ERROR expected generic type parameter, found `u8`
+ val
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/rpit/non-defining-use.stderr b/tests/ui/impl-trait/rpit/non-defining-use.stderr
new file mode 100644
index 000000000..19987d476
--- /dev/null
+++ b/tests/ui/impl-trait/rpit/non-defining-use.stderr
@@ -0,0 +1,31 @@
+error[E0792]: expected generic type parameter, found `u8`
+ --> $DIR/non-defining-use.rs:4:12
+ |
+LL | fn foo<T>() -> impl Sized {
+ | - this generic parameter must be used with a generic type parameter
+LL | let _: () = foo::<u8>();
+ | ^^
+
+error[E0792]: expected generic type parameter, found `u8`
+ --> $DIR/non-defining-use.rs:8:12
+ |
+LL | fn bar<T>(val: T) -> impl Sized {
+ | - this generic parameter must be used with a generic type parameter
+LL | let _: u8 = bar(0u8);
+ | ^^
+
+error: concrete type differs from previous defining opaque type use
+ --> $DIR/non-defining-use.rs:8:17
+ |
+LL | let _: u8 = bar(0u8);
+ | ^^^^^^^^ expected `T`, got `u8`
+ |
+note: previous use here
+ --> $DIR/non-defining-use.rs:7:22
+ |
+LL | fn bar<T>(val: T) -> impl Sized {
+ | ^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-1.rs b/tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-1.rs
new file mode 100644
index 000000000..9b793642d
--- /dev/null
+++ b/tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-1.rs
@@ -0,0 +1,26 @@
+// check-pass
+
+pub trait Foo {
+ type Error: Error;
+
+ fn foo(&self, stream: &<Self::Error as Error>::Span);
+}
+
+pub struct Wrapper<Inner>(Inner);
+
+impl<E: Error, Inner> Foo for Wrapper<Inner>
+where
+ Inner: Foo<Error = E>,
+{
+ type Error = E;
+
+ fn foo(&self, stream: &<Self::Error as Error>::Span) {
+ todo!()
+ }
+}
+
+pub trait Error {
+ type Span;
+}
+
+fn main() {}
diff --git a/tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-2.rs b/tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-2.rs
new file mode 100644
index 000000000..86b10a56c
--- /dev/null
+++ b/tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-2.rs
@@ -0,0 +1,26 @@
+// check-pass
+
+trait AsBufferView {
+ type Device;
+}
+
+trait Error {
+ type Span;
+}
+
+trait Foo {
+ type Error: Error;
+ fn foo(&self) -> &<Self::Error as Error>::Span;
+}
+
+impl<D: Error, VBuf0> Foo for VBuf0
+where
+ VBuf0: AsBufferView<Device = D>,
+{
+ type Error = D;
+ fn foo(&self) -> &<Self::Error as Error>::Span {
+ todo!()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/implied-bounds/implied_bounds_entailment_alias_var.rs b/tests/ui/implied-bounds/implied_bounds_entailment_alias_var.rs
new file mode 100644
index 000000000..e0df96b0d
--- /dev/null
+++ b/tests/ui/implied-bounds/implied_bounds_entailment_alias_var.rs
@@ -0,0 +1,32 @@
+// check-pass
+
+trait Data {
+ type Elem;
+}
+
+impl<F, S: Data<Elem = F>> Data for ArrayBase<S> {
+ type Elem = F;
+}
+
+struct DatasetIter<'a, R: Data> {
+ data: &'a R::Elem,
+}
+
+pub struct ArrayBase<S> {
+ data: S,
+}
+
+trait Trait {
+ type Item;
+ fn next() -> Option<Self::Item>;
+}
+
+impl<'a, D: Data> Trait for DatasetIter<'a, ArrayBase<D>> {
+ type Item = ();
+
+ fn next() -> Option<Self::Item> {
+ None
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/implied-bounds/implied_bounds_entailment_skip_non_outlives.rs b/tests/ui/implied-bounds/implied_bounds_entailment_skip_non_outlives.rs
new file mode 100644
index 000000000..8dcc35a28
--- /dev/null
+++ b/tests/ui/implied-bounds/implied_bounds_entailment_skip_non_outlives.rs
@@ -0,0 +1,23 @@
+// check-pass
+// See issue #109356. We don't want a false positive to the `implied_bounds_entailment` lint.
+
+use std::borrow::Cow;
+
+pub trait Trait {
+ fn method(self) -> Option<Cow<'static, str>>
+ where
+ Self: Sized;
+}
+
+impl<'a> Trait for Cow<'a, str> {
+ // If we're not careful here, we'll check `WF(return-type)` using the trait
+ // and impl where clauses, requiring that `Cow<'a, str>: Sized`. This is
+ // obviously true, but if we pick the `Self: Sized` clause from the trait
+ // over the "inherent impl", we will require `'a == 'static`, which triggers
+ // the `implied_bounds_entailment` lint.
+ fn method(self) -> Option<Cow<'static, str>> {
+ None
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/implied-bounds/trait-where-clause-implied.rs b/tests/ui/implied-bounds/trait-where-clause-implied.rs
new file mode 100644
index 000000000..5f9ab66d3
--- /dev/null
+++ b/tests/ui/implied-bounds/trait-where-clause-implied.rs
@@ -0,0 +1,15 @@
+// check-pass
+
+pub trait Trait<'a, 'b> {
+ fn method(self, _: &'static &'static ())
+ where
+ 'a: 'b;
+}
+
+impl<'a> Trait<'a, 'static> for () {
+ // On first glance, this seems like we have the extra implied bound that
+ // `'a: 'static`, but we know this from the trait method where clause.
+ fn method(self, _: &'static &'a ()) {}
+}
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-1.rs b/tests/ui/imports/ambiguous-1.rs
new file mode 100644
index 000000000..2c9815864
--- /dev/null
+++ b/tests/ui/imports/ambiguous-1.rs
@@ -0,0 +1,30 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/112743#issuecomment-1601986883
+
+macro_rules! m {
+ () => {
+ pub fn id() {}
+ };
+}
+
+mod openssl {
+ pub use self::evp::*;
+ //~^ WARNING ambiguous glob re-exports
+ pub use self::handwritten::*;
+
+ mod evp {
+ m!();
+ }
+
+ mod handwritten {
+ m!();
+ }
+}
+
+pub use openssl::*;
+
+fn main() {
+ id();
+ //~^ WARNING `id` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-1.stderr b/tests/ui/imports/ambiguous-1.stderr
new file mode 100644
index 000000000..61b3077c3
--- /dev/null
+++ b/tests/ui/imports/ambiguous-1.stderr
@@ -0,0 +1,36 @@
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-1.rs:11:13
+ |
+LL | pub use self::evp::*;
+ | ^^^^^^^^^^^^ the name `id` in the value namespace is first re-exported here
+LL |
+LL | pub use self::handwritten::*;
+ | -------------------- but the name `id` in the value namespace is also re-exported here
+ |
+ = note: `#[warn(ambiguous_glob_reexports)]` on by default
+
+warning: `id` is ambiguous
+ --> $DIR/ambiguous-1.rs:27:5
+ |
+LL | id();
+ | ^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `id` could refer to the function imported here
+ --> $DIR/ambiguous-1.rs:11:13
+ |
+LL | pub use self::evp::*;
+ | ^^^^^^^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+note: `id` could also refer to the function imported here
+ --> $DIR/ambiguous-1.rs:13:13
+ |
+LL | pub use self::handwritten::*;
+ | ^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/imports/ambiguous-10.rs b/tests/ui/imports/ambiguous-10.rs
new file mode 100644
index 000000000..5078b734b
--- /dev/null
+++ b/tests/ui/imports/ambiguous-10.rs
@@ -0,0 +1,19 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296
+
+mod a {
+ pub enum Token {}
+}
+
+mod b {
+ use crate::a::*;
+ #[derive(Debug)]
+ pub enum Token {}
+}
+
+use crate::a::*;
+use crate::b::*;
+fn c(_: Token) {}
+//~^ WARNING `Token` is ambiguous
+//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+fn main() { }
diff --git a/tests/ui/imports/ambiguous-10.stderr b/tests/ui/imports/ambiguous-10.stderr
new file mode 100644
index 000000000..704af616b
--- /dev/null
+++ b/tests/ui/imports/ambiguous-10.stderr
@@ -0,0 +1,25 @@
+warning: `Token` is ambiguous
+ --> $DIR/ambiguous-10.rs:16:9
+ |
+LL | fn c(_: Token) {}
+ | ^^^^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Token` could refer to the enum imported here
+ --> $DIR/ambiguous-10.rs:14:5
+ |
+LL | use crate::a::*;
+ | ^^^^^^^^^^^
+ = help: consider adding an explicit import of `Token` to disambiguate
+note: `Token` could also refer to the enum imported here
+ --> $DIR/ambiguous-10.rs:15:5
+ |
+LL | use crate::b::*;
+ | ^^^^^^^^^^^
+ = help: consider adding an explicit import of `Token` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-11.rs b/tests/ui/imports/ambiguous-11.rs
new file mode 100644
index 000000000..0565b9d22
--- /dev/null
+++ b/tests/ui/imports/ambiguous-11.rs
@@ -0,0 +1,14 @@
+// aux-build: ambiguous-11-extern.rs
+
+extern crate ambiguous_11_extern;
+
+mod s {
+ pub trait Error {}
+}
+
+use s::*;
+use ambiguous_11_extern::*;
+fn a<E: Error>(_: E) {}
+//~^ ERROR `Error` is ambiguous
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-11.stderr b/tests/ui/imports/ambiguous-11.stderr
new file mode 100644
index 000000000..765d6afa8
--- /dev/null
+++ b/tests/ui/imports/ambiguous-11.stderr
@@ -0,0 +1,23 @@
+error[E0659]: `Error` is ambiguous
+ --> $DIR/ambiguous-11.rs:11:9
+ |
+LL | fn a<E: Error>(_: E) {}
+ | ^^^^^ ambiguous name
+ |
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Error` could refer to the trait imported here
+ --> $DIR/ambiguous-11.rs:9:5
+ |
+LL | use s::*;
+ | ^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+note: `Error` could also refer to the enum imported here
+ --> $DIR/ambiguous-11.rs:10:5
+ |
+LL | use ambiguous_11_extern::*;
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/ambiguous-12.rs b/tests/ui/imports/ambiguous-12.rs
new file mode 100644
index 000000000..6259c1357
--- /dev/null
+++ b/tests/ui/imports/ambiguous-12.rs
@@ -0,0 +1,25 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296
+
+macro_rules! m {
+ () => {
+ pub fn b() {}
+ };
+}
+
+pub mod ciphertext {
+ m!();
+}
+pub mod public {
+ use crate::ciphertext::*;
+ m!();
+}
+
+use crate::ciphertext::*;
+use crate::public::*;
+
+fn main() {
+ b();
+ //~^ WARNING `b` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-12.stderr b/tests/ui/imports/ambiguous-12.stderr
new file mode 100644
index 000000000..4725c3884
--- /dev/null
+++ b/tests/ui/imports/ambiguous-12.stderr
@@ -0,0 +1,25 @@
+warning: `b` is ambiguous
+ --> $DIR/ambiguous-12.rs:22:5
+ |
+LL | b();
+ | ^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `b` could refer to the function imported here
+ --> $DIR/ambiguous-12.rs:18:5
+ |
+LL | use crate::ciphertext::*;
+ | ^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `b` to disambiguate
+note: `b` could also refer to the function imported here
+ --> $DIR/ambiguous-12.rs:19:5
+ |
+LL | use crate::public::*;
+ | ^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `b` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-13.rs b/tests/ui/imports/ambiguous-13.rs
new file mode 100644
index 000000000..82f933c49
--- /dev/null
+++ b/tests/ui/imports/ambiguous-13.rs
@@ -0,0 +1,22 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296
+
+pub mod object {
+ #[derive(Debug)]
+ pub struct Rect;
+}
+
+pub mod content {
+ use crate::object::*;
+
+ #[derive(Debug)]
+ pub struct Rect;
+}
+
+use crate::object::*;
+use crate::content::*;
+
+fn a(_: Rect) {}
+//~^ WARNING `Rect` is ambiguous
+//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+fn main() { }
diff --git a/tests/ui/imports/ambiguous-13.stderr b/tests/ui/imports/ambiguous-13.stderr
new file mode 100644
index 000000000..3e78100b6
--- /dev/null
+++ b/tests/ui/imports/ambiguous-13.stderr
@@ -0,0 +1,25 @@
+warning: `Rect` is ambiguous
+ --> $DIR/ambiguous-13.rs:19:9
+ |
+LL | fn a(_: Rect) {}
+ | ^^^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Rect` could refer to the struct imported here
+ --> $DIR/ambiguous-13.rs:16:5
+ |
+LL | use crate::object::*;
+ | ^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Rect` to disambiguate
+note: `Rect` could also refer to the struct imported here
+ --> $DIR/ambiguous-13.rs:17:5
+ |
+LL | use crate::content::*;
+ | ^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Rect` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-14.rs b/tests/ui/imports/ambiguous-14.rs
new file mode 100644
index 000000000..5e880b48c
--- /dev/null
+++ b/tests/ui/imports/ambiguous-14.rs
@@ -0,0 +1,26 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/98467
+
+mod a {
+ pub fn foo() {}
+}
+
+mod b {
+ pub fn foo() {}
+}
+
+mod f {
+ pub use a::*;
+ pub use b::*;
+}
+
+mod g {
+ pub use a::*;
+ pub use f::*;
+}
+
+fn main() {
+ g::foo();
+ //~^ WARNING `foo` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-14.stderr b/tests/ui/imports/ambiguous-14.stderr
new file mode 100644
index 000000000..bece58536
--- /dev/null
+++ b/tests/ui/imports/ambiguous-14.stderr
@@ -0,0 +1,25 @@
+warning: `foo` is ambiguous
+ --> $DIR/ambiguous-14.rs:23:8
+ |
+LL | g::foo();
+ | ^^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `foo` could refer to the function imported here
+ --> $DIR/ambiguous-14.rs:13:13
+ |
+LL | pub use a::*;
+ | ^^^^
+ = help: consider adding an explicit import of `foo` to disambiguate
+note: `foo` could also refer to the function imported here
+ --> $DIR/ambiguous-14.rs:14:13
+ |
+LL | pub use b::*;
+ | ^^^^
+ = help: consider adding an explicit import of `foo` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-15.rs b/tests/ui/imports/ambiguous-15.rs
new file mode 100644
index 000000000..8c75c393a
--- /dev/null
+++ b/tests/ui/imports/ambiguous-15.rs
@@ -0,0 +1,27 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152
+
+mod t2 {
+ #[derive(Debug)]
+ pub enum Error {}
+
+ mod s {
+ pub use std::fmt::*;
+ pub trait Error: Sized {}
+ }
+
+ use self::s::*;
+}
+
+pub use t2::*;
+
+mod t3 {
+ pub trait Error {}
+}
+
+use self::t3::*;
+fn a<E: Error>(_: E) {}
+//~^ WARNING `Error` is ambiguous
+//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-15.stderr b/tests/ui/imports/ambiguous-15.stderr
new file mode 100644
index 000000000..838256752
--- /dev/null
+++ b/tests/ui/imports/ambiguous-15.stderr
@@ -0,0 +1,25 @@
+warning: `Error` is ambiguous
+ --> $DIR/ambiguous-15.rs:23:9
+ |
+LL | fn a<E: Error>(_: E) {}
+ | ^^^^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Error` could refer to the trait imported here
+ --> $DIR/ambiguous-15.rs:22:5
+ |
+LL | use self::t3::*;
+ | ^^^^^^^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+note: `Error` could also refer to the enum imported here
+ --> $DIR/ambiguous-15.rs:16:9
+ |
+LL | pub use t2::*;
+ | ^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-16.rs b/tests/ui/imports/ambiguous-16.rs
new file mode 100644
index 000000000..e51e30e3e
--- /dev/null
+++ b/tests/ui/imports/ambiguous-16.rs
@@ -0,0 +1,27 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099
+
+mod framing {
+ mod public_message {
+ use super::*;
+
+ #[derive(Debug)]
+ pub struct ConfirmedTranscriptHashInput;
+ }
+
+ mod public_message_in {
+ use super::*;
+
+ #[derive(Debug)]
+ pub struct ConfirmedTranscriptHashInput;
+ }
+
+ pub use self::public_message::*;
+ pub use self::public_message_in::*;
+}
+
+use crate::framing::ConfirmedTranscriptHashInput;
+//~^ WARNING `ConfirmedTranscriptHashInput` is ambiguous
+//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+fn main() { }
diff --git a/tests/ui/imports/ambiguous-16.stderr b/tests/ui/imports/ambiguous-16.stderr
new file mode 100644
index 000000000..7366cabc4
--- /dev/null
+++ b/tests/ui/imports/ambiguous-16.stderr
@@ -0,0 +1,25 @@
+warning: `ConfirmedTranscriptHashInput` is ambiguous
+ --> $DIR/ambiguous-16.rs:23:21
+ |
+LL | use crate::framing::ConfirmedTranscriptHashInput;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `ConfirmedTranscriptHashInput` could refer to the struct imported here
+ --> $DIR/ambiguous-16.rs:19:13
+ |
+LL | pub use self::public_message::*;
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate
+note: `ConfirmedTranscriptHashInput` could also refer to the struct imported here
+ --> $DIR/ambiguous-16.rs:20:13
+ |
+LL | pub use self::public_message_in::*;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-17.rs b/tests/ui/imports/ambiguous-17.rs
new file mode 100644
index 000000000..7d01404ce
--- /dev/null
+++ b/tests/ui/imports/ambiguous-17.rs
@@ -0,0 +1,29 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152
+
+pub use evp::*; //~ WARNING ambiguous glob re-exports
+pub use handwritten::*;
+
+macro_rules! m {
+ () => {
+ pub fn id() {}
+ };
+}
+mod evp {
+ use *;
+ m!();
+}
+
+mod handwritten {
+ pub use handwritten::evp::*;
+ mod evp {
+ use *;
+ m!();
+ }
+}
+
+fn main() {
+ id();
+ //~^ WARNING `id` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-17.stderr b/tests/ui/imports/ambiguous-17.stderr
new file mode 100644
index 000000000..55bc01095
--- /dev/null
+++ b/tests/ui/imports/ambiguous-17.stderr
@@ -0,0 +1,35 @@
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-17.rs:4:9
+ |
+LL | pub use evp::*;
+ | ^^^^^^ the name `id` in the value namespace is first re-exported here
+LL | pub use handwritten::*;
+ | -------------- but the name `id` in the value namespace is also re-exported here
+ |
+ = note: `#[warn(ambiguous_glob_reexports)]` on by default
+
+warning: `id` is ambiguous
+ --> $DIR/ambiguous-17.rs:26:5
+ |
+LL | id();
+ | ^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `id` could refer to the function imported here
+ --> $DIR/ambiguous-17.rs:4:9
+ |
+LL | pub use evp::*;
+ | ^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+note: `id` could also refer to the function imported here
+ --> $DIR/ambiguous-17.rs:5:9
+ |
+LL | pub use handwritten::*;
+ | ^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/imports/ambiguous-2.rs b/tests/ui/imports/ambiguous-2.rs
new file mode 100644
index 000000000..7b38f3006
--- /dev/null
+++ b/tests/ui/imports/ambiguous-2.rs
@@ -0,0 +1,9 @@
+// check-pass
+// aux-build: ../ambiguous-1.rs
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1633574396
+
+extern crate ambiguous_1;
+
+fn main() {
+ ambiguous_1::id();
+}
diff --git a/tests/ui/imports/ambiguous-3.rs b/tests/ui/imports/ambiguous-3.rs
new file mode 100644
index 000000000..61a5b6b83
--- /dev/null
+++ b/tests/ui/imports/ambiguous-3.rs
@@ -0,0 +1,21 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/47525
+
+fn main() {
+ use a::*;
+ x();
+ //~^ WARNING `x` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+mod a {
+ mod b {
+ pub fn x() { println!(module_path!()); }
+ }
+ mod c {
+ pub fn x() { println!(module_path!()); }
+ }
+
+ pub use self::b::*;
+ pub use self::c::*;
+}
diff --git a/tests/ui/imports/ambiguous-3.stderr b/tests/ui/imports/ambiguous-3.stderr
new file mode 100644
index 000000000..f019f6d89
--- /dev/null
+++ b/tests/ui/imports/ambiguous-3.stderr
@@ -0,0 +1,25 @@
+warning: `x` is ambiguous
+ --> $DIR/ambiguous-3.rs:6:5
+ |
+LL | x();
+ | ^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `x` could refer to the function imported here
+ --> $DIR/ambiguous-3.rs:19:13
+ |
+LL | pub use self::b::*;
+ | ^^^^^^^^^^
+ = help: consider adding an explicit import of `x` to disambiguate
+note: `x` could also refer to the function imported here
+ --> $DIR/ambiguous-3.rs:20:13
+ |
+LL | pub use self::c::*;
+ | ^^^^^^^^^^
+ = help: consider adding an explicit import of `x` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-4-extern.rs b/tests/ui/imports/ambiguous-4-extern.rs
new file mode 100644
index 000000000..02546768e
--- /dev/null
+++ b/tests/ui/imports/ambiguous-4-extern.rs
@@ -0,0 +1,26 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/112743#issuecomment-1601986883
+
+macro_rules! m {
+ () => {
+ pub fn id() {}
+ };
+}
+
+pub use evp::*; //~ WARNING ambiguous glob re-exports
+pub use handwritten::*;
+
+mod evp {
+ use *;
+ m! {}
+}
+mod handwritten {
+ use *;
+ m! {}
+}
+
+fn main() {
+ id();
+ //~^ WARNING `id` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-4-extern.stderr b/tests/ui/imports/ambiguous-4-extern.stderr
new file mode 100644
index 000000000..001197321
--- /dev/null
+++ b/tests/ui/imports/ambiguous-4-extern.stderr
@@ -0,0 +1,35 @@
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-4-extern.rs:10:9
+ |
+LL | pub use evp::*;
+ | ^^^^^^ the name `id` in the value namespace is first re-exported here
+LL | pub use handwritten::*;
+ | -------------- but the name `id` in the value namespace is also re-exported here
+ |
+ = note: `#[warn(ambiguous_glob_reexports)]` on by default
+
+warning: `id` is ambiguous
+ --> $DIR/ambiguous-4-extern.rs:23:5
+ |
+LL | id();
+ | ^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `id` could refer to the function imported here
+ --> $DIR/ambiguous-4-extern.rs:10:9
+ |
+LL | pub use evp::*;
+ | ^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+note: `id` could also refer to the function imported here
+ --> $DIR/ambiguous-4-extern.rs:11:9
+ |
+LL | pub use handwritten::*;
+ | ^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/imports/ambiguous-4.rs b/tests/ui/imports/ambiguous-4.rs
new file mode 100644
index 000000000..24ae33784
--- /dev/null
+++ b/tests/ui/imports/ambiguous-4.rs
@@ -0,0 +1,9 @@
+// build-pass
+// aux-build: ../ambiguous-4-extern.rs
+
+extern crate ambiguous_4_extern;
+
+fn main() {
+ ambiguous_4_extern::id();
+ // `warning_ambiguous` had been lost at metadata.
+}
diff --git a/tests/ui/imports/ambiguous-5.rs b/tests/ui/imports/ambiguous-5.rs
new file mode 100644
index 000000000..56092246a
--- /dev/null
+++ b/tests/ui/imports/ambiguous-5.rs
@@ -0,0 +1,24 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296
+
+mod a {
+ pub struct Class(u16);
+}
+
+use a::Class;
+
+mod gpos {
+ use super::gsubgpos::*;
+ use super::*;
+ struct MarkRecord(Class);
+ //~^ WARNING `Class` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+mod gsubgpos {
+ use super::*;
+ #[derive(Clone)]
+ pub struct Class;
+}
+
+fn main() { }
diff --git a/tests/ui/imports/ambiguous-5.stderr b/tests/ui/imports/ambiguous-5.stderr
new file mode 100644
index 000000000..4bc35f86d
--- /dev/null
+++ b/tests/ui/imports/ambiguous-5.stderr
@@ -0,0 +1,25 @@
+warning: `Class` is ambiguous
+ --> $DIR/ambiguous-5.rs:13:23
+ |
+LL | struct MarkRecord(Class);
+ | ^^^^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Class` could refer to the struct imported here
+ --> $DIR/ambiguous-5.rs:12:9
+ |
+LL | use super::*;
+ | ^^^^^^^^
+ = help: consider adding an explicit import of `Class` to disambiguate
+note: `Class` could also refer to the struct imported here
+ --> $DIR/ambiguous-5.rs:11:9
+ |
+LL | use super::gsubgpos::*;
+ | ^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Class` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-6.rs b/tests/ui/imports/ambiguous-6.rs
new file mode 100644
index 000000000..ba2623bf4
--- /dev/null
+++ b/tests/ui/imports/ambiguous-6.rs
@@ -0,0 +1,20 @@
+// check-pass
+// edition: 2021
+// https://github.com/rust-lang/rust/issues/112713
+
+pub fn foo() -> u32 {
+ use sub::*;
+ C
+ //~^ WARNING `C` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+mod sub {
+ mod mod1 { pub const C: u32 = 1; }
+ mod mod2 { pub const C: u32 = 2; }
+
+ pub use mod1::*;
+ pub use mod2::*;
+}
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-6.stderr b/tests/ui/imports/ambiguous-6.stderr
new file mode 100644
index 000000000..d7871a0b8
--- /dev/null
+++ b/tests/ui/imports/ambiguous-6.stderr
@@ -0,0 +1,25 @@
+warning: `C` is ambiguous
+ --> $DIR/ambiguous-6.rs:7:5
+ |
+LL | C
+ | ^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `C` could refer to the constant imported here
+ --> $DIR/ambiguous-6.rs:16:13
+ |
+LL | pub use mod1::*;
+ | ^^^^^^^
+ = help: consider adding an explicit import of `C` to disambiguate
+note: `C` could also refer to the constant imported here
+ --> $DIR/ambiguous-6.rs:17:13
+ |
+LL | pub use mod2::*;
+ | ^^^^^^^
+ = help: consider adding an explicit import of `C` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-7.rs b/tests/ui/imports/ambiguous-7.rs
new file mode 100644
index 000000000..5148ff4cc
--- /dev/null
+++ b/tests/ui/imports/ambiguous-7.rs
@@ -0,0 +1,18 @@
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152
+
+mod t2 {
+ #[derive(Debug)]
+ pub enum Error {}
+}
+
+pub use t2::*;
+
+mod t3 {
+ pub trait Error {}
+}
+
+use self::t3::*;
+fn a<E: Error>(_: E) {}
+//~^ ERROR `Error` is ambiguous
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-7.stderr b/tests/ui/imports/ambiguous-7.stderr
new file mode 100644
index 000000000..2c6b56c61
--- /dev/null
+++ b/tests/ui/imports/ambiguous-7.stderr
@@ -0,0 +1,23 @@
+error[E0659]: `Error` is ambiguous
+ --> $DIR/ambiguous-7.rs:15:9
+ |
+LL | fn a<E: Error>(_: E) {}
+ | ^^^^^ ambiguous name
+ |
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Error` could refer to the trait imported here
+ --> $DIR/ambiguous-7.rs:14:5
+ |
+LL | use self::t3::*;
+ | ^^^^^^^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+note: `Error` could also refer to the enum imported here
+ --> $DIR/ambiguous-7.rs:8:9
+ |
+LL | pub use t2::*;
+ | ^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/ambiguous-8.rs b/tests/ui/imports/ambiguous-8.rs
new file mode 100644
index 000000000..d44cd9587
--- /dev/null
+++ b/tests/ui/imports/ambiguous-8.rs
@@ -0,0 +1,14 @@
+// aux-build: ambiguous-8-extern.rs
+
+extern crate ambiguous_8_extern;
+
+mod s {
+ pub trait Error {}
+}
+
+use s::*;
+use ambiguous_8_extern::*;
+fn a<E: Error>(_: E) {}
+//~^ ERROR `Error` is ambiguous
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-8.stderr b/tests/ui/imports/ambiguous-8.stderr
new file mode 100644
index 000000000..32056fba6
--- /dev/null
+++ b/tests/ui/imports/ambiguous-8.stderr
@@ -0,0 +1,23 @@
+error[E0659]: `Error` is ambiguous
+ --> $DIR/ambiguous-8.rs:11:9
+ |
+LL | fn a<E: Error>(_: E) {}
+ | ^^^^^ ambiguous name
+ |
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Error` could refer to the trait imported here
+ --> $DIR/ambiguous-8.rs:9:5
+ |
+LL | use s::*;
+ | ^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+note: `Error` could also refer to the enum imported here
+ --> $DIR/ambiguous-8.rs:10:5
+ |
+LL | use ambiguous_8_extern::*;
+ | ^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/ambiguous-9.rs b/tests/ui/imports/ambiguous-9.rs
new file mode 100644
index 000000000..9da2467ad
--- /dev/null
+++ b/tests/ui/imports/ambiguous-9.rs
@@ -0,0 +1,29 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152
+
+pub mod dsl {
+ mod range {
+ pub fn date_range() {}
+ }
+ pub use self::range::*; //~ WARNING ambiguous glob re-exports
+ use super::prelude::*;
+}
+
+pub mod prelude {
+ mod t {
+ pub fn date_range() {}
+ }
+ pub use self::t::*; //~ WARNING ambiguous glob re-exports
+ pub use super::dsl::*;
+}
+
+use dsl::*;
+use prelude::*;
+
+fn main() {
+ date_range();
+ //~^ WARNING `date_range` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| WARNING `date_range` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-9.stderr b/tests/ui/imports/ambiguous-9.stderr
new file mode 100644
index 000000000..6c7d79174
--- /dev/null
+++ b/tests/ui/imports/ambiguous-9.stderr
@@ -0,0 +1,65 @@
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-9.rs:8:13
+ |
+LL | pub use self::range::*;
+ | ^^^^^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here
+LL | use super::prelude::*;
+ | ----------------- but the name `date_range` in the value namespace is also re-exported here
+ |
+ = note: `#[warn(ambiguous_glob_reexports)]` on by default
+
+warning: `date_range` is ambiguous
+ --> $DIR/ambiguous-9.rs:24:5
+ |
+LL | date_range();
+ | ^^^^^^^^^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `date_range` could refer to the function imported here
+ --> $DIR/ambiguous-9.rs:8:13
+ |
+LL | pub use self::range::*;
+ | ^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `date_range` to disambiguate
+note: `date_range` could also refer to the function imported here
+ --> $DIR/ambiguous-9.rs:9:9
+ |
+LL | use super::prelude::*;
+ | ^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `date_range` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-9.rs:16:13
+ |
+LL | pub use self::t::*;
+ | ^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here
+LL | pub use super::dsl::*;
+ | ------------- but the name `date_range` in the value namespace is also re-exported here
+
+warning: `date_range` is ambiguous
+ --> $DIR/ambiguous-9.rs:24:5
+ |
+LL | date_range();
+ | ^^^^^^^^^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `date_range` could refer to the function imported here
+ --> $DIR/ambiguous-9.rs:20:5
+ |
+LL | use dsl::*;
+ | ^^^^^^
+ = help: consider adding an explicit import of `date_range` to disambiguate
+note: `date_range` could also refer to the function imported here
+ --> $DIR/ambiguous-9.rs:21:5
+ |
+LL | use prelude::*;
+ | ^^^^^^^^^^
+ = help: consider adding an explicit import of `date_range` to disambiguate
+
+warning: 4 warnings emitted
+
diff --git a/tests/ui/imports/auxiliary/ambiguous-11-extern.rs b/tests/ui/imports/auxiliary/ambiguous-11-extern.rs
new file mode 100644
index 000000000..e679bc3dc
--- /dev/null
+++ b/tests/ui/imports/auxiliary/ambiguous-11-extern.rs
@@ -0,0 +1,6 @@
+mod t2 {
+ #[derive(Debug)]
+ pub enum Error {}
+}
+
+pub use t2::*;
diff --git a/tests/ui/imports/auxiliary/ambiguous-8-extern.rs b/tests/ui/imports/auxiliary/ambiguous-8-extern.rs
new file mode 100644
index 000000000..c7bf1bae0
--- /dev/null
+++ b/tests/ui/imports/auxiliary/ambiguous-8-extern.rs
@@ -0,0 +1,12 @@
+mod t2 {
+ #[derive(Debug)]
+ pub enum Error {}
+
+ mod t {
+ pub trait Error: Sized {}
+ }
+
+ use self::t::*;
+}
+
+pub use t2::*;
diff --git a/tests/ui/imports/auxiliary/extern-with-ambiguous-1-extern.rs b/tests/ui/imports/auxiliary/extern-with-ambiguous-1-extern.rs
new file mode 100644
index 000000000..5cd102122
--- /dev/null
+++ b/tests/ui/imports/auxiliary/extern-with-ambiguous-1-extern.rs
@@ -0,0 +1,4 @@
+mod a {
+ pub mod error {}
+}
+pub use a::*;
diff --git a/tests/ui/imports/auxiliary/extern-with-ambiguous-2-extern.rs b/tests/ui/imports/auxiliary/extern-with-ambiguous-2-extern.rs
new file mode 100644
index 000000000..378996768
--- /dev/null
+++ b/tests/ui/imports/auxiliary/extern-with-ambiguous-2-extern.rs
@@ -0,0 +1,9 @@
+mod a {
+ pub mod error {}
+}
+pub use a::*;
+
+mod b {
+ pub mod error {}
+}
+pub use b::*;
diff --git a/tests/ui/imports/auxiliary/extern-with-ambiguous-3-extern.rs b/tests/ui/imports/auxiliary/extern-with-ambiguous-3-extern.rs
new file mode 100644
index 000000000..ad4e04804
--- /dev/null
+++ b/tests/ui/imports/auxiliary/extern-with-ambiguous-3-extern.rs
@@ -0,0 +1,14 @@
+mod a {
+ pub mod error {}
+}
+pub use a::*;
+
+mod b {
+ pub mod error {}
+}
+pub use b::*;
+
+mod c {
+ pub mod error {}
+}
+pub use c::*;
diff --git a/tests/ui/imports/duplicate.rs b/tests/ui/imports/duplicate.rs
index db6538969..0c5a376da 100644
--- a/tests/ui/imports/duplicate.rs
+++ b/tests/ui/imports/duplicate.rs
@@ -34,6 +34,8 @@ fn main() {
e::foo();
f::foo(); //~ ERROR `foo` is ambiguous
g::foo();
+ //~^ WARNING `foo` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
}
mod ambiguous_module_errors {
diff --git a/tests/ui/imports/duplicate.stderr b/tests/ui/imports/duplicate.stderr
index 997a2741b..d7a7dfce9 100644
--- a/tests/ui/imports/duplicate.stderr
+++ b/tests/ui/imports/duplicate.stderr
@@ -9,20 +9,20 @@ LL | use a::foo;
= note: `foo` must be defined only once in the value namespace of this module
error[E0659]: `foo` is ambiguous
- --> $DIR/duplicate.rs:46:15
+ --> $DIR/duplicate.rs:48:15
|
LL | use self::foo::bar;
| ^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `foo` could refer to the module imported here
- --> $DIR/duplicate.rs:43:9
+ --> $DIR/duplicate.rs:45:9
|
LL | use self::m1::*;
| ^^^^^^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate
note: `foo` could also refer to the module imported here
- --> $DIR/duplicate.rs:44:9
+ --> $DIR/duplicate.rs:46:9
|
LL | use self::m2::*;
| ^^^^^^^^^^^
@@ -49,26 +49,49 @@ LL | pub use b::*;
= help: consider adding an explicit import of `foo` to disambiguate
error[E0659]: `foo` is ambiguous
- --> $DIR/duplicate.rs:49:9
+ --> $DIR/duplicate.rs:51:9
|
LL | foo::bar();
| ^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `foo` could refer to the module imported here
- --> $DIR/duplicate.rs:43:9
+ --> $DIR/duplicate.rs:45:9
|
LL | use self::m1::*;
| ^^^^^^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate
note: `foo` could also refer to the module imported here
- --> $DIR/duplicate.rs:44:9
+ --> $DIR/duplicate.rs:46:9
|
LL | use self::m2::*;
| ^^^^^^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate
-error: aborting due to 4 previous errors
+warning: `foo` is ambiguous
+ --> $DIR/duplicate.rs:36:8
+ |
+LL | g::foo();
+ | ^^^ ambiguous name
+ |
+ = 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 #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `foo` could refer to the function imported here
+ --> $DIR/duplicate.rs:24:13
+ |
+LL | pub use a::*;
+ | ^^^^
+ = help: consider adding an explicit import of `foo` to disambiguate
+note: `foo` could also refer to the function imported here
+ --> $DIR/duplicate.rs:25:13
+ |
+LL | pub use b::*;
+ | ^^^^
+ = help: consider adding an explicit import of `foo` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0252, E0659.
For more information about an error, try `rustc --explain E0252`.
diff --git a/tests/ui/imports/extern-with-ambiguous-1.rs b/tests/ui/imports/extern-with-ambiguous-1.rs
new file mode 100644
index 000000000..42c3c2068
--- /dev/null
+++ b/tests/ui/imports/extern-with-ambiguous-1.rs
@@ -0,0 +1,19 @@
+// edition: 2021
+// aux-build: extern-with-ambiguous-1-extern.rs
+
+// `extern-with-ambiguous-1-extern.rs` doesn't has
+// ambiguous, just for compare.
+
+extern crate extern_with_ambiguous_1_extern;
+
+mod s {
+ pub mod error {
+ use extern_with_ambiguous_1_extern::*;
+ }
+}
+use s::*;
+use extern_with_ambiguous_1_extern::*;
+use error::*;
+//~^ ERROR `error` is ambiguous
+
+fn main() {}
diff --git a/tests/ui/imports/extern-with-ambiguous-1.stderr b/tests/ui/imports/extern-with-ambiguous-1.stderr
new file mode 100644
index 000000000..dca2b4ebe
--- /dev/null
+++ b/tests/ui/imports/extern-with-ambiguous-1.stderr
@@ -0,0 +1,23 @@
+error[E0659]: `error` is ambiguous
+ --> $DIR/extern-with-ambiguous-1.rs:16:5
+ |
+LL | use error::*;
+ | ^^^^^ ambiguous name
+ |
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `error` could refer to the module imported here
+ --> $DIR/extern-with-ambiguous-1.rs:14:5
+ |
+LL | use s::*;
+ | ^^^^
+ = help: consider adding an explicit import of `error` to disambiguate
+note: `error` could also refer to the module imported here
+ --> $DIR/extern-with-ambiguous-1.rs:15:5
+ |
+LL | use extern_with_ambiguous_1_extern::*;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `error` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/extern-with-ambiguous-2.rs b/tests/ui/imports/extern-with-ambiguous-2.rs
new file mode 100644
index 000000000..68c623c1c
--- /dev/null
+++ b/tests/ui/imports/extern-with-ambiguous-2.rs
@@ -0,0 +1,16 @@
+// check-pass
+// edition: 2021
+// aux-build: extern-with-ambiguous-2-extern.rs
+
+extern crate extern_with_ambiguous_2_extern;
+
+mod s {
+ pub mod error {
+ use extern_with_ambiguous_2_extern::*;
+ }
+}
+use s::*;
+use extern_with_ambiguous_2_extern::*;
+use error::*;
+
+fn main() {}
diff --git a/tests/ui/imports/extern-with-ambiguous-3.rs b/tests/ui/imports/extern-with-ambiguous-3.rs
new file mode 100644
index 000000000..282c1d569
--- /dev/null
+++ b/tests/ui/imports/extern-with-ambiguous-3.rs
@@ -0,0 +1,17 @@
+// check-pass
+// edition: 2021
+// aux-build: extern-with-ambiguous-3-extern.rs
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1643974121
+
+extern crate extern_with_ambiguous_3_extern;
+
+mod s {
+ pub mod error {
+ use extern_with_ambiguous_3_extern::*;
+ }
+}
+use s::*;
+use extern_with_ambiguous_3_extern::*;
+use error::*;
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-1.rs b/tests/ui/imports/import-after-macro-expand-1.rs
new file mode 100644
index 000000000..d7a8aaf2f
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-1.rs
@@ -0,0 +1,19 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/56593#issue-388659456
+
+struct Foo;
+
+mod foo {
+ use super::*;
+
+ #[derive(Debug)]
+ pub struct Foo;
+}
+
+mod bar {
+ use super::foo::*;
+
+ fn bar(_: Foo) {}
+}
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-2.rs b/tests/ui/imports/import-after-macro-expand-2.rs
new file mode 100644
index 000000000..b3996d488
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-2.rs
@@ -0,0 +1,27 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/56593#issuecomment-1133174514
+
+use thing::*;
+
+#[derive(Debug)]
+pub enum Thing {
+ Foo
+}
+
+mod tests {
+ use super::*;
+
+ fn test_thing() {
+ let thing: crate::thing::Thing = Thing::Bar;
+ // FIXME: `thing` should refer to `crate::Thing`,
+ // FIXME: but doesn't currently refer to it due to backward compatibility
+ }
+}
+
+mod thing {
+ pub enum Thing {
+ Bar
+ }
+}
+
+fn main() { }
diff --git a/tests/ui/imports/import-after-macro-expand-3.rs b/tests/ui/imports/import-after-macro-expand-3.rs
new file mode 100644
index 000000000..3babe1470
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-3.rs
@@ -0,0 +1,24 @@
+// check-pass
+// similar with `import-after-macro-expand-2.rs`
+
+use thing::*;
+
+pub enum Thing {
+ Foo
+}
+
+mod tests {
+ use super::*;
+
+ fn test_thing() {
+ let thing: crate::Thing = Thing::Foo;
+ }
+}
+
+mod thing {
+ pub enum Thing {
+ Bar
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-4.rs b/tests/ui/imports/import-after-macro-expand-4.rs
new file mode 100644
index 000000000..02cc3f01a
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-4.rs
@@ -0,0 +1,30 @@
+// https://github.com/rust-lang/rust/pull/113242#issuecomment-1616034904
+// similar with `import-after-macro-expand-2.rs`
+
+mod a {
+ pub trait P {}
+}
+
+pub use a::*;
+
+mod c {
+ use crate::*;
+ pub struct S(Vec<P>);
+ //~^ ERROR the size for values of type
+ //~| WARNING trait objects without an explicit
+ //~| WARNING this is accepted in the current edition
+ //~| WARNING trait objects without an explicit
+ //~| WARNING this is accepted in the current edition
+ //~| WARNING trait objects without an explicit
+ //~| WARNING this is accepted in the current edition
+
+ // FIXME: should works, but doesn't currently refer
+ // to it due to backward compatibility
+}
+
+#[derive(Clone)]
+pub enum P {
+ A
+}
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-4.stderr b/tests/ui/imports/import-after-macro-expand-4.stderr
new file mode 100644
index 000000000..01f70cfc5
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-4.stderr
@@ -0,0 +1,53 @@
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/import-after-macro-expand-4.rs:12:22
+ |
+LL | pub struct S(Vec<P>);
+ | ^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: `#[warn(bare_trait_objects)]` on by default
+help: use `dyn`
+ |
+LL | pub struct S(Vec<dyn P>);
+ | +++
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/import-after-macro-expand-4.rs:12:22
+ |
+LL | pub struct S(Vec<P>);
+ | ^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL | pub struct S(Vec<dyn P>);
+ | +++
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/import-after-macro-expand-4.rs:12:22
+ |
+LL | pub struct S(Vec<P>);
+ | ^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL | pub struct S(Vec<dyn P>);
+ | +++
+
+error[E0277]: the size for values of type `(dyn a::P + 'static)` cannot be known at compilation time
+ --> $DIR/import-after-macro-expand-4.rs:12:18
+ |
+LL | pub struct S(Vec<P>);
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn a::P + 'static)`
+note: required by a bound in `Vec`
+ --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+
+error: aborting due to previous error; 3 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/imports/import-after-macro-expand-5.rs b/tests/ui/imports/import-after-macro-expand-5.rs
new file mode 100644
index 000000000..ba28b6dea
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-5.rs
@@ -0,0 +1,31 @@
+// edition: 2021
+// check-pass
+// https://github.com/rust-lang/rust/issues/105235#issue-1474295873
+
+mod abc {
+ pub struct Beeblebrox;
+ pub struct Zaphod;
+}
+
+mod foo {
+ pub mod bar {
+ use crate::abc::*;
+
+ #[derive(Debug)]
+ pub enum Zaphod {
+ Whale,
+ President,
+ }
+ }
+ pub use bar::*;
+}
+
+mod baz {
+ pub fn do_something() {
+ println!("{:?}", crate::foo::Zaphod::Whale);
+ }
+}
+
+fn main() {
+ baz::do_something();
+}
diff --git a/tests/ui/imports/import-after-macro-expand-6.rs b/tests/ui/imports/import-after-macro-expand-6.rs
new file mode 100644
index 000000000..ab5bb37a1
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-6.rs
@@ -0,0 +1,24 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1633574396
+
+pub mod a {
+ pub use crate::b::*;
+}
+
+mod b {
+ pub mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+use crate::a::HeaderMap;
+
+fn main() {
+ let h: crate::b::http::HeaderMap = HeaderMap;
+ // FIXME: should refer to `crate::b::HeaderMap`,
+ // FIXME: but doesn't currently refer to it due to backward compatibility
+}
diff --git a/tests/ui/imports/import-after-macro-expand-7.rs b/tests/ui/imports/import-after-macro-expand-7.rs
new file mode 100644
index 000000000..0402dfdfd
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-7.rs
@@ -0,0 +1,21 @@
+// check-pass
+// a compared case for `import-after-macro-expand-6.rs`
+
+pub mod a {
+ pub use crate::b::*;
+}
+
+mod b {
+ mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ pub struct HeaderMap;
+}
+
+use crate::a::HeaderMap;
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/imports/import-after-macro-expand-8.rs b/tests/ui/imports/import-after-macro-expand-8.rs
new file mode 100644
index 000000000..e11d65eff
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-8.rs
@@ -0,0 +1,22 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113242#issuecomment-1616034904
+
+mod a {
+ pub trait P {}
+}
+pub use a::*;
+
+mod b {
+ #[derive(Clone)]
+ pub enum P {
+ A
+ }
+}
+pub use b::P;
+
+mod c {
+ use crate::*;
+ pub struct S(Vec<P>);
+}
+
+fn main() {}
diff --git a/tests/ui/imports/issue-113953.rs b/tests/ui/imports/issue-113953.rs
new file mode 100644
index 000000000..449a074f4
--- /dev/null
+++ b/tests/ui/imports/issue-113953.rs
@@ -0,0 +1,6 @@
+// edition: 2021
+use u8 as imported_u8;
+use unresolved as u8;
+//~^ ERROR unresolved import `unresolved`
+
+fn main() {}
diff --git a/tests/ui/imports/issue-113953.stderr b/tests/ui/imports/issue-113953.stderr
new file mode 100644
index 000000000..70f91bd3c
--- /dev/null
+++ b/tests/ui/imports/issue-113953.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `unresolved`
+ --> $DIR/issue-113953.rs:3:5
+ |
+LL | use unresolved as u8;
+ | ^^^^^^^^^^^^^^^^ no external crate `unresolved`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/imports/issue-81413.rs b/tests/ui/imports/issue-81413.rs
new file mode 100644
index 000000000..f3fb8bfab
--- /dev/null
+++ b/tests/ui/imports/issue-81413.rs
@@ -0,0 +1,23 @@
+pub const ITEM: Item = Item;
+
+pub struct Item;
+
+pub fn item() {}
+
+pub use doesnt_exist::*;
+//~^ ERROR unresolved import `doesnt_exist`
+mod a {
+ use crate::{item, Item, ITEM};
+}
+
+mod b {
+ use crate::item;
+ use crate::Item;
+ use crate::ITEM;
+}
+
+mod c {
+ use crate::item;
+}
+
+fn main() {}
diff --git a/tests/ui/imports/issue-81413.stderr b/tests/ui/imports/issue-81413.stderr
new file mode 100644
index 000000000..e2dfe02bc
--- /dev/null
+++ b/tests/ui/imports/issue-81413.stderr
@@ -0,0 +1,11 @@
+error[E0432]: unresolved import `doesnt_exist`
+ --> $DIR/issue-81413.rs:7:9
+ |
+LL | pub use doesnt_exist::*;
+ | ^^^^^^^^^^^^ maybe a missing crate `doesnt_exist`?
+ |
+ = help: consider adding `extern crate doesnt_exist` to use the `doesnt_exist` crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/imports/resolve-other-libc.rs b/tests/ui/imports/resolve-other-libc.rs
new file mode 100644
index 000000000..806d854ec
--- /dev/null
+++ b/tests/ui/imports/resolve-other-libc.rs
@@ -0,0 +1,14 @@
+// Regression test for https://github.com/rust-lang/rust/issues/26043
+
+// compile-flags: --extern libc=test.rlib
+
+// The error shall NOT be something similar to the following, because it
+// indicates that `libc` was wrongly resolved to `libc` shipped with the
+// compiler:
+//
+// error[E0658]: use of unstable library feature 'rustc_private': \
+// this crate is being loaded from the sysroot
+//
+extern crate libc; //~ ERROR: extern location for libc does not exist: test.rlib
+
+fn main() {}
diff --git a/tests/ui/imports/resolve-other-libc.stderr b/tests/ui/imports/resolve-other-libc.stderr
new file mode 100644
index 000000000..e57b88e50
--- /dev/null
+++ b/tests/ui/imports/resolve-other-libc.stderr
@@ -0,0 +1,8 @@
+error: extern location for libc does not exist: test.rlib
+ --> $DIR/resolve-other-libc.rs:12:1
+ |
+LL | extern crate libc;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/index-bot.rs b/tests/ui/indexing/index-bot.rs
index e69c4019f..e69c4019f 100644
--- a/tests/ui/index-bot.rs
+++ b/tests/ui/indexing/index-bot.rs
diff --git a/tests/ui/index-bot.stderr b/tests/ui/indexing/index-bot.stderr
index b5d782975..bf231c92c 100644
--- a/tests/ui/index-bot.stderr
+++ b/tests/ui/indexing/index-bot.stderr
@@ -1,8 +1,8 @@
error[E0608]: cannot index into a value of type `!`
- --> $DIR/index-bot.rs:2:5
+ --> $DIR/index-bot.rs:2:13
|
LL | (return)[0];
- | ^^^^^^^^^^^
+ | ^^^
error: aborting due to previous error
diff --git a/tests/ui/index-help.rs b/tests/ui/indexing/index-help.rs
index 66571ec41..66571ec41 100644
--- a/tests/ui/index-help.rs
+++ b/tests/ui/indexing/index-help.rs
diff --git a/tests/ui/index-help.stderr b/tests/ui/indexing/index-help.stderr
index e020d0298..e020d0298 100644
--- a/tests/ui/index-help.stderr
+++ b/tests/ui/indexing/index-help.stderr
diff --git a/tests/ui/index_message.rs b/tests/ui/indexing/index_message.rs
index 88b848d6f..88b848d6f 100644
--- a/tests/ui/index_message.rs
+++ b/tests/ui/indexing/index_message.rs
diff --git a/tests/ui/index_message.stderr b/tests/ui/indexing/index_message.stderr
index 56d1d7080..80f2bd523 100644
--- a/tests/ui/index_message.stderr
+++ b/tests/ui/indexing/index_message.stderr
@@ -1,8 +1,8 @@
error[E0608]: cannot index into a value of type `({integer},)`
- --> $DIR/index_message.rs:3:13
+ --> $DIR/index_message.rs:3:14
|
LL | let _ = z[0];
- | ^^^^ help: to access tuple elements, use: `z.0`
+ | ^^^ help: to access tuple elements, use: `.0`
error: aborting due to previous error
diff --git a/tests/ui/indexing-requires-a-uint.rs b/tests/ui/indexing/indexing-requires-a-uint.rs
index dbe9b44a1..dbe9b44a1 100644
--- a/tests/ui/indexing-requires-a-uint.rs
+++ b/tests/ui/indexing/indexing-requires-a-uint.rs
diff --git a/tests/ui/indexing-requires-a-uint.stderr b/tests/ui/indexing/indexing-requires-a-uint.stderr
index 7a741cfc7..7a741cfc7 100644
--- a/tests/ui/indexing-requires-a-uint.stderr
+++ b/tests/ui/indexing/indexing-requires-a-uint.stderr
diff --git a/tests/ui/indexing/indexing-spans-caller-location.rs b/tests/ui/indexing/indexing-spans-caller-location.rs
new file mode 100644
index 000000000..2652f0021
--- /dev/null
+++ b/tests/ui/indexing/indexing-spans-caller-location.rs
@@ -0,0 +1,27 @@
+// run-pass
+
+// Regression test for https://github.com/rust-lang/rust/issues/114388
+
+#[track_caller]
+fn caller_line() -> u32 {
+ std::panic::Location::caller().line()
+}
+
+fn main() {
+ let prev_line = caller_line(); // first line
+ (A { prev_line }) // second line
+ [0]; // third line
+}
+
+struct A {
+ prev_line: u32,
+}
+impl std::ops::Index<usize> for A {
+ type Output = ();
+
+ fn index(&self, _idx: usize) -> &() {
+ // Use the relative number to make it resistent to header changes.
+ assert_eq!(caller_line(), self.prev_line + 2);
+ &()
+ }
+}
diff --git a/tests/ui/inference/issue-113354.fixed b/tests/ui/inference/issue-113354.fixed
new file mode 100644
index 000000000..804db985a
--- /dev/null
+++ b/tests/ui/inference/issue-113354.fixed
@@ -0,0 +1,4 @@
+//run-rustfix
+fn main() {
+ let _ = || { while let Some(_) = Some(1) { } }; //~ ERROR mismatched types
+}
diff --git a/tests/ui/inference/issue-113354.rs b/tests/ui/inference/issue-113354.rs
new file mode 100644
index 000000000..ec33d1f8b
--- /dev/null
+++ b/tests/ui/inference/issue-113354.rs
@@ -0,0 +1,4 @@
+//run-rustfix
+fn main() {
+ let _ = || { while Some(_) = Some(1) { } }; //~ ERROR mismatched types
+}
diff --git a/tests/ui/inference/issue-113354.stderr b/tests/ui/inference/issue-113354.stderr
new file mode 100644
index 000000000..045a5aa7b
--- /dev/null
+++ b/tests/ui/inference/issue-113354.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-113354.rs:3:24
+ |
+LL | let _ = || { while Some(_) = Some(1) { } };
+ | ^^^^^^^^^^^^^^^^^ expected `bool`, found `()`
+ |
+help: consider adding `let`
+ |
+LL | let _ = || { while let Some(_) = Some(1) { } };
+ | +++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/inference/need_type_info/infer-var-for-self-param.rs b/tests/ui/inference/need_type_info/infer-var-for-self-param.rs
new file mode 100644
index 000000000..51ac7943f
--- /dev/null
+++ b/tests/ui/inference/need_type_info/infer-var-for-self-param.rs
@@ -0,0 +1,7 @@
+// Regression test for #113610 where we ICEd when trying to print
+// inference variables created by instantiating the self type parameter.
+
+fn main() {
+ let _ = (Default::default(),);
+ //~^ ERROR cannot call associated function on trait
+}
diff --git a/tests/ui/inference/need_type_info/infer-var-for-self-param.stderr b/tests/ui/inference/need_type_info/infer-var-for-self-param.stderr
new file mode 100644
index 000000000..36d754693
--- /dev/null
+++ b/tests/ui/inference/need_type_info/infer-var-for-self-param.stderr
@@ -0,0 +1,14 @@
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+ --> $DIR/infer-var-for-self-param.rs:5:14
+ |
+LL | let _ = (Default::default(),);
+ | ^^^^^^^^^^^^^^^^ cannot call associated function of trait
+ |
+help: use a fully-qualified path to a specific available implementation
+ |
+LL | let _ = (</* self type */ as Default>::default(),);
+ | +++++++++++++++++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0790`.
diff --git a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.rs b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.rs
new file mode 100644
index 000000000..5a893f2d8
--- /dev/null
+++ b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.rs
@@ -0,0 +1,12 @@
+trait T {}
+
+struct S {}
+
+impl S {
+ fn owo(&self, _: Option<&impl T>) {}
+}
+
+fn main() {
+ (S {}).owo(None)
+ //~^ ERROR type annotations needed
+}
diff --git a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
new file mode 100644
index 000000000..0ec219415
--- /dev/null
+++ b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
@@ -0,0 +1,14 @@
+error[E0282]: type annotations needed
+ --> $DIR/issue-113264-incorrect-impl-trait-in-path-suggestion.rs:10:16
+ |
+LL | (S {}).owo(None)
+ | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
+ |
+help: consider specifying the generic argument
+ |
+LL | (S {}).owo(None::<&_>)
+ | ++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/inference/str-as-char.fixed b/tests/ui/inference/str-as-char.fixed
index 6aea809cb..911b067c4 100644
--- a/tests/ui/inference/str-as-char.fixed
+++ b/tests/ui/inference/str-as-char.fixed
@@ -7,4 +7,5 @@ fn main() {
let _: &str = "a"; //~ ERROR mismatched types
let _: &str = "\"\"\""; //~ ERROR character literal may only contain one codepoint
let _: &str = "\"\"\""; //~ ERROR character literal may only contain one codepoint
+ let _: &str = "\"\"\\\"\\\"\\\\\""; //~ ERROR character literal may only contain one codepoint
}
diff --git a/tests/ui/inference/str-as-char.rs b/tests/ui/inference/str-as-char.rs
index eaa8d788c..832bc871a 100644
--- a/tests/ui/inference/str-as-char.rs
+++ b/tests/ui/inference/str-as-char.rs
@@ -7,4 +7,5 @@ fn main() {
let _: &str = 'a'; //~ ERROR mismatched types
let _: &str = '"""'; //~ ERROR character literal may only contain one codepoint
let _: &str = '\"\"\"'; //~ ERROR character literal may only contain one codepoint
+ let _: &str = '"\"\\"\\\"\\\\"'; //~ ERROR character literal may only contain one codepoint
}
diff --git a/tests/ui/inference/str-as-char.stderr b/tests/ui/inference/str-as-char.stderr
index 2c84dac8e..216f4cda6 100644
--- a/tests/ui/inference/str-as-char.stderr
+++ b/tests/ui/inference/str-as-char.stderr
@@ -20,6 +20,17 @@ help: if you meant to write a `str` literal, use double quotes
LL | let _: &str = "\"\"\"";
| ~~~~~~~~
+error: character literal may only contain one codepoint
+ --> $DIR/str-as-char.rs:10:19
+ |
+LL | let _: &str = '"\"\"\\"\\"';
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: if you meant to write a `str` literal, use double quotes
+ |
+LL | let _: &str = "\"\"\\"\\"\\\"";
+ | ~~~~~~~~~~~~~~~~~~~~
+
error[E0308]: mismatched types
--> $DIR/str-as-char.rs:7:19
|
@@ -33,6 +44,6 @@ help: if you meant to write a `str` literal, use double quotes
LL | let _: &str = "a";
| ~~~
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/inference/type-infer-generalize-ty-var.rs b/tests/ui/inference/type-infer-generalize-ty-var.rs
index a3d6916cb..8b4a8c32b 100644
--- a/tests/ui/inference/type-infer-generalize-ty-var.rs
+++ b/tests/ui/inference/type-infer-generalize-ty-var.rs
@@ -1,4 +1,6 @@
-// run-pass
+// check-pass
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
#![allow(non_upper_case_globals)]
#![allow(dead_code)]
diff --git a/tests/ui/infinite/infinite-trait-alias-recursion.stderr b/tests/ui/infinite/infinite-trait-alias-recursion.stderr
index 683987b49..39d7aa4c1 100644
--- a/tests/ui/infinite/infinite-trait-alias-recursion.stderr
+++ b/tests/ui/infinite/infinite-trait-alias-recursion.stderr
@@ -21,6 +21,7 @@ note: cycle used when collecting item types in top-level module
|
LL | trait T1 = T2;
| ^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr
index 7f82b2944..bbdb1f70b 100644
--- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr
+++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.stderr
@@ -28,6 +28,7 @@ LL | | type X3 = X1;
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/infinite/infinite-vec-type-recursion.stderr b/tests/ui/infinite/infinite-vec-type-recursion.stderr
index 1e487a5b1..a21b033a9 100644
--- a/tests/ui/infinite/infinite-vec-type-recursion.stderr
+++ b/tests/ui/infinite/infinite-vec-type-recursion.stderr
@@ -16,6 +16,7 @@ LL | |
LL | |
LL | | fn main() { let b: X = Vec::new(); }
| |____________________________________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/inline-const/instance-doesnt-depend-on-type.rs b/tests/ui/inline-const/instance-doesnt-depend-on-type.rs
new file mode 100644
index 000000000..bc739785c
--- /dev/null
+++ b/tests/ui/inline-const/instance-doesnt-depend-on-type.rs
@@ -0,0 +1,10 @@
+// check-pass
+// issue: 114660
+
+#![feature(inline_const)]
+
+fn main() {
+ const { core::mem::transmute::<u8, u8> };
+ // Don't resolve the instance of this inline constant to be an intrinsic,
+ // even if the type of the constant is `extern "intrinsic" fn(u8) -> u8`.
+}
diff --git a/tests/ui/inline-const/interpolated.rs b/tests/ui/inline-const/interpolated.rs
new file mode 100644
index 000000000..3fcc621c9
--- /dev/null
+++ b/tests/ui/inline-const/interpolated.rs
@@ -0,0 +1,32 @@
+// check-pass
+
+#![feature(inline_const)]
+
+// This used to be unsupported since the parser first tries to check if we have
+// any nested items, and then checks for statements (and expressions). The heuristic
+// that we were using to detect the beginning of a const item was incorrect, so
+// this used to fail.
+macro_rules! m {
+ ($b:block) => {
+ fn foo() {
+ const $b
+ }
+ }
+}
+
+// This has worked since inline-consts were implemented, since the position that
+// the const block is located at doesn't support nested items (e.g. because
+// `let x = const X: u32 = 1;` is invalid), so there's no ambiguity parsing the
+// inline const.
+macro_rules! m2 {
+ ($b:block) => {
+ fn foo2() {
+ let _ = const $b;
+ }
+ }
+}
+
+m!({});
+m2!({});
+
+fn main() {}
diff --git a/tests/ui/inline-const/pat-match-fndef.rs b/tests/ui/inline-const/pat-match-fndef.rs
new file mode 100644
index 000000000..fbd4dc66c
--- /dev/null
+++ b/tests/ui/inline-const/pat-match-fndef.rs
@@ -0,0 +1,13 @@
+#![feature(inline_const_pat)]
+//~^ WARN the feature `inline_const_pat` is incomplete
+
+fn uwu() {}
+
+fn main() {
+ let x = [];
+ match x[123] {
+ const { uwu } => {}
+ //~^ ERROR `fn() {uwu}` cannot be used in patterns
+ _ => {}
+ }
+}
diff --git a/tests/ui/inline-const/pat-match-fndef.stderr b/tests/ui/inline-const/pat-match-fndef.stderr
new file mode 100644
index 000000000..c94782b17
--- /dev/null
+++ b/tests/ui/inline-const/pat-match-fndef.stderr
@@ -0,0 +1,17 @@
+warning: the feature `inline_const_pat` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/pat-match-fndef.rs:1:12
+ |
+LL | #![feature(inline_const_pat)]
+ | ^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #76001 <https://github.com/rust-lang/rust/issues/76001> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+error: `fn() {uwu}` cannot be used in patterns
+ --> $DIR/pat-match-fndef.rs:9:9
+ |
+LL | const { uwu } => {}
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/inline-const/required-const.rs b/tests/ui/inline-const/required-const.rs
new file mode 100644
index 000000000..048341066
--- /dev/null
+++ b/tests/ui/inline-const/required-const.rs
@@ -0,0 +1,13 @@
+// build-fail
+// compile-flags: -Zmir-opt-level=3
+#![feature(inline_const)]
+
+fn foo<T>() {
+ if false {
+ const { panic!() } //~ ERROR E0080
+ }
+}
+
+fn main() {
+ foo::<i32>();
+}
diff --git a/tests/ui/inline-const/required-const.stderr b/tests/ui/inline-const/required-const.stderr
new file mode 100644
index 000000000..d6948e7ac
--- /dev/null
+++ b/tests/ui/inline-const/required-const.stderr
@@ -0,0 +1,11 @@
+error[E0080]: evaluation of `foo::<i32>::{constant#0}` failed
+ --> $DIR/required-const.rs:7:17
+ |
+LL | const { panic!() }
+ | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/required-const.rs:7:17
+ |
+ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/internal/internal-unstable.rs b/tests/ui/internal/internal-unstable.rs
index b8987d3e1..1eb27fbdc 100644
--- a/tests/ui/internal/internal-unstable.rs
+++ b/tests/ui/internal/internal-unstable.rs
@@ -8,7 +8,6 @@ extern crate internal_unstable;
struct Baz {
#[allow_internal_unstable]
- //^ WARN `#[allow_internal_unstable]` is ignored on struct fields and match arms
baz: u8,
}
@@ -50,7 +49,6 @@ fn main() {
match true {
#[allow_internal_unstable]
- //^ WARN `#[allow_internal_unstable]` is ignored on struct fields and match arms
_ => {}
}
}
diff --git a/tests/ui/internal/internal-unstable.stderr b/tests/ui/internal/internal-unstable.stderr
index f0f9bfb8d..b7c47365c 100644
--- a/tests/ui/internal/internal-unstable.stderr
+++ b/tests/ui/internal/internal-unstable.stderr
@@ -1,5 +1,5 @@
error[E0658]: use of unstable library feature 'function'
- --> $DIR/internal-unstable.rs:41:25
+ --> $DIR/internal-unstable.rs:40:25
|
LL | pass_through_allow!(internal_unstable::unstable());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL | pass_through_allow!(internal_unstable::unstable());
= help: add `#![feature(function)]` to the crate attributes to enable
error[E0658]: use of unstable library feature 'function'
- --> $DIR/internal-unstable.rs:43:27
+ --> $DIR/internal-unstable.rs:42:27
|
LL | pass_through_noallow!(internal_unstable::unstable());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ LL | pass_through_noallow!(internal_unstable::unstable());
= help: add `#![feature(function)]` to the crate attributes to enable
error[E0658]: use of unstable library feature 'function'
- --> $DIR/internal-unstable.rs:47:22
+ --> $DIR/internal-unstable.rs:46:22
|
LL | println!("{:?}", internal_unstable::unstable());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | println!("{:?}", internal_unstable::unstable());
= help: add `#![feature(function)]` to the crate attributes to enable
error[E0658]: use of unstable library feature 'function'
- --> $DIR/internal-unstable.rs:49:10
+ --> $DIR/internal-unstable.rs:48:10
|
LL | bar!(internal_unstable::unstable());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -31,7 +31,7 @@ LL | bar!(internal_unstable::unstable());
= help: add `#![feature(function)]` to the crate attributes to enable
error[E0658]: use of unstable library feature 'function'
- --> $DIR/internal-unstable.rs:19:9
+ --> $DIR/internal-unstable.rs:18:9
|
LL | internal_unstable::unstable();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr b/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr
index 463cd52c5..a0024c092 100644
--- a/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr
+++ b/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr
@@ -1,2 +1,3 @@
-thread 'main' panicked at 'byte index 1 is out of bounds of ``', $DIR/const-eval-select-backtrace-std.rs:6:6
+thread 'main' panicked at $DIR/const-eval-select-backtrace-std.rs:6:8:
+byte index 1 is out of bounds of ``
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr b/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr
index 54e28db5e..3f196bd8a 100644
--- a/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr
+++ b/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr
@@ -1,2 +1,3 @@
-thread 'main' panicked at 'Aaah!', $DIR/const-eval-select-backtrace.rs:17:9
+thread 'main' panicked at $DIR/const-eval-select-backtrace.rs:17:9:
+Aaah!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs
new file mode 100644
index 000000000..0e894ef58
--- /dev/null
+++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs
@@ -0,0 +1,17 @@
+#![feature(core_intrinsics)]
+#![feature(const_intrinsic_raw_eq)]
+
+const RAW_EQ_PADDING: bool = unsafe {
+ std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16))
+//~^ ERROR evaluation of constant value failed
+//~| requires initialized memory
+};
+
+const RAW_EQ_PTR: bool = unsafe {
+ std::intrinsics::raw_eq(&(&0), &(&1))
+//~^ ERROR evaluation of constant value failed
+//~| `raw_eq` on bytes with provenance
+};
+
+pub fn main() {
+}
diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-padding.stderr b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
index 56d5a4857..4fc304cda 100644
--- a/tests/ui/intrinsics/intrinsic-raw_eq-const-padding.stderr
+++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
@@ -1,9 +1,15 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/intrinsic-raw_eq-const-padding.rs:5:5
+ --> $DIR/intrinsic-raw_eq-const-bad.rs:5:5
|
LL | std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc3[0x0..0x4], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory
-error: aborting due to previous error
+error[E0080]: evaluation of constant value failed
+ --> $DIR/intrinsic-raw_eq-const-bad.rs:11:5
+ |
+LL | std::intrinsics::raw_eq(&(&0), &(&1))
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `raw_eq` on bytes with provenance
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-padding.rs b/tests/ui/intrinsics/intrinsic-raw_eq-const-padding.rs
deleted file mode 100644
index a93d777d2..000000000
--- a/tests/ui/intrinsics/intrinsic-raw_eq-const-padding.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#![feature(core_intrinsics)]
-#![feature(const_intrinsic_raw_eq)]
-
-const BAD_RAW_EQ_CALL: bool = unsafe {
- std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16))
-//~^ ERROR evaluation of constant value failed
-};
-
-pub fn main() {
-}
diff --git a/tests/ui/invalid/issue-114435-layout-type-err.rs b/tests/ui/invalid/issue-114435-layout-type-err.rs
new file mode 100644
index 000000000..a2d405936
--- /dev/null
+++ b/tests/ui/invalid/issue-114435-layout-type-err.rs
@@ -0,0 +1,44 @@
+// build-fail
+// compile-flags: --crate-type lib -Cdebuginfo=2
+// error-pattern: the type has an unknown layout
+
+#![recursion_limit = "10"]
+macro_rules! link {
+ ($outer:ident, $inner:ident) => {
+ struct $outer($inner);
+ impl $outer {
+ fn new() -> $outer {
+ $outer($inner::new())
+ }
+ }
+ impl std::ops::Deref for $outer {
+ type Target = $inner;
+ fn deref(&self) -> &$inner {
+ &self.0
+ }
+ }
+ };
+}
+
+struct Bottom;
+
+impl Bottom {
+ fn new() -> Bottom {
+ Bottom
+ }
+}
+
+
+link!(A, B);
+link!(B, C);
+link!(C, D);
+link!(D, E);
+link!(E, F);
+link!(F, G);
+link!(G, H);
+link!(H, I);
+link!(I, J);
+link!(J, K);
+link!(K, Bottom);
+
+fn main() { }
diff --git a/tests/ui/invalid/issue-114435-layout-type-err.stderr b/tests/ui/invalid/issue-114435-layout-type-err.stderr
new file mode 100644
index 000000000..a2db74ff8
--- /dev/null
+++ b/tests/ui/invalid/issue-114435-layout-type-err.stderr
@@ -0,0 +1,8 @@
+error: reached the recursion limit finding the struct tail for `Bottom`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]`
+
+error: the type has an unknown layout
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/issues/issue-100605.rs b/tests/ui/issues/issue-100605.rs
deleted file mode 100644
index 917a45c15..000000000
--- a/tests/ui/issues/issue-100605.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-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/tests/ui/issues/issue-11820.rs b/tests/ui/issues/issue-11820.rs
index 7ffe96527..dc6349b10 100644
--- a/tests/ui/issues/issue-11820.rs
+++ b/tests/ui/issues/issue-11820.rs
@@ -1,6 +1,8 @@
// run-pass
// pretty-expanded FIXME #23616
+#![allow(noop_method_call)]
+
struct NoClone;
fn main() {
diff --git a/tests/ui/issues/issue-13497-2.stderr b/tests/ui/issues/issue-13497-2.stderr
index a365e24e2..8ad921027 100644
--- a/tests/ui/issues/issue-13497-2.stderr
+++ b/tests/ui/issues/issue-13497-2.stderr
@@ -1,11 +1,13 @@
error[E0515]: cannot return value referencing local variable `rawLines`
--> $DIR/issue-13497-2.rs:3:5
|
-LL | // rawLines
-LL | || .iter().map(|l| l.trim()).collect()
- | ||_______________-___________________________^ returns a value referencing data owned by the current function
- | |_______________|
- | `rawLines` is borrowed here
+LL | rawLines
+ | ^-------
+ | |
+ | _____`rawLines` is borrowed here
+ | |
+LL | | .iter().map(|l| l.trim()).collect()
+ | |___________________________________________^ returns a value referencing data owned by the current function
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-17252.stderr b/tests/ui/issues/issue-17252.stderr
index aca5242b2..daaf82e80 100644
--- a/tests/ui/issues/issue-17252.stderr
+++ b/tests/ui/issues/issue-17252.stderr
@@ -10,6 +10,7 @@ note: cycle used when const-evaluating + checking `main::{constant#0}`
|
LL | let _x: [u8; FOO]; // caused stack overflow prior to fix
| ^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-20413.stderr b/tests/ui/issues/issue-20413.stderr
index 8891a2678..8793029dd 100644
--- a/tests/ui/issues/issue-20413.stderr
+++ b/tests/ui/issues/issue-20413.stderr
@@ -14,12 +14,11 @@ LL | impl<T> Foo for T where NoData<T>: Foo {
| ^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`)
-note: required for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<...>>>>>>>>>>>>>` to implement `Foo`
+note: required for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Foo`
--> $DIR/issue-20413.rs:9:9
|
LL | impl<T> Foo for T where NoData<T>: Foo {
| ^^^ ^ --- unsatisfied trait bound introduced here
- = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
= note: 126 redundant requirements hidden
= note: required for `NoData<T>` to implement `Foo`
@@ -30,18 +29,16 @@ LL | impl<T> Bar for T where EvenLessData<T>: Baz {
| ^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`)
-note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>` to implement `Baz`
+note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz`
--> $DIR/issue-20413.rs:35:9
|
LL | impl<T> Baz for T where AlmostNoData<T>: Bar {
| ^^^ ^ --- unsatisfied trait bound introduced here
- = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
-note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>` to implement `Bar`
+note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar`
--> $DIR/issue-20413.rs:28:9
|
LL | impl<T> Bar for T where EvenLessData<T>: Baz {
| ^^^ ^ --- unsatisfied trait bound introduced here
- = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
= note: 125 redundant requirements hidden
= note: required for `EvenLessData<T>` to implement `Baz`
@@ -52,18 +49,16 @@ LL | impl<T> Baz for T where AlmostNoData<T>: Bar {
| ^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`)
-note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>` to implement `Bar`
+note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Bar`
--> $DIR/issue-20413.rs:28:9
|
LL | impl<T> Bar for T where EvenLessData<T>: Baz {
| ^^^ ^ --- unsatisfied trait bound introduced here
- = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
-note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>` to implement `Baz`
+note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `Baz`
--> $DIR/issue-20413.rs:35:9
|
LL | impl<T> Baz for T where AlmostNoData<T>: Bar {
| ^^^ ^ --- unsatisfied trait bound introduced here
- = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt'
= note: 125 redundant requirements hidden
= note: required for `AlmostNoData<T>` to implement `Bar`
diff --git a/tests/ui/issues/issue-20772.stderr b/tests/ui/issues/issue-20772.stderr
index 416fd8c06..0c7e728c6 100644
--- a/tests/ui/issues/issue-20772.stderr
+++ b/tests/ui/issues/issue-20772.stderr
@@ -10,6 +10,7 @@ note: cycle used when computing the super predicates of `T`
|
LL | trait T : Iterator<Item=Self::Item>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-21177.stderr b/tests/ui/issues/issue-21177.stderr
index 6877a1846..8b749edcc 100644
--- a/tests/ui/issues/issue-21177.stderr
+++ b/tests/ui/issues/issue-21177.stderr
@@ -10,6 +10,7 @@ note: cycle used when computing explicit predicates of `foo`
|
LL | fn foo<T: Trait<A = T::B>>() { }
| ^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-21600.stderr b/tests/ui/issues/issue-21600.stderr
index ea304f936..f79059344 100644
--- a/tests/ui/issues/issue-21600.stderr
+++ b/tests/ui/issues/issue-21600.stderr
@@ -5,7 +5,7 @@ LL | fn call_it<F>(f: F) where F: Fn() { f(); }
| - change this to accept `FnMut` instead of `Fn`
...
LL | call_it(|| x.gen_mut());
- | ------- -- ^^^^^^^^^^^ cannot borrow as mutable
+ | ------- -- ^ cannot borrow as mutable
| | |
| | in this closure
| expects `Fn` instead of `FnMut`
diff --git a/tests/ui/issues/issue-23122-2.stderr b/tests/ui/issues/issue-23122-2.stderr
index 06e5b711a..af77e4b1a 100644
--- a/tests/ui/issues/issue-23122-2.stderr
+++ b/tests/ui/issues/issue-23122-2.stderr
@@ -5,14 +5,13 @@ LL | type Next = <GetNext<T::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 for `GetNext<<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next`
+note: required for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T 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 as Next>::Next>` to implement `Next`
--> $DIR/issue-23122-2.rs:10:15
|
LL | impl<T: Next> Next for GetNext<T> {
| - ^^^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
- = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-23122-2/issue-23122-2.long-type-hash.txt'
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-23302-1.stderr b/tests/ui/issues/issue-23302-1.stderr
index 9366050d7..d807e2440 100644
--- a/tests/ui/issues/issue-23302-1.stderr
+++ b/tests/ui/issues/issue-23302-1.stderr
@@ -10,6 +10,7 @@ note: cycle used when simplifying constant for the type system `X::A::{constant#
|
LL | A = X::A as isize,
| ^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-23302-2.stderr b/tests/ui/issues/issue-23302-2.stderr
index b97ae287a..91b39dba1 100644
--- a/tests/ui/issues/issue-23302-2.stderr
+++ b/tests/ui/issues/issue-23302-2.stderr
@@ -10,6 +10,7 @@ note: cycle used when simplifying constant for the type system `Y::A::{constant#
|
LL | A = Y::B as isize,
| ^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-23302-3.stderr b/tests/ui/issues/issue-23302-3.stderr
index c6cafe575..6b708d81f 100644
--- a/tests/ui/issues/issue-23302-3.stderr
+++ b/tests/ui/issues/issue-23302-3.stderr
@@ -15,6 +15,7 @@ note: cycle used when simplifying constant for the type system `A`
|
LL | const A: i32 = B;
| ^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-27842.stderr b/tests/ui/issues/issue-27842.stderr
index 83333aa0c..b18fe1512 100644
--- a/tests/ui/issues/issue-27842.stderr
+++ b/tests/ui/issues/issue-27842.stderr
@@ -1,24 +1,24 @@
error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})`
- --> $DIR/issue-27842.rs:4:13
+ --> $DIR/issue-27842.rs:4:16
|
LL | let _ = tup[0];
- | ^^^^^^ help: to access tuple elements, use: `tup.0`
+ | ^^^ help: to access tuple elements, use: `.0`
error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})`
- --> $DIR/issue-27842.rs:9:13
+ --> $DIR/issue-27842.rs:9:16
|
LL | let _ = tup[i];
- | ^^^^-^
+ | ^-^
| |
| cannot access tuple elements at a variable index
|
= help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`)
error[E0608]: cannot index into a value of type `({integer},)`
- --> $DIR/issue-27842.rs:14:13
+ --> $DIR/issue-27842.rs:14:16
|
LL | let _ = tup[3];
- | ^^^^^^
+ | ^^^
|
= help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`)
diff --git a/tests/ui/issues/issue-34373.stderr b/tests/ui/issues/issue-34373.stderr
index 8be3cfa72..0f0821518 100644
--- a/tests/ui/issues/issue-34373.stderr
+++ b/tests/ui/issues/issue-34373.stderr
@@ -21,6 +21,7 @@ LL | | fn foo(_: T) {}
LL | | fn main() {
LL | | }
| |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-40861.stderr b/tests/ui/issues/issue-40861.stderr
index 84e38b9bb..9b6469d05 100644
--- a/tests/ui/issues/issue-40861.stderr
+++ b/tests/ui/issues/issue-40861.stderr
@@ -1,8 +1,8 @@
error[E0608]: cannot index into a value of type `()`
- --> $DIR/issue-40861.rs:4:5
+ --> $DIR/issue-40861.rs:4:7
|
LL | ()[f(&[1.0])];
- | ^^^^^^^^^^^^^
+ | ^^^^^^^^^^^
|
= help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`)
diff --git a/tests/ui/issues/issue-41726.stderr b/tests/ui/issues/issue-41726.stderr
index b05c1fb14..7c87fde54 100644
--- a/tests/ui/issues/issue-41726.stderr
+++ b/tests/ui/issues/issue-41726.stderr
@@ -2,13 +2,10 @@ error[E0596]: cannot borrow data in an index of `HashMap<String, Vec<String>>` a
--> $DIR/issue-41726.rs:5:9
|
LL | things[src.as_str()].sort();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<String, Vec<String>>`
-help: to modify a `HashMap<String, Vec<String>>` use `.get_mut()`
- |
-LL | things.get_mut(src.as_str()).map(|val| val.sort());
- | ~~~~~~~~~ ~~~~~~~~~~~~~~~ +
+ = help: to modify a `HashMap<String, Vec<String>>`, use `.get_mut()`, `.insert()` or the entry API
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-42106.stderr b/tests/ui/issues/issue-42106.stderr
index 73cf8652f..d5a9d233b 100644
--- a/tests/ui/issues/issue-42106.stderr
+++ b/tests/ui/issues/issue-42106.stderr
@@ -4,9 +4,9 @@ error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed
LL | let _a = &collection;
| ----------- immutable borrow occurs here
LL | collection.swap(1, 2);
- | ^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
+ | ^^^^^^^^^^ mutable borrow occurs here
LL | _a.use_ref();
- | ------------ immutable borrow later used here
+ | -- immutable borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-44405.stderr b/tests/ui/issues/issue-44405.stderr
index 626cb2999..1fd69f6e7 100644
--- a/tests/ui/issues/issue-44405.stderr
+++ b/tests/ui/issues/issue-44405.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow data in an index of `Container` as mutable
--> $DIR/issue-44405.rs:21:5
|
LL | container[&mut val].test();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
|
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Container`
diff --git a/tests/ui/issues/issue-48364.stderr b/tests/ui/issues/issue-48364.stderr
index cac4af6a7..3f2e1b83a 100644
--- a/tests/ui/issues/issue-48364.stderr
+++ b/tests/ui/issues/issue-48364.stderr
@@ -10,7 +10,6 @@ LL | b"".starts_with(stringify!(foo))
found reference `&'static str`
note: method defined here
--> $SRC_DIR/core/src/slice/mod.rs:LL:COL
- = note: this error originates in the macro `stringify` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr
index 7180a3d24..c92da53db 100644
--- a/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr
+++ b/tests/ui/issues/issue-51632-try-desugar-incompatible-types.stderr
@@ -1,6 +1,8 @@
error[E0308]: `?` operator has incompatible types
--> $DIR/issue-51632-try-desugar-incompatible-types.rs:8:5
|
+LL | fn forbidden_narratives() -> Result<isize, ()> {
+ | ----------------- expected `Result<isize, ()>` because of return type
LL | missing_discourses()?
| ^^^^^^^^^^^^^^^^^^^^^ expected `Result<isize, ()>`, found `isize`
|
diff --git a/tests/ui/issues/issue-52126-assign-op-invariance.stderr b/tests/ui/issues/issue-52126-assign-op-invariance.stderr
index 2d3b48832..316e755f4 100644
--- a/tests/ui/issues/issue-52126-assign-op-invariance.stderr
+++ b/tests/ui/issues/issue-52126-assign-op-invariance.stderr
@@ -4,7 +4,7 @@ error[E0597]: `line` does not live long enough
LL | for line in vec!["123456789".to_string(), "12345678".to_string()] {
| ---- binding `line` declared here
LL | let v: Vec<&str> = line.split_whitespace().collect();
- | ^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
+ | ^^^^ borrowed value does not live long enough
...
LL | acc += cnt2;
| --- borrow later used here
diff --git a/tests/ui/issues/issue-61108.stderr b/tests/ui/issues/issue-61108.stderr
index 3aaf5fb3f..dd87b6266 100644
--- a/tests/ui/issues/issue-61108.stderr
+++ b/tests/ui/issues/issue-61108.stderr
@@ -7,7 +7,7 @@ LL | for l in bad_letters {
| ----------- `bad_letters` moved due to this implicit call to `.into_iter()`
...
LL | bad_letters.push('s');
- | ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move
+ | ^^^^^^^^^^^ value borrowed here after move
|
note: `into_iter` takes ownership of the receiver `self`, which moves `bad_letters`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
diff --git a/tests/ui/issues/issue-81584.stderr b/tests/ui/issues/issue-81584.stderr
index 54973cfa3..d57f1b778 100644
--- a/tests/ui/issues/issue-81584.stderr
+++ b/tests/ui/issues/issue-81584.stderr
@@ -2,7 +2,7 @@ error[E0515]: cannot return value referencing function parameter `y`
--> $DIR/issue-81584.rs:5:22
|
LL | .map(|y| y.iter().map(|x| x + 1))
- | --------^^^^^^^^^^^^^^^
+ | -^^^^^^^^^^^^^^^^^^^^^^
| |
| returns a value referencing data owned by the current function
| `y` is borrowed here
diff --git a/tests/ui/issues/issue-87707.run.stderr b/tests/ui/issues/issue-87707.run.stderr
index 527c78ba8..255a77a6a 100644
--- a/tests/ui/issues/issue-87707.run.stderr
+++ b/tests/ui/issues/issue-87707.run.stderr
@@ -1,3 +1,5 @@
-thread 'main' panicked at 'Here Once instance is poisoned.', $DIR/issue-87707.rs:14:24
+thread 'main' panicked at $DIR/issue-87707.rs:14:24:
+Here Once instance is poisoned.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
-thread 'main' panicked at 'Once instance has previously been poisoned', $DIR/issue-87707.rs:16:7
+thread 'main' panicked at $DIR/issue-87707.rs:16:7:
+Once instance has previously been poisoned
diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr
index b9fa1b299..eeffb3c5f 100644
--- a/tests/ui/layout/debug.stderr
+++ b/tests/ui/layout/debug.stderr
@@ -53,6 +53,8 @@ error: layout_of(E) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(12 bytes),
@@ -77,9 +79,13 @@ error: layout_of(E) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/debug.rs:7:1
|
@@ -124,6 +130,8 @@ error: layout_of(S) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/debug.rs:10:1
|
@@ -146,6 +154,8 @@ error: layout_of(U) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/debug.rs:13:1
|
@@ -237,6 +247,8 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
Layout {
size: Size(8 bytes),
@@ -272,9 +284,13 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/debug.rs:16:1
|
@@ -301,6 +317,8 @@ error: layout_of(i32) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/debug.rs:19:1
|
@@ -323,6 +341,8 @@ error: layout_of(V) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(2 bytes),
}
--> $DIR/debug.rs:22:1
|
@@ -345,6 +365,8 @@ error: layout_of(W) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(2 bytes),
}
--> $DIR/debug.rs:28:1
|
@@ -367,6 +389,8 @@ error: layout_of(Y) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(2 bytes),
}
--> $DIR/debug.rs:34:1
|
@@ -389,6 +413,8 @@ error: layout_of(P1) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/debug.rs:41:1
|
@@ -411,6 +437,8 @@ error: layout_of(P2) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/debug.rs:45:1
|
@@ -433,6 +461,8 @@ error: layout_of(P3) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/debug.rs:53:1
|
@@ -455,6 +485,8 @@ error: layout_of(P4) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/debug.rs:57:1
|
@@ -482,6 +514,8 @@ error: layout_of(P5) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/debug.rs:61:1
|
@@ -509,6 +543,8 @@ error: layout_of(std::mem::MaybeUninit<u8>) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/debug.rs:64:1
|
diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr
index d850dd69c..a2ad4a1ab 100644
--- a/tests/ui/layout/hexagon-enum.stderr
+++ b/tests/ui/layout/hexagon-enum.stderr
@@ -59,9 +59,13 @@ error: layout_of(A) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/hexagon-enum.rs:16:1
|
@@ -129,9 +133,13 @@ error: layout_of(B) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/hexagon-enum.rs:20:1
|
@@ -199,9 +207,13 @@ error: layout_of(C) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(2 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(2 bytes),
}
--> $DIR/hexagon-enum.rs:24:1
|
@@ -269,9 +281,13 @@ error: layout_of(P) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/hexagon-enum.rs:28:1
|
@@ -339,9 +355,13 @@ error: layout_of(T) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/hexagon-enum.rs:34:1
|
diff --git a/tests/ui/layout/issue-113941.rs b/tests/ui/layout/issue-113941.rs
new file mode 100644
index 000000000..7a54e28b3
--- /dev/null
+++ b/tests/ui/layout/issue-113941.rs
@@ -0,0 +1,13 @@
+// build-pass
+// revisions: normal randomize-layout
+// [randomize-layout]compile-flags: -Zrandomize-layout
+
+enum Void {}
+
+pub struct Struct([*const (); 0], Void);
+
+pub enum Enum {
+ Variant(Struct),
+}
+
+fn main() {}
diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr
index 8c7c91535..d3ba1a295 100644
--- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr
+++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr
@@ -81,6 +81,8 @@ error: layout_of(MissingPayloadField) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(1 bytes),
@@ -99,9 +101,13 @@ error: layout_of(MissingPayloadField) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:16:1
|
@@ -193,6 +199,8 @@ error: layout_of(CommonPayloadField) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(2 bytes),
@@ -228,9 +236,13 @@ error: layout_of(CommonPayloadField) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:25:1
|
@@ -320,6 +332,8 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(2 bytes),
@@ -354,9 +368,13 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:33:1
|
@@ -462,6 +480,8 @@ error: layout_of(NicheFirst) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(0 bytes),
@@ -480,6 +500,8 @@ error: layout_of(NicheFirst) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(0 bytes),
@@ -498,9 +520,13 @@ error: layout_of(NicheFirst) = Layout {
variants: Single {
index: 2,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:41:1
|
@@ -606,6 +632,8 @@ error: layout_of(NicheSecond) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(0 bytes),
@@ -624,6 +652,8 @@ error: layout_of(NicheSecond) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(0 bytes),
@@ -642,9 +672,13 @@ error: layout_of(NicheSecond) = Layout {
variants: Single {
index: 2,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:50:1
|
diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr
index de6177c8d..c539eb453 100644
--- a/tests/ui/layout/issue-96185-overaligned-enum.stderr
+++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr
@@ -53,6 +53,10 @@ error: layout_of(Aligned1) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: Some(
+ Align(8 bytes),
+ ),
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(8 bytes),
@@ -71,9 +75,17 @@ error: layout_of(Aligned1) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: Some(
+ Align(8 bytes),
+ ),
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: Some(
+ Align(8 bytes),
+ ),
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/issue-96185-overaligned-enum.rs:8:1
|
@@ -141,6 +153,10 @@ error: layout_of(Aligned2) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: Some(
+ Align(1 bytes),
+ ),
+ unadjusted_abi_align: Align(1 bytes),
},
Layout {
size: Size(1 bytes),
@@ -159,9 +175,17 @@ error: layout_of(Aligned2) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: Some(
+ Align(1 bytes),
+ ),
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: Some(
+ Align(1 bytes),
+ ),
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/issue-96185-overaligned-enum.rs:16:1
|
diff --git a/tests/ui/layout/malformed-unsized-type-in-union.rs b/tests/ui/layout/malformed-unsized-type-in-union.rs
new file mode 100644
index 000000000..5d8ec576c
--- /dev/null
+++ b/tests/ui/layout/malformed-unsized-type-in-union.rs
@@ -0,0 +1,8 @@
+// issue: 113760
+
+union W { s: dyn Iterator<Item = Missing> }
+//~^ ERROR cannot find type `Missing` in this scope
+
+static ONCE: W = todo!();
+
+fn main() {}
diff --git a/tests/ui/layout/malformed-unsized-type-in-union.stderr b/tests/ui/layout/malformed-unsized-type-in-union.stderr
new file mode 100644
index 000000000..cbb8d6af3
--- /dev/null
+++ b/tests/ui/layout/malformed-unsized-type-in-union.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `Missing` in this scope
+ --> $DIR/malformed-unsized-type-in-union.rs:3:34
+ |
+LL | union W { s: dyn Iterator<Item = Missing> }
+ | ^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr
index 227bd950b..6f6ab4982 100644
--- a/tests/ui/layout/thumb-enum.stderr
+++ b/tests/ui/layout/thumb-enum.stderr
@@ -59,9 +59,13 @@ error: layout_of(A) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/thumb-enum.rs:16:1
|
@@ -129,9 +133,13 @@ error: layout_of(B) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
}
--> $DIR/thumb-enum.rs:20:1
|
@@ -199,9 +207,13 @@ error: layout_of(C) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(2 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(2 bytes),
}
--> $DIR/thumb-enum.rs:24:1
|
@@ -269,9 +281,13 @@ error: layout_of(P) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/thumb-enum.rs:28:1
|
@@ -339,9 +355,13 @@ error: layout_of(T) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/thumb-enum.rs:34:1
|
diff --git a/tests/ui/layout/valid_range_oob.stderr b/tests/ui/layout/valid_range_oob.stderr
index a3a514fb8..d56804a35 100644
--- a/tests/ui/layout/valid_range_oob.stderr
+++ b/tests/ui/layout/valid_range_oob.stderr
@@ -1,3 +1,4 @@
+257 > 255
error: the compiler unexpectedly panicked. this is a bug.
query stack during panic:
diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr
index a3e82070e..df9f1cc8d 100644
--- a/tests/ui/layout/zero-sized-array-enum-niche.stderr
+++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr
@@ -57,6 +57,8 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
Layout {
size: Size(2 bytes),
@@ -88,9 +90,13 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:13:1
|
@@ -156,6 +162,8 @@ error: layout_of(MultipleAlignments) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(2 bytes),
},
Layout {
size: Size(4 bytes),
@@ -178,6 +186,8 @@ error: layout_of(MultipleAlignments) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
Layout {
size: Size(2 bytes),
@@ -209,9 +219,13 @@ error: layout_of(MultipleAlignments) = Layout {
variants: Single {
index: 2,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:21:1
|
@@ -277,6 +291,8 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
Layout {
size: Size(3 bytes),
@@ -308,9 +324,13 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:37:1
|
@@ -380,6 +400,8 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
variants: Single {
index: 0,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
},
Layout {
size: Size(2 bytes),
@@ -411,9 +433,13 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
variants: Single {
index: 1,
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(1 bytes),
},
],
},
+ max_repr_align: None,
+ unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:44:1
|
diff --git a/tests/ui/lazy-type-alias/auxiliary/eager.rs b/tests/ui/lazy-type-alias/auxiliary/eager.rs
new file mode 100644
index 000000000..8793a1701
--- /dev/null
+++ b/tests/ui/lazy-type-alias/auxiliary/eager.rs
@@ -0,0 +1,6 @@
+// This crate does *not* have lazy type aliases enabled.
+
+#![allow(type_alias_bounds)]
+
+// The `Copy` bound is ignored both locally and externally for backward compatibility.
+pub type Alias<T: Copy> = Option<T>;
diff --git a/tests/ui/lazy-type-alias/auxiliary/lazy.rs b/tests/ui/lazy-type-alias/auxiliary/lazy.rs
new file mode 100644
index 000000000..caa7999b4
--- /dev/null
+++ b/tests/ui/lazy-type-alias/auxiliary/lazy.rs
@@ -0,0 +1,4 @@
+#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
+
+pub type Alias<T: Copy> = Option<T>;
diff --git a/tests/ui/lazy-type-alias/coerce-behind-lazy.current.stderr b/tests/ui/lazy-type-alias/coerce-behind-lazy.current.stderr
new file mode 100644
index 000000000..98b3921de
--- /dev/null
+++ b/tests/ui/lazy-type-alias/coerce-behind-lazy.current.stderr
@@ -0,0 +1,11 @@
+warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/coerce-behind-lazy.rs:5:12
+ |
+LL | #![feature(lazy_type_alias)]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/lazy-type-alias/coerce-behind-lazy.next.stderr b/tests/ui/lazy-type-alias/coerce-behind-lazy.next.stderr
new file mode 100644
index 000000000..98b3921de
--- /dev/null
+++ b/tests/ui/lazy-type-alias/coerce-behind-lazy.next.stderr
@@ -0,0 +1,11 @@
+warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/coerce-behind-lazy.rs:5:12
+ |
+LL | #![feature(lazy_type_alias)]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/lazy-type-alias/coerce-behind-lazy.rs b/tests/ui/lazy-type-alias/coerce-behind-lazy.rs
new file mode 100644
index 000000000..745eadb96
--- /dev/null
+++ b/tests/ui/lazy-type-alias/coerce-behind-lazy.rs
@@ -0,0 +1,16 @@
+// check-pass
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+#![feature(lazy_type_alias)]
+//~^ WARN the feature `lazy_type_alias` is incomplete
+
+use std::any::Any;
+
+type Coerce = Box<dyn Any>;
+
+fn test() -> Coerce {
+ Box::new(1)
+}
+
+fn main() {}
diff --git a/tests/ui/lazy-type-alias/enum-variant.rs b/tests/ui/lazy-type-alias/enum-variant.rs
new file mode 100644
index 000000000..6d18e9eca
--- /dev/null
+++ b/tests/ui/lazy-type-alias/enum-variant.rs
@@ -0,0 +1,18 @@
+// Regression test for issue #113736.
+// check-pass
+
+#![feature(lazy_type_alias)]
+//~^ WARN the feature `lazy_type_alias` is incomplete and may not be safe to use
+
+enum Enum {
+ Unit,
+ Tuple(),
+ Struct {},
+}
+
+fn main() {
+ type Alias = Enum;
+ let _ = Alias::Unit;
+ let _ = Alias::Tuple();
+ let _ = Alias::Struct {};
+}
diff --git a/tests/ui/lazy-type-alias/enum-variant.stderr b/tests/ui/lazy-type-alias/enum-variant.stderr
new file mode 100644
index 000000000..4360db917
--- /dev/null
+++ b/tests/ui/lazy-type-alias/enum-variant.stderr
@@ -0,0 +1,11 @@
+warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/enum-variant.rs:4:12
+ |
+LL | #![feature(lazy_type_alias)]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs b/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs
new file mode 100644
index 000000000..07389961c
--- /dev/null
+++ b/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs
@@ -0,0 +1,23 @@
+// This test serves as a regression test for issue #114468 and it also ensures that we consider
+// type aliases from external crates that don't have `lazy_type_alias` enabled to be eager.
+
+// aux-crate:eager=eager.rs
+// edition: 2021
+// check-pass
+
+#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
+
+// This used to crash when we were computing the variances of `Struct` since we would convert
+// `eager::Alias<T>` to a weak projection due to the presence of `#![feature(lazy_type_alias)]` in
+// this (!) crate and subsequently attempt to obtain the variances of the type alias associated with
+// the weak projection which would panic because we don't compute this information for eager type
+// aliases at all.
+struct Struct<T>(eager::Alias<T>);
+
+fn main() {
+ // We want to ignore (or rather “end up ignoring”) the bound `T: Copy` since `Alias` should be
+ // treated as an eager type alias not just inside the crate it is defined in but also in
+ // dependent crates (like this one).
+ let _: eager::Alias<String>;
+}
diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr
new file mode 100644
index 000000000..9e0e2bfa8
--- /dev/null
+++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12
+ |
+LL | let _: lazy::Alias<String>;
+ | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+note: required by a bound on the type alias `Alias`
+ --> $DIR/auxiliary/lazy.rs:4:19
+ |
+LL | pub type Alias<T: Copy> = Option<T>;
+ | ^^^^ required by this bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr
new file mode 100644
index 000000000..9e0e2bfa8
--- /dev/null
+++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12
+ |
+LL | let _: lazy::Alias<String>;
+ | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+note: required by a bound on the type alias `Alias`
+ --> $DIR/auxiliary/lazy.rs:4:19
+ |
+LL | pub type Alias<T: Copy> = Option<T>;
+ | ^^^^ required by this bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs
new file mode 100644
index 000000000..31a19161b
--- /dev/null
+++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs
@@ -0,0 +1,16 @@
+// revisions: locally_eager locally_lazy
+// aux-crate:lazy=lazy.rs
+// edition: 2021
+
+// Test that we treat lazy type aliases from external crates as lazy independently of whether the
+// local crate enables `lazy_type_alias` or not.
+
+#![cfg_attr(
+ locally_lazy,
+ feature(lazy_type_alias),
+ allow(incomplete_features)
+)]
+
+fn main() {
+ let _: lazy::Alias<String>; //~ ERROR the trait bound `String: Copy` is not satisfied
+}
diff --git a/tests/ui/lazy-type-alias/leading-where-clause.fixed b/tests/ui/lazy-type-alias/leading-where-clause.fixed
new file mode 100644
index 000000000..07ebc09b3
--- /dev/null
+++ b/tests/ui/lazy-type-alias/leading-where-clause.fixed
@@ -0,0 +1,15 @@
+// run-rustfix
+
+#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
+
+// Check that we *reject* leading where-clauses on lazy type aliases.
+
+type Alias<T>
+
+= T where String: From<T>;
+//~^^^ ERROR where clauses are not allowed before the type for type aliases
+
+fn main() {
+ let _: Alias<&str>;
+}
diff --git a/tests/ui/lazy-type-alias/leading-where-clause.rs b/tests/ui/lazy-type-alias/leading-where-clause.rs
new file mode 100644
index 000000000..4a6542934
--- /dev/null
+++ b/tests/ui/lazy-type-alias/leading-where-clause.rs
@@ -0,0 +1,16 @@
+// run-rustfix
+
+#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
+
+// Check that we *reject* leading where-clauses on lazy type aliases.
+
+type Alias<T>
+where
+ String: From<T>,
+= T;
+//~^^^ ERROR where clauses are not allowed before the type for type aliases
+
+fn main() {
+ let _: Alias<&str>;
+}
diff --git a/tests/ui/lazy-type-alias/leading-where-clause.stderr b/tests/ui/lazy-type-alias/leading-where-clause.stderr
new file mode 100644
index 000000000..8ddf0ce6c
--- /dev/null
+++ b/tests/ui/lazy-type-alias/leading-where-clause.stderr
@@ -0,0 +1,16 @@
+error: where clauses are not allowed before the type for type aliases
+ --> $DIR/leading-where-clause.rs:9:1
+ |
+LL | / where
+LL | | String: From<T>,
+ | |____________________^
+ |
+ = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
+help: move it to the end of the type declaration
+ |
+LL +
+LL ~ = T where String: From<T>;
+ |
+
+error: aborting due to previous error
+
diff --git a/tests/ui/lazy-type-alias/trailing-where-clause.rs b/tests/ui/lazy-type-alias/trailing-where-clause.rs
new file mode 100644
index 000000000..ac9598fe5
--- /dev/null
+++ b/tests/ui/lazy-type-alias/trailing-where-clause.rs
@@ -0,0 +1,13 @@
+#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
+
+// Check that we allow & respect trailing where-clauses on lazy type aliases.
+
+type Alias<T> = T
+where
+ String: From<T>;
+
+fn main() {
+ let _: Alias<&str>;
+ let _: Alias<()>; //~ ERROR the trait bound `String: From<()>` is not satisfied
+}
diff --git a/tests/ui/lazy-type-alias/trailing-where-clause.stderr b/tests/ui/lazy-type-alias/trailing-where-clause.stderr
new file mode 100644
index 000000000..d7606ba6b
--- /dev/null
+++ b/tests/ui/lazy-type-alias/trailing-where-clause.stderr
@@ -0,0 +1,22 @@
+error[E0277]: the trait bound `String: From<()>` is not satisfied
+ --> $DIR/trailing-where-clause.rs:12:12
+ |
+LL | let _: Alias<()>;
+ | ^^^^^^^^^ the trait `From<()>` is not implemented for `String`
+ |
+ = help: the following other types implement trait `From<T>`:
+ <String as From<char>>
+ <String as From<Box<str>>>
+ <String as From<Cow<'a, str>>>
+ <String as From<&str>>
+ <String as From<&mut str>>
+ <String as From<&String>>
+note: required by a bound on the type alias `Alias`
+ --> $DIR/trailing-where-clause.rs:8:13
+ |
+LL | String: From<T>;
+ | ^^^^^^^ required by this bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/lazy-type-alias/type-alias-bounds-are-enforced.rs b/tests/ui/lazy-type-alias/type-alias-bounds-are-enforced.rs
new file mode 100644
index 000000000..d0abd3ebf
--- /dev/null
+++ b/tests/ui/lazy-type-alias/type-alias-bounds-are-enforced.rs
@@ -0,0 +1,14 @@
+// Check that we don't issue the lint `type_alias_bounds` for
+// lazy type aliases since the bounds are indeed enforced.
+
+// check-pass
+
+#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
+#![deny(type_alias_bounds)]
+
+use std::ops::Mul;
+
+type Alias<T: Mul> = <T as Mul>::Output;
+
+fn main() {}
diff --git a/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.rs b/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.rs
new file mode 100644
index 000000000..c798e4e43
--- /dev/null
+++ b/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.rs
@@ -0,0 +1,8 @@
+// Test that we check lazy type aliases for well-formedness.
+
+#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
+
+type Alias<T> = <T as std::ops::Mul>::Output; //~ ERROR cannot multiply `T` by `T`
+
+fn main() {}
diff --git a/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr b/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr
new file mode 100644
index 000000000..d022f8251
--- /dev/null
+++ b/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr
@@ -0,0 +1,14 @@
+error[E0277]: cannot multiply `T` by `T`
+ --> $DIR/unsatisfied-bounds-type-alias-body.rs:6:17
+ |
+LL | type Alias<T> = <T as std::ops::Mul>::Output;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T`
+ |
+help: consider restricting type parameter `T`
+ |
+LL | type Alias<T: std::ops::Mul> = <T as std::ops::Mul>::Output;
+ | +++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/lazy-type-alias/variance.rs b/tests/ui/lazy-type-alias/variance.rs
new file mode 100644
index 000000000..f83215856
--- /dev/null
+++ b/tests/ui/lazy-type-alias/variance.rs
@@ -0,0 +1,38 @@
+// This is a regression test for issue #114221.
+// Check that we compute variances for lazy type aliases.
+
+// check-pass
+
+#![feature(lazy_type_alias)]
+#![allow(incomplete_features)]
+
+// [+] `A` is covariant over `'a`.
+struct A<'a>(Co<'a>);
+
+// [+] `Co` is covariant over `'a`.
+type Co<'a> = &'a ();
+
+fn co<'a>(x: A<'static>) {
+ let _: A<'a> = x;
+}
+
+// [-] `B` is contravariant over `'a`.
+struct B<'a>(Contra<'a>);
+
+// [-] `Contra` is contravariant over `'a`.
+type Contra<'a> = fn(&'a ());
+
+fn contra<'a>(x: B<'a>) {
+ let _: B<'static> = x;
+}
+
+struct C<T, U>(CoContra<T, U>);
+
+// [+, -] `CoContra` is covariant over `T` and contravariant over `U`.
+type CoContra<T, U> = Option<(T, fn(U))>;
+
+fn co_contra<'a>(x: C<&'static (), &'a ()>) -> C<&'a (), &'static ()> {
+ x
+}
+
+fn main() {}
diff --git a/tests/ui/lexer/lex-emoji-identifiers.rs b/tests/ui/lexer/lex-emoji-identifiers.rs
index 91b5929c0..decf2f005 100644
--- a/tests/ui/lexer/lex-emoji-identifiers.rs
+++ b/tests/ui/lexer/lex-emoji-identifiers.rs
@@ -1,9 +1,7 @@
fn invalid_emoji_usages() {
let arrow↔️ = "basic emoji"; //~ ERROR: identifiers cannot contain emoji
- // FIXME
- let planet🪐 = "basic emoji"; //~ ERROR: unknown start of token
- // FIXME
- let wireless🛜 = "basic emoji"; //~ ERROR: unknown start of token
+ let planet🪐 = "basic emoji"; //~ ERROR: identifiers cannot contain emoji
+ let wireless🛜 = "basic emoji"; //~ ERROR: identifiers cannot contain emoji
// FIXME
let key1️⃣ = "keycap sequence"; //~ ERROR: unknown start of token
//~^ WARN: identifier contains uncommon Unicode codepoints
diff --git a/tests/ui/lexer/lex-emoji-identifiers.stderr b/tests/ui/lexer/lex-emoji-identifiers.stderr
index 6237c5d02..747825fa2 100644
--- a/tests/ui/lexer/lex-emoji-identifiers.stderr
+++ b/tests/ui/lexer/lex-emoji-identifiers.stderr
@@ -1,17 +1,5 @@
-error: unknown start of token: \u{1fa90}
- --> $DIR/lex-emoji-identifiers.rs:4:15
- |
-LL | let planet🪐 = "basic emoji";
- | ^^
-
-error: unknown start of token: \u{1f6dc}
- --> $DIR/lex-emoji-identifiers.rs:6:17
- |
-LL | let wireless🛜 = "basic emoji";
- | ^^
-
error: unknown start of token: \u{20e3}
- --> $DIR/lex-emoji-identifiers.rs:8:14
+ --> $DIR/lex-emoji-identifiers.rs:6:14
|
LL | let key1️⃣ = "keycap sequence";
| ^
@@ -22,26 +10,38 @@ error: identifiers cannot contain emoji: `arrow↔️`
LL | let arrow↔️ = "basic emoji";
| ^^^^^^
+error: identifiers cannot contain emoji: `planet🪐`
+ --> $DIR/lex-emoji-identifiers.rs:3:9
+ |
+LL | let planet🪐 = "basic emoji";
+ | ^^^^^^^^
+
+error: identifiers cannot contain emoji: `wireless🛜`
+ --> $DIR/lex-emoji-identifiers.rs:4:9
+ |
+LL | let wireless🛜 = "basic emoji";
+ | ^^^^^^^^^^
+
error: identifiers cannot contain emoji: `flag🇺🇳`
- --> $DIR/lex-emoji-identifiers.rs:10:9
+ --> $DIR/lex-emoji-identifiers.rs:8:9
|
LL | let flag🇺🇳 = "flag sequence";
| ^^^^^^
error: identifiers cannot contain emoji: `wales🏴`
- --> $DIR/lex-emoji-identifiers.rs:11:9
+ --> $DIR/lex-emoji-identifiers.rs:9:9
|
LL | let wales🏴 = "tag sequence";
| ^^^^^^^
error: identifiers cannot contain emoji: `folded🙏🏿`
- --> $DIR/lex-emoji-identifiers.rs:12:9
+ --> $DIR/lex-emoji-identifiers.rs:10:9
|
LL | let folded🙏🏿 = "modifier sequence";
| ^^^^^^^^^^
warning: identifier contains uncommon Unicode codepoints
- --> $DIR/lex-emoji-identifiers.rs:8:9
+ --> $DIR/lex-emoji-identifiers.rs:6:9
|
LL | let key1️⃣ = "keycap sequence";
| ^^^^
diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr
index 987b051b1..da0078698 100644
--- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr
+++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr
@@ -7,10 +7,14 @@ LL | let mut x = vec![1].iter();
| creates a temporary value which is freed while still in use
LL |
LL | x.use_mut();
- | ----------- borrow later used here
+ | - borrow later used here
|
- = note: consider using a `let` binding to create a longer lived value
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider using a `let` binding to create a longer lived value
+ |
+LL ~ let binding = vec![1];
+LL ~ let mut x = binding.iter();
+ |
error: aborting due to previous error
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr
index cc2447b18..cb629d2e3 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr
@@ -1,3 +1,14 @@
+error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
+ --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
+ |
+LL | y.push(z);
+ | ^ cannot borrow as mutable
+ |
+help: consider changing this to be mutable
+ |
+LL | fn foo(x:fn(&u8, &u8), mut y: Vec<&u8>, z: &u8) {
+ | +++
+
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
|
@@ -13,17 +24,6 @@ help: consider introducing a named lifetime parameter
LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<&'a u8>, z: &'a u8) {
| ++++ ++ ++
-error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
- --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3
- |
-LL | y.push(z);
- | ^^^^^^^^^ cannot borrow as mutable
- |
-help: consider changing this to be mutable
- |
-LL | fn foo(x:fn(&u8, &u8), mut y: Vec<&u8>, z: &u8) {
- | +++
-
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
index 2ba5afa80..05f930812 100644
--- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
@@ -1,3 +1,14 @@
+error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
+ --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
+ |
+LL | y.push(z);
+ | ^ cannot borrow as mutable
+ |
+help: consider changing this to be mutable
+ |
+LL | fn foo(x:Box<dyn Fn(&u8, &u8)> , mut y: Vec<&u8>, z: &u8) {
+ | +++
+
error: lifetime may not live long enough
--> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
|
@@ -13,17 +24,6 @@ help: consider introducing a named lifetime parameter
LL | fn foo<'a>(x:Box<dyn Fn(&u8, &u8)> , y: Vec<&'a u8>, z: &'a u8) {
| ++++ ++ ++
-error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
- --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3
- |
-LL | y.push(z);
- | ^^^^^^^^^ cannot borrow as mutable
- |
-help: consider changing this to be mutable
- |
-LL | fn foo(x:Box<dyn Fn(&u8, &u8)> , mut y: Vec<&u8>, z: &u8) {
- | +++
-
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0596`.
diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr
index 4994e4dc4..01ec69a61 100644
--- a/tests/ui/lifetimes/unusual-rib-combinations.stderr
+++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr
@@ -3,11 +3,6 @@ error[E0106]: missing lifetime specifier
|
LL | fn d<const C: S>() {}
| ^ expected named lifetime parameter
- |
-help: consider introducing a named lifetime parameter
- |
-LL | fn d<'a, const C: S<'a>>() {}
- | +++ ++++
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/unusual-rib-combinations.rs:29:22
diff --git a/tests/ui/limits/issue-17913.stderr b/tests/ui/limits/issue-17913.stderr
index 684db53a9..0d21a4288 100644
--- a/tests/ui/limits/issue-17913.stderr
+++ b/tests/ui/limits/issue-17913.stderr
@@ -1,4 +1,5 @@
error: values of the type `[&usize; usize::MAX]` are too big for the current architecture
+ --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
error: aborting due to previous error
diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr
index 5d457ba0e..0d269e599 100644
--- a/tests/ui/lint/clashing-extern-fn.stderr
+++ b/tests/ui/lint/clashing-extern-fn.stderr
@@ -1,11 +1,30 @@
+warning: `extern` block uses type `Option<TransparentNoNiche>`, which is not FFI-safe
+ --> $DIR/clashing-extern-fn.rs:433:55
+ |
+LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+ |
+ = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
+ = note: enum has no representation hint
+ = note: `#[warn(improper_ctypes)]` on by default
+
+warning: `extern` block uses type `Option<UnsafeCell<NonZeroUsize>>`, which is not FFI-safe
+ --> $DIR/clashing-extern-fn.rs:437:46
+ |
+LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+ |
+ = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
+ = note: enum has no representation hint
+
warning: `clash` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:14:13
|
LL | fn clash(x: u8);
- | ---------------- `clash` previously declared here
+ | --------------- `clash` previously declared here
...
LL | fn clash(x: u64);
- | ^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn(u8)`
found `unsafe extern "C" fn(u64)`
@@ -18,12 +37,11 @@ LL | #![warn(clashing_extern_declarations)]
warning: `extern_link_name` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:52:9
|
-LL | / #[link_name = "extern_link_name"]
-LL | | fn some_new_name(x: i16);
- | |_____________________________- `extern_link_name` previously declared here
+LL | #[link_name = "extern_link_name"]
+ | --------------------------------- `extern_link_name` previously declared here
...
-LL | fn extern_link_name(x: u32);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+LL | fn extern_link_name(x: u32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn(i16)`
found `unsafe extern "C" fn(u32)`
@@ -31,13 +49,11 @@ LL | fn extern_link_name(x: u32);
warning: `some_other_extern_link_name` redeclares `some_other_new_name` with a different signature
--> $DIR/clashing-extern-fn.rs:55:9
|
-LL | fn some_other_new_name(x: i16);
- | ------------------------------- `some_other_new_name` previously declared here
+LL | fn some_other_new_name(x: i16);
+ | ------------------------------ `some_other_new_name` previously declared here
...
-LL | / #[link_name = "some_other_new_name"]
-LL | |
-LL | | fn some_other_extern_link_name(x: u32);
- | |_______________________________________________^ this signature doesn't match the previous declaration
+LL | #[link_name = "some_other_new_name"]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn(i16)`
found `unsafe extern "C" fn(u32)`
@@ -45,14 +61,11 @@ LL | | fn some_other_extern_link_name(x: u32);
warning: `other_both_names_different` redeclares `link_name_same` with a different signature
--> $DIR/clashing-extern-fn.rs:59:9
|
-LL | / #[link_name = "link_name_same"]
-LL | | fn both_names_different(x: i16);
- | |____________________________________- `link_name_same` previously declared here
+LL | #[link_name = "link_name_same"]
+ | ------------------------------- `link_name_same` previously declared here
...
-LL | / #[link_name = "link_name_same"]
-LL | |
-LL | | fn other_both_names_different(x: u32);
- | |______________________________________________^ this signature doesn't match the previous declaration
+LL | #[link_name = "link_name_same"]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn(i16)`
found `unsafe extern "C" fn(u32)`
@@ -61,10 +74,10 @@ warning: `different_mod` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:72:9
|
LL | fn different_mod(x: u8);
- | ------------------------ `different_mod` previously declared here
+ | ----------------------- `different_mod` previously declared here
...
LL | fn different_mod(x: u64);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn(u8)`
found `unsafe extern "C" fn(u64)`
@@ -73,10 +86,10 @@ warning: `variadic_decl` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:82:9
|
LL | fn variadic_decl(x: u8, ...);
- | ----------------------------- `variadic_decl` previously declared here
+ | ---------------------------- `variadic_decl` previously declared here
...
LL | fn variadic_decl(x: u8);
- | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn(u8, ...)`
found `unsafe extern "C" fn(u8)`
@@ -85,10 +98,10 @@ warning: `weigh_banana` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:142:13
|
LL | fn weigh_banana(count: *const Banana) -> u64;
- | --------------------------------------------- `weigh_banana` previously declared here
+ | -------------------------------------------- `weigh_banana` previously declared here
...
LL | fn weigh_banana(count: *const Banana) -> u64;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn(*const one::Banana) -> u64`
found `unsafe extern "C" fn(*const three::Banana) -> u64`
@@ -97,10 +110,10 @@ warning: `draw_point` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:171:13
|
LL | fn draw_point(p: Point);
- | ------------------------ `draw_point` previously declared here
+ | ----------------------- `draw_point` previously declared here
...
LL | fn draw_point(p: Point);
- | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn(sameish_members::a::Point)`
found `unsafe extern "C" fn(sameish_members::b::Point)`
@@ -109,10 +122,10 @@ warning: `origin` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:197:13
|
LL | fn origin() -> Point3;
- | ---------------------- `origin` previously declared here
+ | --------------------- `origin` previously declared here
...
LL | fn origin() -> Point3;
- | ^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> same_sized_members_clash::a::Point3`
found `unsafe extern "C" fn() -> same_sized_members_clash::b::Point3`
@@ -121,10 +134,10 @@ warning: `transparent_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:220:13
|
LL | fn transparent_incorrect() -> T;
- | -------------------------------- `transparent_incorrect` previously declared here
+ | ------------------------------- `transparent_incorrect` previously declared here
...
LL | fn transparent_incorrect() -> isize;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> T`
found `unsafe extern "C" fn() -> isize`
@@ -133,10 +146,10 @@ warning: `missing_return_type` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:259:13
|
LL | fn missing_return_type() -> usize;
- | ---------------------------------- `missing_return_type` previously declared here
+ | --------------------------------- `missing_return_type` previously declared here
...
LL | fn missing_return_type();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> usize`
found `unsafe extern "C" fn()`
@@ -145,10 +158,10 @@ warning: `non_zero_usize` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:277:13
|
LL | fn non_zero_usize() -> core::num::NonZeroUsize;
- | ----------------------------------------------- `non_zero_usize` previously declared here
+ | ---------------------------------------------- `non_zero_usize` previously declared here
...
LL | fn non_zero_usize() -> usize;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> NonZeroUsize`
found `unsafe extern "C" fn() -> usize`
@@ -157,10 +170,10 @@ warning: `non_null_ptr` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:279:13
|
LL | fn non_null_ptr() -> core::ptr::NonNull<usize>;
- | ----------------------------------------------- `non_null_ptr` previously declared here
+ | ---------------------------------------------- `non_null_ptr` previously declared here
...
LL | fn non_null_ptr() -> *const usize;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> NonNull<usize>`
found `unsafe extern "C" fn() -> *const usize`
@@ -169,10 +182,10 @@ warning: `option_non_zero_usize_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:377:13
|
LL | fn option_non_zero_usize_incorrect() -> usize;
- | ---------------------------------------------- `option_non_zero_usize_incorrect` previously declared here
+ | --------------------------------------------- `option_non_zero_usize_incorrect` previously declared here
...
LL | fn option_non_zero_usize_incorrect() -> isize;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> usize`
found `unsafe extern "C" fn() -> isize`
@@ -181,10 +194,10 @@ warning: `option_non_null_ptr_incorrect` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:379:13
|
LL | fn option_non_null_ptr_incorrect() -> *const usize;
- | --------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here
+ | -------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here
...
LL | fn option_non_null_ptr_incorrect() -> *const isize;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> *const usize`
found `unsafe extern "C" fn() -> *const isize`
@@ -193,10 +206,10 @@ warning: `hidden_niche_transparent_no_niche` redeclared with a different signatu
--> $DIR/clashing-extern-fn.rs:433:13
|
LL | fn hidden_niche_transparent_no_niche() -> usize;
- | ------------------------------------------------ `hidden_niche_transparent_no_niche` previously declared here
+ | ----------------------------------------------- `hidden_niche_transparent_no_niche` previously declared here
...
LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> usize`
found `unsafe extern "C" fn() -> Option<TransparentNoNiche>`
@@ -205,32 +218,13 @@ warning: `hidden_niche_unsafe_cell` redeclared with a different signature
--> $DIR/clashing-extern-fn.rs:437:13
|
LL | fn hidden_niche_unsafe_cell() -> usize;
- | --------------------------------------- `hidden_niche_unsafe_cell` previously declared here
+ | -------------------------------------- `hidden_niche_unsafe_cell` previously declared here
...
LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn() -> usize`
found `unsafe extern "C" fn() -> Option<UnsafeCell<NonZeroUsize>>`
-warning: `extern` block uses type `Option<TransparentNoNiche>`, which is not FFI-safe
- --> $DIR/clashing-extern-fn.rs:433:55
- |
-LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
- |
- = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
- = note: enum has no representation hint
- = note: `#[warn(improper_ctypes)]` on by default
-
-warning: `extern` block uses type `Option<UnsafeCell<NonZeroUsize>>`, which is not FFI-safe
- --> $DIR/clashing-extern-fn.rs:437:46
- |
-LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
- |
- = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
- = note: enum has no representation hint
-
warning: 19 warnings emitted
diff --git a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.rs b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.rs
new file mode 100644
index 000000000..b71bcd0fa
--- /dev/null
+++ b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+// this test checks that the `dead_code` lint is *NOT* being emited
+// for `foo` as `foo` is being used by `main`, and so the `#[expect]`
+// is unfulfilled
+//
+// it also checks that the `dead_code` lint is also *NOT* emited
+// for `bar` as it's suppresed by the `#[expect]` on `bar`
+
+#![feature(lint_reasons)]
+#![warn(dead_code)] // to override compiletest
+
+fn bar() {}
+
+#[expect(dead_code)]
+//~^ WARN this lint expectation is unfulfilled
+fn foo() { bar() }
+
+fn main() { foo() }
diff --git a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.stderr b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.stderr
new file mode 100644
index 000000000..d5c4dabed
--- /dev/null
+++ b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-2.stderr
@@ -0,0 +1,10 @@
+warning: this lint expectation is unfulfilled
+ --> $DIR/allow-or-expect-dead_code-114557-2.rs:15:10
+ |
+LL | #[expect(dead_code)]
+ | ^^^^^^^^^
+ |
+ = note: `#[warn(unfulfilled_lint_expectations)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.rs b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.rs
new file mode 100644
index 000000000..f8a5d31a0
--- /dev/null
+++ b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.rs
@@ -0,0 +1,13 @@
+// check-pass
+
+// this test makes sure that the `unfulfilled_lint_expectations` lint
+// is being emited for `foo` as foo is not dead code, it's pub
+
+#![feature(lint_reasons)]
+#![warn(dead_code)] // to override compiletest
+
+#[expect(dead_code)]
+//~^ WARN this lint expectation is unfulfilled
+pub fn foo() {}
+
+fn main() {}
diff --git a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.stderr b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.stderr
new file mode 100644
index 000000000..c954a75b3
--- /dev/null
+++ b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557-3.stderr
@@ -0,0 +1,10 @@
+warning: this lint expectation is unfulfilled
+ --> $DIR/allow-or-expect-dead_code-114557-3.rs:9:10
+ |
+LL | #[expect(dead_code)]
+ | ^^^^^^^^^
+ |
+ = note: `#[warn(unfulfilled_lint_expectations)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557.rs b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557.rs
new file mode 100644
index 000000000..24fafa3d1
--- /dev/null
+++ b/tests/ui/lint/dead-code/allow-or-expect-dead_code-114557.rs
@@ -0,0 +1,18 @@
+// check-pass
+// revisions: allow expect
+
+// this test checks that no matter if we put #[allow(dead_code)]
+// or #[expect(dead_code)], no warning is being emited
+
+#![feature(lint_reasons)]
+#![warn(dead_code)] // to override compiletest
+
+fn f() {}
+
+#[cfg_attr(allow, allow(dead_code))]
+#[cfg_attr(expect, expect(dead_code))]
+fn g() {
+ f();
+}
+
+fn main() {}
diff --git a/tests/ui/lint/invalid-nan-comparison.stderr b/tests/ui/lint/invalid-nan-comparison.stderr
index 054c06d38..f2d55c107 100644
--- a/tests/ui/lint/invalid-nan-comparison.stderr
+++ b/tests/ui/lint/invalid-nan-comparison.stderr
@@ -5,11 +5,6 @@ LL | const TEST: bool = 5f32 == f32::NAN;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(invalid_nan_comparisons)]` on by default
-help: use `f32::is_nan()` or `f64::is_nan()` instead
- |
-LL - const TEST: bool = 5f32 == f32::NAN;
-LL + const TEST: bool = 5f32.is_nan();
- |
warning: incorrect NaN comparison, NaN cannot be directly compared to itself
--> $DIR/invalid-nan-comparison.rs:14:5
diff --git a/tests/ui/lint/issue-111359.stderr b/tests/ui/lint/issue-111359.stderr
index 2296d8413..0aef5007a 100644
--- a/tests/ui/lint/issue-111359.stderr
+++ b/tests/ui/lint/issue-111359.stderr
@@ -1,26 +1,26 @@
-error: type does not implement `Debug`; consider adding `#[derive(Debug)]` or a manual implementation
+error: type could implement `Copy`; consider adding `impl Copy`
--> $DIR/issue-111359.rs:7:5
|
LL | pub struct BarPub;
| ^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
- --> $DIR/issue-111359.rs:1:8
+ --> $DIR/issue-111359.rs:2:8
|
-LL | #[deny(missing_debug_implementations)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(missing_copy_implementations)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: type could implement `Copy`; consider adding `impl Copy`
+error: type does not implement `Debug`; consider adding `#[derive(Debug)]` or a manual implementation
--> $DIR/issue-111359.rs:7:5
|
LL | pub struct BarPub;
| ^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
- --> $DIR/issue-111359.rs:2:8
+ --> $DIR/issue-111359.rs:1:8
|
-LL | #[deny(missing_copy_implementations)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(missing_debug_implementations)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/issue-1866.stderr b/tests/ui/lint/issue-1866.stderr
index d19a13496..36d323825 100644
--- a/tests/ui/lint/issue-1866.stderr
+++ b/tests/ui/lint/issue-1866.stderr
@@ -2,10 +2,10 @@ warning: `rust_task_is_unwinding` redeclared with a different signature
--> $DIR/issue-1866.rs:23:13
|
LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool;
- | ------------------------------------------------------------ `rust_task_is_unwinding` previously declared here
+ | ----------------------------------------------------------- `rust_task_is_unwinding` previously declared here
...
LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
|
= note: expected `unsafe extern "C" fn(*const usize) -> bool`
found `unsafe extern "C" fn(*const bool) -> bool`
diff --git a/tests/ui/lint/lint-attr-everywhere-late.stderr b/tests/ui/lint/lint-attr-everywhere-late.stderr
index 9587556b0..7fe078068 100644
--- a/tests/ui/lint/lint-attr-everywhere-late.stderr
+++ b/tests/ui/lint/lint-attr-everywhere-late.stderr
@@ -34,12 +34,6 @@ note: the lint level is defined here
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
|
@@ -142,52 +136,6 @@ note: the lint level is defined here
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: expected `unsafe extern "C" fn()`
- found `unsafe extern "C" fn(i32)`
-note: the lint level is defined here
- --> $DIR/lint-attr-everywhere-late.rs:122:13
- |
-LL | #![deny(clashing_extern_declarations)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-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: expected `unsafe extern "C" fn()`
- found `unsafe extern "C" fn(i32)`
-note: the lint level is defined here
- --> $DIR/lint-attr-everywhere-late.rs:127:12
- |
-LL | #[deny(clashing_extern_declarations)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
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
|
@@ -230,6 +178,18 @@ note: the lint level is defined here
LL | #[deny(overflowing_literals)] const ASSOC_CONST: u8 = 1000;
| ^^^^^^^^^^^^^^^^^^^^
+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: variable `PARAM` should have a snake case name
--> $DIR/lint-attr-everywhere-late.rs:131:37
|
@@ -436,5 +396,45 @@ note: the lint level is defined here
LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123));
| ^^^^^^^^^^^^^^^^^^^^^^^^^
+error: missing documentation for a function
+ --> $DIR/lint-attr-everywhere-late.rs:47:5
+ |
+LL | pub fn missing_inner() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+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: expected `unsafe extern "C" fn()`
+ found `unsafe extern "C" fn(i32)`
+note: the lint level is defined here
+ --> $DIR/lint-attr-everywhere-late.rs:122:13
+ |
+LL | #![deny(clashing_extern_declarations)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+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: expected `unsafe extern "C" fn()`
+ found `unsafe extern "C" fn(i32)`
+note: the lint level is defined here
+ --> $DIR/lint-attr-everywhere-late.rs:127:12
+ |
+LL | #[deny(clashing_extern_declarations)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
error: aborting due to 32 previous errors
diff --git a/tests/ui/lint/lint-cap-trait-bounds.rs b/tests/ui/lint/lint-cap-trait-bounds.rs
new file mode 100644
index 000000000..d9c28dd0a
--- /dev/null
+++ b/tests/ui/lint/lint-cap-trait-bounds.rs
@@ -0,0 +1,8 @@
+// Regression test for https://github.com/rust-lang/rust/issues/43134
+
+// check-pass
+// compile-flags: --cap-lints allow
+
+type Foo<T: Clone> = Option<T>;
+
+fn main() {}
diff --git a/tests/ui/lint/lint-missing-doc.stderr b/tests/ui/lint/lint-missing-doc.stderr
index adcc21c44..4e9ee4f27 100644
--- a/tests/ui/lint/lint-missing-doc.stderr
+++ b/tests/ui/lint/lint-missing-doc.stderr
@@ -113,24 +113,6 @@ LL | pub static BAR4: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^^
error: missing documentation for a function
- --> $DIR/lint-missing-doc.rs:174:5
- |
-LL | pub fn undocumented1() {}
- | ^^^^^^^^^^^^^^^^^^^^^^
-
-error: missing documentation for a function
- --> $DIR/lint-missing-doc.rs:175:5
- |
-LL | pub fn undocumented2() {}
- | ^^^^^^^^^^^^^^^^^^^^^^
-
-error: missing documentation for a function
- --> $DIR/lint-missing-doc.rs:181:9
- |
-LL | pub fn also_undocumented1() {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: missing documentation for a function
--> $DIR/lint-missing-doc.rs:196:5
|
LL | pub fn extern_fn_undocumented(f: f32) -> f32;
@@ -154,5 +136,23 @@ error: missing documentation for a trait alias
LL | pub trait T = Sync;
| ^^^^^^^^^^^
+error: missing documentation for a function
+ --> $DIR/lint-missing-doc.rs:174:5
+ |
+LL | pub fn undocumented1() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a function
+ --> $DIR/lint-missing-doc.rs:175:5
+ |
+LL | pub fn undocumented2() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a function
+ --> $DIR/lint-missing-doc.rs:181:9
+ |
+LL | pub fn also_undocumented1() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
error: aborting due to 25 previous errors
diff --git a/tests/ui/lint/lint-qualification.fixed b/tests/ui/lint/lint-qualification.fixed
new file mode 100644
index 000000000..c14493013
--- /dev/null
+++ b/tests/ui/lint/lint-qualification.fixed
@@ -0,0 +1,21 @@
+// run-rustfix
+#![deny(unused_qualifications)]
+#![allow(deprecated)]
+
+mod foo {
+ pub fn bar() {}
+}
+
+fn main() {
+ use foo::bar;
+ bar(); //~ ERROR: unnecessary qualification
+ bar();
+
+ let _ = || -> Result<(), ()> { try!(Ok(())); Ok(()) }; // issue #37345
+
+ macro_rules! m { () => {
+ $crate::foo::bar(); // issue #37357
+ ::foo::bar(); // issue #38682
+ } }
+ m!();
+}
diff --git a/tests/ui/lint/lint-qualification.rs b/tests/ui/lint/lint-qualification.rs
index 0cace0ca0..809043035 100644
--- a/tests/ui/lint/lint-qualification.rs
+++ b/tests/ui/lint/lint-qualification.rs
@@ -1,3 +1,4 @@
+// run-rustfix
#![deny(unused_qualifications)]
#![allow(deprecated)]
diff --git a/tests/ui/lint/lint-qualification.stderr b/tests/ui/lint/lint-qualification.stderr
index 149a782d9..90a06bc6c 100644
--- a/tests/ui/lint/lint-qualification.stderr
+++ b/tests/ui/lint/lint-qualification.stderr
@@ -1,14 +1,19 @@
error: unnecessary qualification
- --> $DIR/lint-qualification.rs:10:5
+ --> $DIR/lint-qualification.rs:11:5
|
LL | foo::bar();
| ^^^^^^^^
|
note: the lint level is defined here
- --> $DIR/lint-qualification.rs:1:9
+ --> $DIR/lint-qualification.rs:2:9
|
LL | #![deny(unused_qualifications)]
| ^^^^^^^^^^^^^^^^^^^^^
+help: remove the unnecessary path segments
+ |
+LL - foo::bar();
+LL + bar();
+ |
error: aborting due to previous error
diff --git a/tests/ui/lint/lint-struct-necessary.rs b/tests/ui/lint/lint-struct-necessary.rs
new file mode 100644
index 000000000..8bc3c1205
--- /dev/null
+++ b/tests/ui/lint/lint-struct-necessary.rs
@@ -0,0 +1,31 @@
+#![allow(dead_code)]
+#![deny(unused_parens)]
+
+enum State {
+ Waiting { start_at: u64 }
+}
+struct Foo {}
+
+fn main() {
+ let e = &mut State::Waiting { start_at: 0u64 };
+ match (&mut State::Waiting { start_at: 0u64 }) {
+ _ => {}
+ }
+
+ match (e) {
+ //~^ ERROR unnecessary parentheses around `match` scrutinee expression
+ _ => {}
+ }
+
+ match &(State::Waiting { start_at: 0u64 }) {
+ _ => {}
+ }
+
+ match (State::Waiting { start_at: 0u64 }) {
+ _ => {}
+ }
+
+ match (&&Foo {}) {
+ _ => {}
+ }
+}
diff --git a/tests/ui/lint/lint-struct-necessary.stderr b/tests/ui/lint/lint-struct-necessary.stderr
new file mode 100644
index 000000000..eb65a9e98
--- /dev/null
+++ b/tests/ui/lint/lint-struct-necessary.stderr
@@ -0,0 +1,19 @@
+error: unnecessary parentheses around `match` scrutinee expression
+ --> $DIR/lint-struct-necessary.rs:15:11
+ |
+LL | match (e) {
+ | ^ ^
+ |
+note: the lint level is defined here
+ --> $DIR/lint-struct-necessary.rs:2:9
+ |
+LL | #![deny(unused_parens)]
+ | ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - match (e) {
+LL + match e {
+ |
+
+error: aborting due to previous error
+
diff --git a/tests/ui/lint/lint-unconditional-drop-recursion.rs b/tests/ui/lint/lint-unconditional-drop-recursion.rs
new file mode 100644
index 000000000..348cd2801
--- /dev/null
+++ b/tests/ui/lint/lint-unconditional-drop-recursion.rs
@@ -0,0 +1,38 @@
+// Because drop recursion can only be detected after drop elaboration which
+// happens for codegen:
+// build-fail
+
+#![deny(unconditional_recursion)]
+#![allow(dead_code)]
+
+pub struct RecursiveDrop;
+
+impl Drop for RecursiveDrop {
+ fn drop(&mut self) { //~ ERROR function cannot return without recursing
+ let _ = RecursiveDrop;
+ }
+}
+
+#[derive(Default)]
+struct NotRecursiveDrop1;
+
+impl Drop for NotRecursiveDrop1 {
+ fn drop(&mut self) {
+ // Before drop elaboration, the MIR can look like a recursive drop will
+ // occur. But it will not, since forget() prevents drop() from running.
+ let taken = std::mem::take(self);
+ std::mem::forget(taken);
+ }
+}
+
+struct NotRecursiveDrop2;
+
+impl Drop for NotRecursiveDrop2 {
+ fn drop(&mut self) {
+ // Before drop elaboration, the MIR can look like a recursive drop will
+ // occur. But it will not, since this will panic.
+ std::panic::panic_any(NotRecursiveDrop2);
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/lint/lint-unconditional-drop-recursion.stderr b/tests/ui/lint/lint-unconditional-drop-recursion.stderr
new file mode 100644
index 000000000..76f954816
--- /dev/null
+++ b/tests/ui/lint/lint-unconditional-drop-recursion.stderr
@@ -0,0 +1,17 @@
+error: function cannot return without recursing
+ --> $DIR/lint-unconditional-drop-recursion.rs:11:5
+ |
+LL | fn drop(&mut self) {
+ | ^^^^^^^^^^^^^^^^^^ cannot return without recursing
+LL | let _ = RecursiveDrop;
+ | - recursive call site
+ |
+ = help: a `loop` may express intention better if this is on purpose
+note: the lint level is defined here
+ --> $DIR/lint-unconditional-drop-recursion.rs:5:9
+ |
+LL | #![deny(unconditional_recursion)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/lint/lint-unconditional-recursion.stderr b/tests/ui/lint/lint-unconditional-recursion.stderr
index 9d200a789..d75754bf9 100644
--- a/tests/ui/lint/lint-unconditional-recursion.stderr
+++ b/tests/ui/lint/lint-unconditional-recursion.stderr
@@ -139,7 +139,7 @@ error: function cannot return without recursing
LL | fn index(&self, x: usize) -> &Baz {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
LL | &self[x]
- | ------- recursive call site
+ | --- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
diff --git a/tests/ui/lint/missing-copy-implementations-negative-copy.rs b/tests/ui/lint/missing-copy-implementations-negative-copy.rs
new file mode 100644
index 000000000..b29d2209f
--- /dev/null
+++ b/tests/ui/lint/missing-copy-implementations-negative-copy.rs
@@ -0,0 +1,15 @@
+// Regression test for issue #101980.
+// Ensure that we don't suggest impl'ing `Copy` for a type if it already impl's `!Copy`.
+
+// check-pass
+
+#![feature(negative_impls)]
+#![deny(missing_copy_implementations)]
+
+pub struct Struct {
+ pub field: i32,
+}
+
+impl !Copy for Struct {}
+
+fn main() {}
diff --git a/tests/ui/lint/missing-doc-private-macro.stderr b/tests/ui/lint/missing-doc-private-macro.stderr
index 979b007d0..18c8ad2de 100644
--- a/tests/ui/lint/missing-doc-private-macro.stderr
+++ b/tests/ui/lint/missing-doc-private-macro.stderr
@@ -1,8 +1,8 @@
error: missing documentation for a macro
- --> $DIR/missing-doc-private-macro.rs:31:5
+ --> $DIR/missing-doc-private-macro.rs:37:1
|
-LL | macro_rules! exported_to_top_level {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | pub macro top_level_pub_macro {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/missing-doc-private-macro.rs:5:9
@@ -11,10 +11,10 @@ LL | #![deny(missing_docs)]
| ^^^^^^^^^^^^
error: missing documentation for a macro
- --> $DIR/missing-doc-private-macro.rs:37:1
+ --> $DIR/missing-doc-private-macro.rs:31:5
|
-LL | pub macro top_level_pub_macro {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | macro_rules! exported_to_top_level {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/noop-method-call.fixed b/tests/ui/lint/noop-method-call.fixed
new file mode 100644
index 000000000..eeb80279f
--- /dev/null
+++ b/tests/ui/lint/noop-method-call.fixed
@@ -0,0 +1,51 @@
+// check-pass
+// run-rustfix
+
+#![allow(unused)]
+
+use std::borrow::Borrow;
+use std::ops::Deref;
+
+struct PlainType<T>(T);
+
+#[derive(Clone)]
+struct CloneType<T>(T);
+
+fn check(mut encoded: &[u8]) {
+ let _ = &mut encoded;
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
+ let _ = &encoded;
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
+}
+
+fn main() {
+ let non_clone_type_ref = &PlainType(1u32);
+ let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref;
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
+
+ let clone_type_ref = &CloneType(1u32);
+ let clone_type_ref_clone: CloneType<u32> = clone_type_ref.clone();
+
+
+ let non_deref_type = &PlainType(1u32);
+ let non_deref_type_deref: &PlainType<u32> = non_deref_type;
+ //~^ WARN call to `.deref()` on a reference in this situation does nothing
+
+ let non_borrow_type = &PlainType(1u32);
+ let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type;
+ //~^ WARN call to `.borrow()` on a reference in this situation does nothing
+
+ // Borrowing a &&T does not warn since it has collapsed the double reference
+ let non_borrow_type = &&PlainType(1u32);
+ let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
+}
+
+fn generic<T>(non_clone_type: &PlainType<T>) {
+ non_clone_type;
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
+}
+
+fn non_generic(non_clone_type: &PlainType<u32>) {
+ non_clone_type;
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
+}
diff --git a/tests/ui/lint/noop-method-call.rs b/tests/ui/lint/noop-method-call.rs
index dbcf2a513..9569a0dfc 100644
--- a/tests/ui/lint/noop-method-call.rs
+++ b/tests/ui/lint/noop-method-call.rs
@@ -1,7 +1,7 @@
// check-pass
+// run-rustfix
#![allow(unused)]
-#![warn(noop_method_call)]
use std::borrow::Borrow;
use std::ops::Deref;
@@ -11,45 +11,41 @@ struct PlainType<T>(T);
#[derive(Clone)]
struct CloneType<T>(T);
+fn check(mut encoded: &[u8]) {
+ let _ = &mut encoded.clone();
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
+ let _ = &encoded.clone();
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
+}
+
fn main() {
let non_clone_type_ref = &PlainType(1u32);
let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone();
- //~^ WARNING call to `.clone()` on a reference in this situation does nothing
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
let clone_type_ref = &CloneType(1u32);
let clone_type_ref_clone: CloneType<u32> = clone_type_ref.clone();
- let clone_type_ref = &&CloneType(1u32);
- let clone_type_ref_clone: &CloneType<u32> = clone_type_ref.clone();
- //~^ WARNING using `.clone()` on a double reference, which returns `&CloneType<u32>`
let non_deref_type = &PlainType(1u32);
let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
- //~^ WARNING call to `.deref()` on a reference in this situation does nothing
-
- let non_deref_type = &&PlainType(1u32);
- let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
- //~^ WARNING using `.deref()` on a double reference, which returns `&PlainType<u32>`
+ //~^ WARN call to `.deref()` on a reference in this situation does nothing
let non_borrow_type = &PlainType(1u32);
let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
- //~^ WARNING call to `.borrow()` on a reference in this situation does nothing
+ //~^ WARN call to `.borrow()` on a reference in this situation does nothing
// Borrowing a &&T does not warn since it has collapsed the double reference
let non_borrow_type = &&PlainType(1u32);
let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
-
- let xs = ["a", "b", "c"];
- let _v: Vec<&str> = xs.iter().map(|x| x.clone()).collect(); // could use `*x` instead
- //~^ WARNING using `.clone()` on a double reference, which returns `&str`
}
fn generic<T>(non_clone_type: &PlainType<T>) {
non_clone_type.clone();
- //~^ WARNING call to `.clone()` on a reference in this situation does nothing
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
}
fn non_generic(non_clone_type: &PlainType<u32>) {
non_clone_type.clone();
- //~^ WARNING call to `.clone()` on a reference in this situation does nothing
+ //~^ WARN call to `.clone()` on a reference in this situation does nothing
}
diff --git a/tests/ui/lint/noop-method-call.stderr b/tests/ui/lint/noop-method-call.stderr
index 37cd1a0fc..aefc2706f 100644
--- a/tests/ui/lint/noop-method-call.stderr
+++ b/tests/ui/lint/noop-method-call.stderr
@@ -1,67 +1,59 @@
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:16:71
+ --> $DIR/noop-method-call.rs:15:25
|
-LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone();
- | ^^^^^^^^ unnecessary method call
- |
- = note: the type `&PlainType<u32>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
-note: the lint level is defined here
- --> $DIR/noop-method-call.rs:4:9
+LL | let _ = &mut encoded.clone();
+ | ^^^^^^^^ help: remove this redundant call
|
-LL | #![warn(noop_method_call)]
- | ^^^^^^^^^^^^^^^^
+ = note: the type `[u8]` does not implement `Clone`, so calling `clone` on `&[u8]` copies the reference, which does not do anything and can be removed
+ = note: `#[warn(noop_method_call)]` on by default
-warning: using `.clone()` on a double reference, which returns `&CloneType<u32>` instead of cloning the inner type
- --> $DIR/noop-method-call.rs:23:63
+warning: call to `.clone()` on a reference in this situation does nothing
+ --> $DIR/noop-method-call.rs:17:21
|
-LL | let clone_type_ref_clone: &CloneType<u32> = clone_type_ref.clone();
- | ^^^^^^^^
+LL | let _ = &encoded.clone();
+ | ^^^^^^^^ help: remove this redundant call
|
- = note: `#[warn(suspicious_double_ref_op)]` on by default
+ = note: the type `[u8]` does not implement `Clone`, so calling `clone` on `&[u8]` copies the reference, which does not do anything and can be removed
-warning: call to `.deref()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:27:63
+warning: call to `.clone()` on a reference in this situation does nothing
+ --> $DIR/noop-method-call.rs:23:71
|
-LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
- | ^^^^^^^^ unnecessary method call
+LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone();
+ | ^^^^^^^^ help: remove this redundant call
|
- = note: the type `&PlainType<u32>` which `deref` is being called on is the same as the type returned from `deref`, so the method call does not do anything and can be removed
+ = note: the type `PlainType<u32>` does not implement `Clone`, so calling `clone` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
-warning: using `.deref()` on a double reference, which returns `&PlainType<u32>` instead of dereferencing the inner type
+warning: call to `.deref()` on a reference in this situation does nothing
--> $DIR/noop-method-call.rs:31:63
|
LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
- | ^^^^^^^^
+ | ^^^^^^^^ help: remove this redundant call
+ |
+ = note: the type `PlainType<u32>` does not implement `Deref`, so calling `deref` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
warning: call to `.borrow()` on a reference in this situation does nothing
--> $DIR/noop-method-call.rs:35:66
|
LL | let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow();
- | ^^^^^^^^^ unnecessary method call
- |
- = note: the type `&PlainType<u32>` which `borrow` is being called on is the same as the type returned from `borrow`, so the method call does not do anything and can be removed
-
-warning: using `.clone()` on a double reference, which returns `&str` instead of cloning the inner type
- --> $DIR/noop-method-call.rs:43:44
+ | ^^^^^^^^^ help: remove this redundant call
|
-LL | let _v: Vec<&str> = xs.iter().map(|x| x.clone()).collect(); // could use `*x` instead
- | ^^^^^^^^
+ = note: the type `PlainType<u32>` does not implement `Borrow`, so calling `borrow` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:48:19
+ --> $DIR/noop-method-call.rs:44:19
|
LL | non_clone_type.clone();
- | ^^^^^^^^ unnecessary method call
+ | ^^^^^^^^ help: remove this redundant call
|
- = note: the type `&PlainType<T>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
+ = note: the type `PlainType<T>` does not implement `Clone`, so calling `clone` on `&PlainType<T>` copies the reference, which does not do anything and can be removed
warning: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/noop-method-call.rs:53:19
+ --> $DIR/noop-method-call.rs:49:19
|
LL | non_clone_type.clone();
- | ^^^^^^^^ unnecessary method call
+ | ^^^^^^^^ help: remove this redundant call
|
- = note: the type `&PlainType<u32>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
+ = note: the type `PlainType<u32>` does not implement `Clone`, so calling `clone` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed
-warning: 8 warnings emitted
+warning: 7 warnings emitted
diff --git a/tests/ui/lint/ptr_null_checks.rs b/tests/ui/lint/ptr_null_checks.rs
new file mode 100644
index 000000000..e677ea309
--- /dev/null
+++ b/tests/ui/lint/ptr_null_checks.rs
@@ -0,0 +1,76 @@
+// check-pass
+
+#![feature(ptr_from_ref)]
+
+use std::ptr;
+
+extern "C" fn c_fn() {}
+fn static_i32() -> &'static i32 { &1 }
+
+fn main() {
+ let fn_ptr = main;
+
+ // ------------- Function pointers ---------------
+ if (fn_ptr as *mut ()).is_null() {}
+ //~^ WARN function pointers are not nullable
+ if (fn_ptr as *const u8).is_null() {}
+ //~^ WARN function pointers are not nullable
+ if (fn_ptr as *const ()) == std::ptr::null() {}
+ //~^ WARN function pointers are not nullable
+ if (fn_ptr as *mut ()) == std::ptr::null_mut() {}
+ //~^ WARN function pointers are not nullable
+ if (fn_ptr as *const ()) == (0 as *const ()) {}
+ //~^ WARN function pointers are not nullable
+ if <*const _>::is_null(fn_ptr as *const ()) {}
+ //~^ WARN function pointers are not nullable
+ if (fn_ptr as *mut fn() as *const fn() as *const ()).is_null() {}
+ //~^ WARN function pointers are not nullable
+ if (fn_ptr as *mut fn() as *const fn()).cast_mut().is_null() {}
+ //~^ WARN function pointers are not nullable
+ if ((fn_ptr as *mut fn()).cast() as *const fn()).cast_mut().is_null() {}
+ //~^ WARN function pointers are not nullable
+ if (fn_ptr as fn() as *const ()).is_null() {}
+ //~^ WARN function pointers are not nullable
+ if (c_fn as *const fn()).is_null() {}
+ //~^ WARN function pointers are not nullable
+
+ // ---------------- References ------------------
+ if (&mut 8 as *mut i32).is_null() {}
+ //~^ WARN references are not nullable
+ if ptr::from_mut(&mut 8).is_null() {}
+ //~^ WARN references are not nullable
+ if (&8 as *const i32).is_null() {}
+ //~^ WARN references are not nullable
+ if ptr::from_ref(&8).is_null() {}
+ //~^ WARN references are not nullable
+ if ptr::from_ref(&8).cast_mut().is_null() {}
+ //~^ WARN references are not nullable
+ if (ptr::from_ref(&8).cast_mut() as *mut i32).is_null() {}
+ //~^ WARN references are not nullable
+ if (&8 as *const i32) == std::ptr::null() {}
+ //~^ WARN references are not nullable
+ let ref_num = &8;
+ if (ref_num as *const i32) == std::ptr::null() {}
+ //~^ WARN references are not nullable
+ if (b"\0" as *const u8).is_null() {}
+ //~^ WARN references are not nullable
+ if ("aa" as *const str).is_null() {}
+ //~^ WARN references are not nullable
+ if (&[1, 2] as *const i32).is_null() {}
+ //~^ WARN references are not nullable
+ if (&mut [1, 2] as *mut i32) == std::ptr::null_mut() {}
+ //~^ WARN references are not nullable
+ if (static_i32() as *const i32).is_null() {}
+ //~^ WARN references are not nullable
+ if (&*{ static_i32() } as *const i32).is_null() {}
+ //~^ WARN references are not nullable
+
+ // ----------------------------------------------
+ const ZPTR: *const () = 0 as *const _;
+ const NOT_ZPTR: *const () = 1 as *const _;
+
+ // unlike the uplifted clippy::fn_null_check lint we do
+ // not lint on them
+ if (fn_ptr as *const ()) == ZPTR {}
+ if (fn_ptr as *const ()) == NOT_ZPTR {}
+}
diff --git a/tests/ui/lint/ptr_null_checks.stderr b/tests/ui/lint/ptr_null_checks.stderr
new file mode 100644
index 000000000..3cee1804b
--- /dev/null
+++ b/tests/ui/lint/ptr_null_checks.stderr
@@ -0,0 +1,225 @@
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:14:8
+ |
+LL | if (fn_ptr as *mut ()).is_null() {}
+ | ^------^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn() {main}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+ = note: `#[warn(useless_ptr_null_checks)]` on by default
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:16:8
+ |
+LL | if (fn_ptr as *const u8).is_null() {}
+ | ^------^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn() {main}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:18:8
+ |
+LL | if (fn_ptr as *const ()) == std::ptr::null() {}
+ | ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn() {main}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:20:8
+ |
+LL | if (fn_ptr as *mut ()) == std::ptr::null_mut() {}
+ | ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn() {main}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:22:8
+ |
+LL | if (fn_ptr as *const ()) == (0 as *const ()) {}
+ | ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn() {main}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:24:8
+ |
+LL | if <*const _>::is_null(fn_ptr as *const ()) {}
+ | ^^^^^^^^^^^^^^^^^^^^------^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn() {main}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:26:8
+ |
+LL | if (fn_ptr as *mut fn() as *const fn() as *const ()).is_null() {}
+ | ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn() {main}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:28:8
+ |
+LL | if (fn_ptr as *mut fn() as *const fn()).cast_mut().is_null() {}
+ | ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn() {main}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:30:8
+ |
+LL | if ((fn_ptr as *mut fn()).cast() as *const fn()).cast_mut().is_null() {}
+ | ^^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn() {main}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:32:8
+ |
+LL | if (fn_ptr as fn() as *const ()).is_null() {}
+ | ^--------------^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `fn()`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: function pointers are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:34:8
+ |
+LL | if (c_fn as *const fn()).is_null() {}
+ | ^----^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `extern "C" fn() {c_fn}`
+ |
+ = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:38:8
+ |
+LL | if (&mut 8 as *mut i32).is_null() {}
+ | ^------^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&mut i32`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:40:8
+ |
+LL | if ptr::from_mut(&mut 8).is_null() {}
+ | ^^^^^^^^^^^^^^------^^^^^^^^^^^
+ | |
+ | expression has type `&mut i32`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:42:8
+ |
+LL | if (&8 as *const i32).is_null() {}
+ | ^--^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&i32`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:44:8
+ |
+LL | if ptr::from_ref(&8).is_null() {}
+ | ^^^^^^^^^^^^^^--^^^^^^^^^^^
+ | |
+ | expression has type `&i32`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:46:8
+ |
+LL | if ptr::from_ref(&8).cast_mut().is_null() {}
+ | ^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&i32`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:48:8
+ |
+LL | if (ptr::from_ref(&8).cast_mut() as *mut i32).is_null() {}
+ | ^^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&i32`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:50:8
+ |
+LL | if (&8 as *const i32) == std::ptr::null() {}
+ | ^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&i32`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:53:8
+ |
+LL | if (ref_num as *const i32) == std::ptr::null() {}
+ | ^-------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&i32`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:55:8
+ |
+LL | if (b"\0" as *const u8).is_null() {}
+ | ^-----^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&[u8; 1]`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:57:8
+ |
+LL | if ("aa" as *const str).is_null() {}
+ | ^----^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&str`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:59:8
+ |
+LL | if (&[1, 2] as *const i32).is_null() {}
+ | ^-------^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&[i32; 2]`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:61:8
+ |
+LL | if (&mut [1, 2] as *mut i32) == std::ptr::null_mut() {}
+ | ^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&mut [i32; 2]`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:63:8
+ |
+LL | if (static_i32() as *const i32).is_null() {}
+ | ^------------^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&i32`
+
+warning: references are not nullable, so checking them for null will always return false
+ --> $DIR/ptr_null_checks.rs:65:8
+ |
+LL | if (&*{ static_i32() } as *const i32).is_null() {}
+ | ^------------------^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expression has type `&i32`
+
+warning: 25 warnings emitted
+
diff --git a/tests/ui/lint/reference_casting.rs b/tests/ui/lint/reference_casting.rs
index 996382049..6c38bca3d 100644
--- a/tests/ui/lint/reference_casting.rs
+++ b/tests/ui/lint/reference_casting.rs
@@ -1,7 +1,6 @@
// check-fail
#![feature(ptr_from_ref)]
-#![deny(invalid_reference_casting)]
extern "C" {
// N.B., mutability can be easily incorrect in FFI calls -- as
@@ -10,42 +9,97 @@ extern "C" {
fn int_ffi(c: *mut i32);
}
-fn main() {
+fn static_u8() -> &'static u8 {
+ &8
+}
+
+unsafe fn ref_to_mut() {
+ let num = &3i32;
+
+ let _num = &mut *(num as *const i32 as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(num as *const i32).cast_mut();
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *std::ptr::from_ref(num).cast_mut();
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *std::ptr::from_ref({ num }).cast_mut();
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *{ std::ptr::from_ref(num) }.cast_mut();
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(std::ptr::from_ref({ num }) as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(num as *const i32).cast::<i32>().cast_mut();
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(num as *const i32).cast::<i32>().cast_mut().cast_const().cast_mut();
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(std::ptr::from_ref(static_u8()) as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *std::mem::transmute::<_, *mut i32>(num);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+
+ let deferred = num as *const i32 as *mut i32;
+ let _num = &mut *deferred;
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let deferred = (std::ptr::from_ref(num) as *const i32 as *const i32).cast_mut() as *mut i32;
+ let _num = &mut *deferred;
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let _num = &mut *(num as *const _ as usize as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+
+ unsafe fn generic_ref_cast_mut<T>(this: &T) -> &mut T {
+ &mut *((this as *const _) as *mut _)
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ }
+}
+
+unsafe fn assign_to_ref() {
let s = String::from("Hello");
let a = &s;
- unsafe {
- let num = &3i32;
- let mut_num = &mut 3i32;
+ let num = &3i32;
- (*(a as *const _ as *mut String)).push_str(" world");
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
- *(a as *const _ as *mut _) = String::from("Replaced");
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
- *(a as *const _ as *mut String) += " world";
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
- let _num = &mut *(num as *const i32 as *mut i32);
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
- let _num = &mut *(num as *const i32).cast_mut();
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
- let _num = *{ num as *const i32 }.cast_mut();
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
- *std::ptr::from_ref(num).cast_mut() += 1;
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
- *std::ptr::from_ref({ num }).cast_mut() += 1;
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
- *{ std::ptr::from_ref(num) }.cast_mut() += 1;
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
- *(std::ptr::from_ref({ num }) as *mut i32) += 1;
- //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ *(a as *const _ as *mut _) = String::from("Replaced");
+ //~^ ERROR assigning to `&T` is undefined behavior
+ *(a as *const _ as *mut String) += " world";
+ //~^ ERROR assigning to `&T` is undefined behavior
+ *std::ptr::from_ref(num).cast_mut() += 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
+ *std::ptr::from_ref({ num }).cast_mut() += 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
+ *{ std::ptr::from_ref(num) }.cast_mut() += 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
+ *(std::ptr::from_ref({ num }) as *mut i32) += 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
+ *std::mem::transmute::<_, *mut i32>(num) += 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
+
+ let value = num as *const i32 as *mut i32;
+ *value = 1;
+ //~^ ERROR assigning to `&T` is undefined behavior
+ *(num as *const i32).cast::<i32>().cast_mut() = 2;
+ //~^ ERROR assigning to `&T` is undefined behavior
+ *(num as *const _ as usize as *mut i32) = 2;
+ //~^ ERROR assigning to `&T` is undefined behavior
- // Shouldn't be warned against
- println!("{}", *(num as *const _ as *const i16));
- println!("{}", *(mut_num as *mut _ as *mut i16));
- ffi(a.as_ptr() as *mut _);
- int_ffi(num as *const _ as *mut _);
- int_ffi(&3 as *const _ as *mut _);
- let mut value = 3;
- let value: *const i32 = &mut value;
- *(value as *const i16 as *mut i16) = 42;
+ unsafe fn generic_assign_to_ref<T>(this: &T, a: T) {
+ *(this as *const _ as *mut _) = a;
+ //~^ ERROR assigning to `&T` is undefined behavior
}
}
+
+unsafe fn no_warn() {
+ let num = &3i32;
+ let mut_num = &mut 3i32;
+ let a = &String::from("ffi");
+
+ *(num as *const i32 as *mut i32);
+ println!("{}", *(num as *const _ as *const i16));
+ println!("{}", *(mut_num as *mut _ as *mut i16));
+ ffi(a.as_ptr() as *mut _);
+ int_ffi(num as *const _ as *mut _);
+ int_ffi(&3 as *const _ as *mut _);
+ let mut value = 3;
+ let value: *const i32 = &mut value;
+ *(value as *const i16 as *mut i16) = 42;
+}
+
+fn main() {}
diff --git a/tests/ui/lint/reference_casting.stderr b/tests/ui/lint/reference_casting.stderr
index d5b9bbef6..7ff9b76a8 100644
--- a/tests/ui/lint/reference_casting.stderr
+++ b/tests/ui/lint/reference_casting.stderr
@@ -1,68 +1,160 @@
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:20:9
+ --> $DIR/reference_casting.rs:19:16
|
-LL | (*(a as *const _ as *mut String)).push_str(" world");
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let _num = &mut *(num as *const i32 as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[deny(invalid_reference_casting)]` on by default
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:21:16
+ |
+LL | let _num = &mut *(num as *const i32).cast_mut();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:23:16
+ |
+LL | let _num = &mut *std::ptr::from_ref(num).cast_mut();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:25:16
|
-note: the lint level is defined here
- --> $DIR/reference_casting.rs:4:9
+LL | let _num = &mut *std::ptr::from_ref({ num }).cast_mut();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:27:16
|
-LL | #![deny(invalid_reference_casting)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let _num = &mut *{ std::ptr::from_ref(num) }.cast_mut();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:22:9
+ --> $DIR/reference_casting.rs:29:16
|
-LL | *(a as *const _ as *mut _) = String::from("Replaced");
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let _num = &mut *(std::ptr::from_ref({ num }) as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:24:9
+ --> $DIR/reference_casting.rs:31:16
|
-LL | *(a as *const _ as *mut String) += " world";
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let _num = &mut *(num as *const i32).cast::<i32>().cast_mut();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:26:25
+ --> $DIR/reference_casting.rs:33:16
|
-LL | let _num = &mut *(num as *const i32 as *mut i32);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let _num = &mut *(num as *const i32).cast::<i32>().cast_mut().cast_const().cast_mut();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:28:25
+ --> $DIR/reference_casting.rs:35:16
|
-LL | let _num = &mut *(num as *const i32).cast_mut();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let _num = &mut *(std::ptr::from_ref(static_u8()) as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:30:20
+ --> $DIR/reference_casting.rs:37:16
|
-LL | let _num = *{ num as *const i32 }.cast_mut();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let _num = &mut *std::mem::transmute::<_, *mut i32>(num);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:32:9
+ --> $DIR/reference_casting.rs:41:16
|
-LL | *std::ptr::from_ref(num).cast_mut() += 1;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let deferred = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+LL | let _num = &mut *deferred;
+ | ^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:34:9
+ --> $DIR/reference_casting.rs:44:16
|
-LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let deferred = (std::ptr::from_ref(num) as *const i32 as *const i32).cast_mut() as *mut i32;
+ | ---------------------------------------------------------------------------- casting happend here
+LL | let _num = &mut *deferred;
+ | ^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:36:9
+ --> $DIR/reference_casting.rs:46:16
|
-LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let _num = &mut *(num as *const _ as usize as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:38:9
+ --> $DIR/reference_casting.rs:50:9
+ |
+LL | &mut *((this as *const _) as *mut _)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:60:5
+ |
+LL | *(a as *const _ as *mut _) = String::from("Replaced");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:62:5
+ |
+LL | *(a as *const _ as *mut String) += " world";
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:64:5
|
-LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | *std::ptr::from_ref(num).cast_mut() += 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:66:5
+ |
+LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:68:5
+ |
+LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:70:5
+ |
+LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:72:5
+ |
+LL | *std::mem::transmute::<_, *mut i32>(num) += 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:76:5
+ |
+LL | let value = num as *const i32 as *mut i32;
+ | ----------------------------- casting happend here
+LL | *value = 1;
+ | ^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:78:5
+ |
+LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:80:5
+ |
+LL | *(num as *const _ as usize as *mut i32) = 2;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:84:9
+ |
+LL | *(this as *const _ as *mut _) = a;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 10 previous errors
+error: aborting due to 25 previous errors
diff --git a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.rs b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.rs
index e7da825ae..b2d8a28d3 100644
--- a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.rs
+++ b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.rs
@@ -5,8 +5,8 @@ const s: usize = 42;
const s_s: usize = 42;
fn main() {
- let s = "rust"; //~ ERROR identifier pair considered confusable
- let s_s = "rust2"; //~ ERROR identifier pair considered confusable
+ let s = "rust"; //~ ERROR found both
+ let s_s = "rust2"; //~ ERROR found both
not_affected();
}
diff --git a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.stderr b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.stderr
index e9906c83d..d1920f215 100644
--- a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.stderr
+++ b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-confusable-idents.stderr
@@ -1,11 +1,11 @@
-error: identifier pair considered confusable between `s` and `s`
+error: found both `s` and `s` as identifiers, which look alike
--> $DIR/lint-confusable-idents.rs:8:9
|
LL | const s: usize = 42;
- | -- this is where the previous identifier occurred
+ | -- other identifier used here
...
LL | let s = "rust";
- | ^
+ | ^ this identifier can be confused with `s`
|
note: the lint level is defined here
--> $DIR/lint-confusable-idents.rs:1:9
@@ -13,14 +13,14 @@ note: the lint level is defined here
LL | #![deny(confusable_idents)]
| ^^^^^^^^^^^^^^^^^
-error: identifier pair considered confusable between `s_s` and `s_s`
+error: found both `s_s` and `s_s` as identifiers, which look alike
--> $DIR/lint-confusable-idents.rs:9:9
|
LL | const s_s: usize = 42;
- | --- this is where the previous identifier occurred
+ | --- other identifier used here
...
LL | let s_s = "rust2";
- | ^^^^^
+ | ^^^^^ this identifier can be confused with `s_s`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/suspicious-double-ref-op.rs b/tests/ui/lint/suspicious-double-ref-op.rs
index b9bcd31c2..bc8c23c7b 100644
--- a/tests/ui/lint/suspicious-double-ref-op.rs
+++ b/tests/ui/lint/suspicious-double-ref-op.rs
@@ -1,6 +1,14 @@
#![feature(lazy_cell)]
#![deny(suspicious_double_ref_op, noop_method_call)]
+use std::borrow::Borrow;
+use std::ops::Deref;
+
+struct PlainType<T>(T);
+
+#[derive(Clone)]
+struct CloneType<T>(T);
+
pub fn clone_on_double_ref() {
let x = vec![1];
let y = &&x;
@@ -20,11 +28,16 @@ fn rust_clippy_issue_9272() {
println!("{str}")
}
-fn check(mut encoded: &[u8]) {
- let _ = &mut encoded.clone();
- //~^ ERROR call to `.clone()` on a reference in this situation does nothing
- let _ = &encoded.clone();
- //~^ ERROR call to `.clone()` on a reference in this situation does nothing
-}
+fn main() {
+ let clone_type_ref = &&CloneType(1u32);
+ let clone_type_ref_clone: &CloneType<u32> = clone_type_ref.clone();
+ //~^ ERROR using `.clone()` on a double reference, which returns `&CloneType<u32>`
+
+ let non_deref_type = &&PlainType(1u32);
+ let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
+ //~^ ERROR using `.deref()` on a double reference, which returns `&PlainType<u32>`
-fn main() {}
+ let xs = ["a", "b", "c"];
+ let _v: Vec<&str> = xs.iter().map(|x| x.clone()).collect(); // could use `*x` instead
+ //~^ ERROR using `.clone()` on a double reference, which returns `&str`
+}
diff --git a/tests/ui/lint/suspicious-double-ref-op.stderr b/tests/ui/lint/suspicious-double-ref-op.stderr
index d15487ca2..f5a71d40f 100644
--- a/tests/ui/lint/suspicious-double-ref-op.stderr
+++ b/tests/ui/lint/suspicious-double-ref-op.stderr
@@ -1,5 +1,5 @@
error: using `.clone()` on a double reference, which returns `&Vec<i32>` instead of cloning the inner type
- --> $DIR/suspicious-double-ref-op.rs:7:23
+ --> $DIR/suspicious-double-ref-op.rs:15:23
|
LL | let z: &Vec<_> = y.clone();
| ^^^^^^^^
@@ -10,26 +10,23 @@ note: the lint level is defined here
LL | #![deny(suspicious_double_ref_op, noop_method_call)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/suspicious-double-ref-op.rs:24:25
+error: using `.clone()` on a double reference, which returns `&CloneType<u32>` instead of cloning the inner type
+ --> $DIR/suspicious-double-ref-op.rs:33:63
|
-LL | let _ = &mut encoded.clone();
- | ^^^^^^^^ unnecessary method call
- |
- = note: the type `&[u8]` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
-note: the lint level is defined here
- --> $DIR/suspicious-double-ref-op.rs:2:35
- |
-LL | #![deny(suspicious_double_ref_op, noop_method_call)]
- | ^^^^^^^^^^^^^^^^
+LL | let clone_type_ref_clone: &CloneType<u32> = clone_type_ref.clone();
+ | ^^^^^^^^
-error: call to `.clone()` on a reference in this situation does nothing
- --> $DIR/suspicious-double-ref-op.rs:26:21
+error: using `.deref()` on a double reference, which returns `&PlainType<u32>` instead of dereferencing the inner type
+ --> $DIR/suspicious-double-ref-op.rs:37:63
|
-LL | let _ = &encoded.clone();
- | ^^^^^^^^ unnecessary method call
+LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref();
+ | ^^^^^^^^
+
+error: using `.clone()` on a double reference, which returns `&str` instead of cloning the inner type
+ --> $DIR/suspicious-double-ref-op.rs:41:44
|
- = note: the type `&[u8]` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
+LL | let _v: Vec<&str> = xs.iter().map(|x| x.clone()).collect(); // could use `*x` instead
+ | ^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
diff --git a/tests/ui/lint/unaligned_references.stderr b/tests/ui/lint/unaligned_references.stderr
index 5f9cecadb..d3abc3766 100644
--- a/tests/ui/lint/unaligned_references.stderr
+++ b/tests/ui/lint/unaligned_references.stderr
@@ -52,7 +52,7 @@ error[E0793]: reference to packed field is unaligned
--> $DIR/unaligned_references.rs:40:17
|
LL | let _ = good.data.clone();
- | ^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^
|
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
diff --git a/tests/ui/lint/unknown-lints/allow-in-other-module.rs b/tests/ui/lint/unknown-lints/allow-in-other-module.rs
new file mode 100644
index 000000000..20bf0d7af
--- /dev/null
+++ b/tests/ui/lint/unknown-lints/allow-in-other-module.rs
@@ -0,0 +1,26 @@
+// check-pass
+
+// Tests that the unknown_lints lint doesn't fire for an unknown lint loaded from a separate file.
+// The key part is that the stderr output should be empty.
+// Reported in https://github.com/rust-lang/rust/issues/84936
+// Fixed incidentally by https://github.com/rust-lang/rust/pull/97266
+
+// This `allow` should apply to submodules, whether they are inline or loaded from a file.
+#![allow(unknown_lints)]
+#![allow(dead_code)]
+// no warning
+#![allow(not_a_real_lint)]
+
+mod other;
+
+// no warning
+#[allow(not_a_real_lint)]
+fn m() {}
+
+mod mm {
+ // no warning
+ #[allow(not_a_real_lint)]
+ fn m() {}
+}
+
+fn main() {}
diff --git a/tests/ui/lint/unknown-lints/other.rs b/tests/ui/lint/unknown-lints/other.rs
new file mode 100644
index 000000000..a5111c00a
--- /dev/null
+++ b/tests/ui/lint/unknown-lints/other.rs
@@ -0,0 +1,10 @@
+// ignore-test
+
+// Companion to allow-in-other-module.rs
+
+// This should not warn.
+#![allow(not_a_real_lint)]
+
+// This should not warn, either.
+#[allow(not_a_real_lint)]
+fn m() {}
diff --git a/tests/ui/lint/unused/const-local-var.rs b/tests/ui/lint/unused/const-local-var.rs
new file mode 100644
index 000000000..89ca16fe0
--- /dev/null
+++ b/tests/ui/lint/unused/const-local-var.rs
@@ -0,0 +1,23 @@
+// regression test for https://github.com/rust-lang/rust/issues/69016
+// check-pass
+
+#![warn(unused)]
+#![deny(warnings)]
+
+fn _unused1(x: i32) -> i32 {
+ const F: i32 = 2;
+ let g = 1;
+ x * F + g
+}
+
+pub struct Foo {}
+
+impl Foo {
+ fn _unused2(x: i32) -> i32 {
+ const F: i32 = 2;
+ let g = 1;
+ x * F + g
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/liveness/liveness-move-call-arg-2.rs b/tests/ui/liveness/liveness-move-call-arg-2.rs
new file mode 100644
index 000000000..b93535c89
--- /dev/null
+++ b/tests/ui/liveness/liveness-move-call-arg-2.rs
@@ -0,0 +1,12 @@
+fn take(_x: Box<isize>) {}
+
+
+fn main() {
+ let _ = || {
+ let x: Box<isize> = Box::new(25);
+
+ loop {
+ take(x); //~ ERROR use of moved value: `x`
+ }
+ };
+}
diff --git a/tests/ui/liveness/liveness-move-call-arg-2.stderr b/tests/ui/liveness/liveness-move-call-arg-2.stderr
new file mode 100644
index 000000000..479a086a8
--- /dev/null
+++ b/tests/ui/liveness/liveness-move-call-arg-2.stderr
@@ -0,0 +1,26 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/liveness-move-call-arg-2.rs:9:18
+ |
+LL | let x: Box<isize> = Box::new(25);
+ | - move occurs because `x` has type `Box<isize>`, which does not implement the `Copy` trait
+LL |
+LL | loop {
+ | ---- inside of this loop
+LL | take(x);
+ | ^ value moved here, in previous iteration of loop
+ |
+note: consider changing this parameter type in function `take` to borrow instead if owning the value isn't necessary
+ --> $DIR/liveness-move-call-arg-2.rs:1:13
+ |
+LL | fn take(_x: Box<isize>) {}
+ | ---- ^^^^^^^^^^ this parameter takes ownership of the value
+ | |
+ | in this function
+help: consider cloning the value if the performance cost is acceptable
+ |
+LL | take(x.clone());
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/lto/issue-100772.rs b/tests/ui/lto/issue-100772.rs
index d6b067192..eeb511962 100644
--- a/tests/ui/lto/issue-100772.rs
+++ b/tests/ui/lto/issue-100772.rs
@@ -1,6 +1,6 @@
-// run-pass
+// build-pass
// needs-sanitizer-cfi
-// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
+// compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
// no-prefer-dynamic
// only-x86_64-unknown-linux-gnu
diff --git a/tests/ui/macros/assert-eq-macro-msg.rs b/tests/ui/macros/assert-eq-macro-msg.rs
index accbd2d1e..3d921f400 100644
--- a/tests/ui/macros/assert-eq-macro-msg.rs
+++ b/tests/ui/macros/assert-eq-macro-msg.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:panicked at 'assertion failed: `(left == right)`
-// error-pattern: left: `2`
-// error-pattern:right: `3`: 1 + 1 definitely should be 3'
+// error-pattern:assertion `left == right` failed: 1 + 1 definitely should be 3
+// error-pattern: left: 2
+// error-pattern: right: 3
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-eq-macro-panic.rs b/tests/ui/macros/assert-eq-macro-panic.rs
index 5e505c30b..6745290cb 100644
--- a/tests/ui/macros/assert-eq-macro-panic.rs
+++ b/tests/ui/macros/assert-eq-macro-panic.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:assertion failed: `(left == right)`
-// error-pattern: left: `14`
-// error-pattern:right: `15`
+// error-pattern:assertion `left == right` failed
+// error-pattern: left: 14
+// error-pattern: right: 15
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-macro-explicit.rs b/tests/ui/macros/assert-macro-explicit.rs
index 578ef5632..3d1a9a6b1 100644
--- a/tests/ui/macros/assert-macro-explicit.rs
+++ b/tests/ui/macros/assert-macro-explicit.rs
@@ -1,5 +1,5 @@
// run-fail
-// error-pattern:panicked at 'assertion failed: false'
+// error-pattern:assertion failed: false
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-macro-fmt.rs b/tests/ui/macros/assert-macro-fmt.rs
index b8d319d85..ceec53ceb 100644
--- a/tests/ui/macros/assert-macro-fmt.rs
+++ b/tests/ui/macros/assert-macro-fmt.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'test-assert-fmt 42 rust'
+// error-pattern: panicked
+// error-pattern: test-assert-fmt 42 rust
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-macro-owned.rs b/tests/ui/macros/assert-macro-owned.rs
index 753675872..fb4b389b8 100644
--- a/tests/ui/macros/assert-macro-owned.rs
+++ b/tests/ui/macros/assert-macro-owned.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'test-assert-owned'
+// error-pattern:panicked
+// error-pattern:test-assert-owned
// ignore-emscripten no processes
#![allow(non_fmt_panics)]
diff --git a/tests/ui/macros/assert-macro-static.rs b/tests/ui/macros/assert-macro-static.rs
index dc5274a7e..fccc32592 100644
--- a/tests/ui/macros/assert-macro-static.rs
+++ b/tests/ui/macros/assert-macro-static.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'test-assert-static'
+// error-pattern:panicked
+// error-pattern:test-assert-static
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-matches-macro-msg.rs b/tests/ui/macros/assert-matches-macro-msg.rs
index fd8cd5a1a..7af6a0778 100644
--- a/tests/ui/macros/assert-matches-macro-msg.rs
+++ b/tests/ui/macros/assert-matches-macro-msg.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:panicked at 'assertion failed: `(left matches right)`
-// error-pattern: left: `2`
-// error-pattern:right: `3`: 1 + 1 definitely should be 3'
+// error-pattern:assertion `left matches right` failed: 1 + 1 definitely should be 3
+// error-pattern: left: 2
+// error-pattern: right: 3
// ignore-emscripten no processes
#![feature(assert_matches)]
diff --git a/tests/ui/macros/assert-ne-macro-msg.rs b/tests/ui/macros/assert-ne-macro-msg.rs
index fc0472b99..adda0af88 100644
--- a/tests/ui/macros/assert-ne-macro-msg.rs
+++ b/tests/ui/macros/assert-ne-macro-msg.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:panicked at 'assertion failed: `(left != right)`
-// error-pattern: left: `2`
-// error-pattern:right: `2`: 1 + 1 definitely should not be 2'
+// error-pattern:assertion `left != right` failed: 1 + 1 definitely should not be 2
+// error-pattern: left: 2
+// error-pattern: right: 2
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-ne-macro-panic.rs b/tests/ui/macros/assert-ne-macro-panic.rs
index 4f507d7b5..d977473a2 100644
--- a/tests/ui/macros/assert-ne-macro-panic.rs
+++ b/tests/ui/macros/assert-ne-macro-panic.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:assertion failed: `(left != right)`
-// error-pattern: left: `14`
-// error-pattern:right: `14`
+// error-pattern:assertion `left != right` failed
+// error-pattern: left: 14
+// error-pattern: right: 14
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/builtin-env-issue-114010.rs b/tests/ui/macros/builtin-env-issue-114010.rs
new file mode 100644
index 000000000..819b8b1e8
--- /dev/null
+++ b/tests/ui/macros/builtin-env-issue-114010.rs
@@ -0,0 +1,10 @@
+// unset-rustc-env:oopsie
+// unset-rustc-env:a""a
+
+env![r#"oopsie"#];
+//~^ ERROR environment variable `oopsie` not defined at compile time
+
+env![r#"a""a"#];
+//~^ ERROR environment variable `a""a` not defined at compile time
+
+fn main() {}
diff --git a/tests/ui/macros/builtin-env-issue-114010.stderr b/tests/ui/macros/builtin-env-issue-114010.stderr
new file mode 100644
index 000000000..0da42089c
--- /dev/null
+++ b/tests/ui/macros/builtin-env-issue-114010.stderr
@@ -0,0 +1,20 @@
+error: environment variable `oopsie` not defined at compile time
+ --> $DIR/builtin-env-issue-114010.rs:4:1
+ |
+LL | env![r#"oopsie"#];
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: use `std::env::var(r#"oopsie"#)` to read the variable at run time
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: environment variable `a""a` not defined at compile time
+ --> $DIR/builtin-env-issue-114010.rs:7:1
+ |
+LL | env![r#"a""a"#];
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: use `std::env::var(r#"a""a"#)` to read the variable at run time
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/macros/builtin-prelude-no-accidents.stderr b/tests/ui/macros/builtin-prelude-no-accidents.stderr
index b726e1862..c1054230b 100644
--- a/tests/ui/macros/builtin-prelude-no-accidents.stderr
+++ b/tests/ui/macros/builtin-prelude-no-accidents.stderr
@@ -26,10 +26,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `vec`
LL | type B = vec::Vec<u8>;
| ^^^ use of undeclared crate or module `vec`
|
-help: a struct with a similar name exists
- |
-LL | type B = Vec::Vec<u8>;
- | ~~~
help: consider importing this module
|
LL + use std::vec;
diff --git a/tests/ui/macros/format-args-temporaries-in-write.stderr b/tests/ui/macros/format-args-temporaries-in-write.stderr
index 520b2ce50..e05246cfb 100644
--- a/tests/ui/macros/format-args-temporaries-in-write.stderr
+++ b/tests/ui/macros/format-args-temporaries-in-write.stderr
@@ -4,7 +4,7 @@ error[E0597]: `mutex` does not live long enough
LL | let mutex = Mutex;
| ----- binding `mutex` declared here
LL | write!(Out, "{}", mutex.lock()) /* no semicolon */
- | ^^^^^^^^^^^^
+ | ^^^^^-------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
@@ -21,7 +21,7 @@ error[E0597]: `mutex` does not live long enough
LL | let mutex = Mutex;
| ----- binding `mutex` declared here
LL | writeln!(Out, "{}", mutex.lock()) /* no semicolon */
- | ^^^^^^^^^^^^
+ | ^^^^^-------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
diff --git a/tests/ui/macros/issue-19163.stderr b/tests/ui/macros/issue-19163.stderr
index ae1ae1426..af509aa59 100644
--- a/tests/ui/macros/issue-19163.stderr
+++ b/tests/ui/macros/issue-19163.stderr
@@ -1,10 +1,8 @@
error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/issue-19163.rs:9:5
+ --> $DIR/issue-19163.rs:9:14
|
LL | mywrite!(&v, "Hello world");
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
- |
- = note: this error originates in the macro `mywrite` (in Nightly builds, run with -Z macro-backtrace for more info)
+ | ^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/tests/ui/macros/macro-interpolation.rs b/tests/ui/macros/macro-interpolation.rs
index 35003a79a..48c1f19e7 100644
--- a/tests/ui/macros/macro-interpolation.rs
+++ b/tests/ui/macros/macro-interpolation.rs
@@ -1,5 +1,3 @@
-// run-pass
-
macro_rules! overly_complicated {
($fnname:ident, $arg:ident, $ty:ty, $body:block, $val:expr, $pat:pat, $res:path) =>
({
@@ -21,12 +19,14 @@ macro_rules! qpath {
(ty, <$type:ty as $trait:ty>::$name:ident) => {
<$type as $trait>::$name
+ //~^ ERROR expected identifier, found `!`
};
}
pub fn main() {
let _: qpath!(path, <str as ToOwned>::Owned);
let _: qpath!(ty, <str as ToOwned>::Owned);
+ let _: qpath!(ty, <str as !>::Owned);
assert!(overly_complicated!(f, x, Option<usize>, { return Some(x); },
Some(8), Some(y), y) == 8)
diff --git a/tests/ui/macros/macro-interpolation.stderr b/tests/ui/macros/macro-interpolation.stderr
new file mode 100644
index 000000000..7ef1fcbbc
--- /dev/null
+++ b/tests/ui/macros/macro-interpolation.stderr
@@ -0,0 +1,16 @@
+error: expected identifier, found `!`
+ --> $DIR/macro-interpolation.rs:21:19
+ |
+LL | <$type as $trait>::$name
+ | ^^^^^^ expected identifier
+...
+LL | let _: qpath!(ty, <str as !>::Owned);
+ | -----------------------------
+ | |
+ | this macro call doesn't expand to a type
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `qpath` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs
new file mode 100644
index 000000000..9cc572c23
--- /dev/null
+++ b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs
@@ -0,0 +1,14 @@
+#![feature(macro_metavar_expr)]
+
+macro_rules! foo {
+ ( $( $($t:ident),* );* ) => { ${count(t,)} }
+ //~^ ERROR `count` followed by a comma must have an associated
+ //~| ERROR expected expression, found `$`
+}
+
+fn test() {
+ foo!(a, a; b, b);
+}
+
+fn main() {
+}
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr
new file mode 100644
index 000000000..e9317a5c3
--- /dev/null
+++ b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr
@@ -0,0 +1,19 @@
+error: `count` followed by a comma must have an associated index indicating its depth
+ --> $DIR/issue-111904.rs:4:37
+ |
+LL | ( $( $($t:ident),* );* ) => { ${count(t,)} }
+ | ^^^^^
+
+error: expected expression, found `$`
+ --> $DIR/issue-111904.rs:4:35
+ |
+LL | ( $( $($t:ident),* );* ) => { ${count(t,)} }
+ | ^ expected expression
+...
+LL | foo!(a, a; b, b);
+ | ---------------- in this macro invocation
+ |
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/match/issue-114691.rs b/tests/ui/match/issue-114691.rs
new file mode 100644
index 000000000..cc17d9ecf
--- /dev/null
+++ b/tests/ui/match/issue-114691.rs
@@ -0,0 +1,39 @@
+// run-pass
+
+// This test used to be miscompiled by LLVM 17.
+#![allow(dead_code)]
+
+enum Pass {
+ Opaque {
+ clear_color: [f32; 4],
+ with_depth_pre_pass: bool,
+ },
+ Transparent,
+}
+
+enum LoadOp {
+ Clear,
+ Load,
+}
+
+#[inline(never)]
+fn check(x: Option<LoadOp>) {
+ assert!(x.is_none());
+}
+
+#[inline(never)]
+fn test(mode: Pass) {
+ check(match mode {
+ Pass::Opaque {
+ with_depth_pre_pass: true,
+ ..
+ }
+ | Pass::Transparent => None,
+ _ => Some(LoadOp::Clear),
+ });
+}
+
+fn main() {
+ println!("Hello, world!");
+ test(Pass::Transparent);
+}
diff --git a/tests/ui/match/issue-115681.rs b/tests/ui/match/issue-115681.rs
new file mode 100644
index 000000000..c41e808e1
--- /dev/null
+++ b/tests/ui/match/issue-115681.rs
@@ -0,0 +1,32 @@
+// run-pass
+// compile-flags: -C opt-level=1
+
+// Make sure LLVM does not miscompile this match.
+fn main() {
+ enum Bits {
+ None = 0x00,
+ Low = 0x40,
+ High = 0x80,
+ Both = 0xC0,
+ }
+
+ let value = Box::new(0x40u8);
+ let mut out = Box::new(0u8);
+
+ let bits = match *value {
+ 0x00 => Bits::None,
+ 0x40 => Bits::Low,
+ 0x80 => Bits::High,
+ 0xC0 => Bits::Both,
+ _ => return,
+ };
+
+ match bits {
+ Bits::None | Bits::Low => {
+ *out = 1;
+ }
+ _ => (),
+ }
+
+ assert_eq!(*out, 1);
+}
diff --git a/tests/ui/match/issue-74050-end-span.stderr b/tests/ui/match/issue-74050-end-span.stderr
index 0b3425f2b..0dafeae87 100644
--- a/tests/ui/match/issue-74050-end-span.stderr
+++ b/tests/ui/match/issue-74050-end-span.stderr
@@ -6,7 +6,7 @@ LL | let _arg = match args.next() {
LL | Some(arg) => {
| --- binding `arg` declared here
LL | match arg.to_str() {
- | ^^^^^^^^^^^^ borrowed value does not live long enough
+ | ^^^ borrowed value does not live long enough
...
LL | }
| - `arg` dropped here while still borrowed
diff --git a/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.rs b/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.rs
new file mode 100644
index 000000000..85b1ef755
--- /dev/null
+++ b/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.rs
@@ -0,0 +1,21 @@
+#![allow(unused)]
+
+fn test(shouldwe: Option<u32>, shouldwe2: Option<u32>) -> u32 {
+ //~^ NOTE expected `u32` because of return type
+ match shouldwe {
+ Some(val) => {
+ match shouldwe2 {
+ Some(val) => {
+ return val;
+ }
+ None => (), //~ ERROR mismatched types
+ //~^ NOTE expected `u32`, found `()`
+ }
+ }
+ None => return 12,
+ }
+}
+
+fn main() {
+ println!("returned {}", test(None, Some(5)));
+}
diff --git a/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.stderr b/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.stderr
new file mode 100644
index 000000000..e6d93b8b5
--- /dev/null
+++ b/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/non-first-arm-doesnt-match-expected-return-type.rs:11:25
+ |
+LL | fn test(shouldwe: Option<u32>, shouldwe2: Option<u32>) -> u32 {
+ | --- expected `u32` because of return type
+...
+LL | None => (),
+ | ^^ expected `u32`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/methods/inherent-bound-in-probe.stderr b/tests/ui/methods/inherent-bound-in-probe.stderr
index ff03a7edb..8d7cc4622 100644
--- a/tests/ui/methods/inherent-bound-in-probe.stderr
+++ b/tests/ui/methods/inherent-bound-in-probe.stderr
@@ -24,8 +24,7 @@ LL | where
LL | &'a T: IntoIterator<Item = &'a u8>,
| ------------- unsatisfied trait bound introduced here
= note: 126 redundant requirements hidden
- = note: required for `&BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<...>>>>>` to implement `IntoIterator`
- = note: the full type name has been written to '$TEST_BUILD_DIR/methods/inherent-bound-in-probe/inherent-bound-in-probe.long-type-hash.txt'
+ = note: required for `&BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<_>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `IntoIterator`
note: required by a bound in `Helper<'a, T>`
--> $DIR/inherent-bound-in-probe.rs:25:25
|
diff --git a/tests/ui/methods/method-self-arg-2.stderr b/tests/ui/methods/method-self-arg-2.stderr
index b98f7a786..946e71ee5 100644
--- a/tests/ui/methods/method-self-arg-2.stderr
+++ b/tests/ui/methods/method-self-arg-2.stderr
@@ -6,7 +6,7 @@ LL | let y = &mut x;
LL | Foo::bar(&x);
| ^^ immutable borrow occurs here
LL | y.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/method-self-arg-2.rs:20:14
@@ -16,7 +16,7 @@ LL | let y = &mut x;
LL | Foo::baz(&mut x);
| ^^^^^^ second mutable borrow occurs here
LL | y.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error: aborting due to 2 previous errors
diff --git a/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.rs b/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.rs
new file mode 100644
index 000000000..93b7ddf5e
--- /dev/null
+++ b/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.rs
@@ -0,0 +1,6 @@
+// issue: 114131
+
+fn main() {
+ let hello = len(vec![]);
+ //~^ ERROR cannot find function `len` in this scope
+}
diff --git a/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.stderr b/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.stderr
new file mode 100644
index 000000000..9694f80ab
--- /dev/null
+++ b/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.stderr
@@ -0,0 +1,15 @@
+error[E0425]: cannot find function `len` in this scope
+ --> $DIR/suggest-method-on-call-with-macro-rcvr.rs:4:17
+ |
+LL | let hello = len(vec![]);
+ | ^^^ not found in this scope
+ |
+help: use the `.` operator to call the method `len` on `&Vec<_>`
+ |
+LL - let hello = len(vec![]);
+LL + let hello = vec![].len();
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/mir/debug-ref-undef.rs b/tests/ui/mir/debug-ref-undef.rs
new file mode 100644
index 000000000..37fd22a9d
--- /dev/null
+++ b/tests/ui/mir/debug-ref-undef.rs
@@ -0,0 +1,57 @@
+// run-pass
+// compile-flags: -g -O -Zmir-opt-level=0 -Zinline-mir=y -Zmir-enable-passes=+ReferencePropagation
+
+#![allow(dead_code)]
+
+use std::marker::PhantomData;
+
+struct RawTable<T> {
+ marker: PhantomData<T>,
+}
+
+impl<T> RawTable<T> {
+ fn iter(&self) -> RawIter<T> {
+ RawIter { marker: PhantomData }
+ }
+}
+
+struct RawIter<T> {
+ marker: PhantomData<T>,
+}
+
+impl<T> Iterator for RawIter<T> {
+ type Item = ();
+ fn next(&mut self) -> Option<()> {
+ None
+ }
+}
+
+struct HashMap<T> {
+ table: RawTable<T>,
+}
+
+struct Iter<T> {
+ inner: RawIter<T>, // Removing this breaks the reproducer
+}
+
+impl<T> IntoIterator for &HashMap<T> {
+ type Item = T;
+ type IntoIter = Iter<T>;
+ fn into_iter(self) -> Iter<T> {
+ Iter { inner: self.table.iter() }
+ }
+}
+
+impl<T> Iterator for Iter<T> {
+ type Item = T;
+ fn next(&mut self) -> Option<T> {
+ None
+ }
+}
+
+pub fn main() {
+ let maybe_hash_set: Option<HashMap<()>> = None;
+ for _ in maybe_hash_set.as_ref().unwrap_or(&HashMap { table: RawTable { marker: PhantomData } })
+ {
+ }
+}
diff --git a/tests/ui/mir/validate/storage-live.stderr b/tests/ui/mir/validate/storage-live.stderr
index 720fb0a90..1037ddc88 100644
--- a/tests/ui/mir/validate/storage-live.stderr
+++ b/tests/ui/mir/validate/storage-live.stderr
@@ -5,6 +5,7 @@ error: internal compiler error: broken MIR in Item(DefId(0:8 ~ storage_live[HASH
LL | StorageLive(a);
| ^^^^^^^^^^^^^^
+aborting due to `-Z treat-err-as-bug=1`
error: the compiler unexpectedly panicked. this is a bug.
query stack during panic:
diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.stderr
index fb8af4bb7..452cba6b4 100644
--- a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.stderr
+++ b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.stderr
@@ -10,7 +10,7 @@ LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0);
found closure signature `fn(i32) -> _`
note: required by a bound in `find`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its argument
|
LL | let _ = (-10..=10).find(|x: &i32| x.signum() == 0);
| +
@@ -27,7 +27,7 @@ LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
found closure signature `for<'a, 'b, 'c> fn(&'a &'b &'c i32) -> _`
note: required by a bound in `find`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-help: do not borrow the argument
+help: consider adjusting the signature so it does not borrow its argument
|
LL - let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
LL + let _ = (-10..=10).find(|x: &i32| x.signum() == 0);
diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr
index 811ff0533..760e3327b 100644
--- a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr
+++ b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr
@@ -10,7 +10,7 @@ LL | a.iter().map(|_: (u32, u32)| 45);
found closure signature `fn((u32, u32)) -> _`
note: required by a bound in `map`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its argument
|
LL | a.iter().map(|_: &(u32, u32)| 45);
| +
diff --git a/tests/ui/mismatched_types/closure-ref-114180.rs b/tests/ui/mismatched_types/closure-ref-114180.rs
new file mode 100644
index 000000000..d84bdbeda
--- /dev/null
+++ b/tests/ui/mismatched_types/closure-ref-114180.rs
@@ -0,0 +1,8 @@
+// check-fail
+
+fn main() {
+ let mut v = vec![(1,)];
+ let compare = |(a,), (e,)| todo!();
+ v.sort_by(compare);
+ //~^ ERROR type mismatch in closure arguments
+}
diff --git a/tests/ui/mismatched_types/closure-ref-114180.stderr b/tests/ui/mismatched_types/closure-ref-114180.stderr
new file mode 100644
index 000000000..8a146d784
--- /dev/null
+++ b/tests/ui/mismatched_types/closure-ref-114180.stderr
@@ -0,0 +1,22 @@
+error[E0631]: type mismatch in closure arguments
+ --> $DIR/closure-ref-114180.rs:6:15
+ |
+LL | let compare = |(a,), (e,)| todo!();
+ | ------------ found signature defined here
+LL | v.sort_by(compare);
+ | ------- ^^^^^^^ expected due to this
+ | |
+ | required by a bound introduced by this call
+ |
+ = note: expected closure signature `for<'a, 'b> fn(&'a ({integer},), &'b ({integer},)) -> _`
+ found closure signature `fn((_,), (_,)) -> _`
+note: required by a bound in `slice::<impl [T]>::sort_by`
+ --> $SRC_DIR/alloc/src/slice.rs:LL:COL
+help: consider adjusting the signature so it borrows its arguments
+ |
+LL | let compare = |&(a,), &(e,)| todo!();
+ | + +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0631`.
diff --git a/tests/ui/mismatched_types/issue-36053-2.stderr b/tests/ui/mismatched_types/issue-36053-2.stderr
index a6764a1dc..4d230ce9a 100644
--- a/tests/ui/mismatched_types/issue-36053-2.stderr
+++ b/tests/ui/mismatched_types/issue-36053-2.stderr
@@ -10,7 +10,7 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
found closure signature `for<'a> fn(&'a str) -> _`
note: required by a bound in `filter`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its argument
|
LL | once::<&str>("str").fuse().filter(|a: &&str| true).count();
| +
diff --git a/tests/ui/mismatched_types/ref-pat-suggestions.stderr b/tests/ui/mismatched_types/ref-pat-suggestions.stderr
index 62824004d..148ed00b0 100644
--- a/tests/ui/mismatched_types/ref-pat-suggestions.stderr
+++ b/tests/ui/mismatched_types/ref-pat-suggestions.stderr
@@ -103,10 +103,10 @@ error[E0308]: mismatched types
--> $DIR/ref-pat-suggestions.rs:11:23
|
LL | let _: fn(u32) = |&_a| ();
- | ^--
- | ||
- | |expected due to this
+ | ^^^
+ | |
| expected `u32`, found `&_`
+ | expected due to this
|
= note: expected type `u32`
found reference `&_`
@@ -120,10 +120,10 @@ error[E0308]: mismatched types
--> $DIR/ref-pat-suggestions.rs:12:23
|
LL | let _: fn(u32) = |&mut _a| ();
- | ^^^^^--
- | | |
- | | expected due to this
+ | ^^^^^^^
+ | |
| expected `u32`, found `&mut _`
+ | expected due to this
|
= note: expected type `u32`
found mutable reference `&mut _`
@@ -142,10 +142,10 @@ error[E0308]: mismatched types
--> $DIR/ref-pat-suggestions.rs:13:25
|
LL | let _: fn(&u32) = |&&_a| ();
- | ^--
- | ||
- | |expected due to this
- | expected `u32`, found `&_`
+ | -^^^
+ | ||
+ | |expected `u32`, found `&_`
+ | expected due to this
|
= note: expected type `u32`
found reference `&_`
@@ -159,10 +159,10 @@ error[E0308]: mismatched types
--> $DIR/ref-pat-suggestions.rs:14:33
|
LL | let _: fn(&mut u32) = |&mut &_a| ();
- | ^--
- | ||
- | |expected due to this
- | expected `u32`, found `&_`
+ | -----^^^
+ | | |
+ | | expected `u32`, found `&_`
+ | expected due to this
|
= note: expected type `u32`
found reference `&_`
@@ -176,10 +176,10 @@ error[E0308]: mismatched types
--> $DIR/ref-pat-suggestions.rs:15:25
|
LL | let _: fn(&u32) = |&&mut _a| ();
- | ^^^^^--
- | | |
- | | expected due to this
- | expected `u32`, found `&mut _`
+ | -^^^^^^^
+ | ||
+ | |expected `u32`, found `&mut _`
+ | expected due to this
|
= note: expected type `u32`
found mutable reference `&mut _`
@@ -193,10 +193,10 @@ error[E0308]: mismatched types
--> $DIR/ref-pat-suggestions.rs:16:33
|
LL | let _: fn(&mut u32) = |&mut &mut _a| ();
- | ^^^^^--
- | | |
- | | expected due to this
- | expected `u32`, found `&mut _`
+ | -----^^^^^^^
+ | | |
+ | | expected `u32`, found `&mut _`
+ | expected due to this
|
= note: expected type `u32`
found mutable reference `&mut _`
diff --git a/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr b/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr
index 71c4729e3..5c4c13266 100644
--- a/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr
+++ b/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr
@@ -13,7 +13,7 @@ LL | let _has_inference_vars: Option<i32> = Some(0).map(deref_int);
found function signature `for<'a> fn(&'a i32) -> _`
note: required by a bound in `Option::<T>::map`
--> $SRC_DIR/core/src/option.rs:LL:COL
-help: do not borrow the argument
+help: consider adjusting the signature so it does not borrow its argument
|
LL - fn deref_int(a: &i32) -> i32 {
LL + fn deref_int(a: i32) -> i32 {
diff --git a/tests/ui/mismatched_types/suggest-option-asderef.fixed b/tests/ui/mismatched_types/suggest-option-asderef.fixed
index 5c42ece3c..fc488b790 100644
--- a/tests/ui/mismatched_types/suggest-option-asderef.fixed
+++ b/tests/ui/mismatched_types/suggest-option-asderef.fixed
@@ -17,7 +17,7 @@ fn generic<T>(_: T) -> Option<()> {
}
fn generic_ref<T>(_: T) -> Option<()> {
- //~^ HELP do not borrow the argument
+ //~^ HELP consider adjusting the signature so it does not borrow its argument
Some(())
}
diff --git a/tests/ui/mismatched_types/suggest-option-asderef.rs b/tests/ui/mismatched_types/suggest-option-asderef.rs
index a5278b8fb..28f46808a 100644
--- a/tests/ui/mismatched_types/suggest-option-asderef.rs
+++ b/tests/ui/mismatched_types/suggest-option-asderef.rs
@@ -17,7 +17,7 @@ fn generic<T>(_: T) -> Option<()> {
}
fn generic_ref<T>(_: &T) -> Option<()> {
- //~^ HELP do not borrow the argument
+ //~^ HELP consider adjusting the signature so it does not borrow its argument
Some(())
}
diff --git a/tests/ui/mismatched_types/suggest-option-asderef.stderr b/tests/ui/mismatched_types/suggest-option-asderef.stderr
index 01341603d..bfea08673 100644
--- a/tests/ui/mismatched_types/suggest-option-asderef.stderr
+++ b/tests/ui/mismatched_types/suggest-option-asderef.stderr
@@ -73,7 +73,7 @@ LL | let _ = produces_string().and_then(generic_ref);
found function signature `for<'a> fn(&'a _) -> _`
note: required by a bound in `Option::<T>::and_then`
--> $SRC_DIR/core/src/option.rs:LL:COL
-help: do not borrow the argument
+help: consider adjusting the signature so it does not borrow its argument
|
LL - fn generic_ref<T>(_: &T) -> Option<()> {
LL + fn generic_ref<T>(_: T) -> Option<()> {
diff --git a/tests/ui/missing_debug_impls.rs b/tests/ui/missing_debug_impls.rs
index dc4dacfc4..ccad861c0 100644
--- a/tests/ui/missing_debug_impls.rs
+++ b/tests/ui/missing_debug_impls.rs
@@ -35,4 +35,4 @@ struct PrivateStruct;
enum PrivateEnum {}
#[derive(Debug)]
-struct GenericType<T>(T);
+pub struct GenericType<T>(T);
diff --git a/tests/ui/modules/issue-107649.stderr b/tests/ui/modules/issue-107649.stderr
index 38a910b57..5705e84e0 100644
--- a/tests/ui/modules/issue-107649.stderr
+++ b/tests/ui/modules/issue-107649.stderr
@@ -11,7 +11,7 @@ help: consider annotating `Dummy` with `#[derive(Debug)]`
--> $DIR/auxiliary/dummy_lib.rs:2:1
|
2 + #[derive(Debug)]
-3 | #[path = "auxiliary/dummy_lib.rs"]
+3 | pub struct Dummy;
|
error: aborting due to previous error
diff --git a/tests/ui/moves/move-fn-self-receiver.stderr b/tests/ui/moves/move-fn-self-receiver.stderr
index 91d237b1d..c91a8b5ef 100644
--- a/tests/ui/moves/move-fn-self-receiver.stderr
+++ b/tests/ui/moves/move-fn-self-receiver.stderr
@@ -12,7 +12,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `val.0`
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | val.0.clone().into_iter().next();
- | ++++++++
+ | ++++++++
error[E0382]: use of moved value: `foo`
--> $DIR/move-fn-self-receiver.rs:34:5
@@ -78,7 +78,7 @@ error[E0505]: cannot move out of `mut_foo` because it is borrowed
LL | let mut mut_foo = Foo;
| ----------- binding `mut_foo` declared here
LL | let ret = mut_foo.use_mut_self();
- | ---------------------- borrow of `mut_foo` occurs here
+ | ------- borrow of `mut_foo` occurs here
LL | mut_foo;
| ^^^^^^^ move out of `mut_foo` occurs here
LL | ret;
@@ -102,7 +102,7 @@ LL | fn use_rc_self(self: Rc<Self>) {}
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | rc_foo.clone().use_rc_self();
- | ++++++++
+ | ++++++++
error[E0382]: use of moved value: `foo_add`
--> $DIR/move-fn-self-receiver.rs:59:5
@@ -145,7 +145,7 @@ LL | explicit_into_iter;
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | for _val in explicit_into_iter.clone().into_iter() {}
- | ++++++++
+ | ++++++++
error[E0382]: use of moved value: `container`
--> $DIR/move-fn-self-receiver.rs:71:5
diff --git a/tests/ui/moves/moves-based-on-type-access-to-field.stderr b/tests/ui/moves/moves-based-on-type-access-to-field.stderr
index a28f324aa..739018663 100644
--- a/tests/ui/moves/moves-based-on-type-access-to-field.stderr
+++ b/tests/ui/moves/moves-based-on-type-access-to-field.stderr
@@ -13,7 +13,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `x`
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | consume(x.clone().into_iter().next().unwrap());
- | ++++++++
+ | ++++++++
error: aborting due to previous error
diff --git a/tests/ui/moves/moves-based-on-type-exprs.stderr b/tests/ui/moves/moves-based-on-type-exprs.stderr
index ab7c27456..45f7d4063 100644
--- a/tests/ui/moves/moves-based-on-type-exprs.stderr
+++ b/tests/ui/moves/moves-based-on-type-exprs.stderr
@@ -165,7 +165,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `x`
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | let _y = x.clone().into_iter().next().unwrap();
- | ++++++++
+ | ++++++++
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:83:11
@@ -182,7 +182,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `x`
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | let _y = [x.clone().into_iter().next().unwrap(); 1];
- | ++++++++
+ | ++++++++
error: aborting due to 11 previous errors
diff --git a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr
index 7e513b73c..a184482a4 100644
--- a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr
+++ b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr
@@ -13,7 +13,7 @@ note: `Pin::<&'a mut T>::get_mut` takes ownership of the receiver `self`, which
help: consider reborrowing the `Pin` instead of moving it
|
LL | foo(r.as_mut().get_mut());
- | +++++++++
+ | +++++++++
error: aborting due to previous error
diff --git a/tests/ui/moves/pin-mut-reborrow.stderr b/tests/ui/moves/pin-mut-reborrow.stderr
index 16fa4bacc..4bf207e7e 100644
--- a/tests/ui/moves/pin-mut-reborrow.stderr
+++ b/tests/ui/moves/pin-mut-reborrow.stderr
@@ -16,7 +16,7 @@ LL | fn foo(self: Pin<&mut Self>) {}
help: consider reborrowing the `Pin` instead of moving it
|
LL | foo.as_mut().foo();
- | +++++++++
+ | +++++++++
error: aborting due to previous error
diff --git a/tests/ui/moves/suggest-clone.stderr b/tests/ui/moves/suggest-clone.stderr
index cbb3dfea3..065acf904 100644
--- a/tests/ui/moves/suggest-clone.stderr
+++ b/tests/ui/moves/suggest-clone.stderr
@@ -2,9 +2,8 @@ error[E0507]: cannot move out of `*foo` which is behind a shared reference
--> $DIR/suggest-clone.rs:10:5
|
LL | foo.foo();
- | ^^^^-----
- | | |
- | | `*foo` moved due to this method call
+ | ^^^ ----- `*foo` moved due to this method call
+ | |
| move occurs because `*foo` has type `Foo`, which does not implement the `Copy` trait
|
note: `Foo::foo` takes ownership of the receiver `self`, which moves `*foo`
@@ -15,7 +14,7 @@ LL | fn foo(self) {}
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | foo.clone().foo();
- | ++++++++
+ | ++++++++
error: aborting due to previous error
diff --git a/tests/ui/moves/use_of_moved_value_clone_suggestions.stderr b/tests/ui/moves/use_of_moved_value_clone_suggestions.stderr
index 22e7951db..0bb486a88 100644
--- a/tests/ui/moves/use_of_moved_value_clone_suggestions.stderr
+++ b/tests/ui/moves/use_of_moved_value_clone_suggestions.stderr
@@ -8,7 +8,7 @@ LL | (t, t)
| |
| value moved here
|
-help: consider cloning the value if the performance cost is acceptable
+help: clone the value to increment its reference count
|
LL | (t.clone(), t)
| ++++++++
diff --git a/tests/ui/mut/mut-cant-alias.stderr b/tests/ui/mut/mut-cant-alias.stderr
index 6046c076f..d56e45db1 100644
--- a/tests/ui/mut/mut-cant-alias.stderr
+++ b/tests/ui/mut/mut-cant-alias.stderr
@@ -6,7 +6,7 @@ LL | let b1 = &mut *b;
LL | let b2 = &mut *b;
| ^ second mutable borrow occurs here
LL | b1.use_mut();
- | ------------ first borrow later used here
+ | -- first borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/mut/mut-suggestion.stderr b/tests/ui/mut/mut-suggestion.stderr
index d89c8b413..1521ae4c5 100644
--- a/tests/ui/mut/mut-suggestion.stderr
+++ b/tests/ui/mut/mut-suggestion.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
--> $DIR/mut-suggestion.rs:12:5
|
LL | arg.mutate();
- | ^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -13,7 +13,7 @@ error[E0596]: cannot borrow `local` as mutable, as it is not declared as mutable
--> $DIR/mut-suggestion.rs:20:5
|
LL | local.mutate();
- | ^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/nll/closure-access-spans.stderr b/tests/ui/nll/closure-access-spans.stderr
index 035dd5a56..3e98fbd5e 100644
--- a/tests/ui/nll/closure-access-spans.stderr
+++ b/tests/ui/nll/closure-access-spans.stderr
@@ -8,7 +8,7 @@ LL | || x;
| |
| immutable borrow occurs here
LL | r.use_mut();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/closure-access-spans.rs:11:5
@@ -20,7 +20,7 @@ LL | || x = 2;
| |
| second mutable borrow occurs here
LL | r.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0500]: closure requires unique access to `x` but it is already borrowed
--> $DIR/closure-access-spans.rs:17:5
@@ -32,7 +32,7 @@ LL | || *x = 2;
| |
| closure construction occurs here
LL | r.use_mut();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/closure-access-spans.rs:23:13
@@ -42,7 +42,7 @@ LL | let r = &mut x;
LL | move || x;
| ^ use of borrowed `x`
LL | r.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/closure-access-spans.rs:29:5
@@ -56,7 +56,7 @@ LL | || x;
| |
| move out of `x` occurs here
LL | r.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0382]: borrow of moved value: `x`
--> $DIR/closure-access-spans.rs:35:5
diff --git a/tests/ui/nll/closure-borrow-spans.stderr b/tests/ui/nll/closure-borrow-spans.stderr
index cf0df5834..cac22c2ec 100644
--- a/tests/ui/nll/closure-borrow-spans.stderr
+++ b/tests/ui/nll/closure-borrow-spans.stderr
@@ -8,7 +8,7 @@ LL | let f = || x.len();
LL | let y = x;
| ^ move out of `x` occurs here
LL | f.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/closure-borrow-spans.rs:11:13
@@ -20,7 +20,7 @@ LL | let f = || x;
LL | let y = &mut x;
| ^^^^^^ mutable borrow occurs here
LL | f.use_ref();
- | ----------- immutable borrow later used here
+ | - immutable borrow later used here
error[E0597]: `x` does not live long enough
--> $DIR/closure-borrow-spans.rs:19:16
@@ -32,7 +32,7 @@ LL | f = || x;
LL | }
| - `x` dropped here while still borrowed
LL | f.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0506]: cannot assign to `x` because it is borrowed
--> $DIR/closure-borrow-spans.rs:26:5
@@ -44,7 +44,7 @@ LL | let f = || x;
LL | x = 1;
| ^^^^^ `x` is assigned to here but it was already borrowed
LL | f.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/closure-borrow-spans.rs:32:13
@@ -56,7 +56,7 @@ LL | let f = || x = 0;
LL | let y = x;
| ^ use of borrowed `x`
LL | f.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/closure-borrow-spans.rs:38:13
@@ -68,7 +68,7 @@ LL | let f = || x = 0;
LL | let y = &x;
| ^^ immutable borrow occurs here
LL | f.use_ref();
- | ----------- mutable borrow later used here
+ | - mutable borrow later used here
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/closure-borrow-spans.rs:44:13
@@ -80,7 +80,7 @@ LL | let f = || x = 0;
LL | let y = &mut x;
| ^^^^^^ second mutable borrow occurs here
LL | f.use_ref();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0597]: `x` does not live long enough
--> $DIR/closure-borrow-spans.rs:52:16
@@ -92,7 +92,7 @@ LL | f = || x = 0;
LL | }
| - `x` dropped here while still borrowed
LL | f.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0506]: cannot assign to `x` because it is borrowed
--> $DIR/closure-borrow-spans.rs:59:5
@@ -104,7 +104,7 @@ LL | let f = || x = 0;
LL | x = 1;
| ^^^^^ `x` is assigned to here but it was already borrowed
LL | f.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/closure-borrow-spans.rs:65:13
@@ -116,7 +116,7 @@ LL | let f = || *x = 0;
LL | let y = x;
| ^ move out of `x` occurs here
LL | f.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access
--> $DIR/closure-borrow-spans.rs:71:13
@@ -128,7 +128,7 @@ LL | let f = || *x = 0;
LL | let y = &x;
| ^^ second borrow occurs here
LL | f.use_ref();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0501]: cannot borrow `x` as mutable because previous closure requires unique access
--> $DIR/closure-borrow-spans.rs:77:13
@@ -140,7 +140,7 @@ LL | let f = || *x = 0;
LL | let y = &mut x;
| ^^^^^^ second borrow occurs here
LL | f.use_ref();
- | ----------- first borrow later used here
+ | - first borrow later used here
error[E0597]: `x` does not live long enough
--> $DIR/closure-borrow-spans.rs:86:16
@@ -152,7 +152,7 @@ LL | f = || *x = 0;
LL | }
| - `x` dropped here while still borrowed
LL | f.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error[E0506]: cannot assign to `*x` because it is borrowed
--> $DIR/closure-borrow-spans.rs:93:5
@@ -164,7 +164,7 @@ LL | let f = || *x = 0;
LL | *x = 1;
| ^^^^^^ `*x` is assigned to here but it was already borrowed
LL | f.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to 14 previous errors
diff --git a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr
index 61233fd84..1e3a5328d 100644
--- a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr
+++ b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr
@@ -4,7 +4,7 @@ note: no external requirements
LL | let mut closure = expect_sig(|p, y| *p = y);
| ^^^^^^
|
- = note: defining type: test::{closure#0} with closure substs [
+ = note: defining type: test::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) i32)),
(),
diff --git a/tests/ui/nll/closure-requirements/escape-argument.stderr b/tests/ui/nll/closure-requirements/escape-argument.stderr
index 61e2a1ea6..bc4ba93f8 100644
--- a/tests/ui/nll/closure-requirements/escape-argument.stderr
+++ b/tests/ui/nll/closure-requirements/escape-argument.stderr
@@ -4,7 +4,7 @@ note: no external requirements
LL | let mut closure = expect_sig(|p, y| *p = y);
| ^^^^^^
|
- = note: defining type: test::{closure#0} with closure substs [
+ = note: defining type: test::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)),
(),
diff --git a/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr b/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr
index c00a31ef8..727df1cf8 100644
--- a/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr
+++ b/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | let mut closure1 = || p = &y;
| ^^
|
- = note: defining type: test::{closure#0}::{closure#0} with closure substs [
+ = note: defining type: test::{closure#0}::{closure#0} with closure args [
i16,
extern "rust-call" fn(()),
(&'?1 mut &'?2 i32, &'?3 i32),
@@ -18,7 +18,7 @@ note: external requirements
LL | let mut closure = || {
| ^^
|
- = note: defining type: test::{closure#0} with closure substs [
+ = note: defining type: test::{closure#0} with closure args [
i16,
extern "rust-call" fn(()),
(&'?1 mut &'?2 i32, &'?3 i32),
diff --git a/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr b/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr
index 2d67e6e7d..ff638f2a1 100644
--- a/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr
+++ b/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | let mut closure = || p = &y;
| ^^
|
- = note: defining type: test::{closure#0} with closure substs [
+ = note: defining type: test::{closure#0} with closure args [
i16,
extern "rust-call" fn(()),
(&'?1 mut &'?2 i32, &'?3 i32),
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
index ba42576d4..f8383cc42 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
@@ -4,7 +4,7 @@ note: no external requirements
LL | |_outlives1, _outlives2, _outlives3, x, y| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: defining type: supply::{closure#0} with closure substs [
+ = note: defining type: supply::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?3 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
(),
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
index 9dd6e0208..113173d8f 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: defining type: supply::{closure#0} with closure substs [
+ = note: defining type: supply::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)),
(),
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
index e2f5576d3..ba15199ab 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
@@ -4,7 +4,7 @@ note: no external requirements
LL | foo(cell, |cell_a, cell_x| {
| ^^^^^^^^^^^^^^^^
|
- = note: defining type: case1::{closure#0} with closure substs [
+ = note: defining type: case1::{closure#0} with closure args [
i32,
for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)),
(),
@@ -34,7 +34,7 @@ note: external requirements
LL | foo(cell, |cell_a, cell_x| {
| ^^^^^^^^^^^^^^^^
|
- = note: defining type: case2::{closure#0} with closure substs [
+ = note: defining type: case2::{closure#0} with closure args [
i32,
for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)),
(),
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
index 383fb471a..f2bf83c6c 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
| ^^^^^^^^^^^^^^^^^
|
- = note: defining type: supply::{closure#0} with closure substs [
+ = note: defining type: supply::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) u32>)),
(),
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
index ac346c0b1..2734326ed 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: defining type: supply::{closure#0} with closure substs [
+ = note: defining type: supply::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)),
(),
diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
index b217ae197..5ab321eb6 100644
--- a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: defining type: test::{closure#0} with closure substs [
+ = note: defining type: test::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
(),
diff --git a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
index f31478b6d..595fd5ff5 100644
--- a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | |_outlives1, _outlives2, x, y| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: defining type: supply::{closure#0} with closure substs [
+ = note: defining type: supply::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
(),
diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
index 1509ade87..62b0e3eed 100644
--- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
@@ -4,7 +4,7 @@ note: no external requirements
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
| ^^^^^^^^^^^^^^^^^
|
- = note: defining type: supply::{closure#0} with closure substs [
+ = note: defining type: supply::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
(),
diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
index c85a9872e..6f2044d62 100644
--- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
@@ -4,7 +4,7 @@ note: no external requirements
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: defining type: supply::{closure#0} with closure substs [
+ = note: defining type: supply::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)),
(),
diff --git a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr
index 05e274ab2..1aa7de1e1 100644
--- a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | establish_relationships(value, |value| {
| ^^^^^^^
|
- = note: defining type: supply::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: supply::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((T,)),
(),
diff --git a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr
index 4e34ba516..7635f2ede 100644
--- a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr
+++ b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr
@@ -4,7 +4,7 @@ note: no external requirements
LL | expect_sig(|a, b| b); // ought to return `a`
| ^^^^^^
|
- = note: defining type: test::{closure#0} with closure substs [
+ = note: defining type: test::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32,
(),
diff --git a/tests/ui/nll/closures-in-loops.stderr b/tests/ui/nll/closures-in-loops.stderr
index 1c1a31d35..2c1008c51 100644
--- a/tests/ui/nll/closures-in-loops.stderr
+++ b/tests/ui/nll/closures-in-loops.stderr
@@ -13,9 +13,8 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/closures-in-loops.rs:13:16
|
LL | v.push(|| x = String::new());
- | -------^^-------------------
- | | | |
- | | | borrows occur due to use of `x` in closure
+ | - ^^ - borrows occur due to use of `x` in closure
+ | | |
| | `x` was mutably borrowed here in the previous iteration of the loop
| first borrow used here, in later iteration of loop
@@ -23,9 +22,8 @@ error[E0524]: two closures require unique access to `x` at the same time
--> $DIR/closures-in-loops.rs:20:16
|
LL | v.push(|| *x = String::new());
- | -------^^--------------------
- | | | |
- | | | borrows occur due to use of `x` in closure
+ | - ^^ -- borrows occur due to use of `x` in closure
+ | | |
| | closures are constructed here in different iterations of loop
| first borrow used here, in later iteration of loop
diff --git a/tests/ui/nll/get_default.stderr b/tests/ui/nll/get_default.stderr
index 6998c0433..af79771e7 100644
--- a/tests/ui/nll/get_default.stderr
+++ b/tests/ui/nll/get_default.stderr
@@ -5,7 +5,7 @@ LL | fn ok(map: &mut Map) -> &String {
| - let's call the lifetime of this reference `'1`
LL | loop {
LL | match map.get() {
- | --------- immutable borrow occurs here
+ | --- immutable borrow occurs here
LL | Some(v) => {
LL | return v;
| - returning this value requires that `*map` is borrowed for `'1`
@@ -20,7 +20,7 @@ LL | fn err(map: &mut Map) -> &String {
| - let's call the lifetime of this reference `'1`
LL | loop {
LL | match map.get() {
- | --------- immutable borrow occurs here
+ | --- immutable borrow occurs here
LL | Some(v) => {
LL | map.set(String::new()); // Both AST and MIR error here
| ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
@@ -35,7 +35,7 @@ LL | fn err(map: &mut Map) -> &String {
| - let's call the lifetime of this reference `'1`
LL | loop {
LL | match map.get() {
- | --------- immutable borrow occurs here
+ | --- immutable borrow occurs here
...
LL | return v;
| - returning this value requires that `*map` is borrowed for `'1`
diff --git a/tests/ui/nll/guarantor-issue-46974.rs b/tests/ui/nll/guarantor-issue-46974.rs
index 96af4bf5c..93fdf7b46 100644
--- a/tests/ui/nll/guarantor-issue-46974.rs
+++ b/tests/ui/nll/guarantor-issue-46974.rs
@@ -9,7 +9,6 @@ fn foo(s: &mut (i32,)) -> i32 {
}
fn bar(s: &Box<(i32,)>) -> &'static i32 {
- // FIXME(#46983): error message should be better
&s.0 //~ ERROR lifetime may not live long enough
}
diff --git a/tests/ui/nll/guarantor-issue-46974.stderr b/tests/ui/nll/guarantor-issue-46974.stderr
index 7edc3dcc5..f09faf163 100644
--- a/tests/ui/nll/guarantor-issue-46974.stderr
+++ b/tests/ui/nll/guarantor-issue-46974.stderr
@@ -10,11 +10,10 @@ LL | *x
| -- borrow later used here
error: lifetime may not live long enough
- --> $DIR/guarantor-issue-46974.rs:13:5
+ --> $DIR/guarantor-issue-46974.rs:12:5
|
LL | fn bar(s: &Box<(i32,)>) -> &'static i32 {
| - let's call the lifetime of this reference `'1`
-LL | // FIXME(#46983): error message should be better
LL | &s.0
| ^^^^ returning this value requires that `'1` must outlive `'static`
diff --git a/tests/ui/nll/issue-46589.stderr b/tests/ui/nll/issue-46589.stderr
index 60ef3f7b8..82cd364ee 100644
--- a/tests/ui/nll/issue-46589.stderr
+++ b/tests/ui/nll/issue-46589.stderr
@@ -2,10 +2,10 @@ error[E0499]: cannot borrow `**other` as mutable more than once at a time
--> $DIR/issue-46589.rs:23:21
|
LL | *other = match (*other).get_self() {
- | ------------------- first mutable borrow occurs here
+ | -------- first mutable borrow occurs here
LL | Some(s) => s,
LL | None => (*other).new_self()
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^
| |
| second mutable borrow occurs here
| first borrow later used here
diff --git a/tests/ui/nll/issue-51191.stderr b/tests/ui/nll/issue-51191.stderr
index 27b1f8705..c14056c3a 100644
--- a/tests/ui/nll/issue-51191.stderr
+++ b/tests/ui/nll/issue-51191.stderr
@@ -48,7 +48,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/issue-51191.rs:22:9
|
LL | (&mut self).bar();
- | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^^^^^^^^^^^ cannot borrow as mutable
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
--> $DIR/issue-51191.rs:28:9
diff --git a/tests/ui/nll/issue-51345-2.rs b/tests/ui/nll/issue-51345-2.rs
index 52f342a85..77a944a7b 100644
--- a/tests/ui/nll/issue-51345-2.rs
+++ b/tests/ui/nll/issue-51345-2.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern: thread 'main' panicked at 'explicit panic'
+// error-pattern:thread 'main' panicked
+// error-pattern:explicit panic
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/nll/issue-52669.stderr b/tests/ui/nll/issue-52669.stderr
index 807b95f7e..db53e444b 100644
--- a/tests/ui/nll/issue-52669.stderr
+++ b/tests/ui/nll/issue-52669.stderr
@@ -7,7 +7,7 @@ LL | a.b = B;
LL | foo(a);
| - value moved here
LL | a.b.clone()
- | ^^^^^^^^^^^ value borrowed here after move
+ | ^^^ value borrowed here after move
error: aborting due to previous error
diff --git a/tests/ui/nll/issue-53773.stderr b/tests/ui/nll/issue-53773.stderr
index 90cba2a14..fc185d42d 100644
--- a/tests/ui/nll/issue-53773.stderr
+++ b/tests/ui/nll/issue-53773.stderr
@@ -2,7 +2,9 @@ error[E0713]: borrow may still be in use when destructor runs
--> $DIR/issue-53773.rs:41:22
|
LL | members.push(child.raw);
- | -------------^^^^^^^^^- borrow later used here
+ | ------- ^^^^^^^^^
+ | |
+ | borrow later used here
LL |
LL | }
| - here, drop of `child` needs exclusive access to `*child.raw`, because the type `C<'_>` implements the `Drop` trait
diff --git a/tests/ui/nll/issue-54556-niconii.stderr b/tests/ui/nll/issue-54556-niconii.stderr
index d41d462f2..ad0a2d1e3 100644
--- a/tests/ui/nll/issue-54556-niconii.stderr
+++ b/tests/ui/nll/issue-54556-niconii.stderr
@@ -5,7 +5,7 @@ LL | let counter = Mutex;
| ------- binding `counter` declared here
LL |
LL | if let Ok(_) = counter.lock() { }
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^-------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
diff --git a/tests/ui/nll/issue-62007-assign-const-index.stderr b/tests/ui/nll/issue-62007-assign-const-index.stderr
index 12e28aa3f..0db9fe62c 100644
--- a/tests/ui/nll/issue-62007-assign-const-index.stderr
+++ b/tests/ui/nll/issue-62007-assign-const-index.stderr
@@ -17,7 +17,7 @@ LL | fn to_refs<T>(mut list: [&mut List<T>; 2]) -> Vec<&mut T> {
| - let's call the lifetime of this reference `'1`
...
LL | if let Some(n) = list[0].next.as_mut() {
- | ^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^---------
| |
| `list[_].next` was mutably borrowed here in the previous iteration of the loop
| argument requires that `list[_].next` is borrowed for `'1`
diff --git a/tests/ui/nll/issue-62007-assign-differing-fields.stderr b/tests/ui/nll/issue-62007-assign-differing-fields.stderr
index 4488431fc..f1af2e855 100644
--- a/tests/ui/nll/issue-62007-assign-differing-fields.stderr
+++ b/tests/ui/nll/issue-62007-assign-differing-fields.stderr
@@ -17,7 +17,7 @@ LL | fn to_refs<'a, T>(mut list: (&'a mut List<T>, &'a mut List<T>)) -> Vec<&'a
| -- lifetime `'a` defined here
...
LL | if let Some(n) = (list.0).next.as_mut() {
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^---------
| |
| `list.0.next` was mutably borrowed here in the previous iteration of the loop
| argument requires that `list.0.next` is borrowed for `'a`
diff --git a/tests/ui/nll/loan_ends_mid_block_vec.stderr b/tests/ui/nll/loan_ends_mid_block_vec.stderr
index 22c72af61..c0b97bea3 100644
--- a/tests/ui/nll/loan_ends_mid_block_vec.stderr
+++ b/tests/ui/nll/loan_ends_mid_block_vec.stderr
@@ -5,7 +5,7 @@ LL | let slice = &mut data;
| --------- first mutable borrow occurs here
LL | capitalize(slice);
LL | data.push('d');
- | ^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | ^^^^ second mutable borrow occurs here
...
LL | capitalize(slice);
| ----- first borrow later used here
@@ -17,7 +17,7 @@ LL | let slice = &mut data;
| --------- first mutable borrow occurs here
...
LL | data.push('e');
- | ^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | ^^^^ second mutable borrow occurs here
...
LL | capitalize(slice);
| ----- first borrow later used here
@@ -29,7 +29,7 @@ LL | let slice = &mut data;
| --------- first mutable borrow occurs here
...
LL | data.push('f');
- | ^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | ^^^^ second mutable borrow occurs here
LL |
LL | capitalize(slice);
| ----- first borrow later used here
diff --git a/tests/ui/nll/polonius/assignment-to-differing-field.stderr b/tests/ui/nll/polonius/assignment-to-differing-field.stderr
index afa1b9344..acac47eac 100644
--- a/tests/ui/nll/polonius/assignment-to-differing-field.stderr
+++ b/tests/ui/nll/polonius/assignment-to-differing-field.stderr
@@ -17,7 +17,7 @@ LL | fn assignment_to_field_projection<'a, T>(
| -- lifetime `'a` defined here
...
LL | if let Some(n) = (list.0).next.as_mut() {
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^---------
| |
| `list.0.next` was mutably borrowed here in the previous iteration of the loop
| argument requires that `list.0.next` is borrowed for `'a`
@@ -41,7 +41,7 @@ LL | fn assignment_through_projection_chain<'a, T>(
| -- lifetime `'a` defined here
...
LL | if let Some(n) = ((((list.0).0).0).0).0.next.as_mut() {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^---------
| |
| `list.0.0.0.0.0.next` was mutably borrowed here in the previous iteration of the loop
| argument requires that `list.0.0.0.0.0.next` is borrowed for `'a`
diff --git a/tests/ui/nll/return_from_loop.stderr b/tests/ui/nll/return_from_loop.stderr
index bd2b8b158..efd56ea2d 100644
--- a/tests/ui/nll/return_from_loop.stderr
+++ b/tests/ui/nll/return_from_loop.stderr
@@ -5,10 +5,10 @@ LL | let value = &mut my_struct.field;
| -------------------- first mutable borrow occurs here
LL | loop {
LL | my_struct.field.push_str("Hello, world!");
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | ^^^^^^^^^^^^^^^ second mutable borrow occurs here
LL |
LL | value.len();
- | ----------- first borrow later used here
+ | ----- first borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr
index 4eefb180e..433024c30 100644
--- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^
|
- = note: defining type: no_region::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: no_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?2)>,
(),
@@ -37,7 +37,7 @@ note: external requirements
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^
|
- = note: defining type: correct_region::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: correct_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?2)>,
(),
@@ -61,7 +61,7 @@ note: external requirements
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^
|
- = note: defining type: wrong_region::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: wrong_region::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?3)>,
(),
@@ -94,7 +94,7 @@ note: external requirements
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^
|
- = note: defining type: outlives_region::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: outlives_region::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?3)>,
(),
diff --git a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
index 986c2bd21..ebdce7bc1 100644
--- a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
(),
@@ -54,7 +54,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -104,7 +104,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -129,7 +129,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
diff --git a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
index 25cc60d81..52040663e 100644
--- a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
(),
@@ -42,7 +42,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -80,7 +80,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -105,7 +105,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -130,7 +130,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: one_region::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: one_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
(),
diff --git a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr
index 5a092d7b8..97be61b77 100644
--- a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr
@@ -4,7 +4,7 @@ note: no external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
(),
@@ -27,7 +27,7 @@ note: no external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -50,7 +50,7 @@ note: no external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -73,7 +73,7 @@ note: no external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -96,7 +96,7 @@ note: no external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: one_region::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: one_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
(),
diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
index 51283aa88..dbad8e478 100644
--- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: no_relationships_late::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: no_relationships_late::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -38,7 +38,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: no_relationships_early::<'?1, '?2, '?3, T>::{closure#0} with closure substs [
+ = note: defining type: no_relationships_early::<'?1, '?2, '?3, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)),
(),
@@ -72,7 +72,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: projection_outlives::<'?1, '?2, '?3, T>::{closure#0} with closure substs [
+ = note: defining type: projection_outlives::<'?1, '?2, '?3, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)),
(),
@@ -97,7 +97,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: elements_outlive1::<'?1, '?2, '?3, T>::{closure#0} with closure substs [
+ = note: defining type: elements_outlive1::<'?1, '?2, '?3, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)),
(),
@@ -122,7 +122,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: elements_outlive2::<'?1, '?2, '?3, T>::{closure#0} with closure substs [
+ = note: defining type: elements_outlive2::<'?1, '?2, '?3, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)),
(),
@@ -147,7 +147,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: two_regions::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: two_regions::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
(),
@@ -188,7 +188,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: two_regions_outlive::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: two_regions_outlive::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
@@ -213,7 +213,7 @@ note: external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^
|
- = note: defining type: one_region::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: one_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
(),
diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
index 04616f9b7..660211fe2 100644
--- a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^
|
- = note: defining type: generic::<T>::{closure#0} with closure substs [
+ = note: defining type: generic::<T>::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)),
(),
@@ -26,7 +26,7 @@ note: external requirements
LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^
|
- = note: defining type: generic_fail::<T>::{closure#0} with closure substs [
+ = note: defining type: generic_fail::<T>::{closure#0} with closure args [
i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)),
(),
diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
index d580774ff..ddad1d205 100644
--- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | with_signature(x, |y| y)
| ^^^
|
- = note: defining type: no_region::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: no_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn std::fmt::Debug + '?2)>,
(),
diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
index 3d4c11a3c..bb455e9ae 100644
--- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
@@ -4,7 +4,7 @@ note: external requirements
LL | with_signature(a, b, |x, y| {
| ^^^^^^
|
- = note: defining type: no_region::<T>::{closure#0} with closure substs [
+ = note: defining type: no_region::<T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?1 ()>, T)),
(),
@@ -38,7 +38,7 @@ note: external requirements
LL | with_signature(a, b, |x, y| {
| ^^^^^^
|
- = note: defining type: correct_region::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: correct_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
(),
@@ -62,7 +62,7 @@ note: external requirements
LL | with_signature(a, b, |x, y| {
| ^^^^^^
|
- = note: defining type: wrong_region::<'?1, T>::{closure#0} with closure substs [
+ = note: defining type: wrong_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
(),
@@ -98,7 +98,7 @@ note: external requirements
LL | with_signature(a, b, |x, y| {
| ^^^^^^
|
- = note: defining type: outlives_region::<'?1, '?2, T>::{closure#0} with closure substs [
+ = note: defining type: outlives_region::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
(),
diff --git a/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs b/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs
index ccda9129d..1d0b0d55a 100644
--- a/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs
+++ b/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs
@@ -8,7 +8,7 @@
struct SomeStruct<T> { t: T }
-#[rustc_dump_user_substs]
+#[rustc_dump_user_args]
fn main() {
SomeStruct { t: 22 }; // Nothing given, no annotation.
diff --git a/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr b/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr
index 586062190..7809b2470 100644
--- a/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr
+++ b/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr
@@ -1,4 +1,4 @@
-error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None }
+error: user args: UserArgs { args: [&ReStatic u32], user_self_ty: None }
--> $DIR/dump-adt-brace-struct.rs:19:5
|
LL | SomeStruct::<&'static u32> { t: &22 };
diff --git a/tests/ui/nll/user-annotations/dump-fn-method.rs b/tests/ui/nll/user-annotations/dump-fn-method.rs
index 148d63d84..9bdbbc37c 100644
--- a/tests/ui/nll/user-annotations/dump-fn-method.rs
+++ b/tests/ui/nll/user-annotations/dump-fn-method.rs
@@ -15,7 +15,7 @@ impl<S, T> Bazoom<T> for S {
fn foo<'a, T>(_: T) { }
-#[rustc_dump_user_substs]
+#[rustc_dump_user_args]
fn main() {
// Here: nothing is given, so we don't have any annotation.
let x = foo;
diff --git a/tests/ui/nll/user-annotations/dump-fn-method.stderr b/tests/ui/nll/user-annotations/dump-fn-method.stderr
index d139efa88..1daf49825 100644
--- a/tests/ui/nll/user-annotations/dump-fn-method.stderr
+++ b/tests/ui/nll/user-annotations/dump-fn-method.stderr
@@ -1,22 +1,22 @@
-error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None }
+error: user args: UserArgs { args: [&ReStatic u32], user_self_ty: None }
--> $DIR/dump-fn-method.rs:29:13
|
LL | let x = foo::<&'static u32>;
| ^^^^^^^^^^^^^^^^^^^
-error: user substs: UserSubsts { substs: [^0, u32, ^1], user_self_ty: None }
+error: user args: UserArgs { args: [^0, u32, ^1], user_self_ty: None }
--> $DIR/dump-fn-method.rs:35:13
|
LL | let x = <_ as Bazoom<u32>>::method::<_>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: user substs: UserSubsts { substs: [u8, &ReStatic u16, u32], user_self_ty: None }
+error: user args: UserArgs { args: [u8, &ReStatic u16, u32], user_self_ty: None }
--> $DIR/dump-fn-method.rs:44:13
|
LL | let x = <u8 as Bazoom<&'static u16>>::method::<u32>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: user substs: UserSubsts { substs: [^0, ^1, u32], user_self_ty: None }
+error: user args: UserArgs { args: [^0, ^1, u32], user_self_ty: None }
--> $DIR/dump-fn-method.rs:52:5
|
LL | y.method::<u32>(44, 66);
diff --git a/tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs b/tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs
new file mode 100644
index 000000000..64ff1f8b1
--- /dev/null
+++ b/tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs
@@ -0,0 +1,15 @@
+// run-pass
+// check-run-results
+// regression test for issue #109567
+
+fn f() -> f64 {
+ std::hint::black_box(-1.0) % std::hint::black_box(-1.0)
+}
+
+const G: f64 = -1.0 % -1.0;
+
+pub fn main() {
+ assert_eq!(-1, G.signum() as i32);
+ assert_eq!((-0.0_f64).to_bits(), G.to_bits());
+ assert_eq!(f().signum(), G.signum());
+}
diff --git a/tests/ui/numbers-arithmetic/overflowing-add.rs b/tests/ui/numbers-arithmetic/overflowing-add.rs
index b0f22a74b..c45b44966 100644
--- a/tests/ui/numbers-arithmetic/overflowing-add.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-add.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:thread 'main' panicked at 'attempt to add with overflow'
+// error-pattern:thread 'main' panicked
+// error-pattern:attempt to add with overflow
// compile-flags: -C debug-assertions
// ignore-emscripten no processes
diff --git a/tests/ui/numbers-arithmetic/overflowing-mul.rs b/tests/ui/numbers-arithmetic/overflowing-mul.rs
index 34ab5d8fa..ec5279d32 100644
--- a/tests/ui/numbers-arithmetic/overflowing-mul.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-mul.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:thread 'main' panicked at 'attempt to multiply with overflow'
+// error-pattern:thread 'main' panicked
+// error-pattern:attempt to multiply with overflow
// ignore-emscripten no processes
// compile-flags: -C debug-assertions
diff --git a/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs b/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs
index 565b7e86f..dabb0d50c 100644
--- a/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs
@@ -1,5 +1,5 @@
// run-fail
-// error-pattern:thread 'main' panicked at 'attempt to negate with overflow'
+// error-pattern:attempt to negate with overflow
// ignore-emscripten no processes
// compile-flags: -C debug-assertions
diff --git a/tests/ui/numbers-arithmetic/overflowing-neg.rs b/tests/ui/numbers-arithmetic/overflowing-neg.rs
index df1198053..530243753 100644
--- a/tests/ui/numbers-arithmetic/overflowing-neg.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-neg.rs
@@ -1,5 +1,5 @@
// run-fail
-// error-pattern:thread 'main' panicked at 'attempt to negate with overflow'
+// error-pattern:attempt to negate with overflow
// ignore-emscripten no processes
// compile-flags: -C debug-assertions
diff --git a/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs b/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs
index b59efe6f2..c2c8cad5f 100644
--- a/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-pow-signed.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:thread 'main' panicked at 'attempt to multiply with overflow'
+// error-pattern:thread 'main' panicked
+// error-pattern:attempt to multiply with overflow
// ignore-emscripten no processes
// compile-flags: -C debug-assertions
diff --git a/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs b/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs
index f2643c164..4a0f9abd9 100644
--- a/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-pow-unsigned.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:thread 'main' panicked at 'attempt to multiply with overflow'
+// error-pattern:thread 'main' panicked
+// error-pattern:attempt to multiply with overflow
// ignore-emscripten no processes
// compile-flags: -C debug-assertions
diff --git a/tests/ui/numbers-arithmetic/overflowing-sub.rs b/tests/ui/numbers-arithmetic/overflowing-sub.rs
index 66685ac96..119d80748 100644
--- a/tests/ui/numbers-arithmetic/overflowing-sub.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-sub.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:thread 'main' panicked at 'attempt to subtract with overflow'
+// error-pattern:thread 'main' panicked
+// error-pattern:attempt to subtract with overflow
// ignore-emscripten no processes
// compile-flags: -C debug-assertions
diff --git a/tests/ui/object-safety/assoc_const_bounds.rs b/tests/ui/object-safety/assoc_const_bounds.rs
index 94b1f6316..bfa21fd9a 100644
--- a/tests/ui/object-safety/assoc_const_bounds.rs
+++ b/tests/ui/object-safety/assoc_const_bounds.rs
@@ -1,7 +1,12 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features, dead_code)]
+
+// check-pass
+
trait Foo<T> {
const BAR: bool
- where //~ ERROR: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
- Self: Sized;
+ where
+ Self: Sized;
}
trait Cake {}
diff --git a/tests/ui/object-safety/assoc_const_bounds.stderr b/tests/ui/object-safety/assoc_const_bounds.stderr
deleted file mode 100644
index 09bc11e17..000000000
--- a/tests/ui/object-safety/assoc_const_bounds.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
- --> $DIR/assoc_const_bounds.rs:3:9
- |
-LL | trait Foo<T> {
- | - while parsing this item list starting here
-LL | const BAR: bool
- | - expected one of 7 possible tokens
-LL | where
- | ^^^^^ unexpected token
-LL | Self: Sized;
-LL | }
- | - the item list ends here
-
-error: aborting due to previous error
-
diff --git a/tests/ui/object-safety/assoc_const_bounds_sized.rs b/tests/ui/object-safety/assoc_const_bounds_sized.rs
index 2a76e5dce..87d1f06f0 100644
--- a/tests/ui/object-safety/assoc_const_bounds_sized.rs
+++ b/tests/ui/object-safety/assoc_const_bounds_sized.rs
@@ -1,7 +1,12 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features, dead_code)]
+
+// check-pass
+
trait Foo {
const BAR: bool
- where //~ ERROR: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
- Self: Sized;
+ where
+ Self: Sized;
}
fn foo(_: &dyn Foo) {}
diff --git a/tests/ui/object-safety/assoc_const_bounds_sized.stderr b/tests/ui/object-safety/assoc_const_bounds_sized.stderr
deleted file mode 100644
index e1f57f677..000000000
--- a/tests/ui/object-safety/assoc_const_bounds_sized.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
- --> $DIR/assoc_const_bounds_sized.rs:3:9
- |
-LL | trait Foo {
- | - while parsing this item list starting here
-LL | const BAR: bool
- | - expected one of 7 possible tokens
-LL | where
- | ^^^^^ unexpected token
-LL | Self: Sized;
-LL | }
- | - the item list ends here
-
-error: aborting due to previous error
-
diff --git a/tests/ui/object-safety/object-safety-by-value-self-use.stderr b/tests/ui/object-safety/object-safety-by-value-self-use.stderr
index 94fdcdf26..17f4cb4d4 100644
--- a/tests/ui/object-safety/object-safety-by-value-self-use.stderr
+++ b/tests/ui/object-safety/object-safety-by-value-self-use.stderr
@@ -2,7 +2,7 @@ error[E0161]: cannot move a value of type `dyn Bar`
--> $DIR/object-safety-by-value-self-use.rs:15:5
|
LL | t.bar()
- | ^^^^^^^ the size of `dyn Bar` cannot be statically determined
+ | ^ the size of `dyn Bar` cannot be statically determined
error: aborting due to previous error
diff --git a/tests/ui/or-patterns/missing-bindings.stderr b/tests/ui/or-patterns/missing-bindings.stderr
index 8fafa275b..4457b7893 100644
--- a/tests/ui/or-patterns/missing-bindings.stderr
+++ b/tests/ui/or-patterns/missing-bindings.stderr
@@ -79,6 +79,14 @@ LL | let (A(A(..) | B(a), _) | B(A(a, _) | B(a))) = Y;
| |
| pattern doesn't bind `a`
+error[E0408]: variable `c` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:45:12
+ |
+LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
+ | ^^^^^^^ - variable not in all patterns
+ | |
+ | pattern doesn't bind `c`
+
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:45:22
|
@@ -96,12 +104,12 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| variable not in all patterns
error[E0408]: variable `c` is not bound in all patterns
- --> $DIR/missing-bindings.rs:45:12
+ --> $DIR/missing-bindings.rs:45:33
|
LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
- | ^^^^^^^ - variable not in all patterns
- | |
- | pattern doesn't bind `c`
+ | - ^^^^ pattern doesn't bind `c`
+ | |
+ | variable not in all patterns
error[E0408]: variable `d` is not bound in all patterns
--> $DIR/missing-bindings.rs:45:33
@@ -135,14 +143,6 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| |
| variable not in all patterns
-error[E0408]: variable `c` is not bound in all patterns
- --> $DIR/missing-bindings.rs:45:33
- |
-LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
- | - ^^^^ pattern doesn't bind `c`
- | |
- | variable not in all patterns
-
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:61:29
|
@@ -185,6 +185,28 @@ LL | B(b),
LL | B(_)
| ^^^^ pattern doesn't bind `b`
+error[E0408]: variable `c` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:57:13
+ |
+LL | / V1(
+LL | |
+LL | |
+LL | | A(
+... |
+LL | | B(Ok(a) | Err(a))
+LL | | ) |
+ | |_____________^ pattern doesn't bind `c`
+LL | / V2(
+LL | | A(
+LL | | A(_, a) |
+LL | | B(b),
+... |
+LL | |
+LL | | ) |
+ | |_____________^ pattern doesn't bind `c`
+LL | V3(c),
+ | - variable not in all patterns
+
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:76:13
|
@@ -215,28 +237,6 @@ LL | B(b),
LL | V3(c),
| ^^^^^ pattern doesn't bind `b`
-error[E0408]: variable `c` is not bound in all patterns
- --> $DIR/missing-bindings.rs:57:13
- |
-LL | / V1(
-LL | |
-LL | |
-LL | | A(
-... |
-LL | | B(Ok(a) | Err(a))
-LL | | ) |
- | |_____________^ pattern doesn't bind `c`
-LL | / V2(
-LL | | A(
-LL | | A(_, a) |
-LL | | B(b),
-... |
-LL | |
-LL | | ) |
- | |_____________^ pattern doesn't bind `c`
-LL | V3(c),
- | - variable not in all patterns
-
error: aborting due to 26 previous errors
For more information about this error, try `rustc --explain E0408`.
diff --git a/tests/ui/panic-handler/weak-lang-item-2.rs b/tests/ui/panic-handler/weak-lang-item-2.rs
index a429d8fab..2cc5f23b4 100644
--- a/tests/ui/panic-handler/weak-lang-item-2.rs
+++ b/tests/ui/panic-handler/weak-lang-item-2.rs
@@ -1,15 +1,15 @@
// run-pass
// aux-build:weak-lang-items.rs
-// ignore-emscripten no threads support
// pretty-expanded FIXME #23616
extern crate weak_lang_items as other;
-use std::thread;
-
fn main() {
- let _ = thread::spawn(move|| {
- other::foo()
- });
+ // The goal of the test is just to make sure other::foo() is referenced at link time. Since
+ // the function panics, to prevent it from running we gate it behind an always-false `if` that
+ // is not going to be optimized away.
+ if std::hint::black_box(false) {
+ other::foo();
+ }
}
diff --git a/tests/ui/panics/abort-on-panic.rs b/tests/ui/panics/abort-on-panic.rs
index 1f6ad64c0..7fbee85ff 100644
--- a/tests/ui/panics/abort-on-panic.rs
+++ b/tests/ui/panics/abort-on-panic.rs
@@ -1,4 +1,6 @@
// run-pass
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
#![allow(unused_must_use)]
#![feature(c_unwind)]
diff --git a/tests/ui/panics/default-backtrace-ice.stderr b/tests/ui/panics/default-backtrace-ice.stderr
index 815ce4dd0..4b00f1350 100644
--- a/tests/ui/panics/default-backtrace-ice.stderr
+++ b/tests/ui/panics/default-backtrace-ice.stderr
@@ -5,6 +5,7 @@ LL | fn main() { missing_ident; }
| ^^^^^^^^^^^^^ not found in this scope
+aborting due to `-Z treat-err-as-bug=1`
stack backtrace:
(end_short_backtrace)
(begin_short_backtrace)
diff --git a/tests/ui/panics/fmt-only-once.run.stderr b/tests/ui/panics/fmt-only-once.run.stderr
index 39bd06881..a991706d3 100644
--- a/tests/ui/panics/fmt-only-once.run.stderr
+++ b/tests/ui/panics/fmt-only-once.run.stderr
@@ -1,3 +1,4 @@
fmt
-thread 'main' panicked at 'PrintOnFmt', $DIR/fmt-only-once.rs:20:5
+thread 'main' panicked at $DIR/fmt-only-once.rs:20:5:
+PrintOnFmt
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/panics/issue-47429-short-backtraces.legacy.run.stderr b/tests/ui/panics/issue-47429-short-backtraces.legacy.run.stderr
index ac4ed8225..dce91ce59 100644
--- a/tests/ui/panics/issue-47429-short-backtraces.legacy.run.stderr
+++ b/tests/ui/panics/issue-47429-short-backtraces.legacy.run.stderr
@@ -1,4 +1,5 @@
-thread 'main' panicked at 'explicit panic', $DIR/issue-47429-short-backtraces.rs:23:5
+thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:23:5:
+explicit panic
stack backtrace:
0: std::panicking::begin_panic
1: issue_47429_short_backtraces::main
diff --git a/tests/ui/panics/issue-47429-short-backtraces.v0.run.stderr b/tests/ui/panics/issue-47429-short-backtraces.v0.run.stderr
index 65401fe1c..f458c7acb 100644
--- a/tests/ui/panics/issue-47429-short-backtraces.v0.run.stderr
+++ b/tests/ui/panics/issue-47429-short-backtraces.v0.run.stderr
@@ -1,4 +1,5 @@
-thread 'main' panicked at 'explicit panic', $DIR/issue-47429-short-backtraces.rs:23:5
+thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:23:5:
+explicit panic
stack backtrace:
0: std::panicking::begin_panic::<&str>
1: issue_47429_short_backtraces::main
diff --git a/tests/ui/panics/location-detail-panic-no-column.run.stderr b/tests/ui/panics/location-detail-panic-no-column.run.stderr
index 46c9b8448..6d8d02a3a 100644
--- a/tests/ui/panics/location-detail-panic-no-column.run.stderr
+++ b/tests/ui/panics/location-detail-panic-no-column.run.stderr
@@ -1,2 +1,3 @@
-thread 'main' panicked at 'column-redacted', $DIR/location-detail-panic-no-column.rs:7:0
+thread 'main' panicked at $DIR/location-detail-panic-no-column.rs:7:0:
+column-redacted
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/panics/location-detail-panic-no-file.run.stderr b/tests/ui/panics/location-detail-panic-no-file.run.stderr
index 811f93bf3..492ad37f5 100644
--- a/tests/ui/panics/location-detail-panic-no-file.run.stderr
+++ b/tests/ui/panics/location-detail-panic-no-file.run.stderr
@@ -1,2 +1,3 @@
-thread 'main' panicked at 'file-redacted', <redacted>:7:5
+thread 'main' panicked at <redacted>:7:5:
+file-redacted
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/panics/location-detail-panic-no-line.run.stderr b/tests/ui/panics/location-detail-panic-no-line.run.stderr
index cc3f1624c..fdbc43c43 100644
--- a/tests/ui/panics/location-detail-panic-no-line.run.stderr
+++ b/tests/ui/panics/location-detail-panic-no-line.run.stderr
@@ -1,2 +1,3 @@
-thread 'main' panicked at 'line-redacted', $DIR/location-detail-panic-no-line.rs:0:5
+thread 'main' panicked at $DIR/location-detail-panic-no-line.rs:0:5:
+line-redacted
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/panics/location-detail-panic-no-location-info.run.stderr b/tests/ui/panics/location-detail-panic-no-location-info.run.stderr
index d1c310864..1e9002df9 100644
--- a/tests/ui/panics/location-detail-panic-no-location-info.run.stderr
+++ b/tests/ui/panics/location-detail-panic-no-location-info.run.stderr
@@ -1,2 +1,3 @@
-thread 'main' panicked at 'no location info', <redacted>:0:0
+thread 'main' panicked at <redacted>:0:0:
+no location info
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/panics/location-detail-unwrap-no-file.run.stderr b/tests/ui/panics/location-detail-unwrap-no-file.run.stderr
index 7d8e1d930..52019f622 100644
--- a/tests/ui/panics/location-detail-unwrap-no-file.run.stderr
+++ b/tests/ui/panics/location-detail-unwrap-no-file.run.stderr
@@ -1,2 +1,3 @@
-thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', <redacted>:8:9
+thread 'main' panicked at <redacted>:8:9:
+called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/panics/panic-macro-any-wrapped.rs b/tests/ui/panics/panic-macro-any-wrapped.rs
index 663bf6713..1815a0d2c 100644
--- a/tests/ui/panics/panic-macro-any-wrapped.rs
+++ b/tests/ui/panics/panic-macro-any-wrapped.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'Box<dyn Any>'
+// error-pattern:panicked
+// error-pattern:Box<dyn Any>
// ignore-emscripten no processes
#![allow(non_fmt_panics)]
diff --git a/tests/ui/panics/panic-macro-any.rs b/tests/ui/panics/panic-macro-any.rs
index c7df53654..1bc3c336c 100644
--- a/tests/ui/panics/panic-macro-any.rs
+++ b/tests/ui/panics/panic-macro-any.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'Box<dyn Any>'
+// error-pattern:panicked
+// error-pattern:Box<dyn Any>
// ignore-emscripten no processes
#![allow(non_fmt_panics)]
diff --git a/tests/ui/panics/panic-macro-explicit.rs b/tests/ui/panics/panic-macro-explicit.rs
index ac4d6f812..b5b6c7675 100644
--- a/tests/ui/panics/panic-macro-explicit.rs
+++ b/tests/ui/panics/panic-macro-explicit.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'explicit panic'
+// error-pattern:panicked
+// error-pattern:explicit panic
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/panics/panic-macro-fmt.rs b/tests/ui/panics/panic-macro-fmt.rs
index a755ebc0f..0796d33ea 100644
--- a/tests/ui/panics/panic-macro-fmt.rs
+++ b/tests/ui/panics/panic-macro-fmt.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'test-fail-fmt 42 rust'
+// error-pattern:panicked
+// error-pattern:test-fail-fmt 42 rust
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/panics/panic-macro-owned.rs b/tests/ui/panics/panic-macro-owned.rs
index b898fde77..522c87e1c 100644
--- a/tests/ui/panics/panic-macro-owned.rs
+++ b/tests/ui/panics/panic-macro-owned.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'test-fail-owned'
+// error-pattern:panicked
+// error-pattern:test-fail-owned
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/panics/panic-macro-static.rs b/tests/ui/panics/panic-macro-static.rs
index a1d467cbf..06ec5b0ad 100644
--- a/tests/ui/panics/panic-macro-static.rs
+++ b/tests/ui/panics/panic-macro-static.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'test-fail-static'
+// error-pattern:panicked
+// error-pattern:test-fail-static
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/panics/panic-set-unset-handler.rs b/tests/ui/panics/panic-set-unset-handler.rs
index dde0c72f7..91f69f0a6 100644
--- a/tests/ui/panics/panic-set-unset-handler.rs
+++ b/tests/ui/panics/panic-set-unset-handler.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:thread 'main' panicked at 'foobar'
+// error-pattern:thread 'main' panicked
+// error-pattern:foobar
// ignore-emscripten no processes
use std::panic;
diff --git a/tests/ui/panics/panic-take-handler-nop.rs b/tests/ui/panics/panic-take-handler-nop.rs
index 41cbac97c..d14a3244e 100644
--- a/tests/ui/panics/panic-take-handler-nop.rs
+++ b/tests/ui/panics/panic-take-handler-nop.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:thread 'main' panicked at 'foobar'
+// error-pattern:thread 'main' panicked
+// error-pattern:foobar
// ignore-emscripten no processes
use std::panic;
diff --git a/tests/ui/panics/panic-task-name-none.rs b/tests/ui/panics/panic-task-name-none.rs
index 4e95fb5bd..3fb0f3412 100644
--- a/tests/ui/panics/panic-task-name-none.rs
+++ b/tests/ui/panics/panic-task-name-none.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:thread '<unnamed>' panicked at 'test'
+// error-pattern:thread '<unnamed>' panicked
+// error-pattern:test
// ignore-emscripten Needs threads
use std::thread;
diff --git a/tests/ui/panics/panic-task-name-owned.rs b/tests/ui/panics/panic-task-name-owned.rs
index f85be7bb8..d5274ebbc 100644
--- a/tests/ui/panics/panic-task-name-owned.rs
+++ b/tests/ui/panics/panic-task-name-owned.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:thread 'owned name' panicked at 'test'
+// error-pattern:thread 'owned name' panicked
+// error-pattern:test
// ignore-emscripten Needs threads.
use std::thread::Builder;
diff --git a/tests/ui/panics/runtime-switch.legacy.run.stderr b/tests/ui/panics/runtime-switch.legacy.run.stderr
index 0f7655163..bd05b6cc0 100644
--- a/tests/ui/panics/runtime-switch.legacy.run.stderr
+++ b/tests/ui/panics/runtime-switch.legacy.run.stderr
@@ -1,4 +1,5 @@
-thread 'main' panicked at 'explicit panic', $DIR/runtime-switch.rs:26:5
+thread 'main' panicked at $DIR/runtime-switch.rs:26:5:
+explicit panic
stack backtrace:
0: std::panicking::begin_panic
1: runtime_switch::main
diff --git a/tests/ui/panics/runtime-switch.v0.run.stderr b/tests/ui/panics/runtime-switch.v0.run.stderr
index a4ae44131..2078c356d 100644
--- a/tests/ui/panics/runtime-switch.v0.run.stderr
+++ b/tests/ui/panics/runtime-switch.v0.run.stderr
@@ -1,4 +1,5 @@
-thread 'main' panicked at 'explicit panic', $DIR/runtime-switch.rs:26:5
+thread 'main' panicked at $DIR/runtime-switch.rs:26:5:
+explicit panic
stack backtrace:
0: std::panicking::begin_panic::<&str>
1: runtime_switch::main
diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
index 2592b7479..2b648a0ca 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
+++ b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
@@ -1,10 +1,13 @@
-thread 'main' panicked at 'debug!!!', $DIR/short-ice-remove-middle-frames-2.rs:56:5
+thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:56:5:
+debug!!!
stack backtrace:
0: std::panicking::begin_panic
1: short_ice_remove_middle_frames_2::eight
2: short_ice_remove_middle_frames_2::seven::{{closure}}
+ [... omitted 3 frames ...]
3: short_ice_remove_middle_frames_2::fifth
4: short_ice_remove_middle_frames_2::fourth::{{closure}}
+ [... omitted 4 frames ...]
5: short_ice_remove_middle_frames_2::first
6: short_ice_remove_middle_frames_2::main
7: core::ops::function::FnOnce::call_once
diff --git a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
index 9c15f2e08..5b3726840 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
+++ b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
@@ -1,9 +1,11 @@
-thread 'main' panicked at 'debug!!!', $DIR/short-ice-remove-middle-frames.rs:52:5
+thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:52:5:
+debug!!!
stack backtrace:
0: std::panicking::begin_panic
1: short_ice_remove_middle_frames::seven
2: short_ice_remove_middle_frames::sixth
3: short_ice_remove_middle_frames::fifth::{{closure}}
+ [... omitted 4 frames ...]
4: short_ice_remove_middle_frames::second
5: short_ice_remove_middle_frames::first::{{closure}}
6: short_ice_remove_middle_frames::first
diff --git a/tests/ui/parser/async-with-nonterminal-block.rs b/tests/ui/parser/async-with-nonterminal-block.rs
new file mode 100644
index 000000000..96015fd5d
--- /dev/null
+++ b/tests/ui/parser/async-with-nonterminal-block.rs
@@ -0,0 +1,16 @@
+// check-pass
+// edition:2021
+
+macro_rules! create_async {
+ ($body:block) => {
+ async $body
+ };
+}
+
+async fn other() {}
+
+fn main() {
+ let y = create_async! {{
+ other().await;
+ }};
+}
diff --git a/tests/ui/parser/generic-statics.rs b/tests/ui/parser/generic-statics.rs
new file mode 100644
index 000000000..2fb8781fd
--- /dev/null
+++ b/tests/ui/parser/generic-statics.rs
@@ -0,0 +1,4 @@
+static S<T>: i32 = 0;
+//~^ ERROR static items may not have generic parameters
+
+fn main() {}
diff --git a/tests/ui/parser/generic-statics.stderr b/tests/ui/parser/generic-statics.stderr
new file mode 100644
index 000000000..c757232b0
--- /dev/null
+++ b/tests/ui/parser/generic-statics.stderr
@@ -0,0 +1,8 @@
+error: static items may not have generic parameters
+ --> $DIR/generic-statics.rs:1:9
+ |
+LL | static S<T>: i32 = 0;
+ | ^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-113203.rs b/tests/ui/parser/issues/issue-113203.rs
new file mode 100644
index 000000000..1103251c1
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113203.rs
@@ -0,0 +1,7 @@
+// Checks what happens when we attempt to use the await keyword as a prefix. Span
+// incorrectly emitted an `.await` in E0277 which does not exist
+// edition:2018
+fn main() {
+ await {}()
+ //~^ ERROR incorrect use of `await`
+}
diff --git a/tests/ui/parser/issues/issue-113203.stderr b/tests/ui/parser/issues/issue-113203.stderr
new file mode 100644
index 000000000..97304a89c
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113203.stderr
@@ -0,0 +1,8 @@
+error: incorrect use of `await`
+ --> $DIR/issue-113203.rs:5:5
+ |
+LL | await {}()
+ | ^^^^^^^^ help: `await` is a postfix operation: `{}.await`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-114219.rs b/tests/ui/parser/issues/issue-114219.rs
new file mode 100644
index 000000000..332258b62
--- /dev/null
+++ b/tests/ui/parser/issues/issue-114219.rs
@@ -0,0 +1,4 @@
+fn main() {
+ async move {};
+ //~^ ERROR `async move` blocks are only allowed in Rust 2018 or later
+}
diff --git a/tests/ui/parser/issues/issue-114219.stderr b/tests/ui/parser/issues/issue-114219.stderr
new file mode 100644
index 000000000..90dcdc427
--- /dev/null
+++ b/tests/ui/parser/issues/issue-114219.stderr
@@ -0,0 +1,8 @@
+error: `async move` blocks are only allowed in Rust 2018 or later
+ --> $DIR/issue-114219.rs:2:5
+ |
+LL | async move {};
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs b/tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs
new file mode 100644
index 000000000..3421333b8
--- /dev/null
+++ b/tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs
@@ -0,0 +1,21 @@
+// Regression test for issue #115780.
+// Ensure that we don't emit a parse error for the token sequence `Ident "<" Ty` in pattern position
+// if we are inside a macro call since it can be valid input for a subsequent macro rule.
+// See also #103534.
+
+// check-pass
+
+macro_rules! mdo {
+ ($p: pat =<< $e: expr ; $( $t: tt )*) => {
+ $e.and_then(|$p| mdo! { $( $t )* })
+ };
+ (ret<$ty: ty> $e: expr;) => { Some::<$ty>($e) };
+}
+
+fn main() {
+ mdo! {
+ x_val =<< Some(0);
+ y_val =<< Some(1);
+ ret<(i32, i32)> (x_val, y_val);
+ };
+}
diff --git a/tests/ui/parser/issues/issue-22647.rs b/tests/ui/parser/issues/issue-22647.rs
index a68614106..163cbc69d 100644
--- a/tests/ui/parser/issues/issue-22647.rs
+++ b/tests/ui/parser/issues/issue-22647.rs
@@ -1,5 +1,5 @@
fn main() {
- let caller<F> = |f: F| //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+ let caller<F> = |f: F| //~ ERROR generic args in patterns require the turbofish syntax
where F: Fn() -> i32
{
let x = f();
diff --git a/tests/ui/parser/issues/issue-22647.stderr b/tests/ui/parser/issues/issue-22647.stderr
index 89b454d19..585e70266 100644
--- a/tests/ui/parser/issues/issue-22647.stderr
+++ b/tests/ui/parser/issues/issue-22647.stderr
@@ -1,8 +1,13 @@
-error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+error: generic args in patterns require the turbofish syntax
--> $DIR/issue-22647.rs:2:15
|
LL | let caller<F> = |f: F|
- | ^ expected one of `:`, `;`, `=`, `@`, or `|`
+ | ^
+ |
+help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
+ |
+LL | let caller::<F> = |f: F|
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-22712.rs b/tests/ui/parser/issues/issue-22712.rs
index 774de9c7e..92b12b8e1 100644
--- a/tests/ui/parser/issues/issue-22712.rs
+++ b/tests/ui/parser/issues/issue-22712.rs
@@ -3,7 +3,7 @@ struct Foo<B> {
}
fn bar() {
- let Foo<Vec<u8>> //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+ let Foo<Vec<u8>> //~ ERROR generic args in patterns require the turbofish syntax
}
fn main() {}
diff --git a/tests/ui/parser/issues/issue-22712.stderr b/tests/ui/parser/issues/issue-22712.stderr
index 30fabac65..7f9d99d8e 100644
--- a/tests/ui/parser/issues/issue-22712.stderr
+++ b/tests/ui/parser/issues/issue-22712.stderr
@@ -1,8 +1,13 @@
-error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+error: generic args in patterns require the turbofish syntax
--> $DIR/issue-22712.rs:6:12
|
LL | let Foo<Vec<u8>>
- | ^ expected one of `:`, `;`, `=`, `@`, or `|`
+ | ^
+ |
+help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
+ |
+LL | let Foo::<Vec<u8>>
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs b/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs
index 80f53338a..92ff0ef64 100644
--- a/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs
+++ b/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs
@@ -6,9 +6,13 @@ pub enum ErrorHandled {
impl ErrorHandled {
pub fn assert_reported(self) {
match self {
+ //~^ NOTE this delimiter might not be properly closed...
ErrorHandled::Reported => {}}
- //^~ ERROR block is empty, you might have not meant to close it
+ //~^ NOTE block is empty, you might have not meant to close it
+ //~| NOTE as it matches this but it has different indentation
ErrorHandled::TooGeneric => panic!(),
}
}
-} //~ ERROR unexpected closing delimiter: `}`
+}
+//~^ ERROR unexpected closing delimiter: `}`
+//~| NOTE unexpected closing delimiter
diff --git a/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr b/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr
index 9ae94c701..c590e04bb 100644
--- a/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr
+++ b/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr
@@ -1,8 +1,9 @@
error: unexpected closing delimiter: `}`
- --> $DIR/issue-70583-block-is-empty-2.rs:14:1
+ --> $DIR/issue-70583-block-is-empty-2.rs:16:1
|
LL | match self {
| - this delimiter might not be properly closed...
+LL |
LL | ErrorHandled::Reported => {}}
| --- ...as it matches this but it has different indentation
| |
diff --git a/tests/ui/parser/macro/macro-expand-to-field.rs b/tests/ui/parser/macro/macro-expand-to-field.rs
new file mode 100644
index 000000000..155872f7a
--- /dev/null
+++ b/tests/ui/parser/macro/macro-expand-to-field.rs
@@ -0,0 +1,70 @@
+// compile-flags: --crate-type=lib
+
+macro_rules! field {
+ ($name:ident:$type:ty) => {
+ $name:$type
+ };
+}
+
+macro_rules! variant {
+ ($name:ident) => {
+ $name
+ }
+}
+
+struct Struct {
+ field!(bar:u128),
+ //~^ NOTE macros cannot expand to struct fields
+ //~| ERROR unexpected token: `!`
+ //~| NOTE unexpected token after this
+ a: u32,
+ b: u32,
+ field!(recovers:()), //~ NOTE macros cannot expand to struct fields
+ //~^ ERROR unexpected token: `!`
+ //~^^ NOTE unexpected token after this
+}
+
+enum EnumVariant {
+ variant!(whoops),
+ //~^ NOTE macros cannot expand to enum variants
+ //~| ERROR unexpected token: `!`
+ //~| NOTE unexpected token after this
+ U32,
+ F64,
+ variant!(recovers),
+ //~^ NOTE macros cannot expand to enum variants
+ //~| ERROR unexpected token: `!`
+ //~| NOTE unexpected token after this
+ Data {
+ field!(x:u32),
+ //~^ NOTE macros cannot expand to struct fields
+ //~| ERROR unexpected token: `!`
+ //~| NOTE unexpected token after this
+ }
+}
+
+enum EnumVariantField {
+ Named {
+ field!(oopsies:()),
+ //~^ NOTE macros cannot expand to struct fields
+ //~| ERROR unexpected token: `!`
+ //~| unexpected token after this
+ field!(oopsies2:()),
+ //~^ NOTE macros cannot expand to struct fields
+ //~| ERROR unexpected token: `!`
+ //~| unexpected token after this
+ },
+}
+
+union Union {
+ A: u32,
+ field!(oopsies:()),
+ //~^ NOTE macros cannot expand to union fields
+ //~| ERROR unexpected token: `!`
+ //~| unexpected token after this
+ B: u32,
+ field!(recovers:()),
+ //~^ NOTE macros cannot expand to union fields
+ //~| ERROR unexpected token: `!`
+ //~| unexpected token after this
+}
diff --git a/tests/ui/parser/macro/macro-expand-to-field.stderr b/tests/ui/parser/macro/macro-expand-to-field.stderr
new file mode 100644
index 000000000..adcd032f5
--- /dev/null
+++ b/tests/ui/parser/macro/macro-expand-to-field.stderr
@@ -0,0 +1,74 @@
+error: unexpected token: `!`
+ --> $DIR/macro-expand-to-field.rs:16:10
+ |
+LL | field!(bar:u128),
+ | ^ unexpected token after this
+ |
+ = note: macros cannot expand to struct fields
+
+error: unexpected token: `!`
+ --> $DIR/macro-expand-to-field.rs:22:10
+ |
+LL | field!(recovers:()),
+ | ^ unexpected token after this
+ |
+ = note: macros cannot expand to struct fields
+
+error: unexpected token: `!`
+ --> $DIR/macro-expand-to-field.rs:28:12
+ |
+LL | variant!(whoops),
+ | ^ unexpected token after this
+ |
+ = note: macros cannot expand to enum variants
+
+error: unexpected token: `!`
+ --> $DIR/macro-expand-to-field.rs:34:12
+ |
+LL | variant!(recovers),
+ | ^ unexpected token after this
+ |
+ = note: macros cannot expand to enum variants
+
+error: unexpected token: `!`
+ --> $DIR/macro-expand-to-field.rs:39:14
+ |
+LL | field!(x:u32),
+ | ^ unexpected token after this
+ |
+ = note: macros cannot expand to struct fields
+
+error: unexpected token: `!`
+ --> $DIR/macro-expand-to-field.rs:48:14
+ |
+LL | field!(oopsies:()),
+ | ^ unexpected token after this
+ |
+ = note: macros cannot expand to struct fields
+
+error: unexpected token: `!`
+ --> $DIR/macro-expand-to-field.rs:52:14
+ |
+LL | field!(oopsies2:()),
+ | ^ unexpected token after this
+ |
+ = note: macros cannot expand to struct fields
+
+error: unexpected token: `!`
+ --> $DIR/macro-expand-to-field.rs:61:10
+ |
+LL | field!(oopsies:()),
+ | ^ unexpected token after this
+ |
+ = note: macros cannot expand to union fields
+
+error: unexpected token: `!`
+ --> $DIR/macro-expand-to-field.rs:66:10
+ |
+LL | field!(recovers:()),
+ | ^ unexpected token after this
+ |
+ = note: macros cannot expand to union fields
+
+error: aborting due to 9 previous errors
+
diff --git a/tests/ui/parser/macro/macro-expand-to-match-arm.rs b/tests/ui/parser/macro/macro-expand-to-match-arm.rs
new file mode 100644
index 000000000..39d1d065e
--- /dev/null
+++ b/tests/ui/parser/macro/macro-expand-to-match-arm.rs
@@ -0,0 +1,18 @@
+macro_rules! arm {
+ ($pattern:pat => $block:block) => {
+ $pattern => $block
+ };
+}
+
+fn main() {
+ let x = Some(1);
+ match x {
+ Some(1) => {},
+ arm!(None => {}),
+ //~^ NOTE macros cannot expand to match arms
+ //~| ERROR unexpected `,` in pattern
+ // doesn't recover
+ Some(2) => {},
+ _ => {},
+ };
+}
diff --git a/tests/ui/parser/macro/macro-expand-to-match-arm.stderr b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr
new file mode 100644
index 000000000..1a5f46968
--- /dev/null
+++ b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr
@@ -0,0 +1,10 @@
+error: unexpected `,` in pattern
+ --> $DIR/macro-expand-to-match-arm.rs:11:25
+ |
+LL | arm!(None => {}),
+ | ^
+ |
+ = note: macros cannot expand to match arms
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/pat-lt-bracket-3.rs b/tests/ui/parser/pat-lt-bracket-3.rs
index a8bdfd3fa..bd83fe8db 100644
--- a/tests/ui/parser/pat-lt-bracket-3.rs
+++ b/tests/ui/parser/pat-lt-bracket-3.rs
@@ -3,8 +3,7 @@ struct Foo<T>(T, T);
impl<T> Foo<T> {
fn foo(&self) {
match *self {
- Foo<T>(x, y) => {
- //~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<`
+ Foo<T>(x, y) => { //~ ERROR generic args in patterns require the turbofish syntax
println!("Goodbye, World!")
}
}
diff --git a/tests/ui/parser/pat-lt-bracket-3.stderr b/tests/ui/parser/pat-lt-bracket-3.stderr
index bacf868e3..afdf1e9a5 100644
--- a/tests/ui/parser/pat-lt-bracket-3.stderr
+++ b/tests/ui/parser/pat-lt-bracket-3.stderr
@@ -1,8 +1,13 @@
-error: expected one of `=>`, `@`, `if`, or `|`, found `<`
+error: generic args in patterns require the turbofish syntax
--> $DIR/pat-lt-bracket-3.rs:6:16
|
LL | Foo<T>(x, y) => {
- | ^ expected one of `=>`, `@`, `if`, or `|`
+ | ^
+ |
+help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
+ |
+LL | Foo::<T>(x, y) => {
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/parser/pat-lt-bracket-4.rs b/tests/ui/parser/pat-lt-bracket-4.rs
index de314f6c6..6d348b68c 100644
--- a/tests/ui/parser/pat-lt-bracket-4.rs
+++ b/tests/ui/parser/pat-lt-bracket-4.rs
@@ -5,7 +5,7 @@ enum BtNode {
fn main() {
let y = match 10 {
- Foo<T>::A(value) => value, //~ error: expected one of `=>`, `@`, `if`, or `|`, found `<`
+ Foo<T>::A(value) => value, //~ ERROR generic args in patterns require the turbofish syntax
Foo<T>::B => 7,
};
}
diff --git a/tests/ui/parser/pat-lt-bracket-4.stderr b/tests/ui/parser/pat-lt-bracket-4.stderr
index 911c276b9..b71a5ad93 100644
--- a/tests/ui/parser/pat-lt-bracket-4.stderr
+++ b/tests/ui/parser/pat-lt-bracket-4.stderr
@@ -1,8 +1,13 @@
-error: expected one of `=>`, `@`, `if`, or `|`, found `<`
+error: generic args in patterns require the turbofish syntax
--> $DIR/pat-lt-bracket-4.rs:8:12
|
LL | Foo<T>::A(value) => value,
- | ^ expected one of `=>`, `@`, `if`, or `|`
+ | ^
+ |
+help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
+ |
+LL | Foo::<T>::A(value) => value,
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/parser/ternary_operator.rs b/tests/ui/parser/ternary_operator.rs
new file mode 100644
index 000000000..23d537e77
--- /dev/null
+++ b/tests/ui/parser/ternary_operator.rs
@@ -0,0 +1,69 @@
+// A good chunk of these errors aren't shown to the user, but are still
+// required in the test for it to pass.
+
+fn a() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+ let x = 5 > 2 ? true : false;
+ //~^ ERROR Rust has no ternary operator
+ //~| HELP use an `if-else` expression instead
+ //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
+ //~| HELP the trait `Try` is not implemented for `{integer}`
+ //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
+ //~| HELP the trait `FromResidual<_>` is not implemented for `()`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE the `?` operator cannot be applied to type `{integer}`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE cannot use the `?` operator in a function that returns `()`
+ //~| NOTE in this expansion of desugaring of operator `?`
+}
+
+fn b() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+ let x = 5 > 2 ? { true } : { false };
+ //~^ ERROR Rust has no ternary operator
+ //~| HELP use an `if-else` expression instead
+ //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
+ //~| HELP the trait `Try` is not implemented for `{integer}`
+ //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
+ //~| HELP the trait `FromResidual<_>` is not implemented for `()`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE the `?` operator cannot be applied to type `{integer}`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE cannot use the `?` operator in a function that returns `()`
+ //~| NOTE in this expansion of desugaring of operator `?`
+}
+
+fn c() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+ let x = 5 > 2 ? f32::MAX : f32::MIN;
+ //~^ ERROR Rust has no ternary operator
+ //~| HELP use an `if-else` expression instead
+ //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
+ //~| HELP the trait `Try` is not implemented for `{integer}`
+ //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
+ //~| HELP the trait `FromResidual<_>` is not implemented for `()`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE the `?` operator cannot be applied to type `{integer}`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE cannot use the `?` operator in a function that returns `()`
+ //~| NOTE in this expansion of desugaring of operator `?`
+}
+
+fn main() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+ let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
+ //~^ ERROR Rust has no ternary operator
+ //~| HELP use an `if-else` expression instead
+ //~| ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
+ //~| NOTE expected one of `.`, `;`, `?`, `else`, or an operator
+ //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
+ //~| HELP the trait `Try` is not implemented for `{integer}`
+ //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
+ //~| HELP the trait `FromResidual<_>` is not implemented for `()`
+ //~| NOTE type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE the `?` operator cannot be applied to type `{integer}`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE in this expansion of desugaring of operator `?`
+ //~| NOTE cannot use the `?` operator in a function that returns `()`
+ //~| NOTE in this expansion of desugaring of operator `?`
+}
diff --git a/tests/ui/parser/ternary_operator.stderr b/tests/ui/parser/ternary_operator.stderr
new file mode 100644
index 000000000..af9565bbe
--- /dev/null
+++ b/tests/ui/parser/ternary_operator.stderr
@@ -0,0 +1,115 @@
+error: Rust has no ternary operator
+ --> $DIR/ternary_operator.rs:5:19
+ |
+LL | let x = 5 > 2 ? true : false;
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: use an `if-else` expression instead
+
+error: Rust has no ternary operator
+ --> $DIR/ternary_operator.rs:21:19
+ |
+LL | let x = 5 > 2 ? { true } : { false };
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: use an `if-else` expression instead
+
+error: Rust has no ternary operator
+ --> $DIR/ternary_operator.rs:37:19
+ |
+LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: use an `if-else` expression instead
+
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
+ --> $DIR/ternary_operator.rs:53:37
+ |
+LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
+ | ^ expected one of `.`, `;`, `?`, `else`, or an operator
+ |
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
+
+error: Rust has no ternary operator
+ --> $DIR/ternary_operator.rs:53:19
+ |
+LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: use an `if-else` expression instead
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/ternary_operator.rs:5:17
+ |
+LL | let x = 5 > 2 ? true : false;
+ | ^^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
+ --> $DIR/ternary_operator.rs:5:19
+ |
+LL | fn a() {
+ | ------ this function should return `Result` or `Option` to accept `?`
+LL | let x = 5 > 2 ? true : false;
+ | ^ cannot use the `?` operator in a function that returns `()`
+ |
+ = help: the trait `FromResidual<_>` is not implemented for `()`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/ternary_operator.rs:21:17
+ |
+LL | let x = 5 > 2 ? { true } : { false };
+ | ^^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
+ --> $DIR/ternary_operator.rs:21:19
+ |
+LL | fn b() {
+ | ------ this function should return `Result` or `Option` to accept `?`
+LL | let x = 5 > 2 ? { true } : { false };
+ | ^ cannot use the `?` operator in a function that returns `()`
+ |
+ = help: the trait `FromResidual<_>` is not implemented for `()`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/ternary_operator.rs:37:17
+ |
+LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
+ | ^^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
+ --> $DIR/ternary_operator.rs:37:19
+ |
+LL | fn c() {
+ | ------ this function should return `Result` or `Option` to accept `?`
+LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
+ | ^ cannot use the `?` operator in a function that returns `()`
+ |
+ = help: the trait `FromResidual<_>` is not implemented for `()`
+
+error[E0277]: the `?` operator can only be applied to values that implement `Try`
+ --> $DIR/ternary_operator.rs:53:17
+ |
+LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
+ | ^^^ the `?` operator cannot be applied to type `{integer}`
+ |
+ = help: the trait `Try` is not implemented for `{integer}`
+
+error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
+ --> $DIR/ternary_operator.rs:53:19
+ |
+LL | fn main() {
+ | --------- this function should return `Result` or `Option` to accept `?`
+LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
+ | ^ cannot use the `?` operator in a function that returns `()`
+ |
+ = help: the trait `FromResidual<_>` is not implemented for `()`
+
+error: aborting due to 13 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/parser/trait-object-delimiters.rs b/tests/ui/parser/trait-object-delimiters.rs
index c41cda187..e9b13defe 100644
--- a/tests/ui/parser/trait-object-delimiters.rs
+++ b/tests/ui/parser/trait-object-delimiters.rs
@@ -3,9 +3,9 @@
fn foo1(_: &dyn Drop + AsRef<str>) {} //~ ERROR ambiguous `+` in a type
//~^ ERROR only auto traits can be used as additional traits in a trait object
-fn foo2(_: &dyn (Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds
+fn foo2(_: &dyn (Drop + AsRef<str>)) {} //~ ERROR incorrect parentheses around trait bounds
-fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds
+fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} //~ ERROR incorrect parentheses around trait bounds
fn foo3(_: &dyn {Drop + AsRef<str>}) {} //~ ERROR expected parameter name, found `{`
//~^ ERROR expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{`
diff --git a/tests/ui/parser/trait-object-delimiters.stderr b/tests/ui/parser/trait-object-delimiters.stderr
index ccce3a805..519546750 100644
--- a/tests/ui/parser/trait-object-delimiters.stderr
+++ b/tests/ui/parser/trait-object-delimiters.stderr
@@ -4,28 +4,28 @@ error: ambiguous `+` in a type
LL | fn foo1(_: &dyn Drop + AsRef<str>) {}
| ^^^^^^^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(dyn Drop + AsRef<str>)`
-error: incorrect braces around trait bounds
+error: incorrect parentheses around trait bounds
--> $DIR/trait-object-delimiters.rs:6:17
|
LL | fn foo2(_: &dyn (Drop + AsRef<str>)) {}
| ^ ^
|
-help: remove the parentheses
+help: fix the parentheses
|
LL - fn foo2(_: &dyn (Drop + AsRef<str>)) {}
-LL + fn foo2(_: &dyn Drop + AsRef<str>) {}
+LL + fn foo2(_: &(dyn Drop + AsRef<str>)) {}
|
-error: incorrect braces around trait bounds
+error: incorrect parentheses around trait bounds
--> $DIR/trait-object-delimiters.rs:8:25
|
LL | fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {}
| ^ ^
|
-help: remove the parentheses
+help: fix the parentheses
|
LL - fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {}
-LL + fn foo2_no_space(_: &dyn Drop + AsRef<str>) {}
+LL + fn foo2_no_space(_: &(dyn Drop + AsRef<str>)) {}
|
error: expected parameter name, found `{`
diff --git a/tests/ui/parser/try-with-nonterminal-block.rs b/tests/ui/parser/try-with-nonterminal-block.rs
new file mode 100644
index 000000000..2a9652f2e
--- /dev/null
+++ b/tests/ui/parser/try-with-nonterminal-block.rs
@@ -0,0 +1,19 @@
+// check-pass
+// edition:2021
+
+#![feature(try_blocks)]
+
+macro_rules! create_try {
+ ($body:block) => {
+ try $body
+ };
+}
+
+fn main() {
+ let x: Option<&str> = create_try! {{
+ None?;
+ "Hello world"
+ }};
+
+ println!("{x:?}");
+}
diff --git a/tests/ui/parser/type-alias-where.stderr b/tests/ui/parser/type-alias-where.stderr
deleted file mode 100644
index fb8381792..000000000
--- a/tests/ui/parser/type-alias-where.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: where clauses are not allowed after the type for type aliases
- --> $DIR/type-alias-where.rs:6:15
- |
-LL | type Bar = () where u32: Copy;
- | ^^^^^^^^^^^^^^^
- |
- = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
-
-error: where clauses are not allowed after the type for type aliases
- --> $DIR/type-alias-where.rs:8:15
- |
-LL | type Baz = () where;
- | ^^^^^
- |
- = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/pattern/slice-array-infer.rs b/tests/ui/pattern/slice-array-infer.rs
new file mode 100644
index 000000000..f94a3dcfe
--- /dev/null
+++ b/tests/ui/pattern/slice-array-infer.rs
@@ -0,0 +1,27 @@
+// check-pass
+
+#![allow(unused_variables)]
+#![feature(generic_arg_infer)]
+
+struct Zeroes;
+impl Into<&'static [usize; 3]> for Zeroes {
+ fn into(self) -> &'static [usize; 3] {
+ &[0; 3]
+ }
+}
+impl Into<[usize; 3]> for Zeroes {
+ fn into(self) -> [usize; 3] {
+ [0; 3]
+ }
+}
+fn main() {
+ let [a, b, c] = Zeroes.into();
+ let [d, e, f] = <Zeroes as Into<&'static [usize; 3]>>::into(Zeroes);
+ let &[g, h, i] = Zeroes.into();
+ let [j, k, l]: [usize; _] = Zeroes.into();
+ let [m, n, o]: &[usize; _] = Zeroes.into();
+
+ // check the binding mode of these patterns:
+ let _: &[usize] = &[a, b, c, g, h, i, j, k, l];
+ let _: &[&usize] = &[d, e, f, m, n, o];
+}
diff --git a/tests/ui/pattern/slice-pattern-refutable.rs b/tests/ui/pattern/slice-pattern-refutable.rs
new file mode 100644
index 000000000..1be3c6ef8
--- /dev/null
+++ b/tests/ui/pattern/slice-pattern-refutable.rs
@@ -0,0 +1,36 @@
+// Test that we do not infer the expected types of patterns to an array
+// if we're in a refutable pattern.
+#![allow(unused_variables)]
+
+struct Zeroes;
+
+impl Into<[usize; 3]> for Zeroes {
+ fn into(self) -> [usize; 3] {
+ [0; 3]
+ }
+}
+
+fn let_else() {
+ let [a, b, c] = Zeroes.into() else {
+ //~^ ERROR type annotations needed
+ unreachable!();
+ };
+}
+
+fn if_let() {
+ if let [a, b, c] = Zeroes.into() {
+ //~^ ERROR type annotations needed
+ unreachable!();
+ }
+}
+
+fn if_let_else() {
+ if let [a, b, c] = Zeroes.into() {
+ //~^ ERROR type annotations needed
+ unreachable!();
+ } else {
+ unreachable!();
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/pattern/slice-pattern-refutable.stderr b/tests/ui/pattern/slice-pattern-refutable.stderr
new file mode 100644
index 000000000..df5b58d3e
--- /dev/null
+++ b/tests/ui/pattern/slice-pattern-refutable.stderr
@@ -0,0 +1,40 @@
+error[E0282]: type annotations needed
+ --> $DIR/slice-pattern-refutable.rs:14:9
+ |
+LL | let [a, b, c] = Zeroes.into() else {
+ | ^^^^^^^^^
+ |
+help: consider giving this pattern a type
+ |
+LL | let [a, b, c]: /* Type */ = Zeroes.into() else {
+ | ++++++++++++
+
+error[E0282]: type annotations needed
+ --> $DIR/slice-pattern-refutable.rs:21:31
+ |
+LL | if let [a, b, c] = Zeroes.into() {
+ | --------- ^^^^
+ | |
+ | type must be known at this point
+ |
+help: try using a fully qualified path to specify the expected types
+ |
+LL | if let [a, b, c] = <Zeroes as Into<T>>::into(Zeroes) {
+ | ++++++++++++++++++++++++++ ~
+
+error[E0282]: type annotations needed
+ --> $DIR/slice-pattern-refutable.rs:28:31
+ |
+LL | if let [a, b, c] = Zeroes.into() {
+ | --------- ^^^^
+ | |
+ | type must be known at this point
+ |
+help: try using a fully qualified path to specify the expected types
+ |
+LL | if let [a, b, c] = <Zeroes as Into<T>>::into(Zeroes) {
+ | ++++++++++++++++++++++++++ ~
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/pattern/slice-patterns-ambiguity.rs b/tests/ui/pattern/slice-patterns-ambiguity.rs
new file mode 100644
index 000000000..0fe24b0e5
--- /dev/null
+++ b/tests/ui/pattern/slice-patterns-ambiguity.rs
@@ -0,0 +1,47 @@
+#![allow(unused_variables)]
+
+struct Zeroes;
+
+const ARR: [usize; 2] = [0; 2];
+const ARR2: [usize; 2] = [2; 2];
+
+impl Into<&'static [usize; 2]> for Zeroes {
+ fn into(self) -> &'static [usize; 2] {
+ &ARR
+ }
+}
+
+impl Into<&'static [usize]> for Zeroes {
+ fn into(self) -> &'static [usize] {
+ &ARR2
+ }
+}
+
+fn let_decl() {
+ let &[a, b] = Zeroes.into();
+}
+
+fn let_else() {
+ let &[a, b] = Zeroes.into() else {
+ //~^ ERROR type annotations needed
+ unreachable!();
+ };
+}
+
+fn if_let() {
+ if let &[a, b] = Zeroes.into() {
+ //~^ ERROR type annotations needed
+ unreachable!();
+ }
+}
+
+fn if_let_else() {
+ if let &[a, b] = Zeroes.into() {
+ //~^ ERROR type annotations needed
+ unreachable!();
+ } else {
+ unreachable!();
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/pattern/slice-patterns-ambiguity.stderr b/tests/ui/pattern/slice-patterns-ambiguity.stderr
new file mode 100644
index 000000000..3ef99d0e2
--- /dev/null
+++ b/tests/ui/pattern/slice-patterns-ambiguity.stderr
@@ -0,0 +1,40 @@
+error[E0282]: type annotations needed for `&_`
+ --> $DIR/slice-patterns-ambiguity.rs:25:9
+ |
+LL | let &[a, b] = Zeroes.into() else {
+ | ^^^^^^^
+ |
+help: consider giving this pattern a type, where the placeholders `_` are specified
+ |
+LL | let &[a, b]: &_ = Zeroes.into() else {
+ | ++++
+
+error[E0282]: type annotations needed
+ --> $DIR/slice-patterns-ambiguity.rs:32:29
+ |
+LL | if let &[a, b] = Zeroes.into() {
+ | ------ ^^^^
+ | |
+ | type must be known at this point
+ |
+help: try using a fully qualified path to specify the expected types
+ |
+LL | if let &[a, b] = <Zeroes as Into<&_>>::into(Zeroes) {
+ | +++++++++++++++++++++++++++ ~
+
+error[E0282]: type annotations needed
+ --> $DIR/slice-patterns-ambiguity.rs:39:29
+ |
+LL | if let &[a, b] = Zeroes.into() {
+ | ------ ^^^^
+ | |
+ | type must be known at this point
+ |
+help: try using a fully qualified path to specify the expected types
+ |
+LL | if let &[a, b] = <Zeroes as Into<&_>>::into(Zeroes) {
+ | +++++++++++++++++++++++++++ ~
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/pattern/slice-patterns-irrefutable.rs b/tests/ui/pattern/slice-patterns-irrefutable.rs
new file mode 100644
index 000000000..bd230608e
--- /dev/null
+++ b/tests/ui/pattern/slice-patterns-irrefutable.rs
@@ -0,0 +1,74 @@
+// Test that we infer the expected type of a pattern to an array of the given length.
+
+#![allow(unused_variables)]
+
+use std::array::TryFromSliceError;
+use std::convert::TryInto;
+
+struct Zeroes;
+impl Into<[usize; 2]> for Zeroes {
+ fn into(self) -> [usize; 2] {
+ [0; 2]
+ }
+}
+impl Into<[usize; 3]> for Zeroes {
+ fn into(self) -> [usize; 3] {
+ [0; 3]
+ }
+}
+impl Into<[usize; 4]> for Zeroes {
+ fn into(self) -> [usize; 4] {
+ [0; 4]
+ }
+}
+
+fn zeroes_into() {
+ let [a, b, c] = Zeroes.into();
+ let [d, e, f]: [_; 3] = Zeroes.into();
+}
+
+fn array_try_from(x: &[usize]) -> Result<usize, TryFromSliceError> {
+ let [a, b] = x.try_into()?;
+ Ok(a + b)
+}
+
+fn destructuring_assignment() {
+ let a: i32;
+ let b;
+ [a, b] = Default::default();
+}
+
+fn test_nested_array() {
+ let a: [_; 3];
+ let b;
+ //~^ ERROR type annotations needed
+ [a, b] = Default::default();
+}
+
+fn test_nested_array_type_hint() {
+ let a: [_; 3];
+ let b;
+ [a, b] = Default::default();
+ let _: i32 = b[1];
+}
+
+fn test_working_nested_array() {
+ let a: i32;
+ [[a, _, _], _, _] = Default::default();
+}
+
+struct Foo<T>([T; 2]);
+
+impl<T: Default + Copy> Default for Foo<T> {
+ fn default() -> Self {
+ Foo([Default::default(); 2])
+ }
+}
+
+fn field_array() {
+ let a: i32;
+ let b;
+ Foo([a, b]) = Default::default();
+}
+
+fn main() {}
diff --git a/tests/ui/pattern/slice-patterns-irrefutable.stderr b/tests/ui/pattern/slice-patterns-irrefutable.stderr
new file mode 100644
index 000000000..fac99534f
--- /dev/null
+++ b/tests/ui/pattern/slice-patterns-irrefutable.stderr
@@ -0,0 +1,14 @@
+error[E0282]: type annotations needed for `[_; 3]`
+ --> $DIR/slice-patterns-irrefutable.rs:43:9
+ |
+LL | let b;
+ | ^
+ |
+help: consider giving `b` an explicit type, where the placeholders `_` are specified
+ |
+LL | let b: [_; 3];
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/pattern/slice-patterns-nested.rs b/tests/ui/pattern/slice-patterns-nested.rs
new file mode 100644
index 000000000..077e0a139
--- /dev/null
+++ b/tests/ui/pattern/slice-patterns-nested.rs
@@ -0,0 +1,15 @@
+// check-pass
+#![allow(unused_variables)]
+
+struct Zeroes;
+struct Foo<T>(T);
+
+impl Into<[usize; 3]> for Zeroes {
+ fn into(self) -> [usize; 3] {
+ [0; 3]
+ }
+}
+
+fn main() {
+ let Foo([a, b, c]) = Foo(Zeroes.into());
+}
diff --git a/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr b/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr
index 4ecc6370d..9df7f0ffd 100644
--- a/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr
+++ b/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr
@@ -9,8 +9,12 @@ LL |
LL | stuff(phantom_pinned)
| -------------- borrow later used here
|
- = note: consider using a `let` binding to create a longer lived value
= note: this error originates in the macro `pin` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider using a `let` binding to create a longer lived value
+ |
+LL ~ let binding = pin!(PhantomPinned);
+LL ~ let phantom_pinned = identity(binding);
+ |
error[E0716]: temporary value dropped while borrowed
--> $DIR/lifetime_errors_on_promotion_misusage.rs:18:30
diff --git a/tests/ui/privacy/issue-113860-1.rs b/tests/ui/privacy/issue-113860-1.rs
new file mode 100644
index 000000000..86ccca41f
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-1.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+pub trait Trait {
+ //~^ ERROR trait has missing stability attribute
+ fn fun() {}
+ //~^ ERROR associated function has missing stability attribute
+}
+
+impl Trait for u8 {
+ //~^ ERROR implementation has missing stability attribute
+ pub(self) fn fun() {}
+ //~^ ERROR visibility qualifiers are not permitted here [E0449]
+}
+
+fn main() {}
diff --git a/tests/ui/privacy/issue-113860-1.stderr b/tests/ui/privacy/issue-113860-1.stderr
new file mode 100644
index 000000000..c33ce26f0
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-1.stderr
@@ -0,0 +1,49 @@
+error[E0449]: visibility qualifiers are not permitted here
+ --> $DIR/issue-113860-1.rs:12:5
+ |
+LL | pub(self) fn fun() {}
+ | ^^^^^^^^^
+ |
+ = note: trait items always share the visibility of their trait
+
+error: module has missing stability attribute
+ --> $DIR/issue-113860-1.rs:1:1
+ |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | pub trait Trait {
+... |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: trait has missing stability attribute
+ --> $DIR/issue-113860-1.rs:4:1
+ |
+LL | / pub trait Trait {
+LL | |
+LL | | fn fun() {}
+LL | |
+LL | | }
+ | |_^
+
+error: implementation has missing stability attribute
+ --> $DIR/issue-113860-1.rs:10:1
+ |
+LL | / impl Trait for u8 {
+LL | |
+LL | | pub(self) fn fun() {}
+LL | |
+LL | | }
+ | |_^
+
+error: associated function has missing stability attribute
+ --> $DIR/issue-113860-1.rs:6:5
+ |
+LL | fn fun() {}
+ | ^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/tests/ui/privacy/issue-113860-2.rs b/tests/ui/privacy/issue-113860-2.rs
new file mode 100644
index 000000000..59be19d88
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-2.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+pub trait Trait {
+ //~^ ERROR trait has missing stability attribute
+ type X;
+ //~^ ERROR associated type has missing stability attribute
+}
+
+impl Trait for u8 {
+ //~^ ERROR implementation has missing stability attribute
+ pub(self) type X = Self;
+ //~^ ERROR visibility qualifiers are not permitted here [E0449]
+}
+
+fn main() {}
diff --git a/tests/ui/privacy/issue-113860-2.stderr b/tests/ui/privacy/issue-113860-2.stderr
new file mode 100644
index 000000000..6748bc276
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-2.stderr
@@ -0,0 +1,49 @@
+error[E0449]: visibility qualifiers are not permitted here
+ --> $DIR/issue-113860-2.rs:12:5
+ |
+LL | pub(self) type X = Self;
+ | ^^^^^^^^^
+ |
+ = note: trait items always share the visibility of their trait
+
+error: module has missing stability attribute
+ --> $DIR/issue-113860-2.rs:1:1
+ |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | pub trait Trait {
+... |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: trait has missing stability attribute
+ --> $DIR/issue-113860-2.rs:4:1
+ |
+LL | / pub trait Trait {
+LL | |
+LL | | type X;
+LL | |
+LL | | }
+ | |_^
+
+error: implementation has missing stability attribute
+ --> $DIR/issue-113860-2.rs:10:1
+ |
+LL | / impl Trait for u8 {
+LL | |
+LL | | pub(self) type X = Self;
+LL | |
+LL | | }
+ | |_^
+
+error: associated type has missing stability attribute
+ --> $DIR/issue-113860-2.rs:6:5
+ |
+LL | type X;
+ | ^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/tests/ui/privacy/issue-113860.rs b/tests/ui/privacy/issue-113860.rs
new file mode 100644
index 000000000..b94c14fac
--- /dev/null
+++ b/tests/ui/privacy/issue-113860.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+pub trait Trait {
+ //~^ ERROR trait has missing stability attribute
+ const X: u32;
+ //~^ ERROR associated constant has missing stability attribute
+}
+
+impl Trait for u8 {
+ //~^ ERROR implementation has missing stability attribute
+ pub(self) const X: u32 = 3;
+ //~^ ERROR visibility qualifiers are not permitted here [E0449]
+}
+
+fn main() {}
diff --git a/tests/ui/privacy/issue-113860.stderr b/tests/ui/privacy/issue-113860.stderr
new file mode 100644
index 000000000..3204f4ff9
--- /dev/null
+++ b/tests/ui/privacy/issue-113860.stderr
@@ -0,0 +1,49 @@
+error[E0449]: visibility qualifiers are not permitted here
+ --> $DIR/issue-113860.rs:12:5
+ |
+LL | pub(self) const X: u32 = 3;
+ | ^^^^^^^^^
+ |
+ = note: trait items always share the visibility of their trait
+
+error: module has missing stability attribute
+ --> $DIR/issue-113860.rs:1:1
+ |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | pub trait Trait {
+... |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: trait has missing stability attribute
+ --> $DIR/issue-113860.rs:4:1
+ |
+LL | / pub trait Trait {
+LL | |
+LL | | const X: u32;
+LL | |
+LL | | }
+ | |_^
+
+error: implementation has missing stability attribute
+ --> $DIR/issue-113860.rs:10:1
+ |
+LL | / impl Trait for u8 {
+LL | |
+LL | | pub(self) const X: u32 = 3;
+LL | |
+LL | | }
+ | |_^
+
+error: associated constant has missing stability attribute
+ --> $DIR/issue-113860.rs:6:5
+ |
+LL | const X: u32;
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/tests/ui/privacy/privacy2.rs b/tests/ui/privacy/privacy2.rs
index c8fa436bd..212bc003e 100644
--- a/tests/ui/privacy/privacy2.rs
+++ b/tests/ui/privacy/privacy2.rs
@@ -1,3 +1,5 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(start, no_core)]
#![no_core] // makes debugging this test *a lot* easier (during resolve)
diff --git a/tests/ui/privacy/privacy2.stderr b/tests/ui/privacy/privacy2.stderr
index c2a33ce1f..e7135d3fd 100644
--- a/tests/ui/privacy/privacy2.stderr
+++ b/tests/ui/privacy/privacy2.stderr
@@ -1,22 +1,22 @@
error[E0432]: unresolved import `bar::foo`
- --> $DIR/privacy2.rs:17:9
+ --> $DIR/privacy2.rs:19:9
|
LL | use bar::foo;
| ^^^^^^^^ no `foo` in `bar`
error[E0603]: function import `foo` is private
- --> $DIR/privacy2.rs:23:20
+ --> $DIR/privacy2.rs:25:20
|
LL | use bar::glob::foo;
| ^^^ private function import
|
note: the function import `foo` is defined here...
- --> $DIR/privacy2.rs:10:13
+ --> $DIR/privacy2.rs:12:13
|
LL | use foo;
| ^^^
note: ...and refers to the function `foo` which is defined here
- --> $DIR/privacy2.rs:14:1
+ --> $DIR/privacy2.rs:16:1
|
LL | pub fn foo() {}
| ^^^^^^^^^^^^ consider importing it directly
diff --git a/tests/ui/privacy/privacy3.rs b/tests/ui/privacy/privacy3.rs
index 5a7cd76a9..3466f5bb1 100644
--- a/tests/ui/privacy/privacy3.rs
+++ b/tests/ui/privacy/privacy3.rs
@@ -1,3 +1,5 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(start, no_core)]
#![no_core] // makes debugging this test *a lot* easier (during resolve)
diff --git a/tests/ui/privacy/privacy3.stderr b/tests/ui/privacy/privacy3.stderr
index 22c1e48b0..df66c8475 100644
--- a/tests/ui/privacy/privacy3.stderr
+++ b/tests/ui/privacy/privacy3.stderr
@@ -1,5 +1,5 @@
error[E0432]: unresolved import `bar::gpriv`
- --> $DIR/privacy3.rs:18:9
+ --> $DIR/privacy3.rs:20:9
|
LL | use bar::gpriv;
| ^^^^^^^^^^ no `gpriv` in `bar`
diff --git a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
index d1052ce35..5f8076fc8 100644
--- a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
+++ b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
@@ -9,7 +9,7 @@ note: required by a bound in `Sealed`
|
LL | pub trait Sealed: self::b::Hidden {
| ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
- = note: `Sealed` is a "sealed trait", because to implement it you also need to implelement `a::b::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = note: `Sealed` is a "sealed trait", because to implement it you also need to implement `a::b::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
error: aborting due to previous error
diff --git a/tests/ui/privacy/unnameable_types.rs b/tests/ui/privacy/unnameable_types.rs
index eae20dd9d..46e249152 100644
--- a/tests/ui/privacy/unnameable_types.rs
+++ b/tests/ui/privacy/unnameable_types.rs
@@ -11,12 +11,12 @@ mod m {
pub trait PubTr { //~ ERROR trait `PubTr` is reachable but cannot be named
const C : i32 = 0;
- type Alias; //~ ERROR associated type `PubTr::Alias` is reachable but cannot be named
+ type Alias;
fn f() {}
}
impl PubTr for PubStruct {
- type Alias = i32; //~ ERROR associated type `<PubStruct as PubTr>::Alias` is reachable but cannot be named
+ type Alias = i32;
fn f() {}
}
}
diff --git a/tests/ui/privacy/unnameable_types.stderr b/tests/ui/privacy/unnameable_types.stderr
index 25eb5c943..904127525 100644
--- a/tests/ui/privacy/unnameable_types.stderr
+++ b/tests/ui/privacy/unnameable_types.stderr
@@ -22,17 +22,5 @@ error: trait `PubTr` is reachable but cannot be named
LL | pub trait PubTr {
| ^^^^^^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
-error: associated type `PubTr::Alias` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:14:9
- |
-LL | type Alias;
- | ^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
-
-error: associated type `<PubStruct as PubTr>::Alias` is reachable but cannot be named
- --> $DIR/unnameable_types.rs:19:9
- |
-LL | type Alias = i32;
- | ^^^^^^^^^^ reachable at visibility `pub`, but can only be named at visibility `pub(crate)`
-
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
diff --git a/tests/ui/proc-macro/allowed-attr-stmt-expr.stdout b/tests/ui/proc-macro/allowed-attr-stmt-expr.stdout
index 091862de3..4f8730053 100644
--- a/tests/ui/proc-macro/allowed-attr-stmt-expr.stdout
+++ b/tests/ui/proc-macro/allowed-attr-stmt-expr.stdout
@@ -19,17 +19,17 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/allowed-attr-stmt-expr.rs:35:9: 35:10 (#11),
+ span: $DIR/allowed-attr-stmt-expr.rs:35:9: 35:10 (#10),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "rustc_dummy",
- span: $DIR/allowed-attr-stmt-expr.rs:35:11: 35:22 (#11),
+ span: $DIR/allowed-attr-stmt-expr.rs:35:11: 35:22 (#10),
},
],
- span: $DIR/allowed-attr-stmt-expr.rs:35:10: 35:23 (#11),
+ span: $DIR/allowed-attr-stmt-expr.rs:35:10: 35:23 (#10),
},
Ident {
ident: "struct",
@@ -206,17 +206,17 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/allowed-attr-stmt-expr.rs:35:9: 35:10 (#32),
+ span: $DIR/allowed-attr-stmt-expr.rs:35:9: 35:10 (#31),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "rustc_dummy",
- span: $DIR/allowed-attr-stmt-expr.rs:35:11: 35:22 (#32),
+ span: $DIR/allowed-attr-stmt-expr.rs:35:11: 35:22 (#31),
},
],
- span: $DIR/allowed-attr-stmt-expr.rs:35:10: 35:23 (#32),
+ span: $DIR/allowed-attr-stmt-expr.rs:35:10: 35:23 (#31),
},
Punct {
ch: '#',
diff --git a/tests/ui/proc-macro/attr-stmt-expr.stdout b/tests/ui/proc-macro/attr-stmt-expr.stdout
index f9b2305c7..c6d77e0ed 100644
--- a/tests/ui/proc-macro/attr-stmt-expr.stdout
+++ b/tests/ui/proc-macro/attr-stmt-expr.stdout
@@ -3,17 +3,17 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/attr-stmt-expr.rs:33:9: 33:10 (#8),
+ span: $DIR/attr-stmt-expr.rs:33:9: 33:10 (#7),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "rustc_dummy",
- span: $DIR/attr-stmt-expr.rs:33:11: 33:22 (#8),
+ span: $DIR/attr-stmt-expr.rs:33:11: 33:22 (#7),
},
],
- span: $DIR/attr-stmt-expr.rs:33:10: 33:23 (#8),
+ span: $DIR/attr-stmt-expr.rs:33:10: 33:23 (#7),
},
Ident {
ident: "struct",
@@ -190,17 +190,17 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/attr-stmt-expr.rs:33:9: 33:10 (#29),
+ span: $DIR/attr-stmt-expr.rs:33:9: 33:10 (#28),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "rustc_dummy",
- span: $DIR/attr-stmt-expr.rs:33:11: 33:22 (#29),
+ span: $DIR/attr-stmt-expr.rs:33:11: 33:22 (#28),
},
],
- span: $DIR/attr-stmt-expr.rs:33:10: 33:23 (#29),
+ span: $DIR/attr-stmt-expr.rs:33:10: 33:23 (#28),
},
Punct {
ch: '#',
diff --git a/tests/ui/proc-macro/auxiliary/issue-107113.rs b/tests/ui/proc-macro/auxiliary/issue-107113.rs
new file mode 100644
index 000000000..b27d3fd2f
--- /dev/null
+++ b/tests/ui/proc-macro/auxiliary/issue-107113.rs
@@ -0,0 +1,13 @@
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn main(_: TokenStream, item: TokenStream) -> TokenStream {
+ "fn main() -> std::io::Result<()> { () } ".parse().unwrap()
+}
diff --git a/tests/ui/proc-macro/capture-macro-rules-invoke.stdout b/tests/ui/proc-macro/capture-macro-rules-invoke.stdout
index b88fbd3e8..01d71ff98 100644
--- a/tests/ui/proc-macro/capture-macro-rules-invoke.stdout
+++ b/tests/ui/proc-macro/capture-macro-rules-invoke.stdout
@@ -8,7 +8,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:36:24: 36:28 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:21:21: 21:26 (#4),
+ span: $DIR/capture-macro-rules-invoke.rs:21:21: 21:26 (#3),
},
]
PRINT-BANG INPUT (DISPLAY): 1 + 1, { "a" }, let a = 1;, String, my_name, 'a, my_val = 30,
@@ -37,12 +37,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:38:17: 38:18 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:14:29: 14:34 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:14:29: 14:34 (#7),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:14:34: 14:35 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:14:34: 14:35 (#7),
},
Group {
delimiter: None,
@@ -60,12 +60,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:39:13: 39:20 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:14:36: 14:42 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:14:36: 14:42 (#7),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:14:42: 14:43 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:14:42: 14:43 (#7),
},
Group {
delimiter: None,
@@ -90,12 +90,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:40:21: 40:22 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:14:44: 14:49 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:14:44: 14:49 (#7),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:14:49: 14:50 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:14:49: 14:50 (#7),
},
Group {
delimiter: None,
@@ -105,12 +105,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:41:13: 41:19 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:14:51: 14:54 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:14:51: 14:54 (#7),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:14:54: 14:55 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:14:54: 14:55 (#7),
},
Ident {
ident: "my_name",
@@ -119,7 +119,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:14:62: 14:63 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:14:62: 14:63 (#7),
},
Group {
delimiter: None,
@@ -134,12 +134,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:43:13: 43:15 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:15:29: 15:38 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:29: 15:38 (#7),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:15:38: 15:39 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:38: 15:39 (#7),
},
Group {
delimiter: None,
@@ -160,12 +160,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:44:22: 44:24 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:15:40: 15:45 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:40: 15:45 (#7),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:15:45: 15:46 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:45: 15:46 (#7),
},
Group {
delimiter: None,
@@ -203,12 +203,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:45:26: 45:32 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:15:47: 15:52 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:47: 15:52 (#7),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:15:52: 15:53 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:52: 15:53 (#7),
},
Group {
delimiter: None,
@@ -246,12 +246,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:46:16: 46:31 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:15:54: 15:58 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:54: 15:58 (#7),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:15:58: 15:59 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:58: 15:59 (#7),
},
Group {
delimiter: Bracket,
@@ -274,7 +274,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/capture-macro-rules-invoke.rs:15:63: 15:64 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:63: 15:64 (#7),
},
Group {
delimiter: None,
@@ -291,7 +291,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:48:14: 48:16 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:15:65: 15:69 (#8),
+ span: $DIR/capture-macro-rules-invoke.rs:15:65: 15:69 (#7),
},
]
PRINT-BANG INPUT (DISPLAY): (a, b)
@@ -319,6 +319,6 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-macro-rules-invoke.rs:52:26: 52:32 (#0),
},
],
- span: $DIR/capture-macro-rules-invoke.rs:27:21: 27:25 (#12),
+ span: $DIR/capture-macro-rules-invoke.rs:27:21: 27:25 (#11),
},
]
diff --git a/tests/ui/proc-macro/capture-unglued-token.stdout b/tests/ui/proc-macro/capture-unglued-token.stdout
index 7e6b54033..a0d2178f0 100644
--- a/tests/ui/proc-macro/capture-unglued-token.stdout
+++ b/tests/ui/proc-macro/capture-unglued-token.stdout
@@ -23,6 +23,6 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/capture-unglued-token.rs:19:30: 19:31 (#0),
},
],
- span: $DIR/capture-unglued-token.rs:15:42: 15:48 (#4),
+ span: $DIR/capture-unglued-token.rs:15:42: 15:48 (#3),
},
]
diff --git a/tests/ui/proc-macro/derive-helper-shadowed.rs b/tests/ui/proc-macro/derive-helper-shadowed.rs
index e299454e0..ac14ece69 100644
--- a/tests/ui/proc-macro/derive-helper-shadowed.rs
+++ b/tests/ui/proc-macro/derive-helper-shadowed.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
// aux-build:test-macros.rs
// aux-build:derive-helper-shadowed-2.rs
diff --git a/tests/ui/proc-macro/derive-in-mod.rs b/tests/ui/proc-macro/derive-in-mod.rs
index 8b5d4e9d0..96e9d93fe 100644
--- a/tests/ui/proc-macro/derive-in-mod.rs
+++ b/tests/ui/proc-macro/derive-in-mod.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
// aux-build:test-macros.rs
extern crate test_macros;
diff --git a/tests/ui/proc-macro/dollar-crate-issue-57089.stdout b/tests/ui/proc-macro/dollar-crate-issue-57089.stdout
index 2622c005d..de4f0c000 100644
--- a/tests/ui/proc-macro/dollar-crate-issue-57089.stdout
+++ b/tests/ui/proc-macro/dollar-crate-issue-57089.stdout
@@ -2,79 +2,79 @@ PRINT-BANG INPUT (DISPLAY): struct M($crate :: S) ;
PRINT-BANG INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/dollar-crate-issue-57089.rs:17:13: 17:19 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:17:13: 17:19 (#3),
},
Ident {
ident: "M",
- span: $DIR/dollar-crate-issue-57089.rs:17:20: 17:21 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:17:20: 17:21 (#3),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/dollar-crate-issue-57089.rs:17:22: 17:28 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:17:22: 17:28 (#3),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/dollar-crate-issue-57089.rs:17:28: 17:29 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:17:28: 17:29 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/dollar-crate-issue-57089.rs:17:29: 17:30 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:17:29: 17:30 (#3),
},
Ident {
ident: "S",
- span: $DIR/dollar-crate-issue-57089.rs:17:30: 17:31 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:17:30: 17:31 (#3),
},
],
- span: $DIR/dollar-crate-issue-57089.rs:17:21: 17:32 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:17:21: 17:32 (#3),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/dollar-crate-issue-57089.rs:17:32: 17:33 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:17:32: 17:33 (#3),
},
]
PRINT-ATTR INPUT (DISPLAY): struct A($crate :: S) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/dollar-crate-issue-57089.rs:21:9: 21:15 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:21:9: 21:15 (#3),
},
Ident {
ident: "A",
- span: $DIR/dollar-crate-issue-57089.rs:21:16: 21:17 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:21:16: 21:17 (#3),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/dollar-crate-issue-57089.rs:21:18: 21:24 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:21:18: 21:24 (#3),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/dollar-crate-issue-57089.rs:21:24: 21:25 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:21:24: 21:25 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/dollar-crate-issue-57089.rs:21:25: 21:26 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:21:25: 21:26 (#3),
},
Ident {
ident: "S",
- span: $DIR/dollar-crate-issue-57089.rs:21:26: 21:27 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:21:26: 21:27 (#3),
},
],
- span: $DIR/dollar-crate-issue-57089.rs:21:17: 21:28 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:21:17: 21:28 (#3),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/dollar-crate-issue-57089.rs:21:28: 21:29 (#4),
+ span: $DIR/dollar-crate-issue-57089.rs:21:28: 21:29 (#3),
},
]
diff --git a/tests/ui/proc-macro/dollar-crate-issue-62325.stdout b/tests/ui/proc-macro/dollar-crate-issue-62325.stdout
index a91908239..c7e72bf4f 100644
--- a/tests/ui/proc-macro/dollar-crate-issue-62325.stdout
+++ b/tests/ui/proc-macro/dollar-crate-issue-62325.stdout
@@ -2,109 +2,109 @@ PRINT-ATTR INPUT (DISPLAY): struct A(identity! ($crate :: S)) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/dollar-crate-issue-62325.rs:19:5: 19:11 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:5: 19:11 (#3),
},
Ident {
ident: "A",
- span: $DIR/dollar-crate-issue-62325.rs:19:12: 19:13 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:12: 19:13 (#3),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "identity",
- span: $DIR/dollar-crate-issue-62325.rs:19:14: 19:22 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:14: 19:22 (#3),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/dollar-crate-issue-62325.rs:19:22: 19:23 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:22: 19:23 (#3),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/dollar-crate-issue-62325.rs:19:24: 19:30 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:24: 19:30 (#3),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/dollar-crate-issue-62325.rs:19:30: 19:31 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:30: 19:31 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/dollar-crate-issue-62325.rs:19:31: 19:32 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:31: 19:32 (#3),
},
Ident {
ident: "S",
- span: $DIR/dollar-crate-issue-62325.rs:19:32: 19:33 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:32: 19:33 (#3),
},
],
- span: $DIR/dollar-crate-issue-62325.rs:19:23: 19:34 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:23: 19:34 (#3),
},
],
- span: $DIR/dollar-crate-issue-62325.rs:19:13: 19:35 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:13: 19:35 (#3),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/dollar-crate-issue-62325.rs:19:35: 19:36 (#4),
+ span: $DIR/dollar-crate-issue-62325.rs:19:35: 19:36 (#3),
},
]
PRINT-ATTR INPUT (DISPLAY): struct B(identity! ($crate :: S)) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/auxiliary/dollar-crate-external.rs:21:5: 21:11 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:5: 21:11 (#11),
},
Ident {
ident: "B",
- span: $DIR/auxiliary/dollar-crate-external.rs:21:12: 21:13 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:12: 21:13 (#11),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "identity",
- span: $DIR/auxiliary/dollar-crate-external.rs:21:14: 21:22 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:14: 21:22 (#11),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/auxiliary/dollar-crate-external.rs:21:22: 21:23 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:22: 21:23 (#11),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/auxiliary/dollar-crate-external.rs:21:24: 21:30 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:24: 21:30 (#11),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/auxiliary/dollar-crate-external.rs:21:30: 21:31 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:30: 21:31 (#11),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/auxiliary/dollar-crate-external.rs:21:31: 21:32 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:31: 21:32 (#11),
},
Ident {
ident: "S",
- span: $DIR/auxiliary/dollar-crate-external.rs:21:32: 21:33 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:32: 21:33 (#11),
},
],
- span: $DIR/auxiliary/dollar-crate-external.rs:21:23: 21:34 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:23: 21:34 (#11),
},
],
- span: $DIR/auxiliary/dollar-crate-external.rs:21:13: 21:35 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:13: 21:35 (#11),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/auxiliary/dollar-crate-external.rs:21:35: 21:36 (#12),
+ span: $DIR/auxiliary/dollar-crate-external.rs:21:35: 21:36 (#11),
},
]
diff --git a/tests/ui/proc-macro/dollar-crate.stdout b/tests/ui/proc-macro/dollar-crate.stdout
index 4e169d47e..0f5f87cec 100644
--- a/tests/ui/proc-macro/dollar-crate.stdout
+++ b/tests/ui/proc-macro/dollar-crate.stdout
@@ -2,239 +2,239 @@ PRINT-BANG INPUT (DISPLAY): struct M($crate :: S) ;
PRINT-BANG INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/dollar-crate.rs:20:17: 20:23 (#4),
+ span: $DIR/dollar-crate.rs:20:17: 20:23 (#3),
},
Ident {
ident: "M",
- span: $DIR/dollar-crate.rs:20:24: 20:25 (#4),
+ span: $DIR/dollar-crate.rs:20:24: 20:25 (#3),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/dollar-crate.rs:20:26: 20:32 (#4),
+ span: $DIR/dollar-crate.rs:20:26: 20:32 (#3),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/dollar-crate.rs:20:32: 20:33 (#4),
+ span: $DIR/dollar-crate.rs:20:32: 20:33 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/dollar-crate.rs:20:33: 20:34 (#4),
+ span: $DIR/dollar-crate.rs:20:33: 20:34 (#3),
},
Ident {
ident: "S",
- span: $DIR/dollar-crate.rs:20:34: 20:35 (#4),
+ span: $DIR/dollar-crate.rs:20:34: 20:35 (#3),
},
],
- span: $DIR/dollar-crate.rs:20:25: 20:36 (#4),
+ span: $DIR/dollar-crate.rs:20:25: 20:36 (#3),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/dollar-crate.rs:20:36: 20:37 (#4),
+ span: $DIR/dollar-crate.rs:20:36: 20:37 (#3),
},
]
PRINT-ATTR INPUT (DISPLAY): struct A($crate :: S) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/dollar-crate.rs:24:13: 24:19 (#4),
+ span: $DIR/dollar-crate.rs:24:13: 24:19 (#3),
},
Ident {
ident: "A",
- span: $DIR/dollar-crate.rs:24:20: 24:21 (#4),
+ span: $DIR/dollar-crate.rs:24:20: 24:21 (#3),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/dollar-crate.rs:24:22: 24:28 (#4),
+ span: $DIR/dollar-crate.rs:24:22: 24:28 (#3),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/dollar-crate.rs:24:28: 24:29 (#4),
+ span: $DIR/dollar-crate.rs:24:28: 24:29 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/dollar-crate.rs:24:29: 24:30 (#4),
+ span: $DIR/dollar-crate.rs:24:29: 24:30 (#3),
},
Ident {
ident: "S",
- span: $DIR/dollar-crate.rs:24:30: 24:31 (#4),
+ span: $DIR/dollar-crate.rs:24:30: 24:31 (#3),
},
],
- span: $DIR/dollar-crate.rs:24:21: 24:32 (#4),
+ span: $DIR/dollar-crate.rs:24:21: 24:32 (#3),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/dollar-crate.rs:24:32: 24:33 (#4),
+ span: $DIR/dollar-crate.rs:24:32: 24:33 (#3),
},
]
PRINT-DERIVE INPUT (DISPLAY): struct D($crate :: S) ;
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/dollar-crate.rs:27:13: 27:19 (#4),
+ span: $DIR/dollar-crate.rs:27:13: 27:19 (#3),
},
Ident {
ident: "D",
- span: $DIR/dollar-crate.rs:27:20: 27:21 (#4),
+ span: $DIR/dollar-crate.rs:27:20: 27:21 (#3),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/dollar-crate.rs:27:22: 27:28 (#4),
+ span: $DIR/dollar-crate.rs:27:22: 27:28 (#3),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/dollar-crate.rs:27:28: 27:29 (#4),
+ span: $DIR/dollar-crate.rs:27:28: 27:29 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/dollar-crate.rs:27:29: 27:30 (#4),
+ span: $DIR/dollar-crate.rs:27:29: 27:30 (#3),
},
Ident {
ident: "S",
- span: $DIR/dollar-crate.rs:27:30: 27:31 (#4),
+ span: $DIR/dollar-crate.rs:27:30: 27:31 (#3),
},
],
- span: $DIR/dollar-crate.rs:27:21: 27:32 (#4),
+ span: $DIR/dollar-crate.rs:27:21: 27:32 (#3),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/dollar-crate.rs:27:32: 27:33 (#4),
+ span: $DIR/dollar-crate.rs:27:32: 27:33 (#3),
},
]
PRINT-BANG INPUT (DISPLAY): struct M($crate :: S) ;
PRINT-BANG INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/auxiliary/dollar-crate-external.rs:7:13: 7:19 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:7:13: 7:19 (#14),
},
Ident {
ident: "M",
- span: $DIR/auxiliary/dollar-crate-external.rs:7:20: 7:21 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:7:20: 7:21 (#14),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/auxiliary/dollar-crate-external.rs:7:22: 7:28 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:7:22: 7:28 (#14),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/auxiliary/dollar-crate-external.rs:7:28: 7:29 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:7:28: 7:29 (#14),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/auxiliary/dollar-crate-external.rs:7:29: 7:30 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:7:29: 7:30 (#14),
},
Ident {
ident: "S",
- span: $DIR/auxiliary/dollar-crate-external.rs:7:30: 7:31 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:7:30: 7:31 (#14),
},
],
- span: $DIR/auxiliary/dollar-crate-external.rs:7:21: 7:32 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:7:21: 7:32 (#14),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/auxiliary/dollar-crate-external.rs:7:32: 7:33 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:7:32: 7:33 (#14),
},
]
PRINT-ATTR INPUT (DISPLAY): struct A($crate :: S) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/auxiliary/dollar-crate-external.rs:11:9: 11:15 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:11:9: 11:15 (#14),
},
Ident {
ident: "A",
- span: $DIR/auxiliary/dollar-crate-external.rs:11:16: 11:17 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:11:16: 11:17 (#14),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/auxiliary/dollar-crate-external.rs:11:18: 11:24 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:11:18: 11:24 (#14),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/auxiliary/dollar-crate-external.rs:11:24: 11:25 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:11:24: 11:25 (#14),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/auxiliary/dollar-crate-external.rs:11:25: 11:26 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:11:25: 11:26 (#14),
},
Ident {
ident: "S",
- span: $DIR/auxiliary/dollar-crate-external.rs:11:26: 11:27 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:11:26: 11:27 (#14),
},
],
- span: $DIR/auxiliary/dollar-crate-external.rs:11:17: 11:28 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:11:17: 11:28 (#14),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/auxiliary/dollar-crate-external.rs:11:28: 11:29 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:11:28: 11:29 (#14),
},
]
PRINT-DERIVE INPUT (DISPLAY): struct D($crate :: S) ;
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/auxiliary/dollar-crate-external.rs:14:9: 14:15 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:14:9: 14:15 (#14),
},
Ident {
ident: "D",
- span: $DIR/auxiliary/dollar-crate-external.rs:14:16: 14:17 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:14:16: 14:17 (#14),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
- span: $DIR/auxiliary/dollar-crate-external.rs:14:18: 14:24 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:14:18: 14:24 (#14),
},
Punct {
ch: ':',
spacing: Joint,
- span: $DIR/auxiliary/dollar-crate-external.rs:14:24: 14:25 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:14:24: 14:25 (#14),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/auxiliary/dollar-crate-external.rs:14:25: 14:26 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:14:25: 14:26 (#14),
},
Ident {
ident: "S",
- span: $DIR/auxiliary/dollar-crate-external.rs:14:26: 14:27 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:14:26: 14:27 (#14),
},
],
- span: $DIR/auxiliary/dollar-crate-external.rs:14:17: 14:28 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:14:17: 14:28 (#14),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/auxiliary/dollar-crate-external.rs:14:28: 14:29 (#15),
+ span: $DIR/auxiliary/dollar-crate-external.rs:14:28: 14:29 (#14),
},
]
diff --git a/tests/ui/proc-macro/edition-imports-2018.rs b/tests/ui/proc-macro/edition-imports-2018.rs
index 5a77cd4ef..765673531 100644
--- a/tests/ui/proc-macro/edition-imports-2018.rs
+++ b/tests/ui/proc-macro/edition-imports-2018.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
// edition:2018
// aux-build:edition-imports-2015.rs
diff --git a/tests/ui/proc-macro/expand-to-derive.stdout b/tests/ui/proc-macro/expand-to-derive.stdout
index a6437982a..39f009183 100644
--- a/tests/ui/proc-macro/expand-to-derive.stdout
+++ b/tests/ui/proc-macro/expand-to-derive.stdout
@@ -6,35 +6,35 @@ PRINT-DERIVE INPUT (DISPLAY): struct Foo
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/expand-to-derive.rs:16:9: 16:15 (#4),
+ span: $DIR/expand-to-derive.rs:16:9: 16:15 (#3),
},
Ident {
ident: "Foo",
- span: $DIR/expand-to-derive.rs:16:16: 16:19 (#4),
+ span: $DIR/expand-to-derive.rs:16:16: 16:19 (#3),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "field",
- span: $DIR/expand-to-derive.rs:18:13: 18:18 (#4),
+ span: $DIR/expand-to-derive.rs:18:13: 18:18 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/expand-to-derive.rs:18:18: 18:19 (#4),
+ span: $DIR/expand-to-derive.rs:18:18: 18:19 (#3),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "bool",
- span: $DIR/expand-to-derive.rs:18:21: 18:25 (#4),
+ span: $DIR/expand-to-derive.rs:18:21: 18:25 (#3),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/expand-to-derive.rs:18:25: 18:26 (#4),
+ span: $DIR/expand-to-derive.rs:18:25: 18:26 (#3),
},
Group {
delimiter: Brace,
@@ -90,15 +90,15 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
kind: Integer,
symbol: "0",
suffix: None,
- span: $DIR/expand-to-derive.rs:20:17: 20:18 (#4),
+ span: $DIR/expand-to-derive.rs:20:17: 20:18 (#3),
},
],
- span: $DIR/expand-to-derive.rs:18:27: 21:14 (#4),
+ span: $DIR/expand-to-derive.rs:18:27: 21:14 (#3),
},
],
- span: $DIR/expand-to-derive.rs:18:20: 21:15 (#4),
+ span: $DIR/expand-to-derive.rs:18:20: 21:15 (#3),
},
],
- span: $DIR/expand-to-derive.rs:16:20: 22:10 (#4),
+ span: $DIR/expand-to-derive.rs:16:20: 22:10 (#3),
},
]
diff --git a/tests/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout b/tests/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout
index 686d53e88..40181efc0 100644
--- a/tests/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout
+++ b/tests/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout
@@ -3,39 +3,39 @@ PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = #[allow(warning
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "enum",
- span: #4 bytes(299..303),
+ span: #3 bytes(299..303),
},
Ident {
ident: "E",
- span: #4 bytes(304..305),
+ span: #3 bytes(304..305),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "V",
- span: #4 bytes(320..321),
+ span: #3 bytes(320..321),
},
Punct {
ch: '=',
spacing: Alone,
- span: #4 bytes(322..323),
+ span: #3 bytes(322..323),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "let",
- span: #4 bytes(326..329),
+ span: #3 bytes(326..329),
},
Ident {
ident: "_",
- span: #4 bytes(330..331),
+ span: #3 bytes(330..331),
},
Punct {
ch: '=',
spacing: Alone,
- span: #4 bytes(332..333),
+ span: #3 bytes(332..333),
},
Group {
delimiter: None,
@@ -97,29 +97,29 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
span: #0 bytes(560..561),
},
],
- span: #4 bytes(334..339),
+ span: #3 bytes(334..339),
},
Punct {
ch: ';',
spacing: Alone,
- span: #4 bytes(339..340),
+ span: #3 bytes(339..340),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: #4 bytes(341..342),
+ span: #3 bytes(341..342),
},
],
- span: #4 bytes(324..344),
+ span: #3 bytes(324..344),
},
Punct {
ch: ',',
spacing: Alone,
- span: #4 bytes(344..345),
+ span: #3 bytes(344..345),
},
],
- span: #4 bytes(306..355),
+ span: #3 bytes(306..355),
},
]
PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { 0; } ; 0 }, }
@@ -127,39 +127,39 @@ PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { 0 } ; 0 }, }
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "enum",
- span: #8 bytes(423..427),
+ span: #7 bytes(423..427),
},
Ident {
ident: "E",
- span: #8 bytes(428..429),
+ span: #7 bytes(428..429),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "V",
- span: #8 bytes(444..445),
+ span: #7 bytes(444..445),
},
Punct {
ch: '=',
spacing: Alone,
- span: #8 bytes(446..447),
+ span: #7 bytes(446..447),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "let",
- span: #8 bytes(450..453),
+ span: #7 bytes(450..453),
},
Ident {
ident: "_",
- span: #8 bytes(454..455),
+ span: #7 bytes(454..455),
},
Punct {
ch: '=',
spacing: Alone,
- span: #8 bytes(456..457),
+ span: #7 bytes(456..457),
},
Group {
delimiter: Brace,
@@ -174,71 +174,71 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
span: #0 bytes(578..579),
},
],
- span: #8 bytes(460..465),
+ span: #7 bytes(460..465),
},
],
- span: #8 bytes(458..467),
+ span: #7 bytes(458..467),
},
Punct {
ch: ';',
spacing: Alone,
- span: #8 bytes(467..468),
+ span: #7 bytes(467..468),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: #8 bytes(469..470),
+ span: #7 bytes(469..470),
},
],
- span: #8 bytes(448..472),
+ span: #7 bytes(448..472),
},
Punct {
ch: ',',
spacing: Alone,
- span: #8 bytes(472..473),
+ span: #7 bytes(472..473),
},
],
- span: #8 bytes(430..483),
+ span: #7 bytes(430..483),
},
]
PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { {} } ; 0 }, }
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "enum",
- span: #12 bytes(423..427),
+ span: #11 bytes(423..427),
},
Ident {
ident: "E",
- span: #12 bytes(428..429),
+ span: #11 bytes(428..429),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "V",
- span: #12 bytes(444..445),
+ span: #11 bytes(444..445),
},
Punct {
ch: '=',
spacing: Alone,
- span: #12 bytes(446..447),
+ span: #11 bytes(446..447),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "let",
- span: #12 bytes(450..453),
+ span: #11 bytes(450..453),
},
Ident {
ident: "_",
- span: #12 bytes(454..455),
+ span: #11 bytes(454..455),
},
Punct {
ch: '=',
spacing: Alone,
- span: #12 bytes(456..457),
+ span: #11 bytes(456..457),
},
Group {
delimiter: Brace,
@@ -252,32 +252,32 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
span: #0 bytes(596..598),
},
],
- span: #12 bytes(460..465),
+ span: #11 bytes(460..465),
},
],
- span: #12 bytes(458..467),
+ span: #11 bytes(458..467),
},
Punct {
ch: ';',
spacing: Alone,
- span: #12 bytes(467..468),
+ span: #11 bytes(467..468),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: #12 bytes(469..470),
+ span: #11 bytes(469..470),
},
],
- span: #12 bytes(448..472),
+ span: #11 bytes(448..472),
},
Punct {
ch: ',',
spacing: Alone,
- span: #12 bytes(472..473),
+ span: #11 bytes(472..473),
},
],
- span: #12 bytes(430..483),
+ span: #11 bytes(430..483),
},
]
PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { PATH; } ; 0 }, }
@@ -285,39 +285,39 @@ PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { PATH } ; 0 },
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "enum",
- span: #16 bytes(423..427),
+ span: #15 bytes(423..427),
},
Ident {
ident: "E",
- span: #16 bytes(428..429),
+ span: #15 bytes(428..429),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "V",
- span: #16 bytes(444..445),
+ span: #15 bytes(444..445),
},
Punct {
ch: '=',
spacing: Alone,
- span: #16 bytes(446..447),
+ span: #15 bytes(446..447),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "let",
- span: #16 bytes(450..453),
+ span: #15 bytes(450..453),
},
Ident {
ident: "_",
- span: #16 bytes(454..455),
+ span: #15 bytes(454..455),
},
Punct {
ch: '=',
spacing: Alone,
- span: #16 bytes(456..457),
+ span: #15 bytes(456..457),
},
Group {
delimiter: Brace,
@@ -330,32 +330,32 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
span: #0 bytes(615..619),
},
],
- span: #16 bytes(460..465),
+ span: #15 bytes(460..465),
},
],
- span: #16 bytes(458..467),
+ span: #15 bytes(458..467),
},
Punct {
ch: ';',
spacing: Alone,
- span: #16 bytes(467..468),
+ span: #15 bytes(467..468),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: #16 bytes(469..470),
+ span: #15 bytes(469..470),
},
],
- span: #16 bytes(448..472),
+ span: #15 bytes(448..472),
},
Punct {
ch: ',',
spacing: Alone,
- span: #16 bytes(472..473),
+ span: #15 bytes(472..473),
},
],
- span: #16 bytes(430..483),
+ span: #15 bytes(430..483),
},
]
PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { 0 + 1; } ; 0 }, }
@@ -363,39 +363,39 @@ PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { 0 + 1 } ; 0 }
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "enum",
- span: #20 bytes(423..427),
+ span: #19 bytes(423..427),
},
Ident {
ident: "E",
- span: #20 bytes(428..429),
+ span: #19 bytes(428..429),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "V",
- span: #20 bytes(444..445),
+ span: #19 bytes(444..445),
},
Punct {
ch: '=',
spacing: Alone,
- span: #20 bytes(446..447),
+ span: #19 bytes(446..447),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "let",
- span: #20 bytes(450..453),
+ span: #19 bytes(450..453),
},
Ident {
ident: "_",
- span: #20 bytes(454..455),
+ span: #19 bytes(454..455),
},
Punct {
ch: '=',
spacing: Alone,
- span: #20 bytes(456..457),
+ span: #19 bytes(456..457),
},
Group {
delimiter: Brace,
@@ -421,32 +421,32 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
span: #0 bytes(640..641),
},
],
- span: #20 bytes(460..465),
+ span: #19 bytes(460..465),
},
],
- span: #20 bytes(458..467),
+ span: #19 bytes(458..467),
},
Punct {
ch: ';',
spacing: Alone,
- span: #20 bytes(467..468),
+ span: #19 bytes(467..468),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: #20 bytes(469..470),
+ span: #19 bytes(469..470),
},
],
- span: #20 bytes(448..472),
+ span: #19 bytes(448..472),
},
Punct {
ch: ',',
spacing: Alone,
- span: #20 bytes(472..473),
+ span: #19 bytes(472..473),
},
],
- span: #20 bytes(430..483),
+ span: #19 bytes(430..483),
},
]
PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { PATH + 1; } ; 0 }, }
@@ -454,39 +454,39 @@ PRINT-DERIVE DEEP-RE-COLLECTED (DISPLAY): enum E { V = { let _ = { PATH + 1 } ;
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "enum",
- span: #24 bytes(423..427),
+ span: #23 bytes(423..427),
},
Ident {
ident: "E",
- span: #24 bytes(428..429),
+ span: #23 bytes(428..429),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "V",
- span: #24 bytes(444..445),
+ span: #23 bytes(444..445),
},
Punct {
ch: '=',
spacing: Alone,
- span: #24 bytes(446..447),
+ span: #23 bytes(446..447),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "let",
- span: #24 bytes(450..453),
+ span: #23 bytes(450..453),
},
Ident {
ident: "_",
- span: #24 bytes(454..455),
+ span: #23 bytes(454..455),
},
Punct {
ch: '=',
spacing: Alone,
- span: #24 bytes(456..457),
+ span: #23 bytes(456..457),
},
Group {
delimiter: Brace,
@@ -510,31 +510,31 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
span: #0 bytes(665..666),
},
],
- span: #24 bytes(460..465),
+ span: #23 bytes(460..465),
},
],
- span: #24 bytes(458..467),
+ span: #23 bytes(458..467),
},
Punct {
ch: ';',
spacing: Alone,
- span: #24 bytes(467..468),
+ span: #23 bytes(467..468),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: #24 bytes(469..470),
+ span: #23 bytes(469..470),
},
],
- span: #24 bytes(448..472),
+ span: #23 bytes(448..472),
},
Punct {
ch: ',',
spacing: Alone,
- span: #24 bytes(472..473),
+ span: #23 bytes(472..473),
},
],
- span: #24 bytes(430..483),
+ span: #23 bytes(430..483),
},
]
diff --git a/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs b/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs
index a6e64e1b1..38f61c36c 100644
--- a/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs
+++ b/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
// edition:2018
extern crate proc_macro;
diff --git a/tests/ui/proc-macro/helper-attr-blocked-by-import.rs b/tests/ui/proc-macro/helper-attr-blocked-by-import.rs
index 2e20a3de6..344323122 100644
--- a/tests/ui/proc-macro/helper-attr-blocked-by-import.rs
+++ b/tests/ui/proc-macro/helper-attr-blocked-by-import.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
// aux-build:test-macros.rs
#[macro_use(Empty)]
diff --git a/tests/ui/proc-macro/input-interpolated.stdout b/tests/ui/proc-macro/input-interpolated.stdout
index 34566c780..6a8789b2c 100644
--- a/tests/ui/proc-macro/input-interpolated.stdout
+++ b/tests/ui/proc-macro/input-interpolated.stdout
@@ -9,7 +9,7 @@ PRINT-ATTR INPUT (DISPLAY): const A : u8 = 0 ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "const",
- span: #4 bytes(416..421),
+ span: #3 bytes(416..421),
},
Ident {
ident: "A",
@@ -18,34 +18,34 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: ':',
spacing: Alone,
- span: #4 bytes(424..425),
+ span: #3 bytes(424..425),
},
Ident {
ident: "u8",
- span: #4 bytes(426..428),
+ span: #3 bytes(426..428),
},
Punct {
ch: '=',
spacing: Alone,
- span: #4 bytes(429..430),
+ span: #3 bytes(429..430),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: #4 bytes(431..432),
+ span: #3 bytes(431..432),
},
Punct {
ch: ';',
spacing: Alone,
- span: #4 bytes(432..433),
+ span: #3 bytes(432..433),
},
]
PRINT-DERIVE INPUT (DISPLAY): struct A {}
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: #4 bytes(468..474),
+ span: #3 bytes(468..474),
},
Ident {
ident: "A",
@@ -54,6 +54,6 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Group {
delimiter: Brace,
stream: TokenStream [],
- span: #4 bytes(478..480),
+ span: #3 bytes(478..480),
},
]
diff --git a/tests/ui/proc-macro/issue-107113-wrap.rs b/tests/ui/proc-macro/issue-107113-wrap.rs
new file mode 100644
index 000000000..bc5b44963
--- /dev/null
+++ b/tests/ui/proc-macro/issue-107113-wrap.rs
@@ -0,0 +1,8 @@
+// edition:2021
+// aux-build:issue-107113.rs
+
+#[macro_use]
+extern crate issue_107113;
+
+#[issue_107113::main] //~ ERROR mismatched types [E0308]
+async fn main() -> std::io::Result<()> {}
diff --git a/tests/ui/proc-macro/issue-107113-wrap.stderr b/tests/ui/proc-macro/issue-107113-wrap.stderr
new file mode 100644
index 000000000..4122253d2
--- /dev/null
+++ b/tests/ui/proc-macro/issue-107113-wrap.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-107113-wrap.rs:7:1
+ |
+LL | #[issue_107113::main]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | expected `Result<(), Error>`, found `()`
+ | expected `Result<(), std::io::Error>` because of return type
+ |
+ = note: expected enum `Result<(), std::io::Error>`
+ found unit type `()`
+ = note: this error originates in the attribute macro `issue_107113::main` (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 E0308`.
diff --git a/tests/ui/proc-macro/issue-53481.rs b/tests/ui/proc-macro/issue-53481.rs
index ae10a3baa..922e60a4c 100644
--- a/tests/ui/proc-macro/issue-53481.rs
+++ b/tests/ui/proc-macro/issue-53481.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
// aux-build:test-macros.rs
#[macro_use]
diff --git a/tests/ui/proc-macro/issue-75734-pp-paren.stdout b/tests/ui/proc-macro/issue-75734-pp-paren.stdout
index 0fda6654f..2f7c013e9 100644
--- a/tests/ui/proc-macro/issue-75734-pp-paren.stdout
+++ b/tests/ui/proc-macro/issue-75734-pp-paren.stdout
@@ -118,17 +118,17 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/issue-75734-pp-paren.rs:25:16: 25:17 (#0),
},
],
- span: $DIR/issue-75734-pp-paren.rs:17:21: 17:25 (#7),
+ span: $DIR/issue-75734-pp-paren.rs:17:21: 17:25 (#6),
},
Punct {
ch: '*',
spacing: Alone,
- span: $DIR/issue-75734-pp-paren.rs:17:26: 17:27 (#7),
+ span: $DIR/issue-75734-pp-paren.rs:17:26: 17:27 (#6),
},
Literal {
kind: Integer,
symbol: "2",
suffix: None,
- span: $DIR/issue-75734-pp-paren.rs:17:28: 17:29 (#7),
+ span: $DIR/issue-75734-pp-paren.rs:17:28: 17:29 (#6),
},
]
diff --git a/tests/ui/proc-macro/issue-78675-captured-inner-attrs.stdout b/tests/ui/proc-macro/issue-78675-captured-inner-attrs.stdout
index 60a400a5d..ae5e94008 100644
--- a/tests/ui/proc-macro/issue-78675-captured-inner-attrs.stdout
+++ b/tests/ui/proc-macro/issue-78675-captured-inner-attrs.stdout
@@ -5,12 +5,12 @@ PRINT-BANG DEEP-RE-COLLECTED (DISPLAY): foo! { #[fake_attr] mod bar { #! [doc =
PRINT-BANG INPUT (DEBUG): TokenStream [
Ident {
ident: "foo",
- span: $DIR/issue-78675-captured-inner-attrs.rs:20:9: 20:12 (#4),
+ span: $DIR/issue-78675-captured-inner-attrs.rs:20:9: 20:12 (#3),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-78675-captured-inner-attrs.rs:20:12: 20:13 (#4),
+ span: $DIR/issue-78675-captured-inner-attrs.rs:20:12: 20:13 (#3),
},
Group {
delimiter: Brace,
@@ -18,17 +18,17 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-78675-captured-inner-attrs.rs:21:13: 21:14 (#4),
+ span: $DIR/issue-78675-captured-inner-attrs.rs:21:13: 21:14 (#3),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "fake_attr",
- span: $DIR/issue-78675-captured-inner-attrs.rs:21:15: 21:24 (#4),
+ span: $DIR/issue-78675-captured-inner-attrs.rs:21:15: 21:24 (#3),
},
],
- span: $DIR/issue-78675-captured-inner-attrs.rs:21:14: 21:25 (#4),
+ span: $DIR/issue-78675-captured-inner-attrs.rs:21:14: 21:25 (#3),
},
Group {
delimiter: None,
@@ -79,9 +79,9 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/issue-78675-captured-inner-attrs.rs:27:13: 29:6 (#0),
},
],
- span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#4),
+ span: $DIR/issue-78675-captured-inner-attrs.rs:22:13: 22:18 (#3),
},
],
- span: $DIR/issue-78675-captured-inner-attrs.rs:20:14: 23:10 (#4),
+ span: $DIR/issue-78675-captured-inner-attrs.rs:20:14: 23:10 (#3),
},
]
diff --git a/tests/ui/proc-macro/issue-80760-empty-stmt.stdout b/tests/ui/proc-macro/issue-80760-empty-stmt.stdout
index 4b7ed8743..82f52e4bc 100644
--- a/tests/ui/proc-macro/issue-80760-empty-stmt.stdout
+++ b/tests/ui/proc-macro/issue-80760-empty-stmt.stdout
@@ -9,6 +9,6 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/issue-80760-empty-stmt.rs:25:17: 25:18 (#0),
},
],
- span: $DIR/issue-80760-empty-stmt.rs:13:21: 13:23 (#4),
+ span: $DIR/issue-80760-empty-stmt.rs:13:21: 13:23 (#3),
},
]
diff --git a/tests/ui/proc-macro/load-panic-backtrace.stderr b/tests/ui/proc-macro/load-panic-backtrace.stderr
index 45d4fd1c9..c1a642713 100644
--- a/tests/ui/proc-macro/load-panic-backtrace.stderr
+++ b/tests/ui/proc-macro/load-panic-backtrace.stderr
@@ -1,4 +1,5 @@
-at 'panic-derive', $DIR/auxiliary/test-macros.rs:43:5
+at $DIR/auxiliary/test-macros.rs:43:5:
+panic-derive
error: proc-macro derive panicked
--> $DIR/load-panic-backtrace.rs:11:10
|
diff --git a/tests/ui/proc-macro/macro-rules-derive-cfg.stdout b/tests/ui/proc-macro/macro-rules-derive-cfg.stdout
index 74641058e..aee0f966d 100644
--- a/tests/ui/proc-macro/macro-rules-derive-cfg.stdout
+++ b/tests/ui/proc-macro/macro-rules-derive-cfg.stdout
@@ -10,76 +10,76 @@ PRINT-DERIVE INPUT (DISPLAY): struct Foo
PRINT-DERIVE INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/macro-rules-derive-cfg.rs:17:9: 17:15 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:17:9: 17:15 (#3),
},
Ident {
ident: "Foo",
- span: $DIR/macro-rules-derive-cfg.rs:17:16: 17:19 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:17:16: 17:19 (#3),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "val",
- span: $DIR/macro-rules-derive-cfg.rs:18:13: 18:16 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:18:13: 18:16 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/macro-rules-derive-cfg.rs:18:16: 18:17 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:18:16: 18:17 (#3),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "bool",
- span: $DIR/macro-rules-derive-cfg.rs:18:19: 18:23 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:18:19: 18:23 (#3),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/macro-rules-derive-cfg.rs:18:23: 18:24 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:18:23: 18:24 (#3),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "let",
- span: $DIR/macro-rules-derive-cfg.rs:19:17: 19:20 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:19:17: 19:20 (#3),
},
Ident {
ident: "a",
- span: $DIR/macro-rules-derive-cfg.rs:19:21: 19:22 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:19:21: 19:22 (#3),
},
Punct {
ch: '=',
spacing: Alone,
- span: $DIR/macro-rules-derive-cfg.rs:19:23: 19:24 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:19:23: 19:24 (#3),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/macro-rules-derive-cfg.rs:19:25: 19:26 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:19:25: 19:26 (#3),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "rustc_dummy",
- span: $DIR/macro-rules-derive-cfg.rs:19:48: 19:59 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:19:48: 19:59 (#3),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "first",
- span: $DIR/macro-rules-derive-cfg.rs:19:60: 19:65 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:19:60: 19:65 (#3),
},
],
- span: $DIR/macro-rules-derive-cfg.rs:19:59: 19:66 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:19:59: 19:66 (#3),
},
],
- span: $DIR/macro-rules-derive-cfg.rs:19:25: 19:26 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:19:25: 19:26 (#3),
},
Punct {
ch: '#',
@@ -151,21 +151,21 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/macro-rules-derive-cfg.rs:19:74: 19:75 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:19:74: 19:75 (#3),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: $DIR/macro-rules-derive-cfg.rs:20:17: 20:18 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:20:17: 20:18 (#3),
},
],
- span: $DIR/macro-rules-derive-cfg.rs:18:25: 21:14 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:18:25: 21:14 (#3),
},
],
- span: $DIR/macro-rules-derive-cfg.rs:18:18: 21:15 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:18:18: 21:15 (#3),
},
],
- span: $DIR/macro-rules-derive-cfg.rs:17:20: 22:10 (#4),
+ span: $DIR/macro-rules-derive-cfg.rs:17:20: 22:10 (#3),
},
]
diff --git a/tests/ui/proc-macro/macro-use-attr.rs b/tests/ui/proc-macro/macro-use-attr.rs
index b101c09ed..d275fb6a8 100644
--- a/tests/ui/proc-macro/macro-use-attr.rs
+++ b/tests/ui/proc-macro/macro-use-attr.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
// aux-build:test-macros.rs
#[macro_use]
diff --git a/tests/ui/proc-macro/macro-use-bang.rs b/tests/ui/proc-macro/macro-use-bang.rs
index 4a0bf0b2f..e3174fd44 100644
--- a/tests/ui/proc-macro/macro-use-bang.rs
+++ b/tests/ui/proc-macro/macro-use-bang.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
// aux-build:test-macros.rs
#[macro_use]
diff --git a/tests/ui/proc-macro/meta-macro-hygiene.rs b/tests/ui/proc-macro/meta-macro-hygiene.rs
index 70b8d8da1..72fd88e11 100644
--- a/tests/ui/proc-macro/meta-macro-hygiene.rs
+++ b/tests/ui/proc-macro/meta-macro-hygiene.rs
@@ -3,8 +3,10 @@
// edition:2018
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene -Z trim-diagnostic-paths=no
// check-pass
+// ignore-tidy-linelength
// normalize-stdout-test "\d+#" -> "0#"
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
+// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
//
// We don't care about symbol ids, so we set them all to 0
// in the stdout
@@ -22,7 +24,7 @@ macro_rules! produce_it {
// the fact that `print_def_site` is produced by a
// `macro_rules!` macro in `make_macro`).
meta_macro::print_def_site!($crate::dummy!());
- }
+ };
}
fn main() {
diff --git a/tests/ui/proc-macro/meta-macro-hygiene.stdout b/tests/ui/proc-macro/meta-macro-hygiene.stdout
index 6b7b0c819..eeb7179e6 100644
--- a/tests/ui/proc-macro/meta-macro-hygiene.stdout
+++ b/tests/ui/proc-macro/meta-macro-hygiene.stdout
@@ -1,14 +1,16 @@
-Def site: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5)
-Input: TokenStream [Ident { ident: "$crate", span: $DIR/meta-macro-hygiene.rs:24:37: 24:43 (#4) }, Punct { ch: ':', spacing: Joint, span: $DIR/meta-macro-hygiene.rs:24:43: 24:44 (#4) }, Punct { ch: ':', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:44: 24:45 (#4) }, Ident { ident: "dummy", span: $DIR/meta-macro-hygiene.rs:24:45: 24:50 (#4) }, Punct { ch: '!', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:24:50: 24:51 (#4) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/meta-macro-hygiene.rs:24:51: 24:53 (#4) }]
-Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Punct { ch: ':', spacing: Joint, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Punct { ch: ':', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Ident { ident: "dummy", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Punct { ch: '!', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#5) }]
+Def site: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4)
+Input: TokenStream [Ident { ident: "$crate", span: $DIR/meta-macro-hygiene.rs:26:37: 26:43 (#3) }, Punct { ch: ':', spacing: Joint, span: $DIR/meta-macro-hygiene.rs:26:43: 26:44 (#3) }, Punct { ch: ':', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:26:44: 26:45 (#3) }, Ident { ident: "dummy", span: $DIR/meta-macro-hygiene.rs:26:45: 26:50 (#3) }, Punct { ch: '!', spacing: Alone, span: $DIR/meta-macro-hygiene.rs:26:50: 26:51 (#3) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/meta-macro-hygiene.rs:26:51: 26:53 (#3) }]
+Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Punct { ch: ':', spacing: Joint, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Punct { ch: ':', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Ident { ident: "dummy", span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Punct { ch: '!', spacing: Alone, span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4) }]
#![feature /* 0#0 */(prelude_import)]
// aux-build:make-macro.rs
// aux-build:meta-macro.rs
// edition:2018
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene -Z trim-diagnostic-paths=no
// check-pass
+// ignore-tidy-linelength
// normalize-stdout-test "\d+#" -> "0#"
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
+// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
//
// We don't care about symbol ids, so we set them all to 0
// in the stdout
@@ -18,8 +20,7 @@ Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro
use core /* 0#1 */::prelude /* 0#1 */::rust_2018 /* 0#1 */::*;
#[macro_use /* 0#1 */]
extern crate core /* 0#1 */;
-#[macro_use /* 0#1 */]
-extern crate compiler_builtins /* 0#1 */;
+extern crate compiler_builtins /* NNN */ as _ /* 0#1 */;
// Don't load unnecessary hygiene information from std
extern crate std /* 0#0 */;
@@ -37,7 +38,7 @@ macro_rules! produce_it
// relative to `meta_macro`, *not* `make_macro` (despite
// the fact that `print_def_site` is produced by a
// `macro_rules!` macro in `make_macro`).
- }
+ } ;
}
fn main /* 0#0 */() { ; }
@@ -47,23 +48,21 @@ Expansions:
crate0::{{expn0}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Root
crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "produce_it")
-crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site")
-crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "$crate::dummy")
+crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site")
+crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "$crate::dummy")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include")
-crate2::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
SyntaxContexts:
#0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque)
#1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque)
#2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent)
-#3: parent: #0, outer_mark: (crate2::{{expn1}}, Opaque)
-#4: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent)
-#5: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
-#6: parent: #4, outer_mark: (crate0::{{expn3}}, Transparent)
-#7: parent: #0, outer_mark: (crate0::{{expn3}}, SemiTransparent)
-#8: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque)
-#9: parent: #5, outer_mark: (crate0::{{expn4}}, Transparent)
-#10: parent: #5, outer_mark: (crate0::{{expn4}}, SemiTransparent)
+#3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent)
+#4: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
+#5: parent: #3, outer_mark: (crate0::{{expn3}}, Transparent)
+#6: parent: #0, outer_mark: (crate0::{{expn3}}, SemiTransparent)
+#7: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque)
+#8: parent: #4, outer_mark: (crate0::{{expn4}}, Transparent)
+#9: parent: #4, outer_mark: (crate0::{{expn4}}, SemiTransparent)
*/
diff --git a/tests/ui/proc-macro/meta-macro.stdout b/tests/ui/proc-macro/meta-macro.stdout
index 662682d40..b2d20c237 100644
--- a/tests/ui/proc-macro/meta-macro.stdout
+++ b/tests/ui/proc-macro/meta-macro.stdout
@@ -1,3 +1,3 @@
-Def site: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#4)
+Def site: $DIR/auxiliary/make-macro.rs:7:9: 7:56 (#3)
Input: TokenStream []
Respanned: TokenStream []
diff --git a/tests/ui/proc-macro/nested-macro-rules.stdout b/tests/ui/proc-macro/nested-macro-rules.stdout
index 311139040..829cfdc0c 100644
--- a/tests/ui/proc-macro/nested-macro-rules.stdout
+++ b/tests/ui/proc-macro/nested-macro-rules.stdout
@@ -2,45 +2,45 @@ PRINT-BANG INPUT (DISPLAY): FirstStruct
PRINT-BANG INPUT (DEBUG): TokenStream [
Ident {
ident: "FirstStruct",
- span: $DIR/auxiliary/nested-macro-rules.rs:16:14: 16:25 (#7),
+ span: $DIR/auxiliary/nested-macro-rules.rs:16:14: 16:25 (#6),
},
]
PRINT-ATTR INPUT (DISPLAY): struct FirstAttrStruct {}
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/auxiliary/nested-macro-rules.rs:10:32: 10:38 (#6),
+ span: $DIR/auxiliary/nested-macro-rules.rs:10:32: 10:38 (#5),
},
Ident {
ident: "FirstAttrStruct",
- span: $DIR/auxiliary/nested-macro-rules.rs:16:27: 16:42 (#7),
+ span: $DIR/auxiliary/nested-macro-rules.rs:16:27: 16:42 (#6),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/auxiliary/nested-macro-rules.rs:10:57: 10:59 (#6),
+ span: $DIR/auxiliary/nested-macro-rules.rs:10:57: 10:59 (#5),
},
]
PRINT-BANG INPUT (DISPLAY): SecondStruct
PRINT-BANG INPUT (DEBUG): TokenStream [
Ident {
ident: "SecondStruct",
- span: $DIR/nested-macro-rules.rs:21:38: 21:50 (#16),
+ span: $DIR/nested-macro-rules.rs:21:38: 21:50 (#15),
},
]
PRINT-ATTR INPUT (DISPLAY): struct SecondAttrStruct {}
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
- span: $DIR/auxiliary/nested-macro-rules.rs:10:32: 10:38 (#15),
+ span: $DIR/auxiliary/nested-macro-rules.rs:10:32: 10:38 (#14),
},
Ident {
ident: "SecondAttrStruct",
- span: $DIR/nested-macro-rules.rs:21:52: 21:68 (#16),
+ span: $DIR/nested-macro-rules.rs:21:52: 21:68 (#15),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/auxiliary/nested-macro-rules.rs:10:57: 10:59 (#15),
+ span: $DIR/auxiliary/nested-macro-rules.rs:10:57: 10:59 (#14),
},
]
diff --git a/tests/ui/proc-macro/nested-nonterminal-tokens.stdout b/tests/ui/proc-macro/nested-nonterminal-tokens.stdout
index a3d24dd26..4c5550bb0 100644
--- a/tests/ui/proc-macro/nested-nonterminal-tokens.stdout
+++ b/tests/ui/proc-macro/nested-nonterminal-tokens.stdout
@@ -16,45 +16,45 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/nested-nonterminal-tokens.rs:25:26: 25:27 (#0),
},
],
- span: $DIR/nested-nonterminal-tokens.rs:17:41: 17:43 (#4),
+ span: $DIR/nested-nonterminal-tokens.rs:17:41: 17:43 (#3),
},
Punct {
ch: '+',
spacing: Alone,
- span: $DIR/nested-nonterminal-tokens.rs:17:44: 17:45 (#4),
+ span: $DIR/nested-nonterminal-tokens.rs:17:44: 17:45 (#3),
},
Literal {
kind: Integer,
symbol: "1",
suffix: None,
- span: $DIR/nested-nonterminal-tokens.rs:17:46: 17:47 (#4),
+ span: $DIR/nested-nonterminal-tokens.rs:17:46: 17:47 (#3),
},
],
- span: $DIR/nested-nonterminal-tokens.rs:18:41: 18:43 (#5),
+ span: $DIR/nested-nonterminal-tokens.rs:18:41: 18:43 (#4),
},
Punct {
ch: '+',
spacing: Alone,
- span: $DIR/nested-nonterminal-tokens.rs:18:44: 18:45 (#5),
+ span: $DIR/nested-nonterminal-tokens.rs:18:44: 18:45 (#4),
},
Literal {
kind: Integer,
symbol: "2",
suffix: None,
- span: $DIR/nested-nonterminal-tokens.rs:18:46: 18:47 (#5),
+ span: $DIR/nested-nonterminal-tokens.rs:18:46: 18:47 (#4),
},
],
- span: $DIR/nested-nonterminal-tokens.rs:20:21: 20:23 (#6),
+ span: $DIR/nested-nonterminal-tokens.rs:20:21: 20:23 (#5),
},
Punct {
ch: '+',
spacing: Alone,
- span: $DIR/nested-nonterminal-tokens.rs:20:24: 20:25 (#6),
+ span: $DIR/nested-nonterminal-tokens.rs:20:24: 20:25 (#5),
},
Literal {
kind: Integer,
symbol: "3",
suffix: None,
- span: $DIR/nested-nonterminal-tokens.rs:20:26: 20:27 (#6),
+ span: $DIR/nested-nonterminal-tokens.rs:20:26: 20:27 (#5),
},
]
diff --git a/tests/ui/proc-macro/nodelim-groups.stdout b/tests/ui/proc-macro/nodelim-groups.stdout
index 6b410f0bf..cdf851b53 100644
--- a/tests/ui/proc-macro/nodelim-groups.stdout
+++ b/tests/ui/proc-macro/nodelim-groups.stdout
@@ -4,7 +4,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
kind: Str,
symbol: "hi",
suffix: None,
- span: $DIR/nodelim-groups.rs:16:42: 16:46 (#4),
+ span: $DIR/nodelim-groups.rs:16:42: 16:46 (#3),
},
Group {
delimiter: None,
@@ -44,7 +44,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/nodelim-groups.rs:20:27: 20:28 (#0),
},
],
- span: $DIR/nodelim-groups.rs:16:47: 16:51 (#4),
+ span: $DIR/nodelim-groups.rs:16:47: 16:51 (#3),
},
Group {
delimiter: Parenthesis,
@@ -53,21 +53,21 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
kind: Integer,
symbol: "1",
suffix: None,
- span: $DIR/nodelim-groups.rs:16:53: 16:54 (#4),
+ span: $DIR/nodelim-groups.rs:16:53: 16:54 (#3),
},
Punct {
ch: '+',
spacing: Alone,
- span: $DIR/nodelim-groups.rs:16:55: 16:56 (#4),
+ span: $DIR/nodelim-groups.rs:16:55: 16:56 (#3),
},
Literal {
kind: Integer,
symbol: "1",
suffix: None,
- span: $DIR/nodelim-groups.rs:16:57: 16:58 (#4),
+ span: $DIR/nodelim-groups.rs:16:57: 16:58 (#3),
},
],
- span: $DIR/nodelim-groups.rs:16:52: 16:59 (#4),
+ span: $DIR/nodelim-groups.rs:16:52: 16:59 (#3),
},
]
PRINT-BANG INPUT (DISPLAY): "hi" "hello".len() + "world".len() (1 + 1)
@@ -76,7 +76,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
kind: Str,
symbol: "hi",
suffix: None,
- span: $DIR/nodelim-groups.rs:16:42: 16:46 (#9),
+ span: $DIR/nodelim-groups.rs:16:42: 16:46 (#8),
},
Group {
delimiter: None,
@@ -105,12 +105,12 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/nodelim-groups.rs:21:28: 21:30 (#0),
},
],
- span: $DIR/nodelim-groups.rs:15:49: 15:54 (#8),
+ span: $DIR/nodelim-groups.rs:15:49: 15:54 (#7),
},
Punct {
ch: '+',
spacing: Alone,
- span: $DIR/nodelim-groups.rs:15:55: 15:56 (#8),
+ span: $DIR/nodelim-groups.rs:15:55: 15:56 (#7),
},
Group {
delimiter: None,
@@ -136,10 +136,10 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
span: $DIR/nodelim-groups.rs:21:44: 21:46 (#0),
},
],
- span: $DIR/nodelim-groups.rs:15:57: 15:62 (#8),
+ span: $DIR/nodelim-groups.rs:15:57: 15:62 (#7),
},
],
- span: $DIR/nodelim-groups.rs:16:47: 16:51 (#9),
+ span: $DIR/nodelim-groups.rs:16:47: 16:51 (#8),
},
Group {
delimiter: Parenthesis,
@@ -148,20 +148,20 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
kind: Integer,
symbol: "1",
suffix: None,
- span: $DIR/nodelim-groups.rs:16:53: 16:54 (#9),
+ span: $DIR/nodelim-groups.rs:16:53: 16:54 (#8),
},
Punct {
ch: '+',
spacing: Alone,
- span: $DIR/nodelim-groups.rs:16:55: 16:56 (#9),
+ span: $DIR/nodelim-groups.rs:16:55: 16:56 (#8),
},
Literal {
kind: Integer,
symbol: "1",
suffix: None,
- span: $DIR/nodelim-groups.rs:16:57: 16:58 (#9),
+ span: $DIR/nodelim-groups.rs:16:57: 16:58 (#8),
},
],
- span: $DIR/nodelim-groups.rs:16:52: 16:59 (#9),
+ span: $DIR/nodelim-groups.rs:16:52: 16:59 (#8),
},
]
diff --git a/tests/ui/proc-macro/nonterminal-expansion.stdout b/tests/ui/proc-macro/nonterminal-expansion.stdout
index 4d884348f..b2557af18 100644
--- a/tests/ui/proc-macro/nonterminal-expansion.stdout
+++ b/tests/ui/proc-macro/nonterminal-expansion.stdout
@@ -3,12 +3,12 @@ PRINT-ATTR_ARGS RE-COLLECTED (DISPLAY): a, line! (), b
PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
Ident {
ident: "a",
- span: $DIR/nonterminal-expansion.rs:13:27: 13:28 (#4),
+ span: $DIR/nonterminal-expansion.rs:13:27: 13:28 (#3),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/nonterminal-expansion.rs:13:28: 13:29 (#4),
+ span: $DIR/nonterminal-expansion.rs:13:28: 13:29 (#3),
},
Group {
delimiter: None,
@@ -28,15 +28,15 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [
span: $DIR/nonterminal-expansion.rs:19:24: 19:26 (#0),
},
],
- span: $DIR/nonterminal-expansion.rs:13:30: 13:35 (#4),
+ span: $DIR/nonterminal-expansion.rs:13:30: 13:35 (#3),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/nonterminal-expansion.rs:13:35: 13:36 (#4),
+ span: $DIR/nonterminal-expansion.rs:13:35: 13:36 (#3),
},
Ident {
ident: "b",
- span: $DIR/nonterminal-expansion.rs:13:37: 13:38 (#4),
+ span: $DIR/nonterminal-expansion.rs:13:37: 13:38 (#3),
},
]
diff --git a/tests/ui/proc-macro/nonterminal-recollect-attr.stdout b/tests/ui/proc-macro/nonterminal-recollect-attr.stdout
index 6824395ae..e722ee97d 100644
--- a/tests/ui/proc-macro/nonterminal-recollect-attr.stdout
+++ b/tests/ui/proc-macro/nonterminal-recollect-attr.stdout
@@ -5,30 +5,30 @@ First recollected: TokenStream [
},
Ident {
ident: "struct",
- span: $DIR/nonterminal-recollect-attr.rs:14:12: 14:18 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:14:12: 14:18 (#3),
},
Ident {
ident: "Foo",
- span: $DIR/nonterminal-recollect-attr.rs:14:19: 14:22 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:14:19: 14:22 (#3),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "field",
- span: $DIR/nonterminal-recollect-attr.rs:15:13: 15:18 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:15:13: 15:18 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/nonterminal-recollect-attr.rs:15:18: 15:19 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:15:18: 15:19 (#3),
},
Ident {
ident: "u8",
- span: $DIR/nonterminal-recollect-attr.rs:15:20: 15:22 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:15:20: 15:22 (#3),
},
],
- span: $DIR/nonterminal-recollect-attr.rs:14:23: 16:10 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:14:23: 16:10 (#3),
},
]
Second recollected: TokenStream [
@@ -38,29 +38,29 @@ Second recollected: TokenStream [
},
Ident {
ident: "struct",
- span: $DIR/nonterminal-recollect-attr.rs:14:12: 14:18 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:14:12: 14:18 (#3),
},
Ident {
ident: "Foo",
- span: $DIR/nonterminal-recollect-attr.rs:14:19: 14:22 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:14:19: 14:22 (#3),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "field",
- span: $DIR/nonterminal-recollect-attr.rs:15:13: 15:18 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:15:13: 15:18 (#3),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/nonterminal-recollect-attr.rs:15:18: 15:19 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:15:18: 15:19 (#3),
},
Ident {
ident: "u8",
- span: $DIR/nonterminal-recollect-attr.rs:15:20: 15:22 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:15:20: 15:22 (#3),
},
],
- span: $DIR/nonterminal-recollect-attr.rs:14:23: 16:10 (#4),
+ span: $DIR/nonterminal-recollect-attr.rs:14:23: 16:10 (#3),
},
]
diff --git a/tests/ui/proc-macro/nonterminal-token-hygiene.rs b/tests/ui/proc-macro/nonterminal-token-hygiene.rs
index fa52a975b..1e9e90a6b 100644
--- a/tests/ui/proc-macro/nonterminal-token-hygiene.rs
+++ b/tests/ui/proc-macro/nonterminal-token-hygiene.rs
@@ -3,12 +3,13 @@
// check-pass
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene
// compile-flags: -Z trim-diagnostic-paths=no
+// ignore-tidy-linelength
// normalize-stdout-test "\d+#" -> "0#"
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
+// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
// aux-build:test-macros.rs
#![feature(decl_macro)]
-
#![no_std] // Don't load unnecessary hygiene information from std
extern crate std;
diff --git a/tests/ui/proc-macro/nonterminal-token-hygiene.stdout b/tests/ui/proc-macro/nonterminal-token-hygiene.stdout
index c08e53081..c437853ac 100644
--- a/tests/ui/proc-macro/nonterminal-token-hygiene.stdout
+++ b/tests/ui/proc-macro/nonterminal-token-hygiene.stdout
@@ -6,19 +6,19 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
stream: TokenStream [
Ident {
ident: "struct",
- span: $DIR/nonterminal-token-hygiene.rs:31:5: 31:11 (#5),
+ span: $DIR/nonterminal-token-hygiene.rs:32:5: 32:11 (#4),
},
Ident {
ident: "S",
- span: $DIR/nonterminal-token-hygiene.rs:31:12: 31:13 (#5),
+ span: $DIR/nonterminal-token-hygiene.rs:32:12: 32:13 (#4),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/nonterminal-token-hygiene.rs:31:13: 31:14 (#5),
+ span: $DIR/nonterminal-token-hygiene.rs:32:13: 32:14 (#4),
},
],
- span: $DIR/nonterminal-token-hygiene.rs:21:27: 21:32 (#6),
+ span: $DIR/nonterminal-token-hygiene.rs:22:27: 22:32 (#5),
},
]
#![feature /* 0#0 */(prelude_import)]
@@ -28,19 +28,19 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
// check-pass
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene
// compile-flags: -Z trim-diagnostic-paths=no
+// ignore-tidy-linelength
// normalize-stdout-test "\d+#" -> "0#"
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
+// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
// aux-build:test-macros.rs
#![feature /* 0#0 */(decl_macro)]
-
#![no_std /* 0#0 */]
#[prelude_import /* 0#1 */]
use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*;
#[macro_use /* 0#1 */]
extern crate core /* 0#2 */;
-#[macro_use /* 0#1 */]
-extern crate compiler_builtins /* 0#2 */;
+extern crate compiler_builtins /* NNN */ as _ /* 0#2 */;
// Don't load unnecessary hygiene information from std
extern crate std /* 0#0 */;
@@ -59,9 +59,9 @@ macro_rules! outer
}
struct S /* 0#0 */;
-macro inner /* 0#4 */ { () => { print_bang! { struct S; } } }
+macro inner /* 0#3 */ { () => { print_bang! { struct S; } } }
-struct S /* 0#5 */;
+struct S /* 0#4 */;
// OK, not a duplicate definition of `S`
fn main /* 0#0 */() {}
@@ -71,22 +71,20 @@ Expansions:
crate0::{{expn0}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Root
crate0::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
crate0::{{expn2}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "outer")
-crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #4, def_site_ctxt: #4, kind: Macro(Bang, "inner")
-crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #6, def_site_ctxt: #0, kind: Macro(Bang, "print_bang")
+crate0::{{expn3}}: parent: crate0::{{expn2}}, call_site_ctxt: #3, def_site_ctxt: #3, kind: Macro(Bang, "inner")
+crate0::{{expn4}}: parent: crate0::{{expn3}}, call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "print_bang")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Attr, "derive")
crate1::{{expnNNN}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "include")
-crate2::{{expn1}}: parent: crate0::{{expn0}}, call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports)
SyntaxContexts:
#0: parent: #0, outer_mark: (crate0::{{expn0}}, Opaque)
#1: parent: #0, outer_mark: (crate0::{{expn1}}, Opaque)
#2: parent: #0, outer_mark: (crate0::{{expn1}}, Transparent)
-#3: parent: #0, outer_mark: (crate2::{{expn1}}, Opaque)
-#4: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent)
-#5: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
-#6: parent: #4, outer_mark: (crate0::{{expn3}}, Opaque)
-#7: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque)
-#8: parent: #6, outer_mark: (crate0::{{expn4}}, Transparent)
-#9: parent: #5, outer_mark: (crate0::{{expn4}}, SemiTransparent)
+#3: parent: #0, outer_mark: (crate0::{{expn2}}, SemiTransparent)
+#4: parent: #0, outer_mark: (crate0::{{expn3}}, Opaque)
+#5: parent: #3, outer_mark: (crate0::{{expn3}}, Opaque)
+#6: parent: #0, outer_mark: (crate0::{{expn4}}, Opaque)
+#7: parent: #5, outer_mark: (crate0::{{expn4}}, Transparent)
+#8: parent: #4, outer_mark: (crate0::{{expn4}}, SemiTransparent)
*/
diff --git a/tests/ui/process/multi-panic.rs b/tests/ui/process/multi-panic.rs
index a1887c218..c240dc18f 100644
--- a/tests/ui/process/multi-panic.rs
+++ b/tests/ui/process/multi-panic.rs
@@ -8,10 +8,12 @@ fn check_for_no_backtrace(test: std::process::Output) {
let err = String::from_utf8_lossy(&test.stderr);
let mut it = err.lines();
- assert_eq!(it.next().map(|l| l.starts_with("thread '<unnamed>' panicked at")), Some(true));
+ assert_eq!(it.next().map(|l| l.starts_with("thread '<unnamed>' panicked")), Some(true));
+ assert_eq!(it.next().is_some(), true);
assert_eq!(it.next(), Some("note: run with `RUST_BACKTRACE=1` \
environment variable to display a backtrace"));
assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true));
+ assert_eq!(it.next().is_some(), true);
assert_eq!(it.next(), None);
}
diff --git a/tests/ui/process/println-with-broken-pipe.rs b/tests/ui/process/println-with-broken-pipe.rs
new file mode 100644
index 000000000..47c590ce2
--- /dev/null
+++ b/tests/ui/process/println-with-broken-pipe.rs
@@ -0,0 +1,44 @@
+// run-pass
+// check-run-results
+// ignore-windows
+// ignore-emscripten
+// ignore-fuchsia
+// ignore-horizon
+// ignore-android
+// normalize-stderr-test ".rs:\d+:\d+" -> ".rs:LL:CC"
+
+// Test what the error message looks like when `println!()` panics because of
+// `std::io::ErrorKind::BrokenPipe`
+
+#![feature(unix_sigpipe)]
+
+use std::env;
+use std::process::{Command, Stdio};
+
+#[unix_sigpipe = "sig_ign"]
+fn main() {
+ let mut args = env::args();
+ let me = args.next().unwrap();
+
+ if let Some(arg) = args.next() {
+ // More than enough iterations to fill any pipe buffer. Normally this
+ // loop will end with a panic more or less immediately.
+ for _ in 0..65536 * 64 {
+ println!("{arg}");
+ }
+ unreachable!("should have panicked because of BrokenPipe");
+ }
+
+ // Set up a pipeline with a short-lived consumer and wait for it to finish.
+ // This will produce the `println!()` panic message on stderr.
+ let mut producer = Command::new(&me)
+ .arg("this line shall appear exactly once on stdout")
+ .env("RUST_BACKTRACE", "0")
+ .stdout(Stdio::piped())
+ .spawn()
+ .unwrap();
+ let mut consumer =
+ Command::new("head").arg("-n1").stdin(producer.stdout.take().unwrap()).spawn().unwrap();
+ consumer.wait().unwrap();
+ producer.wait().unwrap();
+}
diff --git a/tests/ui/process/println-with-broken-pipe.run.stderr b/tests/ui/process/println-with-broken-pipe.run.stderr
new file mode 100644
index 000000000..a334c0ad2
--- /dev/null
+++ b/tests/ui/process/println-with-broken-pipe.run.stderr
@@ -0,0 +1,3 @@
+thread 'main' panicked at library/std/src/io/stdio.rs:LL:CC:
+failed printing to stdout: Broken pipe (os error 32)
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/process/println-with-broken-pipe.run.stdout b/tests/ui/process/println-with-broken-pipe.run.stdout
new file mode 100644
index 000000000..f55c39578
--- /dev/null
+++ b/tests/ui/process/println-with-broken-pipe.run.stdout
@@ -0,0 +1 @@
+this line shall appear exactly once on stdout
diff --git a/tests/ui/recursion/issue-26548-recursion-via-normalize.rs b/tests/ui/recursion/issue-26548-recursion-via-normalize.rs
index 91958dffc..6c7fc4beb 100644
--- a/tests/ui/recursion/issue-26548-recursion-via-normalize.rs
+++ b/tests/ui/recursion/issue-26548-recursion-via-normalize.rs
@@ -1,4 +1,5 @@
//~ ERROR cycle detected when computing layout of `core::option::Option<S>`
+//~| NOTE see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
//~| NOTE ...which requires computing layout of `S`...
//~| NOTE ...which requires computing layout of `core::option::Option<<S as Mirror>::It>`...
//~| NOTE ...which again requires computing layout of `core::option::Option<S>`, completing the cycle
diff --git a/tests/ui/recursion/issue-26548-recursion-via-normalize.stderr b/tests/ui/recursion/issue-26548-recursion-via-normalize.stderr
index a75097cdb..514bed607 100644
--- a/tests/ui/recursion/issue-26548-recursion-via-normalize.stderr
+++ b/tests/ui/recursion/issue-26548-recursion-via-normalize.stderr
@@ -4,6 +4,7 @@ error[E0391]: cycle detected when computing layout of `core::option::Option<S>`
= note: ...which requires computing layout of `core::option::Option<<S as Mirror>::It>`...
= note: ...which again requires computing layout of `core::option::Option<S>`, completing the cycle
= note: cycle used when computing layout of `core::option::Option<<S as Mirror>::It>`
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr
index eae58771a..543b73084 100644
--- a/tests/ui/recursion/issue-83150.stderr
+++ b/tests/ui/recursion/issue-83150.stderr
@@ -14,8 +14,7 @@ error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>,
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`)
= note: required for `&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>` to implement `Iterator`
= note: 65 redundant requirements hidden
- = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>, ...>, ...>, ...>, ...>` to implement `Iterator`
- = note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-83150/issue-83150.long-type-hash.txt'
+ = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>, [closure@$DIR/issue-83150.rs:13:24: 13:27]>` to implement `Iterator`
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/recursion/recursive-static-definition.stderr b/tests/ui/recursion/recursive-static-definition.stderr
index 135976145..b112228d4 100644
--- a/tests/ui/recursion/recursive-static-definition.stderr
+++ b/tests/ui/recursion/recursive-static-definition.stderr
@@ -18,6 +18,7 @@ LL | |
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/regions/higher-ranked-implied.stderr b/tests/ui/regions/higher-ranked-implied.stderr
index 9d80eacd7..8fa65f116 100644
--- a/tests/ui/regions/higher-ranked-implied.stderr
+++ b/tests/ui/regions/higher-ranked-implied.stderr
@@ -2,7 +2,9 @@ error[E0308]: mismatched types
--> $DIR/higher-ranked-implied.rs:12:16
|
LL | let y: B = x;
- | ^ one type is more general than the other
+ | - ^ one type is more general than the other
+ | |
+ | expected due to this
|
= note: expected fn pointer `for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'b ()>)`
found fn pointer `for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'a ()>)`
@@ -11,7 +13,9 @@ error[E0308]: mismatched types
--> $DIR/higher-ranked-implied.rs:13:16
|
LL | let _: A = y;
- | ^ one type is more general than the other
+ | - ^ one type is more general than the other
+ | |
+ | expected due to this
|
= note: expected fn pointer `for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'a ()>)`
found fn pointer `for<'a, 'b> fn(Inv<&'a &'b ()>, Inv<&'b &'a ()>, Inv<&'b ()>)`
diff --git a/tests/ui/regions/issue-102374.stderr b/tests/ui/regions/issue-102374.stderr
index af64b6867..a4230cf8b 100644
--- a/tests/ui/regions/issue-102374.stderr
+++ b/tests/ui/regions/issue-102374.stderr
@@ -7,8 +7,7 @@ LL | f
| ^ expected `i32`, found fn pointer
|
= note: expected type `i32`
- found fn pointer `fn(Cell<...>)`
- the full type name has been written to '$TEST_BUILD_DIR/regions/issue-102374/issue-102374.long-type-hash.txt'
+ found fn pointer `for<'z1, 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x, 'y, 'z, 'z0> fn(Cell<(&'z1 i32, &'a i32, &'b i32, &'c i32, &'d i32, &'e i32, &'f i32, &'g i32, &'h i32, &'i i32, &'j i32, &'k i32, &'l i32, &'m i32, &'n i32, &'o i32, &'p i32, &'q i32, &'r i32, &'s i32, &'t i32, &'u i32, &'v i32, &'w i32, &'x i32, &'y i32, &'z i32, &'z0 i32)>)`
error: aborting due to previous error
diff --git a/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
index bb5bc6f66..f2328cf3b 100644
--- a/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
+++ b/tests/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
@@ -2,7 +2,9 @@ error[E0308]: mismatched types
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43
|
LL | let _: fn(&mut &isize, &mut &isize) = a;
- | ^ one type is more general than the other
+ | ---------------------------- ^ one type is more general than the other
+ | |
+ | expected due to this
|
= note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)`
found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}`
diff --git a/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
index dbe9e9b1a..9c5004981 100644
--- a/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
+++ b/tests/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
@@ -2,7 +2,9 @@ error[E0308]: mismatched types
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56
|
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
- | ^ one type is more general than the other
+ | ----------------------------------------- ^ one type is more general than the other
+ | |
+ | expected due to this
|
= note: expected fn pointer `for<'a, 'b, 'c, 'd, 'e, 'f> fn(&'a mut &'b isize, &'c mut &'d isize, &'e mut &'f isize)`
found fn item `for<'a, 'b, 'c> fn(&'a mut &isize, &'b mut &isize, &'c mut &isize) {a::<'_, '_, '_>}`
diff --git a/tests/ui/regions/region-object-lifetime-5.rs b/tests/ui/regions/region-object-lifetime-5.rs
index ad3593671..307bbcbd5 100644
--- a/tests/ui/regions/region-object-lifetime-5.rs
+++ b/tests/ui/regions/region-object-lifetime-5.rs
@@ -8,7 +8,7 @@ trait Foo {
// Here, the object is bounded by an anonymous lifetime and returned
// as `&'static`, so you get an error.
fn owned_receiver(x: Box<dyn Foo>) -> &'static () {
- x.borrowed() //~ ERROR cannot return reference to local data `*x`
+ x.borrowed() //~ ERROR cannot return value referencing local data `*x`
}
fn main() {}
diff --git a/tests/ui/regions/region-object-lifetime-5.stderr b/tests/ui/regions/region-object-lifetime-5.stderr
index b82b58c7a..b86f6e3a2 100644
--- a/tests/ui/regions/region-object-lifetime-5.stderr
+++ b/tests/ui/regions/region-object-lifetime-5.stderr
@@ -1,8 +1,11 @@
-error[E0515]: cannot return reference to local data `*x`
+error[E0515]: cannot return value referencing local data `*x`
--> $DIR/region-object-lifetime-5.rs:11:5
|
LL | x.borrowed()
- | ^^^^^^^^^^^^ returns a reference to data owned by the current function
+ | -^^^^^^^^^^^
+ | |
+ | returns a value referencing data owned by the current function
+ | `*x` is borrowed here
error: aborting due to previous error
diff --git a/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr b/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr
index df0fd069e..2fab29865 100644
--- a/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr
+++ b/tests/ui/regions/regions-lifetime-bounds-on-fns.stderr
@@ -2,7 +2,9 @@ error[E0308]: mismatched types
--> $DIR/regions-lifetime-bounds-on-fns.rs:20:43
|
LL | let _: fn(&mut &isize, &mut &isize) = a;
- | ^ one type is more general than the other
+ | ---------------------------- ^ one type is more general than the other
+ | |
+ | expected due to this
|
= note: expected fn pointer `for<'a, 'b, 'c, 'd> fn(&'a mut &'b isize, &'c mut &'d isize)`
found fn item `for<'a, 'b> fn(&'a mut &isize, &'b mut &isize) {a::<'_, '_>}`
diff --git a/tests/ui/repr/repr-transparent.stderr b/tests/ui/repr/repr-transparent.stderr
index cb1e23377..028fc25db 100644
--- a/tests/ui/repr/repr-transparent.stderr
+++ b/tests/ui/repr/repr-transparent.stderr
@@ -20,13 +20,13 @@ error[E0691]: zero-sized field in transparent struct has alignment larger than 1
--> $DIR/repr-transparent.rs:36:32
|
LL | struct NontrivialAlignZst(u32, [u16; 0]);
- | ^^^^^^^^ has alignment larger than 1
+ | ^^^^^^^^ has alignment of 2, which is larger than 1
error[E0691]: zero-sized field in transparent struct has alignment larger than 1
--> $DIR/repr-transparent.rs:42:24
|
LL | struct GenericAlign<T>(ZstAlign32<T>, u32);
- | ^^^^^^^^^^^^^ has alignment larger than 1
+ | ^^^^^^^^^^^^^ has alignment of 32, which is larger than 1
error[E0084]: unsupported representation for zero-variant enum
--> $DIR/repr-transparent.rs:44:1
@@ -66,13 +66,13 @@ error[E0691]: zero-sized field in transparent enum has alignment larger than 1
--> $DIR/repr-transparent.rs:71:14
|
LL | Foo(u32, [u16; 0]),
- | ^^^^^^^^ has alignment larger than 1
+ | ^^^^^^^^ has alignment of 2, which is larger than 1
error[E0691]: zero-sized field in transparent enum has alignment larger than 1
--> $DIR/repr-transparent.rs:76:11
|
LL | Foo { bar: ZstAlign32<T>, baz: u32 }
- | ^^^^^^^^^^^^^^^^^^ has alignment larger than 1
+ | ^^^^^^^^^^^^^^^^^^ has alignment of 32, which is larger than 1
error[E0690]: transparent union needs at most one non-zero-sized field, but has 2
--> $DIR/repr-transparent.rs:85:1
diff --git a/tests/ui/resolve/112590-2.fixed b/tests/ui/resolve/112590-2.fixed
new file mode 100644
index 000000000..3bfe81ae8
--- /dev/null
+++ b/tests/ui/resolve/112590-2.fixed
@@ -0,0 +1,34 @@
+// run-rustfix
+use std::vec;
+
+use std::sync::atomic::AtomicBool;
+
+mod foo {
+ pub mod bar {
+ pub mod baz {
+ pub use std::vec::Vec as MyVec;
+ }
+ }
+}
+
+mod u {
+ use foo::bar::baz::MyVec;
+
+fn _a() {
+ let _: Vec<i32> = MyVec::new(); //~ ERROR failed to resolve
+ }
+}
+
+mod v {
+ use foo::bar::baz::MyVec;
+
+fn _b() {
+ let _: Vec<i32> = MyVec::new(); //~ ERROR failed to resolve
+ }
+}
+
+fn main() {
+ let _t: Vec<i32> = Vec::new(); //~ ERROR failed to resolve
+ type _B = vec::Vec::<u8>; //~ ERROR failed to resolve
+ let _t = AtomicBool::new(true); //~ ERROR failed to resolve
+}
diff --git a/tests/ui/resolve/112590-2.rs b/tests/ui/resolve/112590-2.rs
new file mode 100644
index 000000000..e5914cd67
--- /dev/null
+++ b/tests/ui/resolve/112590-2.rs
@@ -0,0 +1,26 @@
+// run-rustfix
+mod foo {
+ pub mod bar {
+ pub mod baz {
+ pub use std::vec::Vec as MyVec;
+ }
+ }
+}
+
+mod u {
+ fn _a() {
+ let _: Vec<i32> = super::foo::baf::baz::MyVec::new(); //~ ERROR failed to resolve
+ }
+}
+
+mod v {
+ fn _b() {
+ let _: Vec<i32> = fox::bar::baz::MyVec::new(); //~ ERROR failed to resolve
+ }
+}
+
+fn main() {
+ let _t: Vec<i32> = vec::new(); //~ ERROR failed to resolve
+ type _B = vec::Vec::<u8>; //~ ERROR failed to resolve
+ let _t = std::sync_error::atomic::AtomicBool::new(true); //~ ERROR failed to resolve
+}
diff --git a/tests/ui/resolve/112590-2.stderr b/tests/ui/resolve/112590-2.stderr
new file mode 100644
index 000000000..0db20249d
--- /dev/null
+++ b/tests/ui/resolve/112590-2.stderr
@@ -0,0 +1,71 @@
+error[E0433]: failed to resolve: could not find `baf` in `foo`
+ --> $DIR/112590-2.rs:12:39
+ |
+LL | let _: Vec<i32> = super::foo::baf::baz::MyVec::new();
+ | ^^^ could not find `baf` in `foo`
+ |
+help: consider importing this struct through its public re-export
+ |
+LL + use foo::bar::baz::MyVec;
+ |
+help: if you import `MyVec`, refer to it directly
+ |
+LL - let _: Vec<i32> = super::foo::baf::baz::MyVec::new();
+LL + let _: Vec<i32> = MyVec::new();
+ |
+
+error[E0433]: failed to resolve: use of undeclared crate or module `fox`
+ --> $DIR/112590-2.rs:18:27
+ |
+LL | let _: Vec<i32> = fox::bar::baz::MyVec::new();
+ | ^^^ use of undeclared crate or module `fox`
+ |
+help: consider importing this struct through its public re-export
+ |
+LL + use foo::bar::baz::MyVec;
+ |
+help: if you import `MyVec`, refer to it directly
+ |
+LL - let _: Vec<i32> = fox::bar::baz::MyVec::new();
+LL + let _: Vec<i32> = MyVec::new();
+ |
+
+error[E0433]: failed to resolve: use of undeclared crate or module `vec`
+ --> $DIR/112590-2.rs:24:15
+ |
+LL | type _B = vec::Vec::<u8>;
+ | ^^^ use of undeclared crate or module `vec`
+ |
+help: consider importing this module
+ |
+LL + use std::vec;
+ |
+
+error[E0433]: failed to resolve: could not find `sync_error` in `std`
+ --> $DIR/112590-2.rs:25:19
+ |
+LL | let _t = std::sync_error::atomic::AtomicBool::new(true);
+ | ^^^^^^^^^^ could not find `sync_error` in `std`
+ |
+help: consider importing this struct
+ |
+LL + use std::sync::atomic::AtomicBool;
+ |
+help: if you import `AtomicBool`, refer to it directly
+ |
+LL - let _t = std::sync_error::atomic::AtomicBool::new(true);
+LL + let _t = AtomicBool::new(true);
+ |
+
+error[E0433]: failed to resolve: use of undeclared crate or module `vec`
+ --> $DIR/112590-2.rs:23:24
+ |
+LL | let _t: Vec<i32> = vec::new();
+ | ^^^
+ | |
+ | use of undeclared crate or module `vec`
+ | help: a struct with a similar name exists (notice the capitalization): `Vec`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/tests/ui/resolve/bad-expr-path.stderr b/tests/ui/resolve/bad-expr-path.stderr
index 8261e8e53..411130913 100644
--- a/tests/ui/resolve/bad-expr-path.stderr
+++ b/tests/ui/resolve/bad-expr-path.stderr
@@ -10,12 +10,6 @@ error[E0425]: cannot find value `arguments` in module `m1`
LL | log(debug, m1::arguments);
| ^^^^^^^^^ not found in `m1`
-error[E0425]: cannot find function `log` in this scope
- --> $DIR/bad-expr-path.rs:4:5
- |
-LL | log(debug, m1::arguments);
- | ^^^ not found in this scope
-
error[E0580]: `main` function has wrong type
--> $DIR/bad-expr-path.rs:3:1
|
@@ -25,6 +19,12 @@ LL | fn main(arguments: Vec<String>) {
= note: expected fn pointer `fn()`
found fn pointer `fn(Vec<String>)`
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-expr-path.rs:4:5
+ |
+LL | log(debug, m1::arguments);
+ | ^^^ not found in this scope
+
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0425, E0580.
diff --git a/tests/ui/resolve/bad-expr-path2.stderr b/tests/ui/resolve/bad-expr-path2.stderr
index 6e11296d9..af3ca99c5 100644
--- a/tests/ui/resolve/bad-expr-path2.stderr
+++ b/tests/ui/resolve/bad-expr-path2.stderr
@@ -10,12 +10,6 @@ error[E0423]: expected value, found module `m1::arguments`
LL | log(debug, m1::arguments);
| ^^^^^^^^^^^^^ not a value
-error[E0425]: cannot find function `log` in this scope
- --> $DIR/bad-expr-path2.rs:6:5
- |
-LL | log(debug, m1::arguments);
- | ^^^ not found in this scope
-
error[E0580]: `main` function has wrong type
--> $DIR/bad-expr-path2.rs:5:1
|
@@ -25,6 +19,12 @@ LL | fn main(arguments: Vec<String>) {
= note: expected fn pointer `fn()`
found fn pointer `fn(Vec<String>)`
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-expr-path2.rs:6:5
+ |
+LL | log(debug, m1::arguments);
+ | ^^^ not found in this scope
+
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0423, E0425, E0580.
diff --git a/tests/ui/resolve/issue-112831.rs b/tests/ui/resolve/derive-macro-1.rs
index ffd83ea8b..90cbd903a 100644
--- a/tests/ui/resolve/issue-112831.rs
+++ b/tests/ui/resolve/derive-macro-1.rs
@@ -1,19 +1,17 @@
// check-pass
// aux-build:issue-112831-aux.rs
-mod zeroable {
+mod z {
pub trait Zeroable {}
}
-use zeroable::*;
+use z::*;
mod pod {
use super::*;
pub trait Pod: Zeroable {}
}
-use pod::*;
-
extern crate issue_112831_aux;
use issue_112831_aux::Zeroable;
diff --git a/tests/ui/resolve/derive-macro-2.rs b/tests/ui/resolve/derive-macro-2.rs
new file mode 100644
index 000000000..7cecdd9e3
--- /dev/null
+++ b/tests/ui/resolve/derive-macro-2.rs
@@ -0,0 +1,18 @@
+// check-pass
+// aux-build:issue-112831-aux.rs
+
+extern crate issue_112831_aux;
+use issue_112831_aux::Zeroable;
+
+mod z {
+ pub trait Zeroable {}
+}
+
+use z::*;
+
+mod pod {
+ use super::*;
+ pub trait Pod: Zeroable {}
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/export-fully-qualified-2018.stderr b/tests/ui/resolve/export-fully-qualified-2018.stderr
index 366ffd9bb..b724da930 100644
--- a/tests/ui/resolve/export-fully-qualified-2018.stderr
+++ b/tests/ui/resolve/export-fully-qualified-2018.stderr
@@ -3,11 +3,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo`
|
LL | pub fn bar() { foo::baz(); }
| ^^^ use of undeclared crate or module `foo`
- |
-help: consider importing this module
- |
-LL + use crate::foo;
- |
error: aborting due to previous error
diff --git a/tests/ui/resolve/export-fully-qualified.stderr b/tests/ui/resolve/export-fully-qualified.stderr
index 0cd516ee1..a8af0c7c9 100644
--- a/tests/ui/resolve/export-fully-qualified.stderr
+++ b/tests/ui/resolve/export-fully-qualified.stderr
@@ -3,11 +3,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo`
|
LL | pub fn bar() { foo::baz(); }
| ^^^ use of undeclared crate or module `foo`
- |
-help: consider importing this module
- |
-LL + use foo;
- |
error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed
new file mode 100644
index 000000000..e730f9466
--- /dev/null
+++ b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.fixed
@@ -0,0 +1,31 @@
+// run-rustfix
+
+#![deny(unused_qualifications)]
+#![feature(unsized_fn_params)]
+
+#[allow(unused_imports)]
+use std::ops;
+use std::ops::Index;
+
+pub struct A;
+
+impl Index<str> for A {
+ //~^ ERROR unnecessary qualification
+ type Output = ();
+ fn index(&self, _: str) -> &Self::Output {
+ &()
+ }
+}
+
+mod inner {
+ pub trait Trait<T> {}
+}
+
+// the import needs to be here for the lint to show up
+#[allow(unused_imports)]
+use inner::Trait;
+
+impl Trait<u8> for () {}
+//~^ ERROR unnecessary qualification
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs
new file mode 100644
index 000000000..641c892e3
--- /dev/null
+++ b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.rs
@@ -0,0 +1,31 @@
+// run-rustfix
+
+#![deny(unused_qualifications)]
+#![feature(unsized_fn_params)]
+
+#[allow(unused_imports)]
+use std::ops;
+use std::ops::Index;
+
+pub struct A;
+
+impl ops::Index<str> for A {
+ //~^ ERROR unnecessary qualification
+ type Output = ();
+ fn index(&self, _: str) -> &Self::Output {
+ &()
+ }
+}
+
+mod inner {
+ pub trait Trait<T> {}
+}
+
+// the import needs to be here for the lint to show up
+#[allow(unused_imports)]
+use inner::Trait;
+
+impl inner::Trait<u8> for () {}
+//~^ ERROR unnecessary qualification
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr
new file mode 100644
index 000000000..d9c7fd218
--- /dev/null
+++ b/tests/ui/resolve/issue-113808-invalid-unused-qualifications-suggestion.stderr
@@ -0,0 +1,31 @@
+error: unnecessary qualification
+ --> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:12:6
+ |
+LL | impl ops::Index<str> for A {
+ | ^^^^^^^^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:3:9
+ |
+LL | #![deny(unused_qualifications)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+help: remove the unnecessary path segments
+ |
+LL - impl ops::Index<str> for A {
+LL + impl Index<str> for A {
+ |
+
+error: unnecessary qualification
+ --> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:28:6
+ |
+LL | impl inner::Trait<u8> for () {}
+ | ^^^^^^^^^^^^^^^^
+ |
+help: remove the unnecessary path segments
+ |
+LL - impl inner::Trait<u8> for () {}
+LL + impl Trait<u8> for () {}
+ |
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs b/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs
new file mode 100644
index 000000000..83349dd33
--- /dev/null
+++ b/tests/ui/resolve/issue-114433-invalid-unused-qualifications-suggestion.rs
@@ -0,0 +1,10 @@
+#![deny(unused_qualifications)]
+// check-pass
+fn bar() {
+ match Option::<Option<()>>::None {
+ Some(v) => {}
+ None => {}
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-2356.stderr b/tests/ui/resolve/issue-2356.stderr
index 313b3e30d..30f5f0595 100644
--- a/tests/ui/resolve/issue-2356.stderr
+++ b/tests/ui/resolve/issue-2356.stderr
@@ -1,18 +1,3 @@
-error[E0425]: cannot find function `default` in this scope
- --> $DIR/issue-2356.rs:31:5
- |
-LL | default();
- | ^^^^^^^
- |
-help: you might have meant to call the associated function
- |
-LL | Self::default();
- | ~~~~~~~~~~~~~
-help: consider importing this function
- |
-LL + use std::default::default;
- |
-
error[E0425]: cannot find value `whiskers` in this scope
--> $DIR/issue-2356.rs:39:5
|
@@ -64,6 +49,12 @@ error[E0425]: cannot find function `clone` in this scope
LL | clone();
| ^^^^^ help: you might have meant to call the method: `self.clone`
+error[E0425]: cannot find function `default` in this scope
+ --> $DIR/issue-2356.rs:31:5
+ |
+LL | default();
+ | ^^^^^^^ help: you might have meant to call the associated function: `Self::default`
+
error[E0425]: cannot find function `shave` in this scope
--> $DIR/issue-2356.rs:41:5
|
diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr
index 023db303d..42b7281d7 100644
--- a/tests/ui/resolve/resolve-inconsistent-names.stderr
+++ b/tests/ui/resolve/resolve-inconsistent-names.stderr
@@ -14,6 +14,15 @@ LL | a | b => {}
| |
| pattern doesn't bind `b`
+error[E0408]: variable `c` is not bound in all patterns
+ --> $DIR/resolve-inconsistent-names.rs:19:9
+ |
+LL | (A, B) | (ref B, c) | (c, A) => ()
+ | ^^^^^^ - - variable not in all patterns
+ | | |
+ | | variable not in all patterns
+ | pattern doesn't bind `c`
+
error[E0408]: variable `A` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:19:18
|
@@ -37,15 +46,6 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
| | variable not in all patterns
| variable not in all patterns
-error[E0408]: variable `c` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:19:9
- |
-LL | (A, B) | (ref B, c) | (c, A) => ()
- | ^^^^^^ - - variable not in all patterns
- | | |
- | | variable not in all patterns
- | pattern doesn't bind `c`
-
error[E0409]: variable `B` is bound inconsistently across alternatives separated by `|`
--> $DIR/resolve-inconsistent-names.rs:19:23
|
diff --git a/tests/ui/resolve/resolve-self-in-impl.stderr b/tests/ui/resolve/resolve-self-in-impl.stderr
index 9f9ed6889..183a17171 100644
--- a/tests/ui/resolve/resolve-self-in-impl.stderr
+++ b/tests/ui/resolve/resolve-self-in-impl.stderr
@@ -56,6 +56,7 @@ LL | | trait Tr<T = u8> {
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to 6 previous errors
diff --git a/tests/ui/resolve/unresolved-segments-visibility.rs b/tests/ui/resolve/unresolved-segments-visibility.rs
new file mode 100644
index 000000000..c26171f75
--- /dev/null
+++ b/tests/ui/resolve/unresolved-segments-visibility.rs
@@ -0,0 +1,11 @@
+// Check that we do not ICE due to unresolved segments in visibility path.
+#![crate_type = "lib"]
+
+extern crate alloc as b;
+
+mod foo {
+ mod bar {
+ pub(in b::string::String::newy) extern crate alloc as e;
+ //~^ ERROR failed to resolve: `String` is a struct, not a module [E0433]
+ }
+}
diff --git a/tests/ui/resolve/unresolved-segments-visibility.stderr b/tests/ui/resolve/unresolved-segments-visibility.stderr
new file mode 100644
index 000000000..0a11549cd
--- /dev/null
+++ b/tests/ui/resolve/unresolved-segments-visibility.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve: `String` is a struct, not a module
+ --> $DIR/unresolved-segments-visibility.rs:8:27
+ |
+LL | pub(in b::string::String::newy) extern crate alloc as e;
+ | ^^^^^^ `String` is a struct, not a module
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/tests/ui/resolve/unused-qualifications-suggestion.fixed b/tests/ui/resolve/unused-qualifications-suggestion.fixed
new file mode 100644
index 000000000..0d4b9007c
--- /dev/null
+++ b/tests/ui/resolve/unused-qualifications-suggestion.fixed
@@ -0,0 +1,23 @@
+// run-rustfix
+
+#![deny(unused_qualifications)]
+
+mod foo {
+ pub fn bar() {}
+}
+
+mod baz {
+ pub mod qux {
+ pub fn quux() {}
+ }
+}
+
+fn main() {
+ use foo::bar;
+ bar();
+ //~^ ERROR unnecessary qualification
+
+ use baz::qux::quux;
+ quux();
+ //~^ ERROR unnecessary qualification
+}
diff --git a/tests/ui/resolve/unused-qualifications-suggestion.rs b/tests/ui/resolve/unused-qualifications-suggestion.rs
new file mode 100644
index 000000000..f6722e965
--- /dev/null
+++ b/tests/ui/resolve/unused-qualifications-suggestion.rs
@@ -0,0 +1,23 @@
+// run-rustfix
+
+#![deny(unused_qualifications)]
+
+mod foo {
+ pub fn bar() {}
+}
+
+mod baz {
+ pub mod qux {
+ pub fn quux() {}
+ }
+}
+
+fn main() {
+ use foo::bar;
+ foo::bar();
+ //~^ ERROR unnecessary qualification
+
+ use baz::qux::quux;
+ baz::qux::quux();
+ //~^ ERROR unnecessary qualification
+}
diff --git a/tests/ui/resolve/unused-qualifications-suggestion.stderr b/tests/ui/resolve/unused-qualifications-suggestion.stderr
new file mode 100644
index 000000000..e3dac37fc
--- /dev/null
+++ b/tests/ui/resolve/unused-qualifications-suggestion.stderr
@@ -0,0 +1,31 @@
+error: unnecessary qualification
+ --> $DIR/unused-qualifications-suggestion.rs:17:5
+ |
+LL | foo::bar();
+ | ^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/unused-qualifications-suggestion.rs:3:9
+ |
+LL | #![deny(unused_qualifications)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+help: remove the unnecessary path segments
+ |
+LL - foo::bar();
+LL + bar();
+ |
+
+error: unnecessary qualification
+ --> $DIR/unused-qualifications-suggestion.rs:21:5
+ |
+LL | baz::qux::quux();
+ | ^^^^^^^^^^^^^^
+ |
+help: remove the unnecessary path segments
+ |
+LL - baz::qux::quux();
+LL + quux();
+ |
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/return/return-struct.rs b/tests/ui/return/return-struct.rs
new file mode 100644
index 000000000..446445c17
--- /dev/null
+++ b/tests/ui/return/return-struct.rs
@@ -0,0 +1,24 @@
+struct S;
+
+enum Age {
+ Years(i64, i64)
+}
+
+fn foo() {
+ let mut age = 29;
+ Age::Years({age += 1; age}, 55)
+ //~^ ERROR mismatched types
+}
+
+fn bar() {
+ let mut age = 29;
+ Age::Years(age, 55)
+ //~^ ERROR mismatched types
+}
+
+fn baz() {
+ S
+ //~^ ERROR mismatched types
+}
+
+fn main() {}
diff --git a/tests/ui/return/return-struct.stderr b/tests/ui/return/return-struct.stderr
new file mode 100644
index 000000000..e6c0363e3
--- /dev/null
+++ b/tests/ui/return/return-struct.stderr
@@ -0,0 +1,35 @@
+error[E0308]: mismatched types
+ --> $DIR/return-struct.rs:9:5
+ |
+LL | Age::Years({age += 1; age}, 55)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Age`
+ |
+help: consider using a semicolon here
+ |
+LL | Age::Years({age += 1; age}, 55);
+ | +
+help: try adding a return type
+ |
+LL | fn foo() -> Age {
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/return-struct.rs:15:5
+ |
+LL | fn bar() {
+ | - help: try adding a return type: `-> Age`
+LL | let mut age = 29;
+LL | Age::Years(age, 55)
+ | ^^^^^^^^^^^^^^^^^^^ expected `()`, found `Age`
+
+error[E0308]: mismatched types
+ --> $DIR/return-struct.rs:20:5
+ |
+LL | fn baz() {
+ | - help: try adding a return type: `-> S`
+LL | S
+ | ^ expected `()`, found `S`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
index ca5fa6df2..77227ebd8 100644
--- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
+++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
@@ -1,6 +1,3 @@
-// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
-// revisions: current next
-
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
new file mode 100644
index 000000000..c4371a002
--- /dev/null
+++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `Something: Termination` is not satisfied
+ --> $DIR/issue-103052-2.rs:12:22
+ |
+LL | fn main() -> Something {
+ | ^^^^^^^^^ the trait `Termination` is not implemented for `Something`
+ |
+note: required by a bound in `Main::{opaque#0}`
+ --> $DIR/issue-103052-2.rs:6:27
+ |
+LL | fn main() -> impl std::process::Termination;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::{opaque#0}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr b/tests/ui/rfcs/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
index b7c0b0bb6..04572920e 100644
--- a/tests/ui/rfcs/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
+++ b/tests/ui/rfcs/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr
@@ -2,7 +2,7 @@ error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immu
--> $DIR/borrowck-issue-49631.rs:20:9
|
LL | while let Some(Ok(string)) = foo.get() {
- | --------- immutable borrow occurs here
+ | --- immutable borrow occurs here
LL | foo.mutate();
| ^^^^^^^^^^^^ mutable borrow occurs here
LL |
diff --git a/tests/ui/rfcs/rfc-2027-object-safe-for-dispatch/manual-self-impl-for-unsafe-obj.rs b/tests/ui/rfcs/rfc-2027-object-safe-for-dispatch/manual-self-impl-for-unsafe-obj.rs
index 721890db4..c27e8c4b0 100644
--- a/tests/ui/rfcs/rfc-2027-object-safe-for-dispatch/manual-self-impl-for-unsafe-obj.rs
+++ b/tests/ui/rfcs/rfc-2027-object-safe-for-dispatch/manual-self-impl-for-unsafe-obj.rs
@@ -1,5 +1,7 @@
// Check that we can manually implement an object-unsafe trait for its trait object.
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
// run-pass
#![feature(object_safe_for_dispatch)]
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs
new file mode 100644
index 000000000..bc8864000
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs
@@ -0,0 +1,18 @@
+// Tests #108655: closures in `#[target_feature]` functions can still be marked #[inline(always)]
+
+// check-pass
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+// only-x86_64
+
+#![feature(target_feature_11)]
+
+#[target_feature(enable = "avx")]
+pub unsafe fn test() {
+ ({
+ #[inline(always)]
+ move || {}
+ })();
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.rs b/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.rs
index d7a418959..880907b24 100644
--- a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.rs
+++ b/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.rs
@@ -6,6 +6,10 @@
// compile-flags: --crate-type lib --emit link
// normalize-stderr-test: "[^ ']*/dlltool.exe" -> "$$DLLTOOL"
// normalize-stderr-test: "[^ ]*/foo.def" -> "$$DEF_FILE"
+// normalize-stderr-test: "[^ ]*/foo.lib" -> "$$LIB_FILE"
+// normalize-stderr-test: "-m [^ ]*" -> "$$TARGET_MACHINE"
+// normalize-stderr-test: "-f [^ ]*" -> "$$ASM_FLAGS"
+// normalize-stderr-test: "--temp-prefix [^ ]*/foo.dll" -> "$$TEMP_PREFIX"
#[link(name = "foo", kind = "raw-dylib")]
extern "C" {
// `@1` is an invalid name to export, as it usually indicates that something
diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr b/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr
index 020ac6a2b..cc532ccc4 100644
--- a/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr
+++ b/tests/ui/rfcs/rfc-2627-raw-dylib/dlltool-failed.stderr
@@ -1,4 +1,5 @@
-error: Dlltool could not create import library:
+error: Dlltool could not create import library with $DLLTOOL -d $DEF_FILE -D foo.dll -l $LIB_FILE $TARGET_MACHINE $ASM_FLAGS --no-leading-underscore $TEMP_PREFIX:
+
$DLLTOOL: Syntax error in def file $DEF_FILE:1
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr b/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr
index 510108405..dfd245669 100644
--- a/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr
+++ b/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr
@@ -2,7 +2,7 @@ error: multiple declarations of external function `f` from library `foo.dll` hav
--> $DIR/multiple-declarations.rs:13:9
|
LL | fn f(x: i32);
- | ^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr b/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr
index f8265ae69..f69275a01 100644
--- a/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr
+++ b/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr
@@ -2,7 +2,7 @@ error: ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture
--> $DIR/unsupported-abi.rs:6:5
|
LL | fn f(x: i32);
- | ^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.rs
index 780a510c5..f41c1051f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.rs
@@ -1,5 +1,6 @@
-// check-pass
-#![feature(const_trait_impl)]
+// known-bug: #110395
+// FIXME check-pass
+#![feature(const_trait_impl, effects)]
#[const_trait]
trait Foo {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
new file mode 100644
index 000000000..4fcfe9d47
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the trait bound `T: Foo` is not satisfied
+ --> $DIR/assoc-type-const-bound-usage.rs:12:5
+ |
+LL | <T as Foo>::Assoc::foo();
+ | ^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
+ |
+help: consider further restricting this bound
+ |
+LL | const fn foo<T: ~const Foo + Foo>() {
+ | +++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs
index e73082c11..f40dc27cb 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs
@@ -1,4 +1,4 @@
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#[const_trait]
pub trait MyTrait {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/staged-api.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/staged-api.rs
index 589e3f024..687cb128b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/staged-api.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/staged-api.rs
@@ -1,4 +1,4 @@
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs
index dd9933974..771c35cf6 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs
@@ -1,4 +1,4 @@
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#[const_trait]
pub trait Plus {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
index 7350909ba..2d9c49af8 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr
@@ -2,13 +2,9 @@ error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
--> $DIR/call-const-trait-method-fail.rs:25:7
|
LL | a.plus(b)
- | ^^^^ the trait `~const Plus` is not implemented for `u32`
+ | ^^^^ the trait `Plus` is not implemented for `u32`
|
-note: the trait `Plus` is implemented for `u32`, but that implementation is not `const`
- --> $DIR/call-const-trait-method-fail.rs:25:7
- |
-LL | a.plus(b)
- | ^^^^
+ = help: the trait `Plus` is implemented for `u32`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr
index ff53eea11..60cd000f2 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr
@@ -1,20 +1,24 @@
-error: const `impl` for trait `Add` which is not marked with `#[const_trait]`
- --> $DIR/call-const-trait-method-pass.rs:7:12
+error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions
+ --> $DIR/call-const-trait-method-pass.rs:36:7
|
-LL | impl const std::ops::Add for Int {
- | ^^^^^^^^^^^^^
+LL | a.plus(b)
+ | ^^^^^^^
|
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
- --> $DIR/call-const-trait-method-pass.rs:15:12
+error[E0015]: cannot call non-const operator in constants
+ --> $DIR/call-const-trait-method-pass.rs:39:22
+ |
+LL | const ADD_INT: Int = Int(1i32) + Int(2i32);
+ | ^^^^^^^^^^^^^^^^^^^^^
|
-LL | impl const PartialEq for Int {
- | ^^^^^^^^^
+note: impl defined here, but it is not `const`
+ --> $DIR/call-const-trait-method-pass.rs:7:1
|
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
+LL | impl const std::ops::Add for Int {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: calls in constants are limited to constant functions, tuple structs and tuple variants
error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-chain.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-chain.stderr
index 529a472e0..37faa3f6b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-chain.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-chain.stderr
@@ -1,12 +1,3 @@
-error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
- --> $DIR/call-generic-method-chain.rs:9:12
- |
-LL | impl const PartialEq for S {
- | ^^^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
-
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:18:32
|
@@ -19,5 +10,5 @@ error: ~const can only be applied to `#[const_trait]` traits
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-dup-bound.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-dup-bound.stderr
index bdc6ccc8a..90cfe04a9 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-dup-bound.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-dup-bound.stderr
@@ -1,12 +1,3 @@
-error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
- --> $DIR/call-generic-method-dup-bound.rs:7:12
- |
-LL | impl const PartialEq for S {
- | ^^^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
-
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:18:44
|
@@ -19,5 +10,5 @@ error: ~const can only be applied to `#[const_trait]` traits
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-fail.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-fail.rs
index fe1abbf42..53778b3af 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-fail.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-fail.rs
@@ -1,5 +1,6 @@
-// known-bug: #110395
-#![feature(const_trait_impl)]
+// FIXME(effects)
+// check-pass
+#![feature(const_trait_impl, effects)]
pub const fn equals_self<T: PartialEq>(t: &T) -> bool {
*t == *t
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-fail.stderr
deleted file mode 100644
index 3963f64ad..000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-fail.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0277]: can't compare `T` with `T` in const contexts
- --> $DIR/call-generic-method-fail.rs:5:5
- |
-LL | *t == *t
- | ^^^^^^^^ no implementation for `T == T`
- |
-note: the trait `PartialEq` is implemented for `T`, but that implementation is not `const`
- --> $DIR/call-generic-method-fail.rs:5:5
- |
-LL | *t == *t
- | ^^^^^^^^
-
-error[E0015]: cannot call non-const operator in constant functions
- --> $DIR/call-generic-method-fail.rs:5:5
- |
-LL | *t == *t
- | ^^^^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-help: consider further restricting this bound
- |
-LL | pub const fn equals_self<T: PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool {
- | ++++++++++++++++++++++++++++
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs
index 414a8c87d..eada4ceaf 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.rs
@@ -1,3 +1,6 @@
+// check-pass
+// known-bug: #110395
+
#![feature(const_trait_impl)]
struct S;
@@ -21,6 +24,6 @@ const fn equals_self<T: ~const Foo>(t: &T) -> bool {
// it not using the impl.
pub const EQ: bool = equals_self(&S);
-//~^ ERROR
+// FIXME(effects) ~^ ERROR
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr
deleted file mode 100644
index a28d6ce05..000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-nonconst.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0277]: the trait bound `S: ~const Foo` is not satisfied
- --> $DIR/call-generic-method-nonconst.rs:23:22
- |
-LL | pub const EQ: bool = equals_self(&S);
- | ^^^^^^^^^^^^^^^ the trait `~const Foo` is not implemented for `S`
- |
-note: the trait `Foo` is implemented for `S`, but that implementation is not `const`
- --> $DIR/call-generic-method-nonconst.rs:23:22
- |
-LL | pub const EQ: bool = equals_self(&S);
- | ^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-pass.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-pass.stderr
index 7fbe89dba..bea1846e7 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-pass.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-method-pass.stderr
@@ -1,17 +1,8 @@
-error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
- --> $DIR/call-generic-method-pass.rs:9:12
- |
-LL | impl const PartialEq for S {
- | ^^^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
-
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-pass.rs:18:32
|
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr
index 4f858d61e..54bc43477 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr
@@ -1,20 +1,25 @@
-error: const `impl` for trait `Add` which is not marked with `#[const_trait]`
- --> $DIR/const-and-non-const-impl.rs:7:12
+error[E0117]: only traits defined in the current crate can be implemented for primitive types
+ --> $DIR/const-and-non-const-impl.rs:7:1
|
LL | impl const std::ops::Add for i32 {
- | ^^^^^^^^^^^^^
+ | ^^^^^^^^^^^-------------^^^^^---
+ | | | |
+ | | | `i32` is not defined in the current crate
+ | | `i32` is not defined in the current crate
+ | impl doesn't use only types from inside the current crate
|
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
+ = note: define and implement a trait or new type instead
-error: const `impl` for trait `Add` which is not marked with `#[const_trait]`
- --> $DIR/const-and-non-const-impl.rs:23:12
+error[E0119]: conflicting implementations of trait `Add` for type `Int`
+ --> $DIR/const-and-non-const-impl.rs:23:1
|
+LL | impl std::ops::Add for Int {
+ | -------------------------- first implementation here
+...
LL | impl const std::ops::Add for Int {
- | ^^^^^^^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
error: aborting due to 2 previous errors
+Some errors have detailed explanations: E0117, E0119.
+For more information about an error, try `rustc --explain E0117`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs
index 52984fb6b..4854f41bf 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-check-fns-in-const-impl.rs
@@ -1,4 +1,4 @@
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
struct S;
#[const_trait]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
index 112416a35..96ffca651 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method-fail.stderr
@@ -1,16 +1,15 @@
-error[E0277]: the trait bound `(): ~const Tr` is not satisfied in `fn(()) -> i32 {<() as Tr>::a}`
- --> $DIR/const-closure-trait-method-fail.rs:18:23
+error[E0015]: cannot call non-const closure in constant functions
+ --> $DIR/const-closure-trait-method-fail.rs:15:5
|
-LL | const _: () = assert!(need_const_closure(Tr::a) == 42);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `fn(()) -> i32 {<() as Tr>::a}`, the trait `~const Tr` is not implemented for `()`
+LL | x(())
+ | ^^^^^
|
-note: the trait `Tr` is implemented for `()`, but that implementation is not `const`
- --> $DIR/const-closure-trait-method-fail.rs:18:23
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+help: consider further restricting this bound
|
-LL | const _: () = assert!(need_const_closure(Tr::a) == 42);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it appears within the type `fn(()) -> i32 {<() as Tr>::a}`
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
+ | ++++++++++++++++++++++++++++++++
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.rs
index 3e6d19088..fd9f28725 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.rs
@@ -1,4 +1,5 @@
-// check-pass
+// known-bug: #110395
+// FIXME check-pass
#![feature(const_trait_impl)]
#[const_trait]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
new file mode 100644
index 000000000..fd0c29118
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closure-trait-method.stderr
@@ -0,0 +1,15 @@
+error[E0015]: cannot call non-const closure in constant functions
+ --> $DIR/const-closure-trait-method.rs:15:5
+ |
+LL | x(())
+ | ^^^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+help: consider further restricting this bound
+ |
+LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const std::ops::FnOnce<((),)>>(x: T) -> i32 {
+ | ++++++++++++++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.rs
index 7c55b51c8..1fe4044d5 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.rs
@@ -1,4 +1,5 @@
-// check-pass
+// known-bug: #110395
+// FIXME check-pass
#![feature(const_trait_impl)]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
new file mode 100644
index 000000000..abf2a2dc5
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-closures.stderr
@@ -0,0 +1,39 @@
+error[E0015]: cannot call non-const closure in constant functions
+ --> $DIR/const-closures.rs:12:5
+ |
+LL | f() * 7
+ | ^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+help: consider further restricting this bound
+ |
+LL | F: ~const FnOnce() -> u8 + ~const std::ops::Fn<()>,
+ | +++++++++++++++++++++++++
+
+error[E0015]: cannot call non-const closure in constant functions
+ --> $DIR/const-closures.rs:24:5
+ |
+LL | f() + f()
+ | ^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+help: consider further restricting this bound
+ |
+LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
+ | +++++++++++++++++++++++++
+
+error[E0015]: cannot call non-const closure in constant functions
+ --> $DIR/const-closures.rs:24:11
+ |
+LL | f() + f()
+ | ^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+help: consider further restricting this bound
+ |
+LL | const fn answer<F: ~const Fn() -> u8 + ~const std::ops::Fn<()>>(f: &F) -> u8 {
+ | +++++++++++++++++++++++++
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.rs
index 140a06a73..be668b4f1 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.rs
@@ -1,4 +1,4 @@
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#[const_trait]
trait ConstDefaultFn: Sized {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.stderr
index f9d0d1f78..7b558e3f7 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-default-method-bodies.stderr
@@ -2,13 +2,9 @@ error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satis
--> $DIR/const-default-method-bodies.rs:24:18
|
LL | NonConstImpl.a();
- | ^ the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl`
+ | ^ the trait `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:5
- |
-LL | NonConstImpl.a();
- | ^^^^^^^^^^^^
+ = help: the trait `ConstDefaultFn` is implemented for `NonConstImpl`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.rs
index 948f0efbc..7f89c1280 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.rs
@@ -1,4 +1,5 @@
-// check-pass
+// known-bug: #110395
+// FIXME check-pass
#![feature(const_trait_impl)]
#![feature(const_precise_live_drops)]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.stderr
new file mode 100644
index 000000000..f5147dc74
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.stderr
@@ -0,0 +1,9 @@
+error[E0493]: destructor of `E` cannot be evaluated at compile-time
+ --> $DIR/const-drop-bound.rs:12:13
+ |
+LL | Err(_e) => None,
+ | ^^ the destructor for this type cannot be evaluated in constant functions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.rs
index 3de9d37d4..747ccbf0f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.rs
@@ -18,6 +18,10 @@ trait A { fn a() { } }
impl A for NonTrivialDrop {}
+const fn check<T: ~const Destruct>(_: T) {}
+
+
+/* FIXME(effects)
struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
@@ -26,11 +30,10 @@ impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
}
}
-const fn check<T: ~const Destruct>(_: T) {}
-
const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
ConstDropImplWithBounds(PhantomData)
);
+*/
struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>);
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.stderr
index 375f5d2c5..100d1df87 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.stderr
@@ -1,50 +1,11 @@
-error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied
- --> $DIR/const-drop-fail-2.rs:31:23
+error[E0493]: destructor of `T` cannot be evaluated at compile-time
+ --> $DIR/const-drop-fail-2.rs:21:36
|
-LL | const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop`
- |
-note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const`
- --> $DIR/const-drop-fail-2.rs:31:23
- |
-LL | const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `ConstDropImplWithBounds`
- --> $DIR/const-drop-fail-2.rs:21:35
- |
-LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
- | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
-
-error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied
- --> $DIR/const-drop-fail-2.rs:32:5
- |
-LL | ConstDropImplWithBounds(PhantomData)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop`
- |
-note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const`
- --> $DIR/const-drop-fail-2.rs:32:5
- |
-LL | ConstDropImplWithBounds(PhantomData)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `ConstDropImplWithBounds`
- --> $DIR/const-drop-fail-2.rs:21:35
- |
-LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
- | ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
-
-error[E0367]: `Drop` impl requires `T: ~const A` but the struct it is implemented for does not
- --> $DIR/const-drop-fail-2.rs:37:9
- |
-LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
- | ^^^^^^^^
- |
-note: the implementor must specify the same requirement
- --> $DIR/const-drop-fail-2.rs:35:1
- |
-LL | struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | const fn check<T: ~const Destruct>(_: T) {}
+ | ^ - value is dropped here
+ | |
+ | the destructor for this type cannot be evaluated in constant functions
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0277, E0367.
-For more information about an error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr
index e745cbd24..dfa5ea8c4 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr
@@ -1,58 +1,9 @@
-error[E0277]: can't drop `NonTrivialDrop` in const contexts
- --> $DIR/const-drop-fail.rs:28:23
+error[E0493]: destructor of `T` cannot be evaluated at compile-time
+ --> $DIR/const-drop-fail.rs:24:36
|
-LL | const _: () = check($exp);
- | ^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop`
-...
-LL | / check_all! {
-LL | | NonTrivialDrop,
-LL | | ConstImplWithDropGlue(NonTrivialDrop),
-LL | | }
- | |_- in this macro invocation
- |
-note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const`
- --> $DIR/const-drop-fail.rs:28:23
- |
-LL | const _: () = check($exp);
- | ^^^^^^^^^^^
-...
-LL | / check_all! {
-LL | | NonTrivialDrop,
-LL | | ConstImplWithDropGlue(NonTrivialDrop),
-LL | | }
- | |_- in this macro invocation
- = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0277]: can't drop `NonTrivialDrop` in const contexts
- --> $DIR/const-drop-fail.rs:28:23
- |
-LL | const _: () = check($exp);
- | ^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Destruct` is not implemented for `NonTrivialDrop`
-...
-LL | / check_all! {
-LL | | NonTrivialDrop,
-LL | | ConstImplWithDropGlue(NonTrivialDrop),
-LL | | }
- | |_- in this macro invocation
- |
-note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const`
- --> $DIR/const-drop-fail.rs:28:23
- |
-LL | const _: () = check($exp);
- | ^^^^^^^^^^^
-...
-LL | / check_all! {
-LL | | NonTrivialDrop,
-LL | | ConstImplWithDropGlue(NonTrivialDrop),
-LL | | }
- | |_- in this macro invocation
-note: required because it appears within the type `ConstImplWithDropGlue`
- --> $DIR/const-drop-fail.rs:18:8
- |
-LL | struct ConstImplWithDropGlue(NonTrivialDrop);
- | ^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
+LL | const fn check<T: ~const Destruct>(_: T) {}
+ | ^ the destructor for this type cannot be evaluated in constant functions
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr
index e745cbd24..8af38b792 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr
@@ -1,58 +1,11 @@
-error[E0277]: can't drop `NonTrivialDrop` in const contexts
- --> $DIR/const-drop-fail.rs:28:23
+error[E0493]: destructor of `T` cannot be evaluated at compile-time
+ --> $DIR/const-drop-fail.rs:24:36
|
-LL | const _: () = check($exp);
- | ^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonTrivialDrop`
-...
-LL | / check_all! {
-LL | | NonTrivialDrop,
-LL | | ConstImplWithDropGlue(NonTrivialDrop),
-LL | | }
- | |_- in this macro invocation
- |
-note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const`
- --> $DIR/const-drop-fail.rs:28:23
- |
-LL | const _: () = check($exp);
- | ^^^^^^^^^^^
-...
-LL | / check_all! {
-LL | | NonTrivialDrop,
-LL | | ConstImplWithDropGlue(NonTrivialDrop),
-LL | | }
- | |_- in this macro invocation
- = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0277]: can't drop `NonTrivialDrop` in const contexts
- --> $DIR/const-drop-fail.rs:28:23
- |
-LL | const _: () = check($exp);
- | ^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Destruct` is not implemented for `NonTrivialDrop`
-...
-LL | / check_all! {
-LL | | NonTrivialDrop,
-LL | | ConstImplWithDropGlue(NonTrivialDrop),
-LL | | }
- | |_- in this macro invocation
- |
-note: the trait `Destruct` is implemented for `NonTrivialDrop`, but that implementation is not `const`
- --> $DIR/const-drop-fail.rs:28:23
- |
-LL | const _: () = check($exp);
- | ^^^^^^^^^^^
-...
-LL | / check_all! {
-LL | | NonTrivialDrop,
-LL | | ConstImplWithDropGlue(NonTrivialDrop),
-LL | | }
- | |_- in this macro invocation
-note: required because it appears within the type `ConstImplWithDropGlue`
- --> $DIR/const-drop-fail.rs:18:8
- |
-LL | struct ConstImplWithDropGlue(NonTrivialDrop);
- | ^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
+LL | const fn check<T: ~const Destruct>(_: T) {}
+ | ^ - value is dropped here
+ | |
+ | the destructor for this type cannot be evaluated in constant functions
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr
new file mode 100644
index 000000000..23e368870
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr
@@ -0,0 +1,19 @@
+error[E0493]: destructor of `T` cannot be evaluated at compile-time
+ --> $DIR/const-drop.rs:19:32
+ |
+LL | const fn a<T: ~const Destruct>(_: T) {}
+ | ^ - value is dropped here
+ | |
+ | the destructor for this type cannot be evaluated in constant functions
+
+error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
+ --> $DIR/const-drop.rs:24:13
+ |
+LL | let _ = S(&mut c);
+ | ^^^^^^^^^- value is dropped here
+ | |
+ | the destructor for this type cannot be evaluated in constant functions
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs
index b0fc3adf9..0a9cf638a 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs
@@ -1,9 +1,10 @@
-// run-pass
+// FIXME run-pass
+// known-bug: #110395
// revisions: stock precise
#![feature(const_trait_impl)]
#![feature(const_mut_refs)]
#![feature(never_type)]
-#![cfg_attr(precise, feature(const_precise_live_drops))]
+// #![cfg_attr(precise, feature(const_precise_live_drops))]
use std::marker::Destruct;
@@ -16,10 +17,12 @@ impl<'a> const Drop for S<'a> {
}
const fn a<T: ~const Destruct>(_: T) {}
+//FIXME ~^ ERROR destructor of
const fn b() -> u8 {
let mut c = 0;
let _ = S(&mut c);
+ //FIXME ~^ ERROR destructor of
a(S(&mut c));
c
}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr
new file mode 100644
index 000000000..23e368870
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr
@@ -0,0 +1,19 @@
+error[E0493]: destructor of `T` cannot be evaluated at compile-time
+ --> $DIR/const-drop.rs:19:32
+ |
+LL | const fn a<T: ~const Destruct>(_: T) {}
+ | ^ - value is dropped here
+ | |
+ | the destructor for this type cannot be evaluated in constant functions
+
+error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
+ --> $DIR/const-drop.rs:24:13
+ |
+LL | let _ = S(&mut c);
+ | ^^^^^^^^^- value is dropped here
+ | |
+ | the destructor for this type cannot be evaluated in constant functions
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.rs
index 2b4963991..fc3a83876 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.rs
@@ -1,9 +1,11 @@
-#![feature(const_trait_impl)]
+// known-bug: #110395
+
+#![feature(const_trait_impl, effects)]
pub trait A {}
-//~^ HELP: mark `A` as const
+// FIXME ~^ HELP: mark `A` as const
impl const A for () {}
-//~^ ERROR: const `impl` for trait `A` which is not marked with `#[const_trait]`
+// FIXME ~^ ERROR: const `impl` for trait `A` which is not marked with `#[const_trait]`
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.stderr
index 478adcf3e..c45af1a9f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-requires-const-trait.stderr
@@ -1,5 +1,5 @@
error: const `impl` for trait `A` which is not marked with `#[const_trait]`
- --> $DIR/const-impl-requires-const-trait.rs:6:12
+ --> $DIR/const-impl-requires-const-trait.rs:8:12
|
LL | pub trait A {}
| - help: mark `A` as const: `#[const_trait]`
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.rs
index dba3ad7f8..348ca0ab1 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.rs
@@ -1,5 +1,4 @@
#[derive_const(Default)] //~ ERROR use of unstable library feature
-//~^ ERROR not marked with `#[const_trait]`
pub struct S;
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.stderr
index 6a81f96d8..cc9bdd271 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-gate.stderr
@@ -6,16 +6,6 @@ LL | #[derive_const(Default)]
|
= help: add `#![feature(derive_const)]` to the crate attributes to enable
-error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
- --> $DIR/derive-const-gate.rs:1:16
- |
-LL | #[derive_const(Default)]
- | ^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
- = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs
index b575ea8da..ce39045d7 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs
@@ -1,5 +1,5 @@
// known-bug: #110395
-#![feature(derive_const)]
+#![feature(derive_const, effects)]
pub struct A;
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr
index 88054096e..046dbae0e 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr
@@ -10,44 +10,6 @@ error[E0635]: unknown feature `const_default_impls`
LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const)]
| ^^^^^^^^^^^^^^^^^^^
-error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
- --> $DIR/derive-const-use.rs:6:12
- |
-LL | impl const Default for A {
- | ^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
-
-error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
- --> $DIR/derive-const-use.rs:10:12
- |
-LL | impl const PartialEq for A {
- | ^^^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
-
-error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
- --> $DIR/derive-const-use.rs:14:16
- |
-LL | #[derive_const(Default, PartialEq)]
- | ^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
- = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
- --> $DIR/derive-const-use.rs:14:25
- |
-LL | #[derive_const(Default, PartialEq)]
- | ^^^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
- = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 6 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0635`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.stderr
index fa7832658..37d123e4c 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.stderr
@@ -1,13 +1,3 @@
-error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
- --> $DIR/derive-const-with-params.rs:6:16
- |
-LL | #[derive_const(PartialEq)]
- | ^^^^^^^^^
- |
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
- = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
-
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/derive-const-with-params.rs:6:16
|
@@ -16,5 +6,5 @@ LL | #[derive_const(PartialEq)]
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr
index 633b7cc25..428286e0b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr
@@ -2,13 +2,9 @@ error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrai
--> $DIR/cross-crate.rs:17:14
|
LL | NonConst.func();
- | ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
+ | ^^^^ the trait `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:5
- |
-LL | NonConst.func();
- | ^^^^^^^^
+ = help: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.rs
index 6df47022c..95edbdc0e 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.rs
@@ -1,6 +1,6 @@
// revisions: stock gated stocknc gatednc
// [gated] check-pass
-#![cfg_attr(any(gated, gatednc), feature(const_trait_impl))]
+#![cfg_attr(any(gated, gatednc), feature(const_trait_impl, effects))]
// aux-build: cross-crate.rs
extern crate cross_crate;
@@ -15,10 +15,11 @@ fn non_const_context() {
const fn const_context() {
#[cfg(any(stocknc, gatednc))]
NonConst.func();
- //[stocknc]~^ ERROR: the trait bound
+ //[stocknc]~^ ERROR: cannot call
//[gatednc]~^^ ERROR: the trait bound
Const.func();
//[stock]~^ ERROR: cannot call
+ //[stocknc]~^^ ERROR: cannot call
}
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr
index 9e97d3f11..ebbe9aa22 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr
@@ -1,15 +1,21 @@
-error[E0277]: the trait bound `cross_crate::NonConst: cross_crate::MyTrait` is not satisfied
+error[E0015]: cannot call non-const fn `<cross_crate::NonConst as cross_crate::MyTrait>::func` in constant functions
--> $DIR/cross-crate.rs:17:14
|
LL | NonConst.func();
- | ^^^^ 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:5
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+ = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+
+error[E0015]: cannot call non-const fn `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions
+ --> $DIR/cross-crate.rs:20:11
|
-LL | NonConst.func();
- | ^^^^^^^^
+LL | Const.func();
+ | ^^^^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+ = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.rs
index 96acdc300..f5644c888 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.rs
@@ -1,3 +1,6 @@
+// known-bug: #110395
+// check-pass
+
#![feature(const_trait_impl)]
#[const_trait]
@@ -10,7 +13,7 @@ const fn foo<T>() where T: ~const Tr {}
pub trait Foo {
fn foo() {
foo::<()>();
- //~^ ERROR the trait bound `(): ~const Tr` is not satisfied
+ //FIXME ~^ ERROR the trait bound `(): Tr` is not satisfied
}
}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr
deleted file mode 100644
index 26644f72c..000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0277]: the trait bound `(): ~const Tr` is not satisfied
- --> $DIR/default-method-body-is-const-body-checking.rs:12:9
- |
-LL | foo::<()>();
- | ^^^^^^^^^^^ 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-body-checking.rs:12:9
- |
-LL | foo::<()>();
- | ^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.rs
index f70ecbc37..da2772400 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.rs
@@ -1,4 +1,4 @@
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#[const_trait]
pub trait Tr {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr
index 21ecddaff..a6881b8fe 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr
@@ -2,13 +2,9 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12
|
LL | ().a()
- | ^ the trait `~const Tr` is not implemented for `()`
+ | ^ the trait `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:9
- |
-LL | ().a()
- | ^^
+ = help: the trait `Tr` is implemented for `()`
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/do-not-const-check-override.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/do-not-const-check-override.rs
index 730e268c0..5a0db816a 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/do-not-const-check-override.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/do-not-const-check-override.rs
@@ -1,5 +1,5 @@
// check-pass
-#![feature(const_trait_impl, rustc_attrs)]
+#![feature(const_trait_impl, rustc_attrs, effects)]
#[const_trait]
trait Foo {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/helloworld.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/helloworld.rs
index 49457354c..e7ba0505d 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/helloworld.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/helloworld.rs
@@ -7,7 +7,7 @@
// ensure we are passing in the correct host effect in always const contexts.
-pub const fn hmm</* T, */ #[rustc_host] const host: bool = true>() -> usize {
+pub const fn hmm<T, #[rustc_host] const host: bool = true>() -> usize {
if host {
1
} else {
@@ -16,14 +16,12 @@ pub const fn hmm</* T, */ #[rustc_host] const host: bool = true>() -> usize {
}
const _: () = {
- let x = hmm();
+ let x = hmm::<()>();
assert!(0 == x);
};
-/* FIXME(effects)
pub const fn uwu(x: [u8; hmm::<()>()]) {
let [] = x;
}
-*/
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr
index 1b21d7c0e..6a177592b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/generic-bound.stderr
@@ -1,11 +1,16 @@
-error: const `impl` for trait `Add` which is not marked with `#[const_trait]`
- --> $DIR/generic-bound.rs:16:15
+error[E0015]: cannot call non-const operator in constant functions
+ --> $DIR/generic-bound.rs:25:5
|
-LL | impl<T> const std::ops::Add for S<T> {
- | ^^^^^^^^^^^^^
+LL | arg + arg
+ | ^^^^^^^^^
+ |
+note: impl defined here, but it is not `const`
+ --> $DIR/generic-bound.rs:16:1
|
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
+LL | impl<T> const std::ops::Add for S<T> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/hir-const-check.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/hir-const-check.rs
index 337c73340..426534deb 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/hir-const-check.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/hir-const-check.rs
@@ -1,6 +1,6 @@
// Regression test for #69615.
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#[const_trait]
pub trait MyTrait {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.rs
index 07d3f51ed..df242721b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.rs
@@ -1,11 +1,12 @@
+// known-bug: #110395
#![feature(const_trait_impl)]
struct Bug {
inner: [(); match || 1 {
n => n(),
- //~^ ERROR the trait bound
- //~| ERROR the trait bound
- //~| ERROR cannot call non-const closure in constants
+ //FIXME ~^ ERROR the trait bound
+ //FIXME ~| ERROR the trait bound
+ //FIXME ~| ERROR cannot call non-const closure in constants
}],
}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr
index b98ccbe5d..f0c61cf9d 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102985.stderr
@@ -1,41 +1,11 @@
-error[E0277]: the trait bound `[closure@$DIR/issue-102985.rs:4:23: 4:25]: ~const Fn<()>` is not satisfied
- --> $DIR/issue-102985.rs:5:14
- |
-LL | n => n(),
- | ^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
- |
- = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
-note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-102985.rs:4:23: 4:25]`, but that implementation is not `const`
- --> $DIR/issue-102985.rs:5:14
- |
-LL | n => n(),
- | ^^^
- = note: wrap the `[closure@$DIR/issue-102985.rs:4:23: 4:25]` in a closure with no arguments: `|| { /* code */ }`
-
-error[E0277]: the trait bound `[closure@$DIR/issue-102985.rs:4:23: 4:25]: ~const Fn<()>` is not satisfied
- --> $DIR/issue-102985.rs:5:14
- |
-LL | n => n(),
- | ^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
- |
- = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
-note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-102985.rs:4:23: 4:25]`, but that implementation is not `const`
- --> $DIR/issue-102985.rs:5:14
- |
-LL | n => n(),
- | ^^^
- = note: wrap the `[closure@$DIR/issue-102985.rs:4:23: 4:25]` in a closure with no arguments: `|| { /* code */ }`
-
error[E0015]: cannot call non-const closure in constants
- --> $DIR/issue-102985.rs:5:14
+ --> $DIR/issue-102985.rs:6:14
|
LL | n => n(),
| ^^^
|
- = note: closures need an RFC before allowed to be called in constants
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.rs
index b132c395a..5127ec069 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.rs
@@ -1,3 +1,5 @@
+// known-bug: #110395
+
#![feature(const_trait_impl)]
pub trait A {
@@ -6,8 +8,8 @@ pub trait A {
pub const fn foo<T: A>() -> bool {
T::assoc()
- //~^ ERROR the trait bound
- //~| ERROR cannot call non-const fn
+ //FIXME ~^ ERROR the trait bound
+ //FIXME ~| ERROR cannot call non-const fn
}
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr
index 955923505..d8cb10c65 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-88155.stderr
@@ -1,24 +1,11 @@
-error[E0277]: the trait bound `T: ~const A` is not satisfied
- --> $DIR/issue-88155.rs:8:5
- |
-LL | T::assoc()
- | ^^^^^^^^^^ the trait `~const A` is not implemented for `T`
- |
-note: the trait `A` is implemented for `T`, but that implementation is not `const`
- --> $DIR/issue-88155.rs:8:5
- |
-LL | T::assoc()
- | ^^^^^^^^^^
-
error[E0015]: cannot call non-const fn `<T as A>::assoc` in constant functions
- --> $DIR/issue-88155.rs:8:5
+ --> $DIR/issue-88155.rs:10:5
|
LL | T::assoc()
| ^^^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.rs
index 96a3e386e..fdb422201 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.rs
@@ -1,6 +1,7 @@
// Regression test for #92111.
//
-// check-pass
+// known-bug: #110395
+// FIXME check-pass
#![feature(const_trait_impl)]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.stderr
new file mode 100644
index 000000000..b27f94f99
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-92111.stderr
@@ -0,0 +1,11 @@
+error[E0493]: destructor of `T` cannot be evaluated at compile-time
+ --> $DIR/issue-92111.rs:20:32
+ |
+LL | const fn a<T: ~const Destruct>(t: T) {}
+ | ^ - value is dropped here
+ | |
+ | the destructor for this type cannot be evaluated in constant functions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr
index bd0dd126c..4fe8a372e 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr
@@ -1,26 +1,12 @@
-error[E0277]: can't compare `str` with `str` in const contexts
- --> $DIR/match-non-const-eq.rs:6:9
- |
-LL | "a" => (),
- | ^^^ no implementation for `str == str`
- |
- = help: the trait `~const PartialEq` is not implemented for `str`
-note: the trait `PartialEq` is implemented for `str`, but that implementation is not `const`
- --> $DIR/match-non-const-eq.rs:6:9
- |
-LL | "a" => (),
- | ^^^
-
error[E0015]: cannot match on `str` in constant functions
- --> $DIR/match-non-const-eq.rs:6:9
+ --> $DIR/match-non-const-eq.rs:7:9
|
-LL | "a" => (),
+LL | "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in const contexts
| ^^^
|
= note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0015, E0277.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.rs
index 0d04101a3..d06d0d6dd 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.rs
@@ -1,10 +1,11 @@
+// known-bug: #110395
// revisions: stock gated
#![cfg_attr(gated, feature(const_trait_impl))]
const fn foo(input: &'static str) {
match input {
- "a" => (), //[gated]~ ERROR can't compare `str` with `str` in const contexts
- //~^ ERROR cannot match on `str` in constant functions
+ "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in const contexts
+ //FIXME ~^ ERROR cannot match on `str` in constant functions
_ => (),
}
}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr
index dcb9b49ea..c36142dac 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr
@@ -1,7 +1,7 @@
error[E0015]: cannot match on `str` in constant functions
- --> $DIR/match-non-const-eq.rs:6:9
+ --> $DIR/match-non-const-eq.rs:7:9
|
-LL | "a" => (),
+LL | "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in const contexts
| ^^^
|
= note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs
index f31123f16..3db59631e 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs
@@ -1,5 +1,7 @@
// Tests that trait bounds on specializing trait impls must be `~const` if the
// same bound is present on the default impl and is `~const` there.
+// check-pass
+// FIXME(effects) ^ should error
#![feature(const_trait_impl)]
#![feature(rustc_attrs)]
@@ -29,7 +31,7 @@ where
impl<T> Bar for T
where
- T: Foo, //~ ERROR missing `~const` qualifier
+ T: Foo, //FIXME ~ ERROR missing `~const` qualifier
T: Specialize,
{
fn bar() {}
@@ -47,7 +49,7 @@ where
default fn baz() {}
}
-impl<T> const Baz for T //~ ERROR conflicting implementations of trait `Baz`
+impl<T> const Baz for T //FIXME ~ ERROR conflicting implementations of trait `Baz`
where
T: Foo,
T: Specialize,
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr
deleted file mode 100644
index 057cf4aea..000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: missing `~const` qualifier for specialization
- --> $DIR/const-default-bound-non-const-specialized-bound.rs:32:8
- |
-LL | T: Foo,
- | ^^^
-
-error[E0119]: conflicting implementations of trait `Baz`
- --> $DIR/const-default-bound-non-const-specialized-bound.rs:50:1
- |
-LL | impl<T> const Baz for T
- | ----------------------- first implementation here
-...
-LL | impl<T> const Baz for T
- | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.rs
index 9ddea427c..b6cb24d15 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.rs
@@ -3,7 +3,7 @@
// run-pass
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#![feature(min_specialization)]
#[const_trait]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-impl-non-const-specialized-impl.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-impl-non-const-specialized-impl.rs
index a3bb9b3f9..9a93d01ed 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-impl-non-const-specialized-impl.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-impl-non-const-specialized-impl.rs
@@ -1,6 +1,6 @@
// Tests that specializing trait impls must be at least as const as the default impl.
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#![feature(min_specialization)]
#[const_trait]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs
index 35aa52fbd..84c7926f4 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs
@@ -1,9 +1,9 @@
// Tests that a non-const default impl can be specialized by a const trait impl,
// but that the default impl cannot be used in a const context.
+// known-bug: #110395
+// FIXME run-pass
-// run-pass
-
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#![feature(min_specialization)]
#[const_trait]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.stderr
new file mode 100644
index 000000000..4734cee7f
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `Value` for type `FortyTwo`
+ --> $DIR/non-const-default-const-specialized.rs:27:1
+ |
+LL | impl<T> Value for T {
+ | ------------------- first implementation here
+...
+LL | impl const Value for FortyTwo {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `FortyTwo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs
index 633543700..ada475909 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.rs
@@ -1,5 +1,5 @@
#![feature(const_trait_impl, min_specialization, rustc_attrs)]
-
+// known-bug: #110395
#[rustc_specialization_trait]
#[const_trait]
pub trait Sup {}
@@ -25,7 +25,7 @@ impl<T: Default + ~const Sup> const A for T {
const fn generic<T: Default>() {
<T as A>::a();
- //~^ ERROR: the trait bound `T: ~const Sup` is not satisfied
+ //FIXME ~^ ERROR: the trait bound `T: ~const Sup` is not satisfied
}
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr
index 8923416f4..92bc9815e 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr
@@ -1,21 +1,11 @@
-error[E0277]: the trait bound `T: ~const Sup` is not satisfied
+error[E0015]: cannot call non-const fn `<T as A>::a` in constant functions
--> $DIR/specializing-constness-2.rs:27:5
|
LL | <T as A>::a();
- | ^^^^^^^^^^^^^ the trait `~const Sup` is not implemented for `T`
+ | ^^^^^^^^^^^^^
|
-note: required for `T` to implement `~const A`
- --> $DIR/specializing-constness-2.rs:20:37
- |
-LL | impl<T: Default + ~const Sup> const A for T {
- | ---------- ^ ^
- | |
- | unsatisfied trait bound introduced here
-help: consider further restricting this bound
- |
-LL | const fn generic<T: Default + ~const Sup>() {
- | ++++++++++++
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.rs
index 5c2a3f801..7206a89e5 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.rs
@@ -1,4 +1,4 @@
-#![feature(const_trait_impl, min_specialization, rustc_attrs)]
+#![feature(const_trait_impl, effects, min_specialization, rustc_attrs)]
#[rustc_specialization_trait]
#[const_trait]
@@ -22,7 +22,7 @@ impl<T: ~const Spec> const A for T {
impl<T: Spec + Sup> A for T {
//~^ ERROR: cannot specialize
-//~| ERROR: missing `~const` qualifier
+//FIXME(effects) ~| ERROR: missing `~const` qualifier
fn a() -> u32 {
3
}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.stderr
index 1ffdc50e5..08258fd1a 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness.stderr
@@ -4,11 +4,5 @@ error: cannot specialize on const impl with non-const impl
LL | impl<T: Spec + Sup> A for T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: missing `~const` qualifier for specialization
- --> $DIR/specializing-constness.rs:23:9
- |
-LL | impl<T: Spec + Sup> A for T {
- | ^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/staged-api.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/staged-api.rs
index 1d79f5adf..b3977e6ce 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/staged-api.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/staged-api.rs
@@ -1,7 +1,7 @@
// revisions: stable unstable
#![cfg_attr(unstable, feature(unstable))] // The feature from the ./auxiliary/staged-api.rs file.
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")]
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.rs
index ecb06271c..93fd96f8f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.rs
@@ -1,5 +1,5 @@
#![feature(const_trait_impl)]
-
+// known-bug: #110395
// revisions: yy yn ny nn
#[cfg_attr(any(yy, yn), const_trait)]
@@ -9,12 +9,12 @@ trait Foo {
#[cfg_attr(any(yy, ny), const_trait)]
trait Bar: ~const Foo {}
-//[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
-//[ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]`
+// FIXME [ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
+// FIXME [ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]`
const fn foo<T: Bar>(x: &T) {
x.a();
- //[yn,yy]~^ ERROR the trait bound
+ // FIXME [yn,yy]~^ ERROR the trait bound
}
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr
index c9fa19554..5d34156a5 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr
@@ -1,19 +1,11 @@
-error[E0277]: the trait bound `T: ~const Foo` is not satisfied
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-2.rs:16:7
|
LL | x.a();
- | ^ the trait `~const Foo` is not implemented for `T`
+ | ^^^
|
-note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
- --> $DIR/super-traits-fail-2.rs:16:5
- |
-LL | x.a();
- | ^
-help: consider further restricting this bound
- |
-LL | const fn foo<T: Bar + ~const Foo>(x: &T) {
- | ++++++++++++
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr
index c9fa19554..5d34156a5 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr
@@ -1,19 +1,11 @@
-error[E0277]: the trait bound `T: ~const Foo` is not satisfied
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-2.rs:16:7
|
LL | x.a();
- | ^ the trait `~const Foo` is not implemented for `T`
+ | ^^^
|
-note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
- --> $DIR/super-traits-fail-2.rs:16:5
- |
-LL | x.a();
- | ^
-help: consider further restricting this bound
- |
-LL | const fn foo<T: Bar + ~const Foo>(x: &T) {
- | ++++++++++++
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
index fdc6b8058..2897eabb0 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
@@ -1,17 +1,17 @@
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/super-traits-fail-3.rs:12:19
+ --> $DIR/super-traits-fail-3.rs:13:19
|
LL | trait Bar: ~const Foo {}
| ^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/super-traits-fail-3.rs:12:19
+ --> $DIR/super-traits-fail-3.rs:13:19
|
LL | trait Bar: ~const Foo {}
| ^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/super-traits-fail-3.rs:16:24
+ --> $DIR/super-traits-fail-3.rs:17:24
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
index 7375b8c81..9839a4f24 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
@@ -1,11 +1,11 @@
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/super-traits-fail-3.rs:12:19
+ --> $DIR/super-traits-fail-3.rs:13:19
|
LL | trait Bar: ~const Foo {}
| ^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/super-traits-fail-3.rs:12:19
+ --> $DIR/super-traits-fail-3.rs:13:19
|
LL | trait Bar: ~const Foo {}
| ^^^
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs
index 8cf64944a..16c592830 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs
@@ -1,7 +1,8 @@
#![feature(const_trait_impl)]
// revisions: yy yn ny nn
-//[yy] check-pass
+//[yy] known-bug: #110395
+//FIXME [yy] check-pass
#[cfg_attr(any(yy, yn), const_trait)]
trait Foo {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr
index 7a152914b..58225b945 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr
@@ -1,5 +1,5 @@
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/super-traits-fail-3.rs:16:24
+ --> $DIR/super-traits-fail-3.rs:17:24
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yy.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yy.stderr
new file mode 100644
index 000000000..6bc643e68
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yy.stderr
@@ -0,0 +1,11 @@
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
+ --> $DIR/super-traits-fail-3.rs:19:7
+ |
+LL | x.a();
+ | ^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs
index 3e2b81368..b3853def7 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs
@@ -1,3 +1,6 @@
+// check-pass
+// known-bug: #110395
+
#![feature(const_trait_impl)]
#[const_trait]
@@ -13,6 +16,6 @@ impl Foo for S {
}
impl const Bar for S {}
-//~^ ERROR the trait bound
+//FIXME ~^ ERROR the trait bound
fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr
deleted file mode 100644
index bf12ef1ca..000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0277]: the trait bound `S: ~const Foo` is not satisfied
- --> $DIR/super-traits-fail.rs:15:20
- |
-LL | impl const Bar for S {}
- | ^ the trait `~const Foo` is not implemented for `S`
- |
-note: the trait `Foo` is implemented for `S`, but that implementation is not `const`
- --> $DIR/super-traits-fail.rs:15:20
- |
-LL | impl const Bar for S {}
- | ^
-note: required by a bound in `Bar`
- --> $DIR/super-traits-fail.rs:8:12
- |
-LL | trait Bar: ~const Foo {}
- | ^^^^^^^^^^ required by this bound in `Bar`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits.rs
index df96f6fb4..92becf7c4 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits.rs
@@ -1,5 +1,5 @@
// check-pass
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#[const_trait]
trait Foo {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
index 78a64b901..89d74cecf 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
@@ -1,4 +1,4 @@
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#![feature(generic_arg_infer)]
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
@@ -6,9 +6,10 @@
struct Foo<const N: usize>;
impl<const N: usize> Foo<N> {
- fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
- Foo
- }
+ fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
+ //~^ ERROR mismatched types
+ Foo
+ }
}
#[const_trait]
@@ -24,6 +25,7 @@ impl const Add42 for () {
fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
//~^ ERROR `~const` is not allowed here
+ //~| ERROR mismatched types
Foo
}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
index aae72f36e..ec5d21d33 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
@@ -1,14 +1,33 @@
error: `~const` is not allowed here
- --> $DIR/tilde-const-and-const-params.rs:25:11
+ --> $DIR/tilde-const-and-const-params.rs:26:11
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^^^^^^^^^^
|
note: this function is not `const`, so it cannot have `~const` trait bounds
- --> $DIR/tilde-const-and-const-params.rs:25:4
+ --> $DIR/tilde-const-and-const-params.rs:26:4
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/tilde-const-and-const-params.rs:26:61
+ |
+LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
+ | ^^^^^^^^^ expected `false`, found `true`
+ |
+ = note: expected constant `false`
+ found constant `true`
+
+error[E0308]: mismatched types
+ --> $DIR/tilde-const-and-const-params.rs:9:44
+ |
+LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
+ | ^^^^^^^^^ expected `false`, found `true`
+ |
+ = note: expected constant `false`
+ found constant `true`
+
+error: aborting due to 3 previous errors
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde_const_on_impl_bound.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde_const_on_impl_bound.rs
index 285cef571..fbdc3a4f3 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde_const_on_impl_bound.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde_const_on_impl_bound.rs
@@ -1,5 +1,6 @@
-// check-pass
-#![feature(const_trait_impl)]
+// known-bug: #110395
+// FIXME check-pass
+#![feature(const_trait_impl, effects)]
#[const_trait]
trait Foo {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde_const_on_impl_bound.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde_const_on_impl_bound.stderr
new file mode 100644
index 000000000..f77672f3e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde_const_on_impl_bound.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/tilde_const_on_impl_bound.rs:14:9
+ |
+LL | self.0.foo()
+ | ^^^^^^^^^^^^ expected `host`, found `true`
+ |
+ = note: expected constant `host`
+ found constant `true`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-default-body-stability.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-default-body-stability.stderr
index 35dc1ca12..deed05ae1 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-default-body-stability.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-default-body-stability.stderr
@@ -1,20 +1,29 @@
-error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
- --> $DIR/trait-default-body-stability.rs:18:12
+error[E0015]: `?` cannot determine the branch of `T` in constant functions
+ --> $DIR/trait-default-body-stability.rs:44:9
|
-LL | impl const Try for T {
- | ^^^
+LL | T?
+ | ^^
+ |
+note: impl defined here, but it is not `const`
+ --> $DIR/trait-default-body-stability.rs:18:1
|
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
+LL | impl const Try for T {
+ | ^^^^^^^^^^^^^^^^^^^^
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]`
- --> $DIR/trait-default-body-stability.rs:33:12
+error[E0015]: `?` cannot convert from residual of `T` in constant functions
+ --> $DIR/trait-default-body-stability.rs:44:9
|
-LL | impl const FromResidual for T {
- | ^^^^^^^^^^^^
+LL | T?
+ | ^^
+ |
+note: impl defined here, but it is not `const`
+ --> $DIR/trait-default-body-stability.rs:33:1
|
- = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
- = note: adding a non-const method body in the future would be a breaking change
+LL | impl const FromResidual for T {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.rs
index bfe98b98c..94be3ff46 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.rs
@@ -2,7 +2,9 @@
// Checking the validity of traits' where clauses happen at a later stage.
// (`rustc_const_eval` instead of `rustc_hir_analysis`) Therefore one file as a
// test is not enough.
-#![feature(const_trait_impl)]
+// known-bug: #110395
+// FIXME check-pass
+#![feature(const_trait_impl, effects)]
#[const_trait]
trait Bar {}
@@ -17,9 +19,9 @@ trait Foo {
const fn test1<T: ~const Foo + Bar>() {
T::a();
T::b();
- //~^ ERROR the trait bound
+ //FIXME ~^ ERROR the trait bound
T::c::<T>();
- //~^ ERROR the trait bound
+ //FIXME ~^ ERROR the trait bound
}
const fn test2<T: ~const Foo + ~const Bar>() {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
index f2846b6a6..e8d0eec02 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
@@ -1,34 +1,34 @@
error[E0277]: the trait bound `T: ~const Bar` is not satisfied
- --> $DIR/trait-where-clause-const.rs:19:5
+ --> $DIR/trait-where-clause-const.rs:21:5
|
LL | T::b();
- | ^^^^^^ the trait `~const Bar` is not implemented for `T`
+ | ^^^^ the trait `Bar` is not implemented for `T`
|
-note: the trait `Bar` is implemented for `T`, but that implementation is not `const`
- --> $DIR/trait-where-clause-const.rs:19:5
+note: required by a bound in `Foo::b`
+ --> $DIR/trait-where-clause-const.rs:15:24
|
-LL | T::b();
- | ^^^^^^
+LL | fn b() where Self: ~const Bar;
+ | ^^^^^^^^^^ required by this bound in `Foo::b`
help: consider further restricting this bound
|
-LL | const fn test1<T: ~const Foo + Bar + ~const Bar>() {
- | ++++++++++++
+LL | const fn test1<T: ~const Foo + Bar + Bar>() {
+ | +++++
error[E0277]: the trait bound `T: ~const Bar` is not satisfied
- --> $DIR/trait-where-clause-const.rs:21:5
+ --> $DIR/trait-where-clause-const.rs:23:12
|
LL | T::c::<T>();
- | ^^^^^^^^^^^ the trait `~const Bar` is not implemented for `T`
+ | ^ the trait `Bar` is not implemented for `T`
|
-note: the trait `Bar` is implemented for `T`, but that implementation is not `const`
- --> $DIR/trait-where-clause-const.rs:21:5
+note: required by a bound in `Foo::c`
+ --> $DIR/trait-where-clause-const.rs:16:13
|
-LL | T::c::<T>();
- | ^^^^^^^^^^^
+LL | fn c<T: ~const Bar>();
+ | ^^^^^^^^^^ required by this bound in `Foo::c`
help: consider further restricting this bound
|
-LL | const fn test1<T: ~const Foo + Bar + ~const Bar>() {
- | ++++++++++++
+LL | const fn test1<T: ~const Foo + Bar + Bar>() {
+ | +++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs
index 4b8b00406..5439f859a 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-run.rs
@@ -1,6 +1,6 @@
// run-pass
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#[const_trait]
trait Bar {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-self-referential.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-self-referential.rs
index 3b028ac48..c578813b8 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-self-referential.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-self-referential.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#[const_trait]
trait Foo {
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/count.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/count.rs
new file mode 100644
index 000000000..0907061d6
--- /dev/null
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/auxiliary/count.rs
@@ -0,0 +1,14 @@
+// force-host
+// edition: 2018
+// no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+use std::str::FromStr;
+
+#[proc_macro]
+pub fn number_of_tokens(_: TokenStream) -> TokenStream {
+ TokenStream::from_str("c\"\"").unwrap().into_iter().count().to_string().parse().unwrap()
+}
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs
index 3fc5fd481..503739600 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs
@@ -1,5 +1,4 @@
-// FIXME(c_str_literals): This should be `run-pass`
-// known-bug: #113333
+// run-pass
// edition: 2021
#![feature(c_str_literals)]
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr
deleted file mode 100644
index 571c319d8..000000000
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error: prefix `c` is unknown
- --> $DIR/basic.rs:8:27
- |
-LL | assert_eq!(b"test\0", c"test".to_bytes_with_nul());
- | ^ unknown prefix
- |
- = note: prefixed identifiers and literals are reserved since Rust 2021
-help: consider inserting whitespace here
- |
-LL | assert_eq!(b"test\0", c "test".to_bytes_with_nul());
- | +
-
-error: no rules expected the token `"test"`
- --> $DIR/basic.rs:8:28
- |
-LL | assert_eq!(b"test\0", c"test".to_bytes_with_nul());
- | -^^^^^
- | |
- | no rules expected this token in macro call
- | help: missing comma here
- |
- = note: while trying to match sequence start
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs
new file mode 100644
index 000000000..b3557c71b
--- /dev/null
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs
@@ -0,0 +1,16 @@
+// even if this crate is edition 2021, proc macros compiled using older
+// editions should still be able to observe the pre-2021 token behavior
+//
+// adapted from tests/ui/rust-2021/reserved-prefixes-via-macro.rs
+
+// edition: 2021
+// check-pass
+
+// aux-build: count.rs
+extern crate count;
+
+const _: () = {
+ assert!(count::number_of_tokens!() == 2);
+};
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr
index 8de36ca4a..ea666e433 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr
@@ -1,32 +1,21 @@
-error: prefix `c` is unknown
+error[E0658]: `c".."` literals are experimental
--> $DIR/gate.rs:10:5
|
LL | c"foo";
- | ^ unknown prefix
+ | ^^^^^^
|
- = note: prefixed identifiers and literals are reserved since Rust 2021
-help: consider inserting whitespace here
- |
-LL | c "foo";
- | +
+ = note: see issue #105723 <https://github.com/rust-lang/rust/issues/105723> for more information
+ = help: add `#![feature(c_str_literals)]` to the crate attributes to enable
-error: prefix `c` is unknown
+error[E0658]: `c".."` literals are experimental
--> $DIR/gate.rs:13:8
|
LL | m!(c"test");
- | ^ unknown prefix
- |
- = note: prefixed identifiers and literals are reserved since Rust 2021
-help: consider inserting whitespace here
+ | ^^^^^^^
|
-LL | m!(c "test");
- | +
-
-error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"foo"`
- --> $DIR/gate.rs:10:6
- |
-LL | c"foo";
- | ^^^^^ expected one of 8 possible tokens
+ = note: see issue #105723 <https://github.com/rust-lang/rust/issues/105723> for more information
+ = help: add `#![feature(c_str_literals)]` to the crate attributes to enable
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs
index 96945f125..369173e23 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs
Binary files differ
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr
index 2226c7aa6..82d9f9cb3 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr
Binary files differ
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs
index 066505c23..380445d7a 100644
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs
+++ b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs
@@ -1,5 +1,4 @@
-// FIXME(c_str_literals): This should be `run-pass`
-// known-bug: #113333
+// run-pass
// edition: 2021
#![feature(c_str_literals)]
diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr
deleted file mode 100644
index 47361fb61..000000000
--- a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr
+++ /dev/null
@@ -1,38 +0,0 @@
-error: prefix `c` is unknown
- --> $DIR/non-ascii.rs:9:9
- |
-LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | ^ unknown prefix
- |
- = note: prefixed identifiers and literals are reserved since Rust 2021
-help: consider inserting whitespace here
- |
-LL | c "\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | +
-
-error: out of range hex escape
- --> $DIR/non-ascii.rs:9:11
- |
-LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | ^^^^ must be a character in the range [\x00-\x7f]
-
-error: out of range hex escape
- --> $DIR/non-ascii.rs:9:15
- |
-LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | ^^^^ must be a character in the range [\x00-\x7f]
-
-error: no rules expected the token `"\xEF\x80🦀\u{1F980}"`
- --> $DIR/non-ascii.rs:9:10
- |
-LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(),
- | -^^^^^^^^^^^^^^^^^^^^
- | |
- | no rules expected this token in macro call
- | help: missing comma here
- |
-note: while trying to match `,`
- --> $SRC_DIR/core/src/macros/mod.rs:LL:COL
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/rmeta/auxiliary/rmeta-rlib-rpass.rs b/tests/ui/rmeta/auxiliary/rmeta-rlib-rpass.rs
deleted file mode 100644
index f5e8c3d2a..000000000
--- a/tests/ui/rmeta/auxiliary/rmeta-rlib-rpass.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type="rlib"]
-#![crate_name="rmeta_aux"]
-
-pub struct Foo {
- pub field: i32,
-}
diff --git a/tests/ui/rmeta/auxiliary/rmeta-rmeta.rs b/tests/ui/rmeta/auxiliary/rmeta-rmeta.rs
deleted file mode 100644
index 4a6d055a8..000000000
--- a/tests/ui/rmeta/auxiliary/rmeta-rmeta.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// no-prefer-dynamic
-// compile-flags: --emit=metadata
-
-#![crate_type="rlib"]
-#![crate_name="rmeta_aux"]
-
-pub struct Foo {
- pub field2: i32,
-}
diff --git a/tests/ui/rmeta/rmeta-rpass.rs b/tests/ui/rmeta/rmeta-rpass.rs
deleted file mode 100644
index 173a6a394..000000000
--- a/tests/ui/rmeta/rmeta-rpass.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// run-pass
-// Test that using rlibs and rmeta dep crates work together. Specifically, that
-// there can be both an rmeta and an rlib file and rustc will prefer the rmeta
-// file.
-//
-// This behavior is simply making sure this doesn't accidentally change; in this
-// case we want to make sure that the rlib isn't being used as that would cause
-// bugs in -Zbinary-dep-depinfo (see #68298).
-
-// aux-build:rmeta-rmeta.rs
-// aux-build:rmeta-rlib-rpass.rs
-
-extern crate rmeta_aux;
-use rmeta_aux::Foo;
-
-pub fn main() {
- let _ = Foo { field2: 42 };
-}
diff --git a/tests/ui/sanitize/address.rs b/tests/ui/sanitize/address.rs
index 5b2cea875..1faab1fd2 100644
--- a/tests/ui/sanitize/address.rs
+++ b/tests/ui/sanitize/address.rs
@@ -1,11 +1,12 @@
// needs-sanitizer-support
// needs-sanitizer-address
+// ignore-cross-compile
//
// compile-flags: -Z sanitizer=address -O -g
//
// run-fail
// error-pattern: AddressSanitizer: stack-buffer-overflow
-// error-pattern: 'xs' (line 13) <== Memory access at offset
+// error-pattern: 'xs' (line 14) <== Memory access at offset
use std::hint::black_box;
diff --git a/tests/ui/sanitize/badfree.rs b/tests/ui/sanitize/badfree.rs
index 095a6f469..c8d1ce7df 100644
--- a/tests/ui/sanitize/badfree.rs
+++ b/tests/ui/sanitize/badfree.rs
@@ -1,5 +1,6 @@
// needs-sanitizer-support
// needs-sanitizer-address
+// ignore-cross-compile
//
// compile-flags: -Z sanitizer=address -O
//
diff --git a/tests/ui/sanitize/issue-111184-generator-witness.rs b/tests/ui/sanitize/issue-111184-generator-witness.rs
index 8f4118057..d36d8bce5 100644
--- a/tests/ui/sanitize/issue-111184-generator-witness.rs
+++ b/tests/ui/sanitize/issue-111184-generator-witness.rs
@@ -2,10 +2,10 @@
// encode_ty and caused the compiler to ICE.
//
// needs-sanitizer-cfi
-// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi --edition=2021
+// compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi --edition=2021
// no-prefer-dynamic
// only-x86_64-unknown-linux-gnu
-// run-pass
+// build-pass
use std::future::Future;
diff --git a/tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs b/tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs
new file mode 100644
index 000000000..8f870be13
--- /dev/null
+++ b/tests/ui/sanitize/issue-114275-cfi-const-expr-in-arry-len.rs
@@ -0,0 +1,15 @@
+// Regression test for issue 114275 `typeid::typeid_itanium_cxx_abi::transform_ty`
+// was expecting array type lengths to be evaluated, this was causing an ICE.
+//
+// build-pass
+// compile-flags: -Ccodegen-units=1 -Clto -Zsanitizer=cfi -Ctarget-feature=-crt-static
+// needs-sanitizer-cfi
+
+#![crate_type = "lib"]
+
+#[repr(transparent)]
+pub struct Array([u8; 1 * 1]);
+
+pub extern "C" fn array() -> Array {
+ loop {}
+}
diff --git a/tests/ui/sanitize/issue-72154-lifetime-markers.rs b/tests/ui/sanitize/issue-72154-lifetime-markers.rs
index b2e182238..3d9c51daa 100644
--- a/tests/ui/sanitize/issue-72154-lifetime-markers.rs
+++ b/tests/ui/sanitize/issue-72154-lifetime-markers.rs
@@ -5,6 +5,7 @@
//
// needs-sanitizer-support
// needs-sanitizer-address
+// ignore-cross-compile
//
// compile-flags: -Copt-level=0 -Zsanitizer=address
// run-pass
diff --git a/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs b/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs
index 33e18e355..052a40598 100644
--- a/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs
+++ b/tests/ui/sanitize/new-llvm-pass-manager-thin-lto.rs
@@ -4,6 +4,7 @@
//
// needs-sanitizer-support
// needs-sanitizer-address
+// ignore-cross-compile
//
// no-prefer-dynamic
// revisions: opt0 opt1
diff --git a/tests/ui/sanitize/sanitizer-cfi-requires-lto.rs b/tests/ui/sanitize/sanitizer-cfi-requires-lto.rs
index 29e32889f..e9a49dd3f 100644
--- a/tests/ui/sanitize/sanitizer-cfi-requires-lto.rs
+++ b/tests/ui/sanitize/sanitizer-cfi-requires-lto.rs
@@ -1,4 +1,4 @@
-// Verifies that `-Zsanitizer=cfi` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`.
+// Verifies that `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`.
//
// needs-sanitizer-cfi
// compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi
diff --git a/tests/ui/sanitize/sanitizer-cfi-requires-lto.stderr b/tests/ui/sanitize/sanitizer-cfi-requires-lto.stderr
index 5e706b513..8cd9c5444 100644
--- a/tests/ui/sanitize/sanitizer-cfi-requires-lto.stderr
+++ b/tests/ui/sanitize/sanitizer-cfi-requires-lto.stderr
@@ -1,4 +1,4 @@
-error: `-Zsanitizer=cfi` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`
+error: `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`
error: aborting due to previous error
diff --git a/tests/ui/sanitize/sanitizer-cfi-with-rustc-lto-requires-single-codegen-unit.rs b/tests/ui/sanitize/sanitizer-cfi-with-rustc-lto-requires-single-codegen-unit.rs
new file mode 100644
index 000000000..a13c12c17
--- /dev/null
+++ b/tests/ui/sanitize/sanitizer-cfi-with-rustc-lto-requires-single-codegen-unit.rs
@@ -0,0 +1,8 @@
+// Verifies that `-Zsanitizer=cfi` with `-Clto` or `-Clto=thin` requires `-Ccodegen-units=1`.
+//
+// needs-sanitizer-cfi
+// compile-flags: -Ccodegen-units=2 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi
+
+#![feature(no_core)]
+#![no_core]
+#![no_main]
diff --git a/tests/ui/sanitize/sanitizer-cfi-with-rustc-lto-requires-single-codegen-unit.stderr b/tests/ui/sanitize/sanitizer-cfi-with-rustc-lto-requires-single-codegen-unit.stderr
new file mode 100644
index 000000000..136f49360
--- /dev/null
+++ b/tests/ui/sanitize/sanitizer-cfi-with-rustc-lto-requires-single-codegen-unit.stderr
@@ -0,0 +1,4 @@
+error: `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/sanitize/use-after-scope.rs b/tests/ui/sanitize/use-after-scope.rs
index 30be2ae6f..de63eea19 100644
--- a/tests/ui/sanitize/use-after-scope.rs
+++ b/tests/ui/sanitize/use-after-scope.rs
@@ -1,5 +1,6 @@
// needs-sanitizer-support
// needs-sanitizer-address
+// ignore-cross-compile
//
// compile-flags: -Zsanitizer=address
// run-fail
diff --git a/tests/ui/self/arbitrary_self_type_mut_difference.rs b/tests/ui/self/arbitrary_self_type_mut_difference.rs
new file mode 100644
index 000000000..e75c00ae9
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_type_mut_difference.rs
@@ -0,0 +1,13 @@
+// Related to #57994.
+use std::pin::Pin;
+struct S;
+
+impl S {
+ fn x(self: Pin<&mut Self>) {} //~ NOTE method is available for `Pin<&mut S>`
+ fn y(self: Pin<&Self>) {} //~ NOTE method is available for `Pin<&S>`
+}
+
+fn main() {
+ Pin::new(&S).x(); //~ ERROR no method named `x` found for struct `Pin<&S>` in the current scope
+ Pin::new(&mut S).y(); //~ ERROR no method named `y` found for struct `Pin<&mut S>` in the current scope
+}
diff --git a/tests/ui/self/arbitrary_self_type_mut_difference.stderr b/tests/ui/self/arbitrary_self_type_mut_difference.stderr
new file mode 100644
index 000000000..a56d58694
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_type_mut_difference.stderr
@@ -0,0 +1,27 @@
+error[E0599]: no method named `x` found for struct `Pin<&S>` in the current scope
+ --> $DIR/arbitrary_self_type_mut_difference.rs:11:18
+ |
+LL | Pin::new(&S).x();
+ | ^ help: there is a method with a similar name: `y`
+ |
+note: method is available for `Pin<&mut S>`
+ --> $DIR/arbitrary_self_type_mut_difference.rs:6:5
+ |
+LL | fn x(self: Pin<&mut Self>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0599]: no method named `y` found for struct `Pin<&mut S>` in the current scope
+ --> $DIR/arbitrary_self_type_mut_difference.rs:12:22
+ |
+LL | Pin::new(&mut S).y();
+ | ^ help: there is a method with a similar name: `x`
+ |
+note: method is available for `Pin<&S>`
+ --> $DIR/arbitrary_self_type_mut_difference.rs:7:5
+ |
+LL | fn y(self: Pin<&Self>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.fixed b/tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.fixed
new file mode 100644
index 000000000..6a94b85b9
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.fixed
@@ -0,0 +1,17 @@
+// run-rustfix
+#![allow(dead_code)]
+mod first {
+ trait Foo { fn m(self: Box<Self>); }
+ fn foo<T: Foo>(a: T) {
+ Box::new(a).m(); //~ ERROR no method named `m` found
+ }
+}
+mod second {
+ use std::sync::Arc;
+ trait Bar { fn m(self: Arc<Self>); }
+ fn bar(b: impl Bar) {
+ Arc::new(b).m(); //~ ERROR no method named `m` found
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.rs b/tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.rs
new file mode 100644
index 000000000..fa480b1f7
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.rs
@@ -0,0 +1,17 @@
+// run-rustfix
+#![allow(dead_code)]
+mod first {
+ trait Foo { fn m(self: Box<Self>); }
+ fn foo<T: Foo>(a: T) {
+ a.m(); //~ ERROR no method named `m` found
+ }
+}
+mod second {
+ use std::sync::Arc;
+ trait Bar { fn m(self: Arc<Self>); }
+ fn bar(b: impl Bar) {
+ b.m(); //~ ERROR no method named `m` found
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.stderr b/tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.stderr
new file mode 100644
index 000000000..2ab634ad3
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_types_needing_box_or_arc_wrapping.stderr
@@ -0,0 +1,43 @@
+error[E0599]: no method named `m` found for type parameter `T` in the current scope
+ --> $DIR/arbitrary_self_types_needing_box_or_arc_wrapping.rs:6:11
+ |
+LL | trait Foo { fn m(self: Box<Self>); }
+ | - --------- the method might not be found because of this arbitrary self type
+ | |
+ | the method is available for `Box<T>` here
+LL | fn foo<T: Foo>(a: T) {
+ | - method `m` not found for this type parameter
+LL | a.m();
+ | ^ method not found in `T`
+...
+LL | trait Bar { fn m(self: Arc<Self>); }
+ | --------- the method might not be found because of this arbitrary self type
+ |
+help: consider wrapping the receiver expression with the appropriate type
+ |
+LL | Box::new(a).m();
+ | +++++++++ +
+
+error[E0599]: no method named `m` found for type parameter `impl Bar` in the current scope
+ --> $DIR/arbitrary_self_types_needing_box_or_arc_wrapping.rs:13:11
+ |
+LL | trait Foo { fn m(self: Box<Self>); }
+ | --------- the method might not be found because of this arbitrary self type
+...
+LL | trait Bar { fn m(self: Arc<Self>); }
+ | - --------- the method might not be found because of this arbitrary self type
+ | |
+ | the method is available for `Arc<impl Bar>` here
+LL | fn bar(b: impl Bar) {
+ | -------- method `m` not found for this type parameter
+LL | b.m();
+ | ^ method not found in `impl Bar`
+ |
+help: consider wrapping the receiver expression with the appropriate type
+ |
+LL | Arc::new(b).m();
+ | +++++++++ +
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed b/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed
new file mode 100644
index 000000000..ccd65ff40
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed
@@ -0,0 +1,12 @@
+// run-rustfix
+use std::pin::Pin;
+struct S;
+
+impl S {
+ fn x(self: Pin<&mut Self>) {
+ }
+}
+
+fn main() {
+ Pin::new(&mut S).x(); //~ ERROR no method named `x` found
+}
diff --git a/tests/ui/self/arbitrary_self_types_needing_mut_pin.rs b/tests/ui/self/arbitrary_self_types_needing_mut_pin.rs
new file mode 100644
index 000000000..d15676a62
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_types_needing_mut_pin.rs
@@ -0,0 +1,12 @@
+// run-rustfix
+use std::pin::Pin;
+struct S;
+
+impl S {
+ fn x(self: Pin<&mut Self>) {
+ }
+}
+
+fn main() {
+ S.x(); //~ ERROR no method named `x` found
+}
diff --git a/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr b/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr
new file mode 100644
index 000000000..f34ce4dce
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr
@@ -0,0 +1,20 @@
+error[E0599]: no method named `x` found for struct `S` in the current scope
+ --> $DIR/arbitrary_self_types_needing_mut_pin.rs:11:7
+ |
+LL | struct S;
+ | -------- method `x` not found for this struct
+...
+LL | fn x(self: Pin<&mut Self>) {
+ | - the method is available for `Pin<&mut S>` here
+...
+LL | S.x();
+ | ^ method not found in `S`
+ |
+help: consider wrapping the receiver expression with the appropriate type
+ |
+LL | Pin::new(&mut S).x();
+ | +++++++++++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/self/arbitrary_self_types_pin_needing_borrow.rs b/tests/ui/self/arbitrary_self_types_pin_needing_borrow.rs
new file mode 100644
index 000000000..d877dbe60
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_types_pin_needing_borrow.rs
@@ -0,0 +1,13 @@
+use std::pin::Pin;
+struct S;
+
+impl S {
+ fn x(self: Pin<&mut Self>) {
+ }
+}
+
+fn main() {
+ Pin::new(S).x();
+ //~^ ERROR the trait bound `S: Deref` is not satisfied
+ //~| ERROR no method named `x` found for struct `Pin` in the current scope
+}
diff --git a/tests/ui/self/arbitrary_self_types_pin_needing_borrow.stderr b/tests/ui/self/arbitrary_self_types_pin_needing_borrow.stderr
new file mode 100644
index 000000000..ec985b254
--- /dev/null
+++ b/tests/ui/self/arbitrary_self_types_pin_needing_borrow.stderr
@@ -0,0 +1,33 @@
+error[E0277]: the trait bound `S: Deref` is not satisfied
+ --> $DIR/arbitrary_self_types_pin_needing_borrow.rs:10:14
+ |
+LL | Pin::new(S).x();
+ | -------- ^ the trait `Deref` is not implemented for `S`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `Pin::<P>::new`
+ --> $SRC_DIR/core/src/pin.rs:LL:COL
+help: consider borrowing here
+ |
+LL | Pin::new(&S).x();
+ | +
+LL | Pin::new(&mut S).x();
+ | ++++
+
+error[E0599]: no method named `x` found for struct `Pin` in the current scope
+ --> $DIR/arbitrary_self_types_pin_needing_borrow.rs:10:17
+ |
+LL | Pin::new(S).x();
+ | ^ method not found in `Pin<S>`
+ |
+note: method is available for `Pin<&mut S>`
+ --> $DIR/arbitrary_self_types_pin_needing_borrow.rs:5:5
+ |
+LL | fn x(self: Pin<&mut Self>) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0599.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/simd/intrinsic/float-minmax-pass.rs b/tests/ui/simd/intrinsic/float-minmax-pass.rs
index d79be61f9..968b074b6 100644
--- a/tests/ui/simd/intrinsic/float-minmax-pass.rs
+++ b/tests/ui/simd/intrinsic/float-minmax-pass.rs
@@ -21,7 +21,7 @@ fn main() {
#[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
let nan = f32::NAN;
- // MIPS hardware treats f32::NAN as SNAN. Clear the signaling bit.
+ // MIPS hardware except MIPS R6 treats f32::NAN as SNAN. Clear the signaling bit.
// See https://github.com/rust-lang/rust/issues/52746.
#[cfg(any(target_arch = "mips", target_arch = "mips64"))]
let nan = f32::from_bits(f32::NAN.to_bits() - 1);
diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-2.rs b/tests/ui/simd/intrinsic/generic-arithmetic-2.rs
index 3576eed71..62fb5238b 100644
--- a/tests/ui/simd/intrinsic/generic-arithmetic-2.rs
+++ b/tests/ui/simd/intrinsic/generic-arithmetic-2.rs
@@ -27,6 +27,10 @@ extern "platform-intrinsic" {
fn simd_xor<T>(x: T, y: T) -> T;
fn simd_neg<T>(x: T) -> T;
+ fn simd_bswap<T>(x: T) -> T;
+ fn simd_bitreverse<T>(x: T) -> T;
+ fn simd_ctlz<T>(x: T) -> T;
+ fn simd_cttz<T>(x: T) -> T;
}
fn main() {
@@ -64,6 +68,14 @@ fn main() {
simd_neg(x);
simd_neg(z);
+ simd_bswap(x);
+ simd_bswap(y);
+ simd_bitreverse(x);
+ simd_bitreverse(y);
+ simd_ctlz(x);
+ simd_ctlz(y);
+ simd_cttz(x);
+ simd_cttz(y);
simd_add(0, 0);
@@ -87,6 +99,14 @@ fn main() {
simd_neg(0);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
+ simd_bswap(0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
+ simd_bitreverse(0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
+ simd_ctlz(0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
+ simd_cttz(0);
+ //~^ ERROR expected SIMD input type, found non-SIMD `i32`
simd_shl(z, z);
@@ -99,5 +119,13 @@ fn main() {
//~^ ERROR unsupported operation on `f32x4` with element `f32`
simd_xor(z, z);
//~^ ERROR unsupported operation on `f32x4` with element `f32`
+ simd_bswap(z);
+//~^ ERROR unsupported operation on `f32x4` with element `f32`
+ simd_bitreverse(z);
+//~^ ERROR unsupported operation on `f32x4` with element `f32`
+ simd_ctlz(z);
+//~^ ERROR unsupported operation on `f32x4` with element `f32`
+ simd_cttz(z);
+//~^ ERROR unsupported operation on `f32x4` with element `f32`
}
}
diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr b/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr
index 0f0a7ea66..db26f3417 100644
--- a/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr
+++ b/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr
@@ -1,93 +1,141 @@
error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:69:9
+ --> $DIR/generic-arithmetic-2.rs:81:9
|
LL | simd_add(0, 0);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_sub` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:71:9
+ --> $DIR/generic-arithmetic-2.rs:83:9
|
LL | simd_sub(0, 0);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_mul` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:73:9
+ --> $DIR/generic-arithmetic-2.rs:85:9
|
LL | simd_mul(0, 0);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_div` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:75:9
+ --> $DIR/generic-arithmetic-2.rs:87:9
|
LL | simd_div(0, 0);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shl` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:77:9
+ --> $DIR/generic-arithmetic-2.rs:89:9
|
LL | simd_shl(0, 0);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shr` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:79:9
+ --> $DIR/generic-arithmetic-2.rs:91:9
|
LL | simd_shr(0, 0);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_and` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:81:9
+ --> $DIR/generic-arithmetic-2.rs:93:9
|
LL | simd_and(0, 0);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_or` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:83:9
+ --> $DIR/generic-arithmetic-2.rs:95:9
|
LL | simd_or(0, 0);
| ^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_xor` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:85:9
+ --> $DIR/generic-arithmetic-2.rs:97:9
|
LL | simd_xor(0, 0);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_neg` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-arithmetic-2.rs:88:9
+ --> $DIR/generic-arithmetic-2.rs:100:9
|
LL | simd_neg(0);
| ^^^^^^^^^^^
+error[E0511]: invalid monomorphization of `simd_bswap` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-arithmetic-2.rs:102:9
+ |
+LL | simd_bswap(0);
+ | ^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_bitreverse` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-arithmetic-2.rs:104:9
+ |
+LL | simd_bitreverse(0);
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_ctlz` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-arithmetic-2.rs:106:9
+ |
+LL | simd_ctlz(0);
+ | ^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_cttz` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-arithmetic-2.rs:108:9
+ |
+LL | simd_cttz(0);
+ | ^^^^^^^^^^^^
+
error[E0511]: invalid monomorphization of `simd_shl` intrinsic: unsupported operation on `f32x4` with element `f32`
- --> $DIR/generic-arithmetic-2.rs:92:9
+ --> $DIR/generic-arithmetic-2.rs:112:9
|
LL | simd_shl(z, z);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_shr` intrinsic: unsupported operation on `f32x4` with element `f32`
- --> $DIR/generic-arithmetic-2.rs:94:9
+ --> $DIR/generic-arithmetic-2.rs:114:9
|
LL | simd_shr(z, z);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_and` intrinsic: unsupported operation on `f32x4` with element `f32`
- --> $DIR/generic-arithmetic-2.rs:96:9
+ --> $DIR/generic-arithmetic-2.rs:116:9
|
LL | simd_and(z, z);
| ^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_or` intrinsic: unsupported operation on `f32x4` with element `f32`
- --> $DIR/generic-arithmetic-2.rs:98:9
+ --> $DIR/generic-arithmetic-2.rs:118:9
|
LL | simd_or(z, z);
| ^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_xor` intrinsic: unsupported operation on `f32x4` with element `f32`
- --> $DIR/generic-arithmetic-2.rs:100:9
+ --> $DIR/generic-arithmetic-2.rs:120:9
|
LL | simd_xor(z, z);
| ^^^^^^^^^^^^^^
-error: aborting due to 15 previous errors
+error[E0511]: invalid monomorphization of `simd_bswap` intrinsic: unsupported operation on `f32x4` with element `f32`
+ --> $DIR/generic-arithmetic-2.rs:122:9
+ |
+LL | simd_bswap(z);
+ | ^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_bitreverse` intrinsic: unsupported operation on `f32x4` with element `f32`
+ --> $DIR/generic-arithmetic-2.rs:124:9
+ |
+LL | simd_bitreverse(z);
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_ctlz` intrinsic: unsupported operation on `f32x4` with element `f32`
+ --> $DIR/generic-arithmetic-2.rs:126:9
+ |
+LL | simd_ctlz(z);
+ | ^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_cttz` intrinsic: unsupported operation on `f32x4` with element `f32`
+ --> $DIR/generic-arithmetic-2.rs:128:9
+ |
+LL | simd_cttz(z);
+ | ^^^^^^^^^^^^
+
+error: aborting due to 23 previous errors
For more information about this error, try `rustc --explain E0511`.
diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs
index c507b8d31..f021ee471 100644
--- a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs
+++ b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs
@@ -1,8 +1,6 @@
// run-pass
#![allow(non_camel_case_types)]
-
// ignore-emscripten FIXME(#45351) hits an LLVM assert
-
#![feature(repr_simd, platform_intrinsics)]
#[repr(simd)]
@@ -22,7 +20,7 @@ macro_rules! all_eq {
let a = $a;
let b = $b;
assert!(a.0 == b.0 && a.1 == b.1 && a.2 == b.2 && a.3 == b.3);
- }}
+ }};
}
macro_rules! all_eq_ {
@@ -30,10 +28,9 @@ macro_rules! all_eq_ {
let a = $a;
let b = $b;
assert!(a.0 == b.0);
- }}
+ }};
}
-
extern "platform-intrinsic" {
fn simd_add<T>(x: T, y: T) -> T;
fn simd_sub<T>(x: T, y: T) -> T;
@@ -47,6 +44,10 @@ extern "platform-intrinsic" {
fn simd_xor<T>(x: T, y: T) -> T;
fn simd_neg<T>(x: T) -> T;
+ fn simd_bswap<T>(x: T) -> T;
+ fn simd_bitreverse<T>(x: T) -> T;
+ fn simd_ctlz<T>(x: T) -> T;
+ fn simd_cttz<T>(x: T) -> T;
}
fn main() {
@@ -84,8 +85,8 @@ fn main() {
all_eq_!(simd_div(y1, y1), U32::<4>([1, 1, 1, 1]));
all_eq_!(simd_div(U32::<4>([2, 4, 6, 8]), U32::<4>([2, 2, 2, 2])), y1);
all_eq!(simd_div(z1, z1), f32x4(1.0, 1.0, 1.0, 1.0));
- all_eq!(simd_div(z1, z2), f32x4(1.0/2.0, 2.0/3.0, 3.0/4.0, 4.0/5.0));
- all_eq!(simd_div(z2, z1), f32x4(2.0/1.0, 3.0/2.0, 4.0/3.0, 5.0/4.0));
+ all_eq!(simd_div(z1, z2), f32x4(1.0 / 2.0, 2.0 / 3.0, 3.0 / 4.0, 4.0 / 5.0));
+ all_eq!(simd_div(z2, z1), f32x4(2.0 / 1.0, 3.0 / 2.0, 4.0 / 3.0, 5.0 / 4.0));
all_eq!(simd_rem(x1, x1), i32x4(0, 0, 0, 0));
all_eq!(simd_rem(x2, x1), i32x4(0, 1, 1, 1));
@@ -109,8 +110,10 @@ fn main() {
// ensure we get logical vs. arithmetic shifts correct
let (a, b, c, d) = (-12, -123, -1234, -12345);
all_eq!(simd_shr(i32x4(a, b, c, d), x1), i32x4(a >> 1, b >> 2, c >> 3, d >> 4));
- all_eq_!(simd_shr(U32::<4>([a as u32, b as u32, c as u32, d as u32]), y1),
- U32::<4>([(a as u32) >> 1, (b as u32) >> 2, (c as u32) >> 3, (d as u32) >> 4]));
+ all_eq_!(
+ simd_shr(U32::<4>([a as u32, b as u32, c as u32, d as u32]), y1),
+ U32::<4>([(a as u32) >> 1, (b as u32) >> 2, (c as u32) >> 3, (d as u32) >> 4])
+ );
all_eq!(simd_and(x1, x2), i32x4(0, 2, 0, 4));
all_eq!(simd_and(x2, x1), i32x4(0, 2, 0, 4));
@@ -132,5 +135,19 @@ fn main() {
all_eq!(simd_neg(z1), f32x4(-1.0, -2.0, -3.0, -4.0));
all_eq!(simd_neg(z2), f32x4(-2.0, -3.0, -4.0, -5.0));
+ all_eq!(simd_bswap(x1), i32x4(0x01000000, 0x02000000, 0x03000000, 0x04000000));
+ all_eq_!(simd_bswap(y1), U32::<4>([0x01000000, 0x02000000, 0x03000000, 0x04000000]));
+
+ all_eq!(
+ simd_bitreverse(x1),
+ i32x4(0x80000000u32 as i32, 0x40000000, 0xc0000000u32 as i32, 0x20000000)
+ );
+ all_eq_!(simd_bitreverse(y1), U32::<4>([0x80000000, 0x40000000, 0xc0000000, 0x20000000]));
+
+ all_eq!(simd_ctlz(x1), i32x4(31, 30, 30, 29));
+ all_eq_!(simd_ctlz(y1), U32::<4>([31, 30, 30, 29]));
+
+ all_eq!(simd_cttz(x1), i32x4(0, 1, 0, 2));
+ all_eq_!(simd_cttz(y1), U32::<4>([0, 1, 0, 2]));
}
}
diff --git a/tests/ui/simd/intrinsic/generic-bswap-byte.rs b/tests/ui/simd/intrinsic/generic-bswap-byte.rs
new file mode 100644
index 000000000..13fc942c2
--- /dev/null
+++ b/tests/ui/simd/intrinsic/generic-bswap-byte.rs
@@ -0,0 +1,22 @@
+// run-pass
+#![feature(repr_simd, platform_intrinsics)]
+#![allow(non_camel_case_types)]
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+struct i8x4([i8; 4]);
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+struct u8x4([u8; 4]);
+
+extern "platform-intrinsic" {
+ fn simd_bswap<T>(x: T) -> T;
+}
+
+fn main() {
+ unsafe {
+ assert_eq!(simd_bswap(i8x4([0, 1, 2, 3])).0, [0, 1, 2, 3]);
+ assert_eq!(simd_bswap(u8x4([0, 1, 2, 3])).0, [0, 1, 2, 3]);
+ }
+}
diff --git a/tests/ui/simd/intrinsic/generic-elements-pass.rs b/tests/ui/simd/intrinsic/generic-elements-pass.rs
index 3c913c0ad..905c3b8d3 100644
--- a/tests/ui/simd/intrinsic/generic-elements-pass.rs
+++ b/tests/ui/simd/intrinsic/generic-elements-pass.rs
@@ -22,9 +22,7 @@ extern "platform-intrinsic" {
fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T;
fn simd_extract<T, E>(x: T, idx: u32) -> E;
- fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
- fn simd_shuffle4<T, U>(x: T, y: T, idx: [u32; 4]) -> U;
- fn simd_shuffle8<T, U>(x: T, y: T, idx: [u32; 8]) -> U;
+ fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U;
}
macro_rules! all_eq {
@@ -83,19 +81,19 @@ fn main() {
let y4 = i32x4(140, 141, 142, 143);
let y8 = i32x8(180, 181, 182, 183, 184, 185, 186, 187);
unsafe {
- all_eq!(simd_shuffle2(x2, y2, const { [3u32, 0] }), i32x2(121, 20));
- all_eq!(simd_shuffle4(x2, y2, const { [3u32, 0, 1, 2] }), i32x4(121, 20, 21, 120));
- all_eq!(simd_shuffle8(x2, y2, const { [3u32, 0, 1, 2, 1, 2, 3, 0] }),
+ all_eq!(simd_shuffle(x2, y2, const { [3u32, 0] }), i32x2(121, 20));
+ all_eq!(simd_shuffle(x2, y2, const { [3u32, 0, 1, 2] }), i32x4(121, 20, 21, 120));
+ all_eq!(simd_shuffle(x2, y2, const { [3u32, 0, 1, 2, 1, 2, 3, 0] }),
i32x8(121, 20, 21, 120, 21, 120, 121, 20));
- all_eq!(simd_shuffle2(x4, y4, const { [7u32, 2] }), i32x2(143, 42));
- all_eq!(simd_shuffle4(x4, y4, const { [7u32, 2, 5, 0] }), i32x4(143, 42, 141, 40));
- all_eq!(simd_shuffle8(x4, y4, const { [7u32, 2, 5, 0, 3, 6, 4, 1] }),
+ all_eq!(simd_shuffle(x4, y4, const { [7u32, 2] }), i32x2(143, 42));
+ all_eq!(simd_shuffle(x4, y4, const { [7u32, 2, 5, 0] }), i32x4(143, 42, 141, 40));
+ all_eq!(simd_shuffle(x4, y4, const { [7u32, 2, 5, 0, 3, 6, 4, 1] }),
i32x8(143, 42, 141, 40, 43, 142, 140, 41));
- all_eq!(simd_shuffle2(x8, y8, const { [11u32, 5] }), i32x2(183, 85));
- all_eq!(simd_shuffle4(x8, y8, const { [11u32, 5, 15, 0] }), i32x4(183, 85, 187, 80));
- all_eq!(simd_shuffle8(x8, y8, const { [11u32, 5, 15, 0, 3, 8, 12, 1] }),
+ all_eq!(simd_shuffle(x8, y8, const { [11u32, 5] }), i32x2(183, 85));
+ all_eq!(simd_shuffle(x8, y8, const { [11u32, 5, 15, 0] }), i32x4(183, 85, 187, 80));
+ all_eq!(simd_shuffle(x8, y8, const { [11u32, 5, 15, 0, 3, 8, 12, 1] }),
i32x8(183, 85, 187, 80, 83, 180, 184, 81));
}
diff --git a/tests/ui/simd/intrinsic/generic-elements.rs b/tests/ui/simd/intrinsic/generic-elements.rs
index abde69163..0ff2203ec 100644
--- a/tests/ui/simd/intrinsic/generic-elements.rs
+++ b/tests/ui/simd/intrinsic/generic-elements.rs
@@ -34,9 +34,7 @@ extern "platform-intrinsic" {
fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T;
fn simd_extract<T, E>(x: T, idx: u32) -> E;
- fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
- fn simd_shuffle4<T, U>(x: T, y: T, idx: [u32; 4]) -> U;
- fn simd_shuffle8<T, U>(x: T, y: T, idx: [u32; 8]) -> U;
+ fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U;
}
fn main() {
@@ -51,27 +49,27 @@ fn main() {
//~^ ERROR expected return type `i32` (element of input `i32x4`), found `f32`
const IDX2: [u32; 2] = [0; 2];
- simd_shuffle2::<i32, i32>(0, 0, IDX2);
+ simd_shuffle::<i32, _, i32>(0, 0, IDX2);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
const IDX4: [u32; 4] = [0; 4];
- simd_shuffle4::<i32, i32>(0, 0, IDX4);
+ simd_shuffle::<i32, _, i32>(0, 0, IDX4);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
const IDX8: [u32; 8] = [0; 8];
- simd_shuffle8::<i32, i32>(0, 0, IDX8);
+ simd_shuffle::<i32, _, i32>(0, 0, IDX8);
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
- simd_shuffle2::<_, f32x2>(x, x, IDX2);
+ simd_shuffle::<_, _, f32x2>(x, x, IDX2);
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
- simd_shuffle4::<_, f32x4>(x, x, IDX4);
+ simd_shuffle::<_, _, f32x4>(x, x, IDX4);
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
- simd_shuffle8::<_, f32x8>(x, x, IDX8);
+ simd_shuffle::<_, _, f32x8>(x, x, IDX8);
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
- simd_shuffle2::<_, i32x8>(x, x, IDX2);
+ simd_shuffle::<_, _, i32x8>(x, x, IDX2);
//~^ ERROR expected return type of length 2, found `i32x8` with length 8
- simd_shuffle4::<_, i32x8>(x, x, IDX4);
+ simd_shuffle::<_, _, i32x8>(x, x, IDX4);
//~^ ERROR expected return type of length 4, found `i32x8` with length 8
- simd_shuffle8::<_, i32x2>(x, x, IDX8);
+ simd_shuffle::<_, _, i32x2>(x, x, IDX8);
//~^ ERROR expected return type of length 8, found `i32x2` with length 2
}
}
diff --git a/tests/ui/simd/intrinsic/generic-elements.stderr b/tests/ui/simd/intrinsic/generic-elements.stderr
index 5b423f704..115d9d4b3 100644
--- a/tests/ui/simd/intrinsic/generic-elements.stderr
+++ b/tests/ui/simd/intrinsic/generic-elements.stderr
@@ -1,74 +1,74 @@
error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:46:9
+ --> $DIR/generic-elements.rs:44:9
|
LL | simd_insert(0, 0, 0);
| ^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64`
- --> $DIR/generic-elements.rs:48:9
+ --> $DIR/generic-elements.rs:46:9
|
LL | simd_insert(x, 0, 1.0);
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32`
- --> $DIR/generic-elements.rs:50:9
+ --> $DIR/generic-elements.rs:48:9
|
LL | simd_extract::<_, f32>(x, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:54:9
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-elements.rs:52:9
|
-LL | simd_shuffle2::<i32, i32>(0, 0, IDX2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle::<i32, _, i32>(0, 0, IDX2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:57:9
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-elements.rs:55:9
|
-LL | simd_shuffle4::<i32, i32>(0, 0, IDX4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle::<i32, _, i32>(0, 0, IDX4);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected SIMD input type, found non-SIMD `i32`
- --> $DIR/generic-elements.rs:60:9
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/generic-elements.rs:58:9
|
-LL | simd_shuffle8::<i32, i32>(0, 0, IDX8);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle::<i32, _, i32>(0, 0, IDX8);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
+ --> $DIR/generic-elements.rs:61:9
+ |
+LL | simd_shuffle::<_, _, f32x2>(x, x, IDX2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
--> $DIR/generic-elements.rs:63:9
|
-LL | simd_shuffle2::<_, f32x2>(x, x, IDX2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle::<_, _, f32x4>(x, x, IDX4);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
--> $DIR/generic-elements.rs:65:9
|
-LL | simd_shuffle4::<_, f32x4>(x, x, IDX4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle::<_, _, f32x8>(x, x, IDX8);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
- --> $DIR/generic-elements.rs:67:9
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `i32x8` with length 8
+ --> $DIR/generic-elements.rs:68:9
|
-LL | simd_shuffle8::<_, f32x8>(x, x, IDX8);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle::<_, _, i32x8>(x, x, IDX2);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return type of length 2, found `i32x8` with length 8
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 4, found `i32x8` with length 8
--> $DIR/generic-elements.rs:70:9
|
-LL | simd_shuffle2::<_, i32x8>(x, x, IDX2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle::<_, _, i32x8>(x, x, IDX4);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return type of length 4, found `i32x8` with length 8
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 8, found `i32x2` with length 2
--> $DIR/generic-elements.rs:72:9
|
-LL | simd_shuffle4::<_, i32x8>(x, x, IDX4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return type of length 8, found `i32x2` with length 2
- --> $DIR/generic-elements.rs:74:9
- |
-LL | simd_shuffle8::<_, i32x2>(x, x, IDX8);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | simd_shuffle::<_, _, i32x2>(x, x, IDX8);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors
diff --git a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs
index 7221b3ab7..5ca684a9d 100644
--- a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs
+++ b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs
@@ -6,7 +6,7 @@
#![feature(platform_intrinsics, repr_simd)]
extern "platform-intrinsic" {
- fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
+ fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U;
}
#[repr(simd)]
@@ -22,5 +22,5 @@ fn main() {
#[inline(always)]
unsafe fn inline_me() -> Simd2 {
const IDX: [u32; 2] = [0, 3];
- simd_shuffle2(Simd2(10, 11), Simd2(12, 13), IDX)
+ simd_shuffle(Simd2(10, 11), Simd2(12, 13), IDX)
}
diff --git a/tests/ui/simd/intrinsic/inlining-issue67557.rs b/tests/ui/simd/intrinsic/inlining-issue67557.rs
index 0d1542709..5633ad70c 100644
--- a/tests/ui/simd/intrinsic/inlining-issue67557.rs
+++ b/tests/ui/simd/intrinsic/inlining-issue67557.rs
@@ -6,7 +6,7 @@
#![feature(platform_intrinsics, repr_simd)]
extern "platform-intrinsic" {
- fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
+ fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U;
}
#[repr(simd)]
@@ -16,7 +16,7 @@ struct Simd2(u8, u8);
fn main() {
unsafe {
const IDX: [u32; 2] = [0, 1];
- let p_res: Simd2 = simd_shuffle2(Simd2(10, 11), Simd2(12, 13), IDX);
+ let p_res: Simd2 = simd_shuffle(Simd2(10, 11), Simd2(12, 13), IDX);
let a_res: Simd2 = inline_me();
assert_10_11(p_res);
@@ -38,5 +38,5 @@ fn assert_10_13(x: Simd2) {
#[inline(always)]
unsafe fn inline_me() -> Simd2 {
const IDX: [u32; 2] = [0, 3];
- simd_shuffle2(Simd2(10, 11), Simd2(12, 13), IDX)
+ simd_shuffle(Simd2(10, 11), Simd2(12, 13), IDX)
}
diff --git a/tests/ui/simd/shuffle-not-out-of-bounds.rs b/tests/ui/simd/shuffle-not-out-of-bounds.rs
index 0dee3a0e8..18939bcc5 100644
--- a/tests/ui/simd/shuffle-not-out-of-bounds.rs
+++ b/tests/ui/simd/shuffle-not-out-of-bounds.rs
@@ -29,12 +29,7 @@ struct u8x32([u8; 32]);
struct u8x64([u8; 64]);
extern "platform-intrinsic" {
- pub fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
- pub fn simd_shuffle4<T, U>(x: T, y: T, idx: [u32; 4]) -> U;
- pub fn simd_shuffle8<T, U>(x: T, y: T, idx: [u32; 8]) -> U;
- pub fn simd_shuffle16<T, U>(x: T, y: T, idx: [u32; 16]) -> U;
- pub fn simd_shuffle32<T, U>(x: T, y: T, idx: [u32; 32]) -> U;
- pub fn simd_shuffle64<T, U>(x: T, y: T, idx: [u32; 64]) -> U;
+ pub fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U;
}
// Test vectors by lane size. Since LLVM does not distinguish between a shuffle
@@ -58,22 +53,22 @@ macro_rules! test_shuffle_lanes {
}
}
}
-//~^^^^^ ERROR: invalid monomorphization of `simd_shuffle2` intrinsic
-//~| ERROR: invalid monomorphization of `simd_shuffle4` intrinsic
-//~| ERROR: invalid monomorphization of `simd_shuffle8` intrinsic
-//~| ERROR: invalid monomorphization of `simd_shuffle16` intrinsic
-//~| ERROR: invalid monomorphization of `simd_shuffle32` intrinsic
-//~| ERROR: invalid monomorphization of `simd_shuffle64` intrinsic
+//~^^^^^ ERROR: invalid monomorphization of `simd_shuffle` intrinsic
+//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic
+//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic
+//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic
+//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic
+//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic
// Because the test is mostly embedded in a macro, all the errors have the same origin point.
// And unfortunately, standard comments, as in the UI test harness, disappear in macros!
fn main() {
- test_shuffle_lanes!(2, u8x2, simd_shuffle2);
- test_shuffle_lanes!(4, u8x4, simd_shuffle4);
- test_shuffle_lanes!(8, u8x8, simd_shuffle8);
- test_shuffle_lanes!(16, u8x16, simd_shuffle16);
- test_shuffle_lanes!(32, u8x32, simd_shuffle32);
- test_shuffle_lanes!(64, u8x64, simd_shuffle64);
+ test_shuffle_lanes!(2, u8x2, simd_shuffle);
+ test_shuffle_lanes!(4, u8x4, simd_shuffle);
+ test_shuffle_lanes!(8, u8x8, simd_shuffle);
+ test_shuffle_lanes!(16, u8x16, simd_shuffle);
+ test_shuffle_lanes!(32, u8x32, simd_shuffle);
+ test_shuffle_lanes!(64, u8x64, simd_shuffle);
extern "platform-intrinsic" {
fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U;
diff --git a/tests/ui/simd/shuffle-not-out-of-bounds.stderr b/tests/ui/simd/shuffle-not-out-of-bounds.stderr
index 415f04d93..59e5ab858 100644
--- a/tests/ui/simd/shuffle-not-out-of-bounds.stderr
+++ b/tests/ui/simd/shuffle-not-out-of-bounds.stderr
@@ -1,71 +1,71 @@
-error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: shuffle index #0 is out of bounds (limit 4)
- --> $DIR/shuffle-not-out-of-bounds.rs:56:21
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 4)
+ --> $DIR/shuffle-not-out-of-bounds.rs:51:21
|
LL | $y(vec1, vec2, ARR)
| ^^^^^^^^^^^^^^^^^^^
...
-LL | test_shuffle_lanes!(2, u8x2, simd_shuffle2);
- | ------------------------------------------- in this macro invocation
+LL | test_shuffle_lanes!(2, u8x2, simd_shuffle);
+ | ------------------------------------------ in this macro invocation
|
= note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: shuffle index #0 is out of bounds (limit 8)
- --> $DIR/shuffle-not-out-of-bounds.rs:56:21
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 8)
+ --> $DIR/shuffle-not-out-of-bounds.rs:51:21
|
LL | $y(vec1, vec2, ARR)
| ^^^^^^^^^^^^^^^^^^^
...
-LL | test_shuffle_lanes!(4, u8x4, simd_shuffle4);
- | ------------------------------------------- in this macro invocation
+LL | test_shuffle_lanes!(4, u8x4, simd_shuffle);
+ | ------------------------------------------ in this macro invocation
|
= note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: shuffle index #0 is out of bounds (limit 16)
- --> $DIR/shuffle-not-out-of-bounds.rs:56:21
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 16)
+ --> $DIR/shuffle-not-out-of-bounds.rs:51:21
|
LL | $y(vec1, vec2, ARR)
| ^^^^^^^^^^^^^^^^^^^
...
-LL | test_shuffle_lanes!(8, u8x8, simd_shuffle8);
- | ------------------------------------------- in this macro invocation
+LL | test_shuffle_lanes!(8, u8x8, simd_shuffle);
+ | ------------------------------------------ in this macro invocation
|
= note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0511]: invalid monomorphization of `simd_shuffle16` intrinsic: shuffle index #0 is out of bounds (limit 32)
- --> $DIR/shuffle-not-out-of-bounds.rs:56:21
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 32)
+ --> $DIR/shuffle-not-out-of-bounds.rs:51:21
|
LL | $y(vec1, vec2, ARR)
| ^^^^^^^^^^^^^^^^^^^
...
-LL | test_shuffle_lanes!(16, u8x16, simd_shuffle16);
- | ---------------------------------------------- in this macro invocation
+LL | test_shuffle_lanes!(16, u8x16, simd_shuffle);
+ | -------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0511]: invalid monomorphization of `simd_shuffle32` intrinsic: shuffle index #0 is out of bounds (limit 64)
- --> $DIR/shuffle-not-out-of-bounds.rs:56:21
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 64)
+ --> $DIR/shuffle-not-out-of-bounds.rs:51:21
|
LL | $y(vec1, vec2, ARR)
| ^^^^^^^^^^^^^^^^^^^
...
-LL | test_shuffle_lanes!(32, u8x32, simd_shuffle32);
- | ---------------------------------------------- in this macro invocation
+LL | test_shuffle_lanes!(32, u8x32, simd_shuffle);
+ | -------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0511]: invalid monomorphization of `simd_shuffle64` intrinsic: shuffle index #0 is out of bounds (limit 128)
- --> $DIR/shuffle-not-out-of-bounds.rs:56:21
+error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 128)
+ --> $DIR/shuffle-not-out-of-bounds.rs:51:21
|
LL | $y(vec1, vec2, ARR)
| ^^^^^^^^^^^^^^^^^^^
...
-LL | test_shuffle_lanes!(64, u8x64, simd_shuffle64);
- | ---------------------------------------------- in this macro invocation
+LL | test_shuffle_lanes!(64, u8x64, simd_shuffle);
+ | -------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: shuffle index #0 is out of bounds (limit 4)
- --> $DIR/shuffle-not-out-of-bounds.rs:84:23
+ --> $DIR/shuffle-not-out-of-bounds.rs:79:23
|
LL | let _: u8x2 = simd_shuffle(v, v, I);
| ^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/simd/shuffle.rs b/tests/ui/simd/shuffle.rs
index 461243d48..838e31f8e 100644
--- a/tests/ui/simd/shuffle.rs
+++ b/tests/ui/simd/shuffle.rs
@@ -8,7 +8,6 @@
extern "platform-intrinsic" {
fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U;
- fn simd_shuffle16<T, U>(x: T, y: T, idx: [u32; 16]) -> U;
}
#[derive(Copy, Clone)]
@@ -16,7 +15,7 @@ extern "platform-intrinsic" {
struct Simd<T, const N: usize>([T; N]);
pub unsafe fn __shuffle_vector16<const IDX: [u32; 16], T, U>(x: T, y: T) -> U {
- simd_shuffle16(x, y, IDX)
+ simd_shuffle(x, y, IDX)
}
fn main() {
diff --git a/tests/ui/sized/recursive-type-2.stderr b/tests/ui/sized/recursive-type-2.stderr
index d0e6e9db0..0f72f7414 100644
--- a/tests/ui/sized/recursive-type-2.stderr
+++ b/tests/ui/sized/recursive-type-2.stderr
@@ -7,6 +7,7 @@ note: cycle used when elaborating drops for `main`
|
LL | fn main() {
| ^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
index 80c5f9da4..4aad88437 100644
--- a/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
+++ b/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
@@ -66,7 +66,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:109:5
|
LL | x.set(0, 0);
- | ^^^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -77,7 +77,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:121:5
|
LL | x.y_mut()
- | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
@@ -88,7 +88,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:129:6
|
LL | *x.y_mut() = 3;
- | ^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
@@ -99,7 +99,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:133:6
|
LL | *x.y_mut() = 3;
- | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
diff --git a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
index 99c8fa1f9..ba8da2e75 100644
--- a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
+++ b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr
@@ -25,7 +25,7 @@ error[E0596]: cannot borrow `f.f` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5
|
LL | f.f.call_mut(())
- | ^^^^^^^^^^^^^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
diff --git a/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr b/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr
index 328197ae9..3f033f5e4 100644
--- a/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr
+++ b/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-call-method-from-mut-aliasable.rs:17:5
|
LL | x.h();
- | ^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
diff --git a/tests/ui/span/borrowck-fn-in-const-b.stderr b/tests/ui/span/borrowck-fn-in-const-b.stderr
index 17fdcc622..929878026 100644
--- a/tests/ui/span/borrowck-fn-in-const-b.stderr
+++ b/tests/ui/span/borrowck-fn-in-const-b.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-fn-in-const-b.rs:7:9
|
LL | x.push(format!("this is broken"));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
diff --git a/tests/ui/span/borrowck-let-suggestion-suffixes.stderr b/tests/ui/span/borrowck-let-suggestion-suffixes.stderr
index 545b235a5..78cadc8c6 100644
--- a/tests/ui/span/borrowck-let-suggestion-suffixes.stderr
+++ b/tests/ui/span/borrowck-let-suggestion-suffixes.stderr
@@ -39,7 +39,7 @@ LL | v4.push(&id('y'));
| creates a temporary value which is freed while still in use
...
LL | v4.use_ref();
- | ------------ borrow later used here
+ | -- borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
diff --git a/tests/ui/span/borrowck-object-mutability.stderr b/tests/ui/span/borrowck-object-mutability.stderr
index 805a8034c..e4b5c8ce7 100644
--- a/tests/ui/span/borrowck-object-mutability.stderr
+++ b/tests/ui/span/borrowck-object-mutability.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
--> $DIR/borrowck-object-mutability.rs:8:5
|
LL | x.borrowed_mut();
- | ^^^^^^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
@@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable
--> $DIR/borrowck-object-mutability.rs:18:5
|
LL | x.borrowed_mut();
- | ^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ | ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
diff --git a/tests/ui/span/destructor-restrictions.stderr b/tests/ui/span/destructor-restrictions.stderr
index 281248626..b923cee5f 100644
--- a/tests/ui/span/destructor-restrictions.stderr
+++ b/tests/ui/span/destructor-restrictions.stderr
@@ -4,7 +4,7 @@ error[E0597]: `*a` does not live long enough
LL | let a = Box::new(RefCell::new(4));
| - binding `a` declared here
LL | *a.borrow() + 1
- | ^^^^^^^^^^
+ | ^---------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
diff --git a/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr b/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
index e1a377203..421c22566 100644
--- a/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
+++ b/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
@@ -4,7 +4,7 @@ error[E0597]: `y` does not live long enough
LL | let y = x;
| - binding `y` declared here
LL | y.borrow().clone()
- | ^^^^^^^^^^
+ | ^---------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
@@ -27,7 +27,7 @@ error[E0597]: `y` does not live long enough
LL | let y = x;
| - binding `y` declared here
LL | y.borrow().clone()
- | ^^^^^^^^^^
+ | ^---------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
diff --git a/tests/ui/span/issue-36537.stderr b/tests/ui/span/issue-36537.stderr
index 6c330c1a0..8dfee8d64 100644
--- a/tests/ui/span/issue-36537.stderr
+++ b/tests/ui/span/issue-36537.stderr
@@ -9,7 +9,7 @@ LL | p = &a;
LL | }
| - `a` dropped here while still borrowed
LL | p.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/span/issue-39698.stderr b/tests/ui/span/issue-39698.stderr
index 25c35fd54..81211b20a 100644
--- a/tests/ui/span/issue-39698.stderr
+++ b/tests/ui/span/issue-39698.stderr
@@ -1,3 +1,13 @@
+error[E0408]: variable `c` is not bound in all patterns
+ --> $DIR/issue-39698.rs:10:9
+ |
+LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
+ | ^^^^^^^^^^^ ^^^^^^^^^^^ - ^^^^^^^^ pattern doesn't bind `c`
+ | | | |
+ | | | variable not in all patterns
+ | | pattern doesn't bind `c`
+ | pattern doesn't bind `c`
+
error[E0408]: variable `d` is not bound in all patterns
--> $DIR/issue-39698.rs:10:37
|
@@ -28,16 +38,6 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}
| | variable not in all patterns
| pattern doesn't bind `b`
-error[E0408]: variable `c` is not bound in all patterns
- --> $DIR/issue-39698.rs:10:9
- |
-LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
- | ^^^^^^^^^^^ ^^^^^^^^^^^ - ^^^^^^^^ pattern doesn't bind `c`
- | | | |
- | | | variable not in all patterns
- | | pattern doesn't bind `c`
- | pattern doesn't bind `c`
-
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0408`.
diff --git a/tests/ui/span/issue-40157.stderr b/tests/ui/span/issue-40157.stderr
index a0afd33f7..216876717 100644
--- a/tests/ui/span/issue-40157.stderr
+++ b/tests/ui/span/issue-40157.stderr
@@ -2,7 +2,7 @@ error[E0597]: `foo` does not live long enough
--> $DIR/issue-40157.rs:2:53
|
LL | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
- | --- ^^^^^^^^^^ - `foo` dropped here while still borrowed
+ | --- ^^^ - `foo` dropped here while still borrowed
| | |
| | borrowed value does not live long enough
| binding `foo` declared here
diff --git a/tests/ui/span/mut-arg-hint.stderr b/tests/ui/span/mut-arg-hint.stderr
index 06011eac6..df782280b 100644
--- a/tests/ui/span/mut-arg-hint.stderr
+++ b/tests/ui/span/mut-arg-hint.stderr
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
--> $DIR/mut-arg-hint.rs:3:9
|
LL | a.push_str("bar");
- | ^^^^^^^^^^^^^^^^^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
@@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
--> $DIR/mut-arg-hint.rs:8:5
|
LL | a.push_str("foo");
- | ^^^^^^^^^^^^^^^^^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
@@ -24,7 +24,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
--> $DIR/mut-arg-hint.rs:15:9
|
LL | a.push_str("foo");
- | ^^^^^^^^^^^^^^^^^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+ | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
help: consider changing this to be a mutable reference
|
diff --git a/tests/ui/span/mut-ptr-cant-outlive-ref.stderr b/tests/ui/span/mut-ptr-cant-outlive-ref.stderr
index be56f9489..395b6ec67 100644
--- a/tests/ui/span/mut-ptr-cant-outlive-ref.stderr
+++ b/tests/ui/span/mut-ptr-cant-outlive-ref.stderr
@@ -9,7 +9,7 @@ LL | }
| - `b` dropped here while still borrowed
LL |
LL | p.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr b/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr
index fb3fad6ae..9b5ec8461 100644
--- a/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr
+++ b/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr
@@ -9,7 +9,7 @@ LL | let c_ref = &c;
LL | }
| - `c` dropped here while still borrowed
LL | f.use_mut();
- | ----------- borrow later used here
+ | - borrow later used here
error: aborting due to previous error
diff --git a/tests/ui/span/regions-escape-loop-via-vec.stderr b/tests/ui/span/regions-escape-loop-via-vec.stderr
index 532ac3606..18c6cd480 100644
--- a/tests/ui/span/regions-escape-loop-via-vec.stderr
+++ b/tests/ui/span/regions-escape-loop-via-vec.stderr
@@ -7,7 +7,7 @@ LL | while x < 10 {
| ^ use of borrowed `x`
LL | let mut z = x;
LL | _y.push(&mut z);
- | --------------- borrow later used here
+ | -- borrow later used here
error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/regions-escape-loop-via-vec.rs:6:21
@@ -18,7 +18,7 @@ LL | while x < 10 {
LL | let mut z = x;
| ^ use of borrowed `x`
LL | _y.push(&mut z);
- | --------------- borrow later used here
+ | -- borrow later used here
error[E0597]: `z` does not live long enough
--> $DIR/regions-escape-loop-via-vec.rs:7:17
@@ -26,7 +26,9 @@ error[E0597]: `z` does not live long enough
LL | let mut z = x;
| ----- binding `z` declared here
LL | _y.push(&mut z);
- | ^^^^^^ borrowed value does not live long enough
+ | -- ^^^^^^ borrowed value does not live long enough
+ | |
+ | borrow later used here
...
LL | }
| - `z` dropped here while still borrowed
@@ -38,7 +40,7 @@ LL | let mut _y = vec![&mut x];
| ------ `x` is borrowed here
...
LL | _y.push(&mut z);
- | --------------- borrow later used here
+ | -- borrow later used here
LL |
LL | x += 1;
| ^^^^^^ use of borrowed `x`
diff --git a/tests/ui/span/send-is-not-static-std-sync.stderr b/tests/ui/span/send-is-not-static-std-sync.stderr
index 7dfe94bca..eaba415ad 100644
--- a/tests/ui/span/send-is-not-static-std-sync.stderr
+++ b/tests/ui/span/send-is-not-static-std-sync.stderr
@@ -10,7 +10,7 @@ LL | drop(y);
| ^ move out of `y` occurs here
...
LL | *lock.lock().unwrap() = &z;
- | ----------- borrow later used here
+ | ---- borrow later used here
error[E0597]: `z` does not live long enough
--> $DIR/send-is-not-static-std-sync.rs:16:33
@@ -23,7 +23,7 @@ LL | }
| - `z` dropped here while still borrowed
LL |
LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use)
- | -------------- borrow later used here
+ | ---- borrow later used here
error[E0505]: cannot move out of `y` because it is borrowed
--> $DIR/send-is-not-static-std-sync.rs:27:10
@@ -37,7 +37,7 @@ LL | drop(y);
| ^ move out of `y` occurs here
...
LL | *lock.write().unwrap() = &z;
- | ------------ borrow later used here
+ | ---- borrow later used here
error[E0597]: `z` does not live long enough
--> $DIR/send-is-not-static-std-sync.rs:30:34
@@ -50,7 +50,7 @@ LL | }
| - `z` dropped here while still borrowed
LL |
LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use)
- | -------------- borrow later used here
+ | ---- borrow later used here
error[E0505]: cannot move out of `y` because it is borrowed
--> $DIR/send-is-not-static-std-sync.rs:43:10
@@ -64,7 +64,7 @@ LL | drop(y);
| ^ move out of `y` occurs here
...
LL | tx.send(&z).unwrap();
- | ----------- borrow later used here
+ | -- borrow later used here
error[E0597]: `z` does not live long enough
--> $DIR/send-is-not-static-std-sync.rs:46:17
diff --git a/tests/ui/span/slice-borrow.stderr b/tests/ui/span/slice-borrow.stderr
index b70bf69d6..b271c9ae6 100644
--- a/tests/ui/span/slice-borrow.stderr
+++ b/tests/ui/span/slice-borrow.stderr
@@ -7,7 +7,7 @@ LL | let x: &[isize] = &vec![1, 2, 3, 4, 5];
LL | }
| - temporary value is freed at the end of this statement
LL | y.use_ref();
- | ----------- borrow later used here
+ | - borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/span/suggestion-non-ascii.stderr b/tests/ui/span/suggestion-non-ascii.stderr
index b14632d4e..21f8bb62a 100644
--- a/tests/ui/span/suggestion-non-ascii.stderr
+++ b/tests/ui/span/suggestion-non-ascii.stderr
@@ -1,8 +1,8 @@
error[E0608]: cannot index into a value of type `({integer},)`
- --> $DIR/suggestion-non-ascii.rs:3:21
+ --> $DIR/suggestion-non-ascii.rs:3:24
|
LL | println!("☃{}", tup[0]);
- | ^^^^^^ help: to access tuple elements, use: `tup.0`
+ | ^^^ help: to access tuple elements, use: `.0`
error: aborting due to previous error
diff --git a/tests/ui/span/visibility-ty-params.rs b/tests/ui/span/visibility-ty-params.rs
index d77febe0a..11c2cf44c 100644
--- a/tests/ui/span/visibility-ty-params.rs
+++ b/tests/ui/span/visibility-ty-params.rs
@@ -4,7 +4,7 @@ macro_rules! m {
struct S<T>(T);
m!{ S<u8> } //~ ERROR unexpected generic arguments in path
- //~| ERROR expected module, found struct `S`
+ //~| ERROR failed to resolve: `S` is a struct, not a module [E0433]
mod m {
m!{ m<> } //~ ERROR unexpected generic arguments in path
diff --git a/tests/ui/span/visibility-ty-params.stderr b/tests/ui/span/visibility-ty-params.stderr
index 067893fd2..97d05c464 100644
--- a/tests/ui/span/visibility-ty-params.stderr
+++ b/tests/ui/span/visibility-ty-params.stderr
@@ -4,11 +4,11 @@ error: unexpected generic arguments in path
LL | m!{ S<u8> }
| ^^^^
-error[E0577]: expected module, found struct `S`
+error[E0433]: failed to resolve: `S` is a struct, not a module
--> $DIR/visibility-ty-params.rs:6:5
|
LL | m!{ S<u8> }
- | ^^^^^ not a module
+ | ^ `S` is a struct, not a module
error: unexpected generic arguments in path
--> $DIR/visibility-ty-params.rs:10:10
@@ -18,4 +18,4 @@ LL | m!{ m<> }
error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0577`.
+For more information about this error, try `rustc --explain E0433`.
diff --git a/tests/ui/specialization/min_specialization/issue-79224.stderr b/tests/ui/specialization/min_specialization/issue-79224.stderr
index 505baa23c..9a4d557a1 100644
--- a/tests/ui/specialization/min_specialization/issue-79224.stderr
+++ b/tests/ui/specialization/min_specialization/issue-79224.stderr
@@ -11,10 +11,10 @@ LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++
error[E0277]: the trait bound `B: Clone` is not satisfied
- --> $DIR/issue-79224.rs:20:12
+ --> $DIR/issue-79224.rs:20:13
|
LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- | ^^^^^ the trait `Clone` is not implemented for `B`
+ | ^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting this bound
diff --git a/tests/ui/stability-attribute/missing-const-stability.rs b/tests/ui/stability-attribute/missing-const-stability.rs
index 6eff899bf..621e85762 100644
--- a/tests/ui/stability-attribute/missing-const-stability.rs
+++ b/tests/ui/stability-attribute/missing-const-stability.rs
@@ -1,5 +1,5 @@
#![feature(staged_api)]
-#![feature(const_trait_impl)]
+#![feature(const_trait_impl, effects)]
#![stable(feature = "stable", since = "1.0.0")]
#[stable(feature = "stable", since = "1.0.0")]
diff --git a/tests/ui/std/issue-15149.rs b/tests/ui/std/issue-15149.rs
deleted file mode 100644
index 064472f57..000000000
--- a/tests/ui/std/issue-15149.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-// run-pass
-
-#![allow(unused_variables)]
-// no-prefer-dynamic
-// ignore-cross-compile
-
-use std::env;
-use std::ffi::OsStr;
-use std::fs;
-use std::path::PathBuf;
-use std::process;
-use std::str;
-
-fn main() {
- // If we're the child, make sure we were invoked correctly
- let args: Vec<String> = env::args().collect();
- if args.len() > 1 && args[1] == "child" {
- // FIXME: This should check the whole `args[0]` instead of just
- // checking that it ends_with the executable name. This
- // is needed because of Windows, which has a different behavior.
- // See #15149 for more info.
- let my_path = env::current_exe().unwrap();
- return assert_eq!(my_path.file_stem(), Some(OsStr::new("mytest")));
- }
-
- test();
-}
-
-fn test() {
- // If we're the parent, copy our own binary to a new directory.
- let my_path = env::current_exe().unwrap();
- let my_dir = my_path.parent().unwrap();
-
- let child_dir = PathBuf::from(env::var_os("RUST_TEST_TMPDIR").unwrap());
- let child_dir = child_dir.join("issue-15140-child");
- fs::create_dir_all(&child_dir).unwrap();
-
- let child_path = child_dir.join(&format!("mytest{}", env::consts::EXE_SUFFIX));
- fs::copy(&my_path, &child_path).unwrap();
-
- // Append the new directory to our own PATH.
- let path = {
- let mut paths: Vec<_> = env::split_paths(&env::var_os("PATH").unwrap()).collect();
- paths.push(child_dir.to_path_buf());
- env::join_paths(paths).unwrap()
- };
-
- let child_output =
- process::Command::new("mytest").env("PATH", &path).arg("child").output().unwrap();
-
- assert!(
- child_output.status.success(),
- "child assertion failed\n child stdout:\n {}\n child stderr:\n {}",
- str::from_utf8(&child_output.stdout).unwrap(),
- str::from_utf8(&child_output.stderr).unwrap()
- );
-}
diff --git a/tests/ui/std/switch-stdout.rs b/tests/ui/std/switch-stdout.rs
deleted file mode 100644
index 2d936d96b..000000000
--- a/tests/ui/std/switch-stdout.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-// run-pass
-// ignore-wasm (needs file descriptors and env variables)
-
-use std::env;
-use std::fs::File;
-use std::io::{Read, Write};
-use std::path::PathBuf;
-
-#[cfg(unix)]
-fn switch_stdout_to(file: File) {
- use std::os::unix::prelude::*;
-
- extern "C" {
- fn dup2(old: i32, new: i32) -> i32;
- }
-
- unsafe {
- assert_eq!(dup2(file.as_raw_fd(), 1), 1);
- }
-}
-
-#[cfg(windows)]
-fn switch_stdout_to(file: File) {
- use std::os::windows::prelude::*;
-
- extern "system" {
- fn SetStdHandle(nStdHandle: u32, handle: *mut u8) -> i32;
- }
-
- const STD_OUTPUT_HANDLE: u32 = (-11i32) as u32;
-
- unsafe {
- let rc = SetStdHandle(STD_OUTPUT_HANDLE, file.into_raw_handle() as *mut _);
- assert!(rc != 0);
- }
-}
-
-fn main() {
- let path = PathBuf::from(env::var_os("RUST_TEST_TMPDIR").unwrap());
- let path = path.join("switch-stdout-output");
- let f = File::create(&path).unwrap();
-
- println!("foo");
- std::io::stdout().flush().unwrap();
- switch_stdout_to(f);
- println!("bar");
- std::io::stdout().flush().unwrap();
-
- let mut contents = String::new();
- File::open(&path).unwrap().read_to_string(&mut contents).unwrap();
- assert_eq!(contents, "bar\n");
-}
diff --git a/tests/ui/suggestions/copied-and-cloned.fixed b/tests/ui/suggestions/copied-and-cloned.fixed
index f801403fe..4cecf9e26 100644
--- a/tests/ui/suggestions/copied-and-cloned.fixed
+++ b/tests/ui/suggestions/copied-and-cloned.fixed
@@ -2,6 +2,16 @@
fn expect<T>(_: T) {}
+struct Issue114925 {
+ x: Option<String>,
+}
+
+fn issue_114925(lol: &mut Issue114925, x: Option<&String>) {
+ lol.x = x.clone().cloned();
+ //~^ ERROR mismatched types
+ //~| HELP use `Option::cloned` to clone the value inside the `Option`
+}
+
fn main() {
let x = Some(&());
expect::<Option<()>>(x.copied());
@@ -20,4 +30,28 @@ fn main() {
expect::<Result<String, ()>>(x.cloned());
//~^ ERROR mismatched types
//~| HELP use `Result::cloned` to clone the value inside the `Result`
+
+ let s = String::new();
+ let x = Some(s.clone());
+ let y = Some(&s);
+ println!("{}", x == y.cloned());
+ //~^ ERROR mismatched types
+ //~| HELP use `Option::cloned` to clone the value inside the `Option`
+ //FIXME(#114050) ~| HELP use `Option::as_ref` to convert `Option<String>` to `Option<&String>`
+
+ let mut s = ();
+ let x = Some(s);
+ let y = Some(&mut s);
+ println!("{}", x == y.copied());
+ //~^ ERROR mismatched types
+ //~| HELP use `Option::copied` to copy the value inside the `Option`
+
+ let mut s = String::new();
+ let x = Some(s.clone());
+ let y = Some(&mut s);
+ println!("{}", x == y.cloned());
+ //~^ ERROR mismatched types
+ //~| HELP use `Option::cloned` to clone the value inside the `Option`
+
+ issue_114925(&mut Issue114925 { x: None }, None);
}
diff --git a/tests/ui/suggestions/copied-and-cloned.rs b/tests/ui/suggestions/copied-and-cloned.rs
index 640450b76..a79928c50 100644
--- a/tests/ui/suggestions/copied-and-cloned.rs
+++ b/tests/ui/suggestions/copied-and-cloned.rs
@@ -2,6 +2,16 @@
fn expect<T>(_: T) {}
+struct Issue114925 {
+ x: Option<String>,
+}
+
+fn issue_114925(lol: &mut Issue114925, x: Option<&String>) {
+ lol.x = x.clone();
+ //~^ ERROR mismatched types
+ //~| HELP use `Option::cloned` to clone the value inside the `Option`
+}
+
fn main() {
let x = Some(&());
expect::<Option<()>>(x);
@@ -20,4 +30,28 @@ fn main() {
expect::<Result<String, ()>>(x);
//~^ ERROR mismatched types
//~| HELP use `Result::cloned` to clone the value inside the `Result`
+
+ let s = String::new();
+ let x = Some(s.clone());
+ let y = Some(&s);
+ println!("{}", x == y);
+ //~^ ERROR mismatched types
+ //~| HELP use `Option::cloned` to clone the value inside the `Option`
+ //FIXME(#114050) ~| HELP use `Option::as_ref` to convert `Option<String>` to `Option<&String>`
+
+ let mut s = ();
+ let x = Some(s);
+ let y = Some(&mut s);
+ println!("{}", x == y);
+ //~^ ERROR mismatched types
+ //~| HELP use `Option::copied` to copy the value inside the `Option`
+
+ let mut s = String::new();
+ let x = Some(s.clone());
+ let y = Some(&mut s);
+ println!("{}", x == y);
+ //~^ ERROR mismatched types
+ //~| HELP use `Option::cloned` to clone the value inside the `Option`
+
+ issue_114925(&mut Issue114925 { x: None }, None);
}
diff --git a/tests/ui/suggestions/copied-and-cloned.stderr b/tests/ui/suggestions/copied-and-cloned.stderr
index 067808141..87b0624d4 100644
--- a/tests/ui/suggestions/copied-and-cloned.stderr
+++ b/tests/ui/suggestions/copied-and-cloned.stderr
@@ -1,5 +1,20 @@
error[E0308]: mismatched types
- --> $DIR/copied-and-cloned.rs:7:26
+ --> $DIR/copied-and-cloned.rs:10:13
+ |
+LL | lol.x = x.clone();
+ | ----- ^^^^^^^^^ expected `Option<String>`, found `Option<&String>`
+ | |
+ | expected due to the type of this binding
+ |
+ = note: expected enum `Option<String>`
+ found enum `Option<&String>`
+help: use `Option::cloned` to clone the value inside the `Option`
+ |
+LL | lol.x = x.clone().cloned();
+ | +++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/copied-and-cloned.rs:17:26
|
LL | expect::<Option<()>>(x);
| -------------------- ^ expected `Option<()>`, found `Option<&()>`
@@ -19,7 +34,7 @@ LL | expect::<Option<()>>(x.copied());
| +++++++++
error[E0308]: mismatched types
- --> $DIR/copied-and-cloned.rs:11:30
+ --> $DIR/copied-and-cloned.rs:21:30
|
LL | expect::<Result<(), ()>>(x);
| ------------------------ ^ expected `Result<(), ()>`, found `Result<&(), _>`
@@ -39,7 +54,7 @@ LL | expect::<Result<(), ()>>(x.copied());
| +++++++++
error[E0308]: mismatched types
- --> $DIR/copied-and-cloned.rs:16:30
+ --> $DIR/copied-and-cloned.rs:26:30
|
LL | expect::<Option<String>>(x);
| ------------------------ ^ expected `Option<String>`, found `Option<&String>`
@@ -59,7 +74,7 @@ LL | expect::<Option<String>>(x.cloned());
| +++++++++
error[E0308]: mismatched types
- --> $DIR/copied-and-cloned.rs:20:34
+ --> $DIR/copied-and-cloned.rs:30:34
|
LL | expect::<Result<String, ()>>(x);
| ---------------------------- ^ expected `Result<String, ()>`, found `Result<&String, _>`
@@ -78,6 +93,45 @@ help: use `Result::cloned` to clone the value inside the `Result`
LL | expect::<Result<String, ()>>(x.cloned());
| +++++++++
-error: aborting due to 4 previous errors
+error[E0308]: mismatched types
+ --> $DIR/copied-and-cloned.rs:37:25
+ |
+LL | println!("{}", x == y);
+ | ^ expected `Option<String>`, found `Option<&String>`
+ |
+ = note: expected enum `Option<String>`
+ found enum `Option<&String>`
+help: use `Option::cloned` to clone the value inside the `Option`
+ |
+LL | println!("{}", x == y.cloned());
+ | +++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/copied-and-cloned.rs:45:25
+ |
+LL | println!("{}", x == y);
+ | ^ expected `Option<()>`, found `Option<&mut ()>`
+ |
+ = note: expected enum `Option<()>`
+ found enum `Option<&mut ()>`
+help: use `Option::copied` to copy the value inside the `Option`
+ |
+LL | println!("{}", x == y.copied());
+ | +++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/copied-and-cloned.rs:52:25
+ |
+LL | println!("{}", x == y);
+ | ^ expected `Option<String>`, found `Option<&mut String>`
+ |
+ = note: expected enum `Option<String>`
+ found enum `Option<&mut String>`
+help: use `Option::cloned` to clone the value inside the `Option`
+ |
+LL | println!("{}", x == y.cloned());
+ | +++++++++
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr
index 5e7a7685a..9ece31e76 100644
--- a/tests/ui/suggestions/crate-or-module-typo.stderr
+++ b/tests/ui/suggestions/crate-or-module-typo.stderr
@@ -30,17 +30,23 @@ help: there is a crate or module with a similar name
|
LL | bar: std::cell::Cell<bool>
| ~~~
+help: consider importing one of these items
+ |
+LL + use core::cell;
+ |
+LL + use std::cell;
+ |
+help: if you import `cell`, refer to it directly
+ |
+LL - bar: st::cell::Cell<bool>
+LL + bar: cell::Cell<bool>
+ |
error[E0433]: failed to resolve: use of undeclared crate or module `bar`
--> $DIR/crate-or-module-typo.rs:6:20
|
LL | pub fn bar() { bar::baz(); }
| ^^^ use of undeclared crate or module `bar`
- |
-help: consider importing this module
- |
-LL + use crate::bar;
- |
error: aborting due to 4 previous errors
diff --git a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs
index 711cbbd38..255cab060 100644
--- a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs
+++ b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs
@@ -18,7 +18,7 @@ mod bav {
impl Bar for i32 {}
fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> {
- val.use_self() //~ ERROR cannot return reference to function parameter
+ val.use_self() //~ ERROR cannot return value referencing function parameter
}
}
diff --git a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr
index 2dc300ac7..a7e03f491 100644
--- a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr
+++ b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr
@@ -1,20 +1,29 @@
-error[E0515]: cannot return reference to function parameter `val`
+error[E0515]: cannot return value referencing function parameter `val`
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9
|
LL | val.use_self()
- | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function
+ | ---^^^^^^^^^^^
+ | |
+ | returns a value referencing data owned by the current function
+ | `val` is borrowed here
-error[E0515]: cannot return reference to function parameter `val`
+error[E0515]: cannot return value referencing function parameter `val`
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9
|
LL | val.use_self()
- | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function
+ | ---^^^^^^^^^^^
+ | |
+ | returns a value referencing data owned by the current function
+ | `val` is borrowed here
-error[E0515]: cannot return reference to function parameter `val`
+error[E0515]: cannot return value referencing function parameter `val`
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:109:9
|
LL | val.use_self()
- | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function
+ | ---^^^^^^^^^^^
+ | |
+ | returns a value referencing data owned by the current function
+ | `val` is borrowed here
error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/issue-102972.stderr b/tests/ui/suggestions/issue-102972.stderr
index 03f9dbb6c..3303d6bbc 100644
--- a/tests/ui/suggestions/issue-102972.stderr
+++ b/tests/ui/suggestions/issue-102972.stderr
@@ -7,10 +7,7 @@ LL | for _c in chars.by_ref() {
| first mutable borrow occurs here
| first borrow later used here
LL | chars.next();
- | ^^^^^^^^^^^^ second mutable borrow occurs here
- |
- = note: a for loop advances the iterator for you, the result is stored in `_c`.
- = help: if you want to call `next` on a iterator within the loop, consider using `while let`.
+ | ^^^^^ second mutable borrow occurs here
error[E0382]: borrow of moved value: `iter`
--> $DIR/issue-102972.rs:12:9
@@ -20,10 +17,8 @@ LL | let mut iter = v.iter();
LL | for _i in iter {
| ---- `iter` moved due to this implicit call to `.into_iter()`
LL | iter.next();
- | ^^^^^^^^^^^ value borrowed here after move
+ | ^^^^ value borrowed here after move
|
- = note: a for loop advances the iterator for you, the result is stored in `_i`.
- = help: if you want to call `next` on a iterator within the loop, consider using `while let`.
note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
diff --git a/tests/ui/suggestions/issue-114701.rs b/tests/ui/suggestions/issue-114701.rs
new file mode 100644
index 000000000..81d7803ec
--- /dev/null
+++ b/tests/ui/suggestions/issue-114701.rs
@@ -0,0 +1,15 @@
+enum Enum<T> { SVariant { v: T }, UVariant }
+
+macro_rules! is_variant {
+ (TSVariant, ) => (!);
+ (SVariant, ) => (!);
+ (UVariant, $expr:expr) => (is_variant!(@check UVariant, {}, $expr));
+ (@check $variant:ident, $matcher:tt, $expr:expr) => (
+ assert!(if let Enum::$variant::<()> $matcher = $expr () { true } else { false },
+ );
+ );
+}
+
+fn main() {
+ is_variant!(UVariant, Enum::<()>::UVariant); //~ ERROR expected function
+}
diff --git a/tests/ui/suggestions/issue-114701.stderr b/tests/ui/suggestions/issue-114701.stderr
new file mode 100644
index 000000000..67462a09c
--- /dev/null
+++ b/tests/ui/suggestions/issue-114701.stderr
@@ -0,0 +1,15 @@
+error[E0618]: expected function, found `Enum<()>`
+ --> $DIR/issue-114701.rs:14:27
+ |
+LL | enum Enum<T> { SVariant { v: T }, UVariant }
+ | -------- `Enum::UVariant` defined here
+...
+LL | assert!(if let Enum::$variant::<()> $matcher = $expr () { true } else { false },
+ | -------- call expression requires function
+...
+LL | is_variant!(UVariant, Enum::<()>::UVariant);
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.
diff --git a/tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.fixed b/tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.fixed
new file mode 100644
index 000000000..57387936a
--- /dev/null
+++ b/tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.fixed
@@ -0,0 +1,17 @@
+//run-rustfix
+#![allow(dead_code)]
+
+trait Trait {}
+
+fn assert_send(ptr: *mut dyn Trait) -> *mut (dyn Trait + Send) {
+ //~^ ERROR incorrect parentheses around trait bounds
+ ptr as _
+}
+
+fn foo2(_: &(dyn Trait + Send)) {}
+//~^ ERROR incorrect parentheses around trait bounds
+
+fn foo3(_: &(dyn Trait + Send)) {}
+//~^ ERROR incorrect parentheses around trait bounds
+
+fn main() {}
diff --git a/tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.rs b/tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.rs
new file mode 100644
index 000000000..8a1939bcf
--- /dev/null
+++ b/tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.rs
@@ -0,0 +1,17 @@
+//run-rustfix
+#![allow(dead_code)]
+
+trait Trait {}
+
+fn assert_send(ptr: *mut dyn Trait) -> *mut dyn (Trait + Send) {
+ //~^ ERROR incorrect parentheses around trait bounds
+ ptr as _
+}
+
+fn foo2(_: &dyn (Trait + Send)) {}
+//~^ ERROR incorrect parentheses around trait bounds
+
+fn foo3(_: &dyn(Trait + Send)) {}
+//~^ ERROR incorrect parentheses around trait bounds
+
+fn main() {}
diff --git a/tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.stderr b/tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.stderr
new file mode 100644
index 000000000..2d1abe91a
--- /dev/null
+++ b/tests/ui/suggestions/issue-114797-bad-parentheses-dyn-trait.stderr
@@ -0,0 +1,38 @@
+error: incorrect parentheses around trait bounds
+ --> $DIR/issue-114797-bad-parentheses-dyn-trait.rs:6:49
+ |
+LL | fn assert_send(ptr: *mut dyn Trait) -> *mut dyn (Trait + Send) {
+ | ^ ^
+ |
+help: fix the parentheses
+ |
+LL - fn assert_send(ptr: *mut dyn Trait) -> *mut dyn (Trait + Send) {
+LL + fn assert_send(ptr: *mut dyn Trait) -> *mut (dyn Trait + Send) {
+ |
+
+error: incorrect parentheses around trait bounds
+ --> $DIR/issue-114797-bad-parentheses-dyn-trait.rs:11:17
+ |
+LL | fn foo2(_: &dyn (Trait + Send)) {}
+ | ^ ^
+ |
+help: fix the parentheses
+ |
+LL - fn foo2(_: &dyn (Trait + Send)) {}
+LL + fn foo2(_: &(dyn Trait + Send)) {}
+ |
+
+error: incorrect parentheses around trait bounds
+ --> $DIR/issue-114797-bad-parentheses-dyn-trait.rs:14:16
+ |
+LL | fn foo3(_: &dyn(Trait + Send)) {}
+ | ^ ^
+ |
+help: fix the parentheses
+ |
+LL - fn foo3(_: &dyn(Trait + Send)) {}
+LL + fn foo3(_: &(dyn Trait + Send)) {}
+ |
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr b/tests/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr
index 438075083..bb8b9b370 100644
--- a/tests/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr
+++ b/tests/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr
@@ -5,7 +5,7 @@ LL | fn vindictive() -> bool { true }
| ----------------------- `vindictive` defined here returns `bool`
...
LL | vindictive()
- | -^^^^^^^^^^^- help: consider using a semicolon here: `;`
+ | -^^^^^^^^^^^- help: consider using a semicolon here to finish the statement: `;`
| _____|
| |
LL | | (1, 2)
diff --git a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr
index 6820af1fd..a03d4e8ce 100644
--- a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr
+++ b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr
@@ -16,7 +16,7 @@ note: required by a bound in `Trader::<'a>::set_closure`
|
LL | pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) {
| ^^^^^^^^^^^^^^^ required by this bound in `Trader::<'a>::set_closure`
-help: consider borrowing the argument
+help: consider adjusting the signature so it borrows its argument
|
LL | let closure = |trader : &mut Trader| {
| ++++
diff --git a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.stderr b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr
index 233f1bc5a..24e2e0a0f 100644
--- a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.stderr
+++ b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr
@@ -1,5 +1,5 @@
error[E0106]: missing lifetime specifier
- --> $DIR/missing-lifetime-in-assoc-const-type.rs:2:14
+ --> $DIR/missing-lifetime-in-assoc-const-type.rs:6:14
|
LL | const A: &str = "";
| ^ expected named lifetime parameter
@@ -11,7 +11,7 @@ LL ~ const A: &'a str = "";
|
error[E0106]: missing lifetime specifier
- --> $DIR/missing-lifetime-in-assoc-const-type.rs:3:14
+ --> $DIR/missing-lifetime-in-assoc-const-type.rs:7:14
|
LL | const B: S = S { s: &() };
| ^ expected named lifetime parameter
@@ -24,7 +24,7 @@ LL ~ const B: S<'a> = S { s: &() };
|
error[E0106]: missing lifetime specifier
- --> $DIR/missing-lifetime-in-assoc-const-type.rs:4:15
+ --> $DIR/missing-lifetime-in-assoc-const-type.rs:8:15
|
LL | const C: &'_ str = "";
| ^^ expected named lifetime parameter
@@ -38,7 +38,7 @@ LL ~ const C: &'a str = "";
|
error[E0106]: missing lifetime specifiers
- --> $DIR/missing-lifetime-in-assoc-const-type.rs:5:14
+ --> $DIR/missing-lifetime-in-assoc-const-type.rs:9:14
|
LL | const D: T = T { a: &(), b: &() };
| ^ expected 2 lifetime parameters
diff --git a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr
new file mode 100644
index 000000000..a97ffe7da
--- /dev/null
+++ b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr
@@ -0,0 +1,47 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/missing-lifetime-in-assoc-const-type.rs:6:14
+ |
+LL | const A: &str = "";
+ | ^ expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | const A<'a>: &'a str = "";
+ | ++++ ++
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/missing-lifetime-in-assoc-const-type.rs:7:14
+ |
+LL | const B: S = S { s: &() };
+ | ^ expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | const B<'a>: S<'a> = S { s: &() };
+ | ++++ ++++
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/missing-lifetime-in-assoc-const-type.rs:8:15
+ |
+LL | const C: &'_ str = "";
+ | ^^ expected named lifetime parameter
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | const C<'a>: &'a str = "";
+ | ++++ ~~
+
+error[E0106]: missing lifetime specifiers
+ --> $DIR/missing-lifetime-in-assoc-const-type.rs:9:14
+ |
+LL | const D: T = T { a: &(), b: &() };
+ | ^ expected 2 lifetime parameters
+ |
+help: consider introducing a named lifetime parameter
+ |
+LL | const D<'a>: T<'a, 'a> = T { a: &(), b: &() };
+ | ++++ ++++++++
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs
index 38332627f..2a8b4c3c0 100644
--- a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs
+++ b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs
@@ -1,3 +1,7 @@
+// revisions: default generic_const_items
+
+#![cfg_attr(generic_const_items, feature(generic_const_items), allow(incomplete_features))]
+
trait ZstAssert: Sized {
const A: &str = ""; //~ ERROR missing lifetime specifier
const B: S = S { s: &() }; //~ ERROR missing lifetime specifier
diff --git a/tests/ui/suggestions/missing-semicolon.fixed b/tests/ui/suggestions/missing-semicolon.fixed
new file mode 100644
index 000000000..df355f0b0
--- /dev/null
+++ b/tests/ui/suggestions/missing-semicolon.fixed
@@ -0,0 +1,38 @@
+// run-rustfix
+#![allow(dead_code, unused_variables, path_statements)]
+fn a() {
+ let x = 5;
+ let y = x; //~ ERROR expected function
+ (); //~ ERROR expected `;`, found `}`
+}
+
+fn b() {
+ let x = 5;
+ let y = x; //~ ERROR expected function
+ ();
+}
+fn c() {
+ let x = 5;
+ x; //~ ERROR expected function
+ ()
+}
+fn d() { // ok
+ let x = || ();
+ x
+ ()
+}
+fn e() { // ok
+ let x = || ();
+ x
+ ();
+}
+fn f()
+ {
+ let y = 5; //~ ERROR expected function
+ (); //~ ERROR expected `;`, found `}`
+}
+fn g() {
+ 5; //~ ERROR expected function
+ ();
+}
+fn main() {}
diff --git a/tests/ui/suggestions/missing-semicolon.rs b/tests/ui/suggestions/missing-semicolon.rs
new file mode 100644
index 000000000..12ef3d33e
--- /dev/null
+++ b/tests/ui/suggestions/missing-semicolon.rs
@@ -0,0 +1,38 @@
+// run-rustfix
+#![allow(dead_code, unused_variables, path_statements)]
+fn a() {
+ let x = 5;
+ let y = x //~ ERROR expected function
+ () //~ ERROR expected `;`, found `}`
+}
+
+fn b() {
+ let x = 5;
+ let y = x //~ ERROR expected function
+ ();
+}
+fn c() {
+ let x = 5;
+ x //~ ERROR expected function
+ ()
+}
+fn d() { // ok
+ let x = || ();
+ x
+ ()
+}
+fn e() { // ok
+ let x = || ();
+ x
+ ();
+}
+fn f()
+ {
+ let y = 5 //~ ERROR expected function
+ () //~ ERROR expected `;`, found `}`
+}
+fn g() {
+ 5 //~ ERROR expected function
+ ();
+}
+fn main() {}
diff --git a/tests/ui/suggestions/missing-semicolon.stderr b/tests/ui/suggestions/missing-semicolon.stderr
new file mode 100644
index 000000000..54a64f664
--- /dev/null
+++ b/tests/ui/suggestions/missing-semicolon.stderr
@@ -0,0 +1,75 @@
+error: expected `;`, found `}`
+ --> $DIR/missing-semicolon.rs:6:7
+ |
+LL | ()
+ | ^ help: add `;` here
+LL | }
+ | - unexpected token
+
+error: expected `;`, found `}`
+ --> $DIR/missing-semicolon.rs:32:7
+ |
+LL | ()
+ | ^ help: add `;` here
+LL | }
+ | - unexpected token
+
+error[E0618]: expected function, found `{integer}`
+ --> $DIR/missing-semicolon.rs:5:13
+ |
+LL | let x = 5;
+ | - `x` has type `{integer}`
+LL | let y = x
+ | ^- help: consider using a semicolon here to finish the statement: `;`
+ | _____________|
+ | |
+LL | | ()
+ | |______- call expression requires function
+
+error[E0618]: expected function, found `{integer}`
+ --> $DIR/missing-semicolon.rs:11:13
+ |
+LL | let x = 5;
+ | - `x` has type `{integer}`
+LL | let y = x
+ | ^- help: consider using a semicolon here to finish the statement: `;`
+ | _____________|
+ | |
+LL | | ();
+ | |______- call expression requires function
+
+error[E0618]: expected function, found `{integer}`
+ --> $DIR/missing-semicolon.rs:16:5
+ |
+LL | let x = 5;
+ | - `x` has type `{integer}`
+LL | x
+ | ^- help: consider using a semicolon here to finish the statement: `;`
+ | _____|
+ | |
+LL | | ()
+ | |______- call expression requires function
+
+error[E0618]: expected function, found `{integer}`
+ --> $DIR/missing-semicolon.rs:31:13
+ |
+LL | let y = 5
+ | ^- help: consider using a semicolon here to finish the statement: `;`
+ | _____________|
+ | |
+LL | | ()
+ | |______- call expression requires function
+
+error[E0618]: expected function, found `{integer}`
+ --> $DIR/missing-semicolon.rs:35:5
+ |
+LL | 5
+ | ^- help: consider using a semicolon here to finish the statement: `;`
+ | _____|
+ | |
+LL | | ();
+ | |______- call expression requires function
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0618`.
diff --git a/tests/ui/suggestions/option-content-move.stderr b/tests/ui/suggestions/option-content-move.stderr
index 474a72093..5060606d8 100644
--- a/tests/ui/suggestions/option-content-move.stderr
+++ b/tests/ui/suggestions/option-content-move.stderr
@@ -12,7 +12,7 @@ note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | if selection.1.clone().unwrap().contains(selection.0) {
- | ++++++++
+ | ++++++++
error[E0507]: cannot move out of `selection.1` which is behind a shared reference
--> $DIR/option-content-move.rs:27:20
@@ -28,7 +28,7 @@ note: `Result::<T, E>::unwrap` takes ownership of the receiver `self`, which mov
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | if selection.1.clone().unwrap().contains(selection.0) {
- | ++++++++
+ | ++++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/suggestions/remove-question-symbol-with-paren.rs b/tests/ui/suggestions/remove-question-symbol-with-paren.rs
new file mode 100644
index 000000000..c522793db
--- /dev/null
+++ b/tests/ui/suggestions/remove-question-symbol-with-paren.rs
@@ -0,0 +1,9 @@
+// https://github.com/rust-lang/rust/issues/114392
+
+fn foo() -> Option<()> {
+ let x = Some(());
+ (x?)
+ //~^ ERROR `?` operator has incompatible types
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/remove-question-symbol-with-paren.stderr b/tests/ui/suggestions/remove-question-symbol-with-paren.stderr
new file mode 100644
index 000000000..40b9cf2dc
--- /dev/null
+++ b/tests/ui/suggestions/remove-question-symbol-with-paren.stderr
@@ -0,0 +1,25 @@
+error[E0308]: `?` operator has incompatible types
+ --> $DIR/remove-question-symbol-with-paren.rs:5:6
+ |
+LL | fn foo() -> Option<()> {
+ | ---------- expected `Option<()>` because of return type
+LL | let x = Some(());
+LL | (x?)
+ | ^^ expected `Option<()>`, found `()`
+ |
+ = note: `?` operator cannot convert from `()` to `Option<()>`
+ = note: expected enum `Option<()>`
+ found unit type `()`
+help: try removing this `?`
+ |
+LL - (x?)
+LL + (x)
+ |
+help: try wrapping the expression in `Some`
+ |
+LL | (Some(x?))
+ | +++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop-closure.rs b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.rs
new file mode 100644
index 000000000..e4721ba01
--- /dev/null
+++ b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.rs
@@ -0,0 +1,19 @@
+use std::collections::HashMap;
+struct X(usize);
+struct Y {
+ v: u32,
+}
+
+fn main() {
+ let _ = || {
+ let mut buzz = HashMap::new();
+ buzz.insert("a", Y { v: 0 });
+
+ for mut t in buzz.values() {
+ //~^ HELP
+ //~| SUGGESTION values_mut()
+ t.v += 1;
+ //~^ ERROR cannot assign
+ }
+ };
+}
diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr
new file mode 100644
index 000000000..8a2df8d7c
--- /dev/null
+++ b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr
@@ -0,0 +1,15 @@
+error[E0594]: cannot assign to `t.v`, which is behind a `&` reference
+ --> $DIR/suggest-mut-method-for-loop-closure.rs:15:13
+ |
+LL | for mut t in buzz.values() {
+ | -------------
+ | | |
+ | | help: use mutable method: `values_mut()`
+ | this iterator yields `&` references
+...
+LL | t.v += 1;
+ | ^^^^^^^^ `t` is a `&` reference, so the data it refers to cannot be written
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/tests/ui/target-feature/gate.rs b/tests/ui/target-feature/gate.rs
index 8d1765eb8..782444417 100644
--- a/tests/ui/target-feature/gate.rs
+++ b/tests/ui/target-feature/gate.rs
@@ -1,16 +1,5 @@
-// ignore-arm
-// ignore-aarch64
-// ignore-wasm
-// ignore-emscripten
-// ignore-mips
-// ignore-mips64
-// ignore-powerpc
-// ignore-powerpc64
-// ignore-riscv64
-// ignore-sparc
-// ignore-sparc64
-// ignore-s390x
-// ignore-loongarch64
+// only-x86_64
+//
// gate-test-sse4a_target_feature
// gate-test-powerpc_target_feature
// gate-test-avx512_target_feature
@@ -28,6 +17,7 @@
// gate-test-ermsb_target_feature
// gate-test-bpf_target_feature
// gate-test-aarch64_ver_target_feature
+// gate-test-csky_target_feature
#[target_feature(enable = "avx512bw")]
//~^ ERROR: currently unstable
diff --git a/tests/ui/target-feature/gate.stderr b/tests/ui/target-feature/gate.stderr
index ee542b60a..f56efb3bb 100644
--- a/tests/ui/target-feature/gate.stderr
+++ b/tests/ui/target-feature/gate.stderr
@@ -1,5 +1,5 @@
error[E0658]: the target feature `avx512bw` is currently unstable
- --> $DIR/gate.rs:32:18
+ --> $DIR/gate.rs:22:18
|
LL | #[target_feature(enable = "avx512bw")]
| ^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/target-feature/invalid-attribute.rs b/tests/ui/target-feature/invalid-attribute.rs
index 77fd8b85f..d1b3cf71c 100644
--- a/tests/ui/target-feature/invalid-attribute.rs
+++ b/tests/ui/target-feature/invalid-attribute.rs
@@ -1,16 +1,4 @@
-// ignore-arm
-// ignore-aarch64
-// ignore-wasm
-// ignore-emscripten
-// ignore-mips
-// ignore-mips64
-// ignore-powerpc
-// ignore-powerpc64
-// ignore-riscv64
-// ignore-s390x
-// ignore-sparc
-// ignore-sparc64
-// ignore-loongarch64
+// only-x86_64
#![warn(unused_attributes)]
diff --git a/tests/ui/target-feature/invalid-attribute.stderr b/tests/ui/target-feature/invalid-attribute.stderr
index 6d37d0917..29c73921c 100644
--- a/tests/ui/target-feature/invalid-attribute.stderr
+++ b/tests/ui/target-feature/invalid-attribute.stderr
@@ -1,11 +1,11 @@
error: malformed `target_feature` attribute input
- --> $DIR/invalid-attribute.rs:32:1
+ --> $DIR/invalid-attribute.rs:20:1
|
LL | #[target_feature = "+sse2"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[target_feature(enable = "name")]`
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:17:1
+ --> $DIR/invalid-attribute.rs:5:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -14,7 +14,7 @@ LL | extern crate alloc;
| ------------------- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:22:1
+ --> $DIR/invalid-attribute.rs:10:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | use alloc::alloc::alloc;
| ------------------------ not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:27:1
+ --> $DIR/invalid-attribute.rs:15:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -32,7 +32,7 @@ LL | extern "Rust" {}
| ---------------- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:49:1
+ --> $DIR/invalid-attribute.rs:37:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -41,7 +41,7 @@ LL | mod another {}
| -------------- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:54:1
+ --> $DIR/invalid-attribute.rs:42:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,7 +50,7 @@ LL | const FOO: usize = 7;
| --------------------- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:59:1
+ --> $DIR/invalid-attribute.rs:47:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -59,7 +59,7 @@ LL | struct Foo;
| ----------- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:64:1
+ --> $DIR/invalid-attribute.rs:52:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -68,7 +68,7 @@ LL | enum Bar {}
| ----------- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:69:1
+ --> $DIR/invalid-attribute.rs:57:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -81,7 +81,7 @@ LL | | }
| |_- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:77:1
+ --> $DIR/invalid-attribute.rs:65:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -90,7 +90,7 @@ LL | type Uwu = ();
| -------------- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:82:1
+ --> $DIR/invalid-attribute.rs:70:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -99,7 +99,7 @@ LL | trait Baz {}
| ------------ not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:92:1
+ --> $DIR/invalid-attribute.rs:80:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -108,7 +108,7 @@ LL | static A: () = ();
| ------------------ not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:97:1
+ --> $DIR/invalid-attribute.rs:85:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -117,7 +117,7 @@ LL | impl Quux for u8 {}
| ------------------- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:102:1
+ --> $DIR/invalid-attribute.rs:90:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -126,7 +126,7 @@ LL | impl Foo {}
| ----------- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:120:5
+ --> $DIR/invalid-attribute.rs:108:5
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -138,7 +138,7 @@ LL | | }
| |_____- not a function definition
error: attribute should be applied to a function definition
- --> $DIR/invalid-attribute.rs:128:5
+ --> $DIR/invalid-attribute.rs:116:5
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -147,25 +147,25 @@ LL | || {};
| ----- not a function definition
error: the feature named `foo` is not valid for this target
- --> $DIR/invalid-attribute.rs:34:18
+ --> $DIR/invalid-attribute.rs:22:18
|
LL | #[target_feature(enable = "foo")]
| ^^^^^^^^^^^^^^ `foo` is not valid for this target
error: malformed `target_feature` attribute input
- --> $DIR/invalid-attribute.rs:37:18
+ --> $DIR/invalid-attribute.rs:25:18
|
LL | #[target_feature(bar)]
| ^^^ help: must be of the form: `enable = ".."`
error: malformed `target_feature` attribute input
- --> $DIR/invalid-attribute.rs:39:18
+ --> $DIR/invalid-attribute.rs:27:18
|
LL | #[target_feature(disable = "baz")]
| ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."`
error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
- --> $DIR/invalid-attribute.rs:43:1
+ --> $DIR/invalid-attribute.rs:31:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -177,13 +177,13 @@ LL | fn bar() {}
= help: add `#![feature(target_feature_11)]` to the crate attributes to enable
error: cannot use `#[inline(always)]` with `#[target_feature]`
- --> $DIR/invalid-attribute.rs:87:1
+ --> $DIR/invalid-attribute.rs:75:1
|
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^
error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
- --> $DIR/invalid-attribute.rs:112:5
+ --> $DIR/invalid-attribute.rs:100:5
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr b/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr
index 727e9691c..699783383 100644
--- a/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr
+++ b/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr
@@ -1,9 +1,11 @@
-thread 'main' panicked at 'assertion failed: `(left == right)`
- left: `2`,
- right: `4`', $DIR/test-panic-abort-nocapture.rs:33:5
+thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:33:5:
+assertion `left == right` failed
+ left: 2
+ right: 4
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
-thread 'main' panicked at 'assertion failed: `(left == right)`
- left: `2`,
- right: `4`', $DIR/test-panic-abort-nocapture.rs:27:5
+thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:27:5:
+assertion `left == right` failed
+ left: 2
+ right: 4
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
testing321
diff --git a/tests/ui/test-attrs/test-panic-abort.run.stdout b/tests/ui/test-attrs/test-panic-abort.run.stdout
index b6b9c2560..0e27f6fb6 100644
--- a/tests/ui/test-attrs/test-panic-abort.run.stdout
+++ b/tests/ui/test-attrs/test-panic-abort.run.stdout
@@ -17,9 +17,10 @@ hello, world
testing123
---- it_fails stderr ----
testing321
-thread 'main' panicked at 'assertion failed: `(left == right)`
- left: `2`,
- right: `5`', $DIR/test-panic-abort.rs:38:5
+thread 'main' panicked at $DIR/test-panic-abort.rs:38:5:
+assertion `left == right` failed
+ left: 2
+ right: 5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/test-attrs/test-thread-capture.run.stdout b/tests/ui/test-attrs/test-thread-capture.run.stdout
index 513c8cf2a..31261aaa2 100644
--- a/tests/ui/test-attrs/test-thread-capture.run.stdout
+++ b/tests/ui/test-attrs/test-thread-capture.run.stdout
@@ -10,7 +10,8 @@ fee
fie
foe
fum
-thread 'thready_fail' panicked at 'explicit panic', $DIR/test-thread-capture.rs:32:5
+thread 'thready_fail' panicked at $DIR/test-thread-capture.rs:32:5:
+explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/test-attrs/test-thread-nocapture.run.stderr b/tests/ui/test-attrs/test-thread-nocapture.run.stderr
index 8c905d1af..9266fe841 100644
--- a/tests/ui/test-attrs/test-thread-nocapture.run.stderr
+++ b/tests/ui/test-attrs/test-thread-nocapture.run.stderr
@@ -1,2 +1,3 @@
-thread 'thready_fail' panicked at 'explicit panic', $DIR/test-thread-nocapture.rs:32:5
+thread 'thready_fail' panicked at $DIR/test-thread-nocapture.rs:32:5:
+explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/thir-print/thir-flat-const-variant.stdout b/tests/ui/thir-print/thir-flat-const-variant.stdout
index 1b76f07c3..7bddc9259 100644
--- a/tests/ui/thir-print/thir-flat-const-variant.stdout
+++ b/tests/ui/thir-print/thir-flat-const-variant.stdout
@@ -35,7 +35,7 @@ Thir {
AdtExpr {
adt_def: Foo,
variant_index: 0,
- substs: [],
+ args: [],
user_ty: None,
fields: [
FieldExpr {
@@ -120,7 +120,7 @@ Thir {
AdtExpr {
adt_def: Foo,
variant_index: 0,
- substs: [],
+ args: [],
user_ty: None,
fields: [
FieldExpr {
@@ -205,7 +205,7 @@ Thir {
AdtExpr {
adt_def: Foo,
variant_index: 0,
- substs: [],
+ args: [],
user_ty: None,
fields: [
FieldExpr {
@@ -290,7 +290,7 @@ Thir {
AdtExpr {
adt_def: Foo,
variant_index: 0,
- substs: [],
+ args: [],
user_ty: None,
fields: [
FieldExpr {
diff --git a/tests/ui/thir-print/thir-tree-match.stdout b/tests/ui/thir-print/thir-tree-match.stdout
index eea04c095..3fc130f01 100644
--- a/tests/ui/thir-print/thir-tree-match.stdout
+++ b/tests/ui/thir-print/thir-tree-match.stdout
@@ -106,7 +106,7 @@ body:
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
flags: IS_ENUM
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 }
- substs: []
+ args: []
variant_index: 0
subpatterns: [
Pat: {
@@ -120,7 +120,7 @@ body:
variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[fcf8]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[fcf8]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[fcf8]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[fcf8]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[fcf8]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[fcf8]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: NO_VARIANT_FLAGS }]
flags: IS_ENUM
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 10333377570083945360 }
- substs: []
+ args: []
variant_index: 0
subpatterns: []
}
@@ -179,7 +179,7 @@ body:
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
flags: IS_ENUM
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 }
- substs: []
+ args: []
variant_index: 0
subpatterns: [
Pat: {
@@ -242,7 +242,7 @@ body:
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
flags: IS_ENUM
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 }
- substs: []
+ args: []
variant_index: 1
subpatterns: []
}
diff --git a/tests/ui/threads-sendsync/issue-24313.rs b/tests/ui/threads-sendsync/issue-24313.rs
index c28b4ca96..6694bac0d 100644
--- a/tests/ui/threads-sendsync/issue-24313.rs
+++ b/tests/ui/threads-sendsync/issue-24313.rs
@@ -19,7 +19,7 @@ fn main() {
if args.len() == 1 {
let out = Command::new(&args[0]).arg("test").output().unwrap();
let stderr = std::str::from_utf8(&out.stderr).unwrap();
- assert!(stderr.contains("panicked at 'explicit panic'"),
+ assert!(stderr.contains("explicit panic"),
"bad failure message:\n{}\n", stderr);
} else {
// TLS dtors are not always run on process exit
diff --git a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.rs b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.rs
new file mode 100644
index 000000000..d5ba3847a
--- /dev/null
+++ b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.rs
@@ -0,0 +1,22 @@
+// issue:113951
+
+trait Foo<'x, T> {}
+
+trait RefFoo<T> {
+ fn ref_foo(&self);
+}
+
+impl<T> RefFoo<T> for T
+where
+ for<'a> &'a mut Vec<&'a u32>: Foo<'static, T>,
+{
+ fn ref_foo(&self) {}
+}
+
+fn coerce_lifetime2() {
+ <i32 as RefFoo<i32>>::ref_foo(unknown);
+ //~^ ERROR cannot find value `unknown` in this scope
+ //~| ERROR the trait bound `for<'a> &'a mut Vec<&'a u32>: Foo<'static, i32>` is not satisfied
+}
+
+fn main() {}
diff --git a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr
new file mode 100644
index 000000000..934d20b22
--- /dev/null
+++ b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr
@@ -0,0 +1,27 @@
+error[E0425]: cannot find value `unknown` in this scope
+ --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:35
+ |
+LL | <i32 as RefFoo<i32>>::ref_foo(unknown);
+ | ^^^^^^^ not found in this scope
+
+error[E0277]: the trait bound `for<'a> &'a mut Vec<&'a u32>: Foo<'static, i32>` is not satisfied
+ --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:35
+ |
+LL | <i32 as RefFoo<i32>>::ref_foo(unknown);
+ | ----------------------------- ^^^^^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required for `i32` to implement `RefFoo<i32>`
+ --> $DIR/dont-autoderef-ty-with-escaping-var.rs:9:9
+ |
+LL | impl<T> RefFoo<T> for T
+ | ^^^^^^^^^ ^
+LL | where
+LL | for<'a> &'a mut Vec<&'a u32>: Foo<'static, T>,
+ | --------------- unsatisfied trait bound introduced here
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0425.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/issue-105231.rs b/tests/ui/traits/issue-105231.rs
index 74c7afd6b..bb2b13664 100644
--- a/tests/ui/traits/issue-105231.rs
+++ b/tests/ui/traits/issue-105231.rs
@@ -1,9 +1,9 @@
-//~ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
struct A<T>(B<T>);
//~^ ERROR recursive types `A` and `B` have infinite size
struct B<T>(A<A<T>>);
trait Foo {}
impl<T> Foo for T where T: Send {}
+//~^ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
impl Foo for B<u8> {}
fn main() {}
diff --git a/tests/ui/traits/issue-105231.stderr b/tests/ui/traits/issue-105231.stderr
index fe20c47c5..76a710673 100644
--- a/tests/ui/traits/issue-105231.stderr
+++ b/tests/ui/traits/issue-105231.stderr
@@ -1,5 +1,5 @@
error[E0072]: recursive types `A` and `B` have infinite size
- --> $DIR/issue-105231.rs:2:1
+ --> $DIR/issue-105231.rs:1:1
|
LL | struct A<T>(B<T>);
| ^^^^^^^^^^^ ---- recursive without indirection
@@ -15,10 +15,14 @@ LL ~ struct B<T>(Box<A<A<T>>>);
|
error[E0275]: overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
+ --> $DIR/issue-105231.rs:5:28
+ |
+LL | impl<T> Foo for T where T: Send {}
+ | ^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`)
note: required because it appears within the type `B<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<u8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
- --> $DIR/issue-105231.rs:4:8
+ --> $DIR/issue-105231.rs:3:8
|
LL | struct B<T>(A<A<T>>);
| ^
diff --git a/tests/ui/traits/issue-24010.rs b/tests/ui/traits/issue-24010.rs
index f18185334..fd7d6751d 100644
--- a/tests/ui/traits/issue-24010.rs
+++ b/tests/ui/traits/issue-24010.rs
@@ -1,4 +1,6 @@
// run-pass
+// revisions: classic next
+//[next] compile-flags: -Ztrait-solver=next
trait Foo: Fn(i32) -> i32 + Send {}
diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr
index c721dd41a..c6fc7bb12 100644
--- a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr
+++ b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr
@@ -23,8 +23,7 @@ LL | impl<T, I: Iterator<Item = T>> Iterator for IteratorOfWrapped<T, I> {
| |
| unsatisfied trait bound introduced here
= note: 256 redundant requirements hidden
- = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<..., ...>>, ...>>, ...>>` to implement `Iterator`
- = note: the full type name has been written to '$TEST_BUILD_DIR/traits/issue-91949-hangs-on-recursion/issue-91949-hangs-on-recursion.long-type-hash.txt'
+ = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), std::iter::Empty<()>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>` to implement `Iterator`
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/traits/new-solver/alias-bound-preference.rs b/tests/ui/traits/new-solver/alias-bound-preference.rs
new file mode 100644
index 000000000..e4e0f634e
--- /dev/null
+++ b/tests/ui/traits/new-solver/alias-bound-preference.rs
@@ -0,0 +1,39 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+// run-pass
+
+// A test for https://github.com/rust-lang/trait-system-refactor-initiative/issues/45.
+
+trait Trait {
+ type Assoc: Into<u32>;
+}
+impl<T: Into<u32>> Trait for T {
+ type Assoc = T;
+}
+fn prefer_alias_bound_projection<T: Trait>(x: T::Assoc) {
+ // There are two possible types for `x`:
+ // - `u32` by using the "alias bound" of `<T as Trait>::Assoc`
+ // - `<T as Trait>::Assoc`, i.e. `u16`, by using `impl<T> From<T> for T`
+ //
+ // We infer the type of `x` to be `u32` here as it is highly likely
+ // that this is expected by the user.
+ let x = x.into();
+ assert_eq!(std::mem::size_of_val(&x), 4);
+}
+
+fn impl_trait() -> impl Into<u32> {
+ 0u16
+}
+
+fn main() {
+ // There are two possible types for `x`:
+ // - `u32` by using the "alias bound" of `impl Into<u32>`
+ // - `impl Into<u32>`, i.e. `u16`, by using `impl<T> From<T> for T`
+ //
+ // We infer the type of `x` to be `u32` here as it is highly likely
+ // that this is expected by the user.
+ let x = impl_trait().into();
+ assert_eq!(std::mem::size_of_val(&x), 4);
+
+ prefer_alias_bound_projection::<u16>(1);
+}
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.rs b/tests/ui/traits/new-solver/alias-bound-unsound.rs
index 959f1afa0..38d83d289 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.rs
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.rs
@@ -16,12 +16,17 @@ trait Foo {
impl Foo for () {
type Item = String where String: Copy;
+ //~^ ERROR overflow evaluating the requirement `<() as Foo>::Item: Copy`
}
fn main() {
let x = String::from("hello, world");
drop(<() as Foo>::copy_me(&x));
- //~^ ERROR the type `&<() as Foo>::Item` is not well-formed
- //~| ERROR `<() as Foo>::Item` is not well-formed
+ //~^ ERROR overflow evaluating the requirement `<() as Foo>::Item: Sized`
+ //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _`
+ //~| ERROR overflow evaluating the requirement `<() as Foo>::Item well-formed`
+ //~| ERROR overflow evaluating the requirement `String <: <() as Foo>::Item`
+ //~| ERROR overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+ //~| ERROR type annotations needed
println!("{x}");
}
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.stderr b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
index 5800e2c43..abc6677c1 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.stderr
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
@@ -1,14 +1,69 @@
-error: the type `&<() as Foo>::Item` is not well-formed
- --> $DIR/alias-bound-unsound.rs:23:31
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Copy`
+ --> $DIR/alias-bound-unsound.rs:18:17
+ |
+LL | type Item = String where String: Copy;
+ | ^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
+note: required by a bound in `Foo::Item`
+ --> $DIR/alias-bound-unsound.rs:8:16
+ |
+LL | type Item: Copy
+ | ^^^^ required by this bound in `Foo::Item`
+
+error[E0282]: type annotations needed
+ --> $DIR/alias-bound-unsound.rs:24:5
+ |
+LL | drop(<() as Foo>::copy_me(&x));
+ | ^^^^ cannot infer type of the type parameter `T` declared on the function `drop`
+ |
+help: consider specifying the generic argument
+ |
+LL | drop::<T>(<() as Foo>::copy_me(&x));
+ | +++++
+
+error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+ --> $DIR/alias-bound-unsound.rs:24:31
|
LL | drop(<() as Foo>::copy_me(&x));
| ^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error: the type `<() as Foo>::Item` is not well-formed
- --> $DIR/alias-bound-unsound.rs:23:10
+error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item`
+ --> $DIR/alias-bound-unsound.rs:24:31
+ |
+LL | drop(<() as Foo>::copy_me(&x));
+ | ^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
+
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed`
+ --> $DIR/alias-bound-unsound.rs:24:10
+ |
+LL | drop(<() as Foo>::copy_me(&x));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
+
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _`
+ --> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
| ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
+
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Sized`
+ --> $DIR/alias-bound-unsound.rs:24:10
+ |
+LL | drop(<() as Foo>::copy_me(&x));
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
+ = note: the return type of a function must have a statically known size
-error: aborting due to 2 previous errors
+error: aborting due to 7 previous errors
+Some errors have detailed explanations: E0275, E0282.
+For more information about an error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs b/tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs
new file mode 100644
index 000000000..826e8c1e0
--- /dev/null
+++ b/tests/ui/traits/new-solver/assembly/assemble-normalizing-self-ty-impl-ambiguity.rs
@@ -0,0 +1,27 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+// Checks that we do not get ambiguity by considering an impl
+// multiple times if we're able to normalize the self type.
+
+trait Trait<'a> {}
+
+impl<'a, T: 'a> Trait<'a> for T {}
+
+fn impls_trait<'a, T: Trait<'a>>() {}
+
+trait Id {
+ type Assoc;
+}
+impl<T> Id for T {
+ type Assoc = T;
+}
+
+fn call<T>() {
+ impls_trait::<<T as Id>::Assoc>();
+}
+
+fn main() {
+ call::<()>();
+ impls_trait::<<<() as Id>::Assoc as Id>::Assoc>();
+}
diff --git a/tests/ui/traits/new-solver/runaway-impl-candidate-selection.rs b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.rs
index 1dca86d36..1dca86d36 100644
--- a/tests/ui/traits/new-solver/runaway-impl-candidate-selection.rs
+++ b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.rs
diff --git a/tests/ui/traits/new-solver/runaway-impl-candidate-selection.stderr b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
index 47004821a..47004821a 100644
--- a/tests/ui/traits/new-solver/runaway-impl-candidate-selection.stderr
+++ b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs
new file mode 100644
index 000000000..b39ae0333
--- /dev/null
+++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.rs
@@ -0,0 +1,20 @@
+// compile-flags: -Ztrait-solver=next
+
+// Coherence should handle overflow while normalizing for
+// `trait_ref_is_knowable` correctly.
+
+trait Overflow {
+ type Assoc;
+}
+impl<T> Overflow for T {
+ type Assoc = <T as Overflow>::Assoc;
+}
+
+
+trait Trait {}
+impl<T: Copy> Trait for T {}
+struct LocalTy;
+impl Trait for <LocalTy as Overflow>::Assoc {}
+//~^ ERROR conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc`
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
new file mode 100644
index 000000000..5d5f325e4
--- /dev/null
+++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc`
+ --> $DIR/trait_ref_is_knowable-norm-overflow.rs:17:1
+ |
+LL | impl<T: Copy> Trait for T {}
+ | ------------------------- first implementation here
+LL | struct LocalTy;
+LL | impl Trait for <LocalTy as Overflow>::Assoc {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<LocalTy as Overflow>::Assoc`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs
new file mode 100644
index 000000000..c38e3baf5
--- /dev/null
+++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-1.rs
@@ -0,0 +1,22 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+trait Id {
+ type Assoc;
+}
+impl<T> Id for T {
+ type Assoc = T;
+}
+
+
+// Coherence should be able to reason that `<LocalTy as Id>::Assoc: Copy`
+// does not hold.
+//
+// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/51
+// for more details.
+trait Trait {}
+impl<T: Copy> Trait for T {}
+struct LocalTy;
+impl Trait for <LocalTy as Id>::Assoc {}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs
new file mode 100644
index 000000000..2d53266db
--- /dev/null
+++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-2.rs
@@ -0,0 +1,25 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+use std::future::{Future, IntoFuture};
+use std::pin::Pin;
+
+// We check that this does not overlap with the following impl from std:
+// impl<P> Future for Pin<P> where P: DerefMut, <P as Deref>::Target: Future { .. }
+// This should fail because we know ` <&mut Value as Deref>::Target: Future` not to hold.
+// For this to work we have to normalize in the `trait_ref_is_knowable` check as we
+// otherwise add an ambiguous candidate here.
+//
+// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/51
+// for more details.
+struct Value;
+impl<'a> IntoFuture for Pin<&'a mut Value> {
+ type Output = ();
+ type IntoFuture = Pin<Box<dyn Future<Output = ()> + Send>>;
+
+ fn into_future(self) -> Self::IntoFuture {
+ todo!()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs
new file mode 100644
index 000000000..2f27de4e4
--- /dev/null
+++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-normalization-3.rs
@@ -0,0 +1,24 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+trait Id {
+ type Assoc;
+}
+impl<T> Id for T {
+ type Assoc = T;
+}
+
+
+// Coherence should be able to reason that `(): PartialEq<<T as Id>::Assoc>>`
+// does not hold.
+//
+// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/51
+// for more details.
+trait Trait {}
+impl<T> Trait for T
+where
+ (): PartialEq<T> {}
+struct LocalTy;
+impl Trait for <LocalTy as Id>::Assoc {}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
new file mode 100644
index 000000000..fcafdcf63
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
@@ -0,0 +1,32 @@
+// compile-flags: -Ztrait-solver=next
+
+// Proving `W<?0>: Trait` instantiates `?0` with `(W<?1>, W<?2>)` and then
+// proves `W<?1>: Trait` and `W<?2>: Trait`, resulting in a coinductive cycle.
+//
+// Proving coinductive cycles runs until we reach a fixpoint. This fixpoint is
+// never reached here and each step doubles the amount of nested obligations.
+//
+// This previously caused a hang in the trait solver, see
+// https://github.com/rust-lang/trait-system-refactor-initiative/issues/13.
+
+#![feature(rustc_attrs)]
+
+#[rustc_coinductive]
+trait Trait {}
+
+struct W<T>(T);
+
+impl<T, U> Trait for W<(W<T>, W<U>)>
+where
+ W<T>: Trait,
+ W<U>: Trait,
+{
+}
+
+fn impls<T: Trait>() {}
+
+fn main() {
+ impls::<W<_>>();
+ //~^ ERROR type annotations needed
+ //~| ERROR overflow evaluating the requirement
+}
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
new file mode 100644
index 000000000..7d3535e1f
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
@@ -0,0 +1,23 @@
+error[E0282]: type annotations needed
+ --> $DIR/fixpoint-exponential-growth.rs:29:5
+ |
+LL | impls::<W<_>>();
+ | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
+
+error[E0275]: overflow evaluating the requirement `W<_>: Trait`
+ --> $DIR/fixpoint-exponential-growth.rs:29:5
+ |
+LL | impls::<W<_>>();
+ | ^^^^^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`fixpoint_exponential_growth`)
+note: required by a bound in `impls`
+ --> $DIR/fixpoint-exponential-growth.rs:26:13
+ |
+LL | fn impls<T: Trait>() {}
+ | ^^^^^ required by this bound in `impls`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0275, E0282.
+For more information about an error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs b/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs
new file mode 100644
index 000000000..0cd14f05c
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.rs
@@ -0,0 +1,69 @@
+// compile-flags: -Ztrait-solver=next
+#![feature(rustc_attrs)]
+
+// This test is incredibly subtle. At its core the goal is to get a coinductive cycle,
+// which, depending on its root goal, either holds or errors. We achieve this by getting
+// incomplete inference via a `ParamEnv` candidate in the `A<T>` impl and required
+// inference from an `Impl` candidate in the `B<T>` impl.
+//
+// To make global cache accesses stronger than the guidance from the where-bounds, we add
+// another coinductive cycle from `A<T>: Trait<U, V, D>` to `A<T>: Trait<U, D, V>` and only
+// constrain `D` directly. This means that any candidates which rely on `V` only make
+// progress in the second iteration, allowing a cache access in the first iteration to take
+// precedence.
+//
+// tl;dr: our caching of coinductive cycles was broken and this is a regression
+// test for that.
+
+#[rustc_coinductive]
+trait Trait<T: ?Sized, V: ?Sized, D: ?Sized> {}
+struct A<T: ?Sized>(*const T);
+struct B<T: ?Sized>(*const T);
+
+trait IncompleteGuidance<T: ?Sized, V: ?Sized> {}
+impl<T: ?Sized, U: ?Sized + 'static> IncompleteGuidance<U, u8> for T {}
+impl<T: ?Sized, U: ?Sized + 'static> IncompleteGuidance<U, i8> for T {}
+impl<T: ?Sized, U: ?Sized + 'static> IncompleteGuidance<U, i16> for T {}
+
+trait ImplGuidance<T: ?Sized, V: ?Sized> {}
+impl<T: ?Sized> ImplGuidance<u32, u8> for T {}
+impl<T: ?Sized> ImplGuidance<i32, i8> for T {}
+
+impl<T: ?Sized, U: ?Sized, V: ?Sized, D: ?Sized> Trait<U, V, D> for A<T>
+where
+ T: IncompleteGuidance<U, V>,
+ A<T>: Trait<U, D, V>,
+ B<T>: Trait<U, V, D>,
+ (): ToU8<D>,
+{
+}
+
+trait ToU8<T: ?Sized> {}
+impl ToU8<u8> for () {}
+
+impl<T: ?Sized, U: ?Sized, V: ?Sized, D: ?Sized> Trait<U, V, D> for B<T>
+where
+ T: ImplGuidance<U, V>,
+ A<T>: Trait<U, V, D>,
+{
+}
+
+fn impls_trait<T: ?Sized + Trait<U, V, D>, U: ?Sized, V: ?Sized, D: ?Sized>() {}
+
+fn with_bound<X>()
+where
+ X: IncompleteGuidance<i32, u8>,
+ X: IncompleteGuidance<u32, i8>,
+ X: IncompleteGuidance<u32, i16>,
+{
+ impls_trait::<B<X>, _, _, _>(); // entering the cycle from `B` works
+
+ // entering the cycle from `A` fails, but would work if we were to use the cache
+ // result of `B<X>`.
+ impls_trait::<A<X>, _, _, _>();
+ //~^ ERROR the trait bound `A<X>: Trait<_, _, _>` is not satisfied
+}
+
+fn main() {
+ with_bound::<u32>();
+}
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.stderr b/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.stderr
new file mode 100644
index 000000000..f1871ff05
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/coinduction/incompleteness-unstable-result.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `A<X>: Trait<_, _, _>` is not satisfied
+ --> $DIR/incompleteness-unstable-result.rs:63:19
+ |
+LL | impls_trait::<A<X>, _, _, _>();
+ | ^^^^ the trait `Trait<_, _, _>` is not implemented for `A<X>`
+ |
+ = help: the trait `Trait<U, V, D>` is implemented for `A<T>`
+note: required by a bound in `impls_trait`
+ --> $DIR/incompleteness-unstable-result.rs:51:28
+ |
+LL | fn impls_trait<T: ?Sized + Trait<U, V, D>, U: ?Sized, V: ?Sized, D: ?Sized>() {}
+ | ^^^^^^^^^^^^^^ required by this bound in `impls_trait`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs
new file mode 100644
index 000000000..5617e45ad
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.rs
@@ -0,0 +1,37 @@
+// compile-flags: -Ztrait-solver=next
+#![feature(rustc_attrs)]
+
+// Test that having both an inductive and a coinductive cycle
+// is handled correctly.
+
+#[rustc_coinductive]
+trait Trait {}
+impl<T: Inductive + Coinductive> Trait for T {}
+
+trait Inductive {}
+impl<T: Trait> Inductive for T {}
+#[rustc_coinductive]
+trait Coinductive {}
+impl<T: Trait> Coinductive for T {}
+
+fn impls_trait<T: Trait>() {}
+
+#[rustc_coinductive]
+trait TraitRev {}
+impl<T: CoinductiveRev + InductiveRev> TraitRev for T {}
+
+trait InductiveRev {}
+impl<T: TraitRev> InductiveRev for T {}
+#[rustc_coinductive]
+trait CoinductiveRev {}
+impl<T: TraitRev> CoinductiveRev for T {}
+
+fn impls_trait_rev<T: TraitRev>() {}
+
+fn main() {
+ impls_trait::<()>();
+ //~^ ERROR overflow evaluating the requirement
+
+ impls_trait_rev::<()>();
+ //~^ ERROR overflow evaluating the requirement
+}
diff --git a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr
new file mode 100644
index 000000000..4b8846da5
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr
@@ -0,0 +1,29 @@
+error[E0275]: overflow evaluating the requirement `(): Trait`
+ --> $DIR/double-cycle-inductive-coinductive.rs:32:5
+ |
+LL | impls_trait::<()>();
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`)
+note: required by a bound in `impls_trait`
+ --> $DIR/double-cycle-inductive-coinductive.rs:17:19
+ |
+LL | fn impls_trait<T: Trait>() {}
+ | ^^^^^ required by this bound in `impls_trait`
+
+error[E0275]: overflow evaluating the requirement `(): TraitRev`
+ --> $DIR/double-cycle-inductive-coinductive.rs:35:5
+ |
+LL | impls_trait_rev::<()>();
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`)
+note: required by a bound in `impls_trait_rev`
+ --> $DIR/double-cycle-inductive-coinductive.rs:29:23
+ |
+LL | fn impls_trait_rev<T: TraitRev>() {}
+ | ^^^^^^^^ required by this bound in `impls_trait_rev`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs
new file mode 100644
index 000000000..cda987898
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.rs
@@ -0,0 +1,48 @@
+// compile-flags: -Ztrait-solver=next
+#![feature(trivial_bounds, marker_trait_attr)]
+#![allow(trivial_bounds)]
+// This previously triggered a bug in the provisional cache.
+//
+// This has the proof tree
+// - `MultipleCandidates: Trait` proven via impl-one
+// - `MultipleNested: Trait` via impl
+// - `MultipleCandidates: Trait` (inductive cycle ~> OVERFLOW)
+// - `DoesNotImpl: Trait` (ERR)
+// - `MultipleCandidates: Trait` proven via impl-two
+// - `MultipleNested: Trait` (in provisional cache ~> OVERFLOW)
+//
+// We previously incorrectly treated the `MultipleCandidates: Trait` as
+// overflow because it was in the cache and reached via an inductive cycle.
+// It should be `NoSolution`.
+
+struct MultipleCandidates;
+struct MultipleNested;
+struct DoesNotImpl;
+
+#[marker]
+trait Trait {}
+
+// impl-one
+impl Trait for MultipleCandidates
+where
+ MultipleNested: Trait
+{}
+
+// impl-two
+impl Trait for MultipleCandidates
+where
+ MultipleNested: Trait,
+{}
+
+impl Trait for MultipleNested
+where
+ MultipleCandidates: Trait,
+ DoesNotImpl: Trait,
+{}
+
+fn impls_trait<T: Trait>() {}
+
+fn main() {
+ impls_trait::<MultipleCandidates>();
+ //~^ ERROR the trait bound `MultipleCandidates: Trait` is not satisfied
+}
diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.stderr b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.stderr
new file mode 100644
index 000000000..57227321a
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-err.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `MultipleCandidates: Trait` is not satisfied
+ --> $DIR/inductive-cycle-but-err.rs:46:19
+ |
+LL | impls_trait::<MultipleCandidates>();
+ | ^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `MultipleCandidates`
+ |
+ = help: the trait `Trait` is implemented for `MultipleCandidates`
+note: required by a bound in `impls_trait`
+ --> $DIR/inductive-cycle-but-err.rs:43:19
+ |
+LL | fn impls_trait<T: Trait>() {}
+ | ^^^^^ required by this bound in `impls_trait`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs
new file mode 100644
index 000000000..d4851eb69
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/inductive-cycle-but-ok.rs
@@ -0,0 +1,44 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+#![feature(trivial_bounds, marker_trait_attr)]
+#![allow(trivial_bounds)]
+
+// This previously triggered a bug in the provisional cache.
+//
+// This has the proof tree
+// - `Root: Trait` proven via impl
+// - `MultipleCandidates: Trait`
+// - candidate: overflow-impl
+// - `Root: Trait` (inductive cycle ~> OVERFLOW)
+// - candidate: trivial-impl ~> YES
+// - merge respones ~> YES
+// - `MultipleCandidates: Trait` (in provisional cache ~> OVERFLOW)
+//
+// We previously incorrectly treated the `MultipleCandidates: Trait` as
+// overflow because it was in the cache and reached via an inductive cycle.
+// It should be `YES`.
+
+struct Root;
+struct MultipleCandidates;
+
+#[marker]
+trait Trait {}
+impl Trait for Root
+where
+ MultipleCandidates: Trait,
+ MultipleCandidates: Trait,
+{}
+
+// overflow-impl
+impl Trait for MultipleCandidates
+where
+ Root: Trait,
+{}
+// trivial-impl
+impl Trait for MultipleCandidates {}
+
+fn impls_trait<T: Trait>() {}
+
+fn main() {
+ impls_trait::<Root>();
+}
diff --git a/tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs b/tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs
new file mode 100644
index 000000000..530e6d0ec
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/inductive-cycle-discarded-coinductive-constraints.rs
@@ -0,0 +1,36 @@
+// check-pass
+// compile-flags: -Ztrait-solver=next
+#![feature(rustc_attrs, marker_trait_attr)]
+#[rustc_coinductive]
+trait Trait {}
+
+impl<T, U> Trait for (T, U)
+where
+ (U, T): Trait,
+ (T, U): Inductive,
+ (): ConstrainToU32<T>,
+{}
+
+trait ConstrainToU32<T> {}
+impl ConstrainToU32<u32> for () {}
+
+// We only prefer the candidate without an inductive cycle
+// once the inductive cycle has the same constraints as the
+// other goal.
+#[marker]
+trait Inductive {}
+impl<T, U> Inductive for (T, U)
+where
+ (T, U): Trait,
+{}
+
+impl Inductive for (u32, u32) {}
+
+fn impls_trait<T, U>()
+where
+ (T, U): Trait,
+{}
+
+fn main() {
+ impls_trait::<_, _>();
+}
diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
new file mode 100644
index 000000000..3cfe7ab87
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs
@@ -0,0 +1,46 @@
+// compile-flags: -Ztrait-solver=next
+#![feature(rustc_attrs, trivial_bounds)]
+
+// We have to be careful here:
+//
+// We either have the provisional result of `A -> B -> A` on the
+// stack, which is a fully coinductive cycle. Accessing the
+// provisional result for `B` as part of the `A -> C -> B -> A` cycle
+// has to make sure we don't just use the result of `A -> B -> A` as the
+// new cycle is inductive.
+//
+// Alternatively, if we have `A -> C -> A` first, then `A -> B -> A` has
+// a purely inductive stack, so something could also go wrong here.
+
+#[rustc_coinductive]
+trait A {}
+#[rustc_coinductive]
+trait B {}
+trait C {}
+
+impl<T: B + C> A for T {}
+impl<T: A> B for T {}
+impl<T: B> C for T {}
+
+fn impls_a<T: A>() {}
+
+// The same test with reordered where clauses to make sure we're actually testing anything.
+#[rustc_coinductive]
+trait AR {}
+#[rustc_coinductive]
+trait BR {}
+trait CR {}
+
+impl<T: CR + BR> AR for T {}
+impl<T: AR> BR for T {}
+impl<T: BR> CR for T {}
+
+fn impls_ar<T: AR>() {}
+
+fn main() {
+ impls_a::<()>();
+ // FIXME(-Ztrait-solver=next): This is broken and should error.
+
+ impls_ar::<()>();
+ //~^ ERROR overflow evaluating the requirement `(): AR`
+}
diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr
new file mode 100644
index 000000000..0e1c86c1b
--- /dev/null
+++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr
@@ -0,0 +1,16 @@
+error[E0275]: overflow evaluating the requirement `(): AR`
+ --> $DIR/inductive-not-on-stack.rs:44:5
+ |
+LL | impls_ar::<()>();
+ | ^^^^^^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`)
+note: required by a bound in `impls_ar`
+ --> $DIR/inductive-not-on-stack.rs:38:16
+ |
+LL | fn impls_ar<T: AR>() {}
+ | ^^ required by this bound in `impls_ar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/leak-check-coinductive-cycle.rs b/tests/ui/traits/new-solver/cycles/leak-check-coinductive-cycle.rs
index 1f7d4a49c..a6d318726 100644
--- a/tests/ui/traits/new-solver/leak-check-coinductive-cycle.rs
+++ b/tests/ui/traits/new-solver/cycles/leak-check-coinductive-cycle.rs
@@ -1,5 +1,5 @@
-// check-pass
// compile-flags: -Ztrait-solver=next
+// check-pass
#![feature(rustc_attrs)]
#[rustc_coinductive]
diff --git a/tests/ui/traits/new-solver/provisional-result-done.rs b/tests/ui/traits/new-solver/cycles/provisional-result-done.rs
index 589d34dd7..589d34dd7 100644
--- a/tests/ui/traits/new-solver/provisional-result-done.rs
+++ b/tests/ui/traits/new-solver/cycles/provisional-result-done.rs
diff --git a/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs b/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs
new file mode 100644
index 000000000..c2ac80459
--- /dev/null
+++ b/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs
@@ -0,0 +1,17 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+use std::fmt::Display;
+use std::rc::Rc;
+
+fn mk<T: ?Sized>(t: Option<&T>) -> Rc<T> {
+ todo!()
+}
+
+fn main() {
+ let mut x = None;
+ let y = mk(x);
+ // Don't treat the line below as a unsize coercion `Rc<?0> ~> Rc<dyn Display>`
+ let z: Rc<dyn Display> = y;
+ x = Some(&1 as &dyn Display);
+}
diff --git a/tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs b/tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs
new file mode 100644
index 000000000..b241e3bf8
--- /dev/null
+++ b/tests/ui/traits/new-solver/dont-loop-fulfill-on-region-constraints.rs
@@ -0,0 +1,32 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+trait Eq<'a, 'b, T> {}
+
+trait Ambig {}
+impl Ambig for () {}
+
+impl<'a, T> Eq<'a, 'a, T> for () where T: Ambig {}
+
+fn eq<'a, 'b, T>(t: T)
+where
+ (): Eq<'a, 'b, T>,
+{
+}
+
+fn test<'r>() {
+ let mut x = Default::default();
+
+ // When we evaluate `(): Eq<'r, 'r, ?0>` we uniquify the regions.
+ // That leads us to evaluate `(): Eq<'?0, '?1, ?0>`. The response of this
+ // will be ambiguous (because `?0: Ambig` is ambig) and also not an "identity"
+ // response, since the region constraints will contain `'?0 == '?1` (so
+ // `is_changed` will return true). Since it's both ambig and changed,
+ // fulfillment will both re-register the goal AND loop again. This hits the
+ // overflow limit. This should neither be considered overflow, nor ICE.
+ eq::<'r, 'r, _>(x);
+
+ x = ();
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs b/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs
new file mode 100644
index 000000000..19a6fa990
--- /dev/null
+++ b/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs
@@ -0,0 +1,22 @@
+// compile-flags: -Ztrait-solver=next
+
+// Test that we don't incorrectly leak unconstrained inference variables
+// if the projection contained an error. This caused an ICE in writeback.
+
+trait Mirror {
+ type Assoc: ?Sized;
+}
+
+struct Wrapper<T: ?Sized>(T);
+impl<T: ?Sized> Mirror for Wrapper<T> {
+ type Assoc = T;
+}
+
+fn mirror<W: Mirror>(_: W) -> Box<W::Assoc> { todo!() }
+
+fn type_error() -> TypeError { todo!() }
+//~^ ERROR cannot find type `TypeError` in this scope
+
+fn main() {
+ let x = mirror(type_error());
+}
diff --git a/tests/ui/traits/new-solver/dont-normalize-proj-with-error.stderr b/tests/ui/traits/new-solver/dont-normalize-proj-with-error.stderr
new file mode 100644
index 000000000..5a7459ec1
--- /dev/null
+++ b/tests/ui/traits/new-solver/dont-normalize-proj-with-error.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `TypeError` in this scope
+ --> $DIR/dont-normalize-proj-with-error.rs:17:20
+ |
+LL | fn type_error() -> TypeError { todo!() }
+ | ^^^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs b/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs
index 7d15b8c63..af35a6195 100644
--- a/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs
+++ b/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs
@@ -1,6 +1,10 @@
// compile-flags: -Ztrait-solver=next
// check-pass
+// Test that selection prefers the builtin trait object impl for `Any`
+// instead of the user defined impl. Both impls apply to the trait
+// object.
+
use std::any::Any;
fn needs_usize(_: &usize) {}
diff --git a/tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs b/tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs
new file mode 100644
index 000000000..29784c32a
--- /dev/null
+++ b/tests/ui/traits/new-solver/escaping-bound-vars-in-writeback-normalization.rs
@@ -0,0 +1,18 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+trait Trivial {
+ type Assoc;
+}
+
+impl<T: ?Sized> Trivial for T {
+ type Assoc = ();
+}
+
+fn main() {
+ // During writeback, we call `normalize_erasing_regions`, which will walk past
+ // the `for<'a>` binder and try to normalize `<&'a () as Trivial>::Assoc` directly.
+ // We need to handle this case in the new deep normalizer similarly to how it
+ // is handled in the old solver.
+ let x: Option<for<'a> fn(<&'a () as Trivial>::Assoc)> = None;
+}
diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs
new file mode 100644
index 000000000..b0b9b6bbd
--- /dev/null
+++ b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-1.rs
@@ -0,0 +1,73 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+// A minimization of an ambiguity when using typenum. See
+// https://github.com/rust-lang/trait-system-refactor-initiative/issues/55
+// for more details.
+trait Id {
+ type Assoc: ?Sized;
+}
+impl<T: ?Sized> Id for T {
+ type Assoc = T;
+}
+
+trait WithAssoc<T: ?Sized> {
+ type Assoc: ?Sized;
+}
+
+
+struct Leaf;
+struct Wrapper<U: ?Sized>(U);
+
+impl<U: ?Sized> WithAssoc<U> for Leaf {
+ type Assoc = U;
+}
+
+impl<Ul: ?Sized, Ur: ?Sized> WithAssoc<Wrapper<Ur>> for Wrapper<Ul>
+where
+ Ul: WithAssoc<Ur>,
+{
+ type Assoc = <<Ul as WithAssoc<Ur>>::Assoc as Id>::Assoc;
+}
+
+fn bound<T: ?Sized, U: ?Sized, V: ?Sized>()
+where
+ T: WithAssoc<U, Assoc = V>,
+{
+}
+
+// normalize self type to `Wrapper<Leaf>`
+// This succeeds, HOWEVER, instantiating the query response previously
+// incremented the universe index counter.
+// equate impl headers:
+// <Wrapper<Leaf> as WithAssoc<<Wrapper<Leaf> as Id>::Assoc>>
+// <Wrapper<?2t> as WithAssoc<Wrapper<?3t>>>
+// ~> AliasRelate(<Wrapper<Leaf> as Id>::Assoc, Equate, Wrapper<?3t>)
+// add where bounds:
+// ~> Leaf: WithAssoc<?3t>
+// equate with assoc type:
+// ?0t
+// <Leaf as WithAssoc<?3t>>::Assoc as Id>::Assoc
+// ~> AliasRelate(
+// <<Leaf as WithAssoc<?3t>>::Assoc as Id>::Assoc,
+// Equate,
+// <<Leaf as WithAssoc<?4t>>::Assoc as Id>::Assoc,
+// )
+//
+// We do not reuse `?3t` during generalization because `?0t` cannot name `?4t` as we created
+// it after incrementing the universe index while normalizing the self type.
+//
+// evaluate_added_goals_and_make_query_response:
+// AliasRelate(<Wrapper<Leaf> as Id>::Assoc, Equate, Wrapper<?3t>)
+// YES, constrains ?3t to Leaf
+// AliasRelate(
+// <<Leaf as WithAssoc<Leaf>>::Assoc as Id>::Assoc,
+// Equate,
+// <<Leaf as WithAssoc<?4t>>::Assoc as Id>::Assoc,
+// )
+//
+// Normalizing <<Leaf as WithAssoc<?4t>>::Assoc as Id>::Assoc then *correctly*
+// results in ambiguity.
+fn main() {
+ bound::<<Wrapper<Leaf> as Id>::Assoc, <Wrapper<Leaf> as Id>::Assoc, _>()
+}
diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs
new file mode 100644
index 000000000..94d645a98
--- /dev/null
+++ b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.rs
@@ -0,0 +1,75 @@
+// compile-flags: -Ztrait-solver=next
+// known-bug: trait-system-refactor-initiative#60
+
+// Generalizing a projection containing an inference variable
+// which cannot be named by the `root_vid` can result in ambiguity.
+//
+// Because we do not decrement the universe index when exiting a forall,
+// this can cause unexpected failures.
+//
+// See generalize-proj-new-universe-index-1.rs for more details.
+
+// For this reproduction we need:
+// - an inference variable with a lower universe
+// - enter a binder to increment the current universe
+// - create a new inference variable which is constrained by proving a goal
+// - equate a projection containing the new variable with the first variable
+// - generalization creates yet another inference variable which is then
+// part of an alias-relate, resulting this to fail with ambiguity.
+//
+// Because we need to enter the binder in-between the creation of the first
+// and second inference variable, this is easiest via
+// `assemble_candidates_after_normalizing_self_ty` because eagerly call
+// `try_evaluate_added_goals` there before creating the inference variables
+// for the impl parameters.
+trait Id {
+ type Assoc: ?Sized;
+}
+impl<T: ?Sized> Id for T {
+ type Assoc = T;
+}
+
+// By adding an higher ranked bound to the impl we currently
+// propagate this bound to the caller, forcing us to create a new
+// universe.
+trait IdHigherRankedBound {
+ type Assoc: ?Sized;
+}
+
+impl<T: ?Sized> IdHigherRankedBound for T
+where
+ for<'a> T: 'a,
+{
+ type Assoc = T;
+}
+
+trait WithAssoc<T: ?Sized> {
+ type Assoc: ?Sized;
+}
+
+
+struct Leaf;
+struct Wrapper<U: ?Sized>(U);
+struct Rigid;
+
+impl<U: ?Sized> WithAssoc<U> for Leaf {
+ type Assoc = U;
+}
+
+
+impl<Ur: ?Sized> WithAssoc<Wrapper<Ur>> for Rigid
+where
+ Leaf: WithAssoc<Ur>,
+{
+ type Assoc = <<Leaf as WithAssoc<Ur>>::Assoc as Id>::Assoc;
+}
+
+fn bound<T: ?Sized, U: ?Sized, V: ?Sized>()
+where
+ T: WithAssoc<U, Assoc = V>,
+{
+}
+
+fn main() {
+ bound::<<Rigid as IdHigherRankedBound>::Assoc, <Wrapper<Leaf> as Id>::Assoc, _>()
+}
diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
new file mode 100644
index 000000000..9a8060133
--- /dev/null
+++ b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
@@ -0,0 +1,9 @@
+error[E0282]: type annotations needed
+ --> $DIR/generalize-proj-new-universe-index-2.rs:74:5
+ |
+LL | bound::<<Rigid as IdHigherRankedBound>::Assoc, <Wrapper<Leaf> as Id>::Assoc, _>()
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `V` declared on the function `bound`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs
index fd91d81cd..20f504928 100644
--- a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs
+++ b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs
@@ -1,5 +1,5 @@
// compile-flags: -Ztrait-solver=next
-// known-bug: #95863
+// check-pass
pub trait With {
type F;
diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr b/tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr
deleted file mode 100644
index d0a4cd661..000000000
--- a/tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/lazy-nested-obligations-2.rs:15:23
- |
-LL | let _: V<i32> = V(f);
- | - ^ types differ
- | |
- | arguments to this struct are incorrect
- |
- = note: expected associated type `<i32 as With>::F`
- found fn item `for<'a> fn(&'a str) {f}`
- = help: consider constraining the associated type `<i32 as With>::F` to `for<'a> fn(&'a str) {f}` or calling a method that returns `<i32 as With>::F`
- = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
-note: tuple struct defined here
- --> $DIR/lazy-nested-obligations-2.rs:16:16
- |
-LL | pub struct V<T: With>(<T as With>::F);
- | ^
-
-error[E0308]: mismatched types
- --> $DIR/lazy-nested-obligations-2.rs:21:30
- |
-LL | let _: E3<i32> = E3::Var(f);
- | ------- ^ types differ
- | |
- | arguments to this enum variant are incorrect
- |
- = note: expected associated type `<i32 as With>::F`
- found fn item `for<'a> fn(&'a str) {f}`
- = help: consider constraining the associated type `<i32 as With>::F` to `for<'a> fn(&'a str) {f}` or calling a method that returns `<i32 as With>::F`
- = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
-note: tuple variant defined here
- --> $DIR/lazy-nested-obligations-2.rs:19:9
- |
-LL | Var(<T as With>::F),
- | ^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/traits/new-solver/more-object-bound.stderr b/tests/ui/traits/new-solver/more-object-bound.stderr
index 4554b8c74..54965dee1 100644
--- a/tests/ui/traits/new-solver/more-object-bound.stderr
+++ b/tests/ui/traits/new-solver/more-object-bound.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `dyn Trait<A = A, B = B>: Trait` is not satisfied
- --> $DIR/more-object-bound.rs:12:17
+ --> $DIR/more-object-bound.rs:12:5
|
LL | foo::<A, B, dyn Trait<A = A, B = B>>(x)
- | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `dyn Trait<A = A, B = B>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `dyn Trait<A = A, B = B>`
|
note: required by a bound in `foo`
--> $DIR/more-object-bound.rs:18:8
diff --git a/tests/ui/traits/new-solver/normalize-unsize-rhs.rs b/tests/ui/traits/new-solver/normalize-unsize-rhs.rs
new file mode 100644
index 000000000..a398ab4f2
--- /dev/null
+++ b/tests/ui/traits/new-solver/normalize-unsize-rhs.rs
@@ -0,0 +1,23 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+#![feature(trait_upcasting)]
+
+trait A {}
+trait B: A {}
+
+impl A for usize {}
+impl B for usize {}
+
+trait Mirror {
+ type Assoc: ?Sized;
+}
+
+impl<T: ?Sized> Mirror for T {
+ type Assoc = T;
+}
+
+fn main() {
+ let x = Box::new(1usize) as Box<<dyn B as Mirror>::Assoc>;
+ let y = x as Box<<dyn A as Mirror>::Assoc>;
+}
diff --git a/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs b/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs
new file mode 100644
index 000000000..d02dada72
--- /dev/null
+++ b/tests/ui/traits/new-solver/object-soundness-requires-generalization.rs
@@ -0,0 +1,20 @@
+// compile-flags: -Ztrait-solver=next
+// ignore-test
+
+trait Trait {
+ type Gat<'lt>;
+}
+impl Trait for u8 {
+ type Gat<'lt> = u8;
+}
+
+fn test<T: Trait, F: FnOnce(<T as Trait>::Gat<'_>) -> S + ?Sized, S>() {}
+
+fn main() {
+ // Proving `dyn FnOnce: FnOnce` requires making sure that all of the supertraits
+ // of the trait and associated type bounds hold. We check this in
+ // `predicates_for_object_candidate`, and eagerly replace projections using equality
+ // which may generalize a type and emit a nested AliasRelate goal. Make sure that
+ // we don't ICE in that case, and bubble that goal up to the caller.
+ test::<u8, dyn FnOnce(<u8 as Trait>::Gat<'_>) + 'static, _>();
+}
diff --git a/tests/ui/traits/new-solver/exponential-trait-goals.rs b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
index b37f09ee1..b37f09ee1 100644
--- a/tests/ui/traits/new-solver/exponential-trait-goals.rs
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
diff --git a/tests/ui/traits/new-solver/exponential-trait-goals.stderr b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
index 28a99cbbc..28a99cbbc 100644
--- a/tests/ui/traits/new-solver/exponential-trait-goals.stderr
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
diff --git a/tests/ui/traits/new-solver/overflow/global-cache.rs b/tests/ui/traits/new-solver/overflow/global-cache.rs
new file mode 100644
index 000000000..adc03da04
--- /dev/null
+++ b/tests/ui/traits/new-solver/overflow/global-cache.rs
@@ -0,0 +1,23 @@
+// compile-flags: -Ztrait-solver=next
+
+// Check that we consider the reached depth of global cache
+// entries when detecting overflow. We would otherwise be unstable
+// wrt to incremental compilation.
+#![recursion_limit = "9"]
+
+trait Trait {}
+
+struct Inc<T>(T);
+
+impl<T: Trait> Trait for Inc<T> {}
+impl Trait for () {}
+
+fn impls_trait<T: Trait>() {}
+
+type Four<T> = Inc<Inc<Inc<Inc<T>>>>;
+
+fn main() {
+ impls_trait::<Four<Four<()>>>();
+ impls_trait::<Four<Four<Four<Four<()>>>>>();
+ //~^ ERROR overflow evaluating the requirement
+}
diff --git a/tests/ui/traits/new-solver/overflow/global-cache.stderr b/tests/ui/traits/new-solver/overflow/global-cache.stderr
new file mode 100644
index 000000000..f3b86a083
--- /dev/null
+++ b/tests/ui/traits/new-solver/overflow/global-cache.stderr
@@ -0,0 +1,16 @@
+error[E0275]: overflow evaluating the requirement `Inc<Inc<Inc<Inc<Inc<Inc<Inc<...>>>>>>>: Trait`
+ --> $DIR/global-cache.rs:21:5
+ |
+LL | impls_trait::<Four<Four<Four<Four<()>>>>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "18"]` attribute to your crate (`global_cache`)
+note: required by a bound in `impls_trait`
+ --> $DIR/global-cache.rs:15:19
+ |
+LL | fn impls_trait<T: Trait>() {}
+ | ^^^^^ required by this bound in `impls_trait`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/recursive-self-normalization-2.rs b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.rs
index d086db475..d086db475 100644
--- a/tests/ui/traits/new-solver/recursive-self-normalization-2.rs
+++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.rs
diff --git a/tests/ui/traits/new-solver/recursive-self-normalization-2.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr
index eebaf21d7..eebaf21d7 100644
--- a/tests/ui/traits/new-solver/recursive-self-normalization-2.stderr
+++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr
diff --git a/tests/ui/traits/new-solver/recursive-self-normalization.rs b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs
index d15df7dea..d15df7dea 100644
--- a/tests/ui/traits/new-solver/recursive-self-normalization.rs
+++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs
diff --git a/tests/ui/traits/new-solver/recursive-self-normalization.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr
index 6a87fe2f1..6a87fe2f1 100644
--- a/tests/ui/traits/new-solver/recursive-self-normalization.stderr
+++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr
diff --git a/tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs b/tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs
new file mode 100644
index 000000000..43cd773bf
--- /dev/null
+++ b/tests/ui/traits/new-solver/trait-upcast-lhs-needs-normalization.rs
@@ -0,0 +1,20 @@
+// check-pass
+// compile-flags: -Ztrait-solver=next
+
+#![feature(trait_upcasting)]
+
+pub trait A {}
+pub trait B: A {}
+
+pub trait Mirror {
+ type Assoc: ?Sized;
+}
+impl<T: ?Sized> Mirror for T {
+ type Assoc = T;
+}
+
+pub fn foo<'a>(x: &'a <dyn B + 'static as Mirror>::Assoc) -> &'a (dyn A + 'static) {
+ x
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/unsize-although-ambiguous.rs b/tests/ui/traits/new-solver/unsize-although-ambiguous.rs
new file mode 100644
index 000000000..431988a5f
--- /dev/null
+++ b/tests/ui/traits/new-solver/unsize-although-ambiguous.rs
@@ -0,0 +1,13 @@
+// check-pass
+// compile-flags: -Ztrait-solver=next
+
+use std::fmt::Display;
+
+fn box_dyn_display(_: Box<dyn Display>) {}
+
+fn main() {
+ // During coercion, we don't necessarily know whether `{integer}` implements
+ // `Display`. Before, that would cause us to bail out in the coercion loop when
+ // checking `{integer}: Unsize<dyn Display>`.
+ box_dyn_display(Box::new(1));
+}
diff --git a/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.rs b/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.rs
new file mode 100644
index 000000000..ba55ab071
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+#![feature(non_lifetime_binders)]
+//~^ WARN is incomplete and may not be safe
+
+pub fn foo()
+where
+ for<V> V: Sized,
+{
+ bar();
+}
+
+pub fn bar()
+where
+ for<V> V: Sized,
+{
+}
+
+pub fn main() {}
diff --git a/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.stderr b/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.stderr
new file mode 100644
index 000000000..e75d81270
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/sized-late-bound-issue-114872.rs:3:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/object/print_vtable_sizes.rs b/tests/ui/traits/object/print_vtable_sizes.rs
index 565609499..f51060853 100644
--- a/tests/ui/traits/object/print_vtable_sizes.rs
+++ b/tests/ui/traits/object/print_vtable_sizes.rs
@@ -10,8 +10,9 @@ trait C {
fn x() {} // not object safe, shouldn't be reported
}
-// This ideally should not have any upcasting cost,
-// but currently does due to a bug
+// This does not have any upcasting cost,
+// because both `Send` and `Sync` are traits
+// with no methods
trait D: Send + Sync + help::MarkerWithSuper {}
// This can't have no cost without reordering,
diff --git a/tests/ui/traits/object/print_vtable_sizes.stdout b/tests/ui/traits/object/print_vtable_sizes.stdout
index 3ba650bc3..ce90c7621 100644
--- a/tests/ui/traits/object/print_vtable_sizes.stdout
+++ b/tests/ui/traits/object/print_vtable_sizes.stdout
@@ -1,8 +1,8 @@
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "D", "entries": "7", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "3", "upcasting_cost_percent": "75" }
print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "E", "entries": "6", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "2", "upcasting_cost_percent": "50" }
print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "G", "entries": "14", "entries_ignoring_upcasting": "11", "entries_for_upcasting": "3", "upcasting_cost_percent": "27.27272727272727" }
print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "A", "entries": "6", "entries_ignoring_upcasting": "5", "entries_for_upcasting": "1", "upcasting_cost_percent": "20" }
print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "B", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "D", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "F", "entries": "6", "entries_ignoring_upcasting": "6", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs
index d37943b92..206ab0789 100644
--- a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs
+++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs
@@ -1,4 +1,3 @@
-//~ ERROR overflow
// A regression test for #111729 checking that we correctly
// track recursion depth for obligations returned by confirmation.
use std::panic::RefUnwindSafe;
@@ -15,6 +14,7 @@ struct RootDatabase {
}
impl<T: RefUnwindSafe> Database for T {
+ //~^ ERROR overflow
type Storage = SalsaStorage;
}
impl Database for RootDatabase {
diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr
index 8f9ce3ef1..4123a8199 100644
--- a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr
+++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr
@@ -1,13 +1,17 @@
error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: RefUnwindSafe`
+ --> $DIR/cycle-via-builtin-auto-trait-impl.rs:16:9
+ |
+LL | impl<T: RefUnwindSafe> Database for T {
+ | ^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`cycle_via_builtin_auto_trait_impl`)
note: required because it appears within the type `RootDatabase`
- --> $DIR/cycle-via-builtin-auto-trait-impl.rs:13:8
+ --> $DIR/cycle-via-builtin-auto-trait-impl.rs:12:8
|
LL | struct RootDatabase {
| ^^^^^^^^^^^^
note: required for `RootDatabase` to implement `Database`
- --> $DIR/cycle-via-builtin-auto-trait-impl.rs:17:24
+ --> $DIR/cycle-via-builtin-auto-trait-impl.rs:16:24
|
LL | impl<T: RefUnwindSafe> Database for T {
| ------------- ^^^^^^^^ ^
diff --git a/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr b/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr
index ca98e1831..62c732fb1 100644
--- a/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr
+++ b/tests/ui/traits/trait-upcasting/cyclic-trait-resolution.stderr
@@ -10,6 +10,7 @@ note: cycle used when collecting item types in top-level module
|
LL | trait A: B + A {}
| ^^^^^^^^^^^^^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/traits/trait-upcasting/fewer-associated.rs b/tests/ui/traits/trait-upcasting/fewer-associated.rs
new file mode 100644
index 000000000..8228eea26
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/fewer-associated.rs
@@ -0,0 +1,25 @@
+// check-pass
+// issue: 114035
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+#![feature(trait_upcasting)]
+
+trait A: B {
+ type Assoc;
+}
+
+trait B {}
+
+fn upcast(a: &dyn A<Assoc = i32>) -> &dyn B {
+ a
+}
+
+// Make sure that we can drop the existential projection `A::Assoc = i32`
+// when upcasting `dyn A<Assoc = i32>` to `dyn B`. Before, we used some
+// complicated algorithm which required rebuilding a new object type with
+// different bounds in order to test that an upcast was valid, but this
+// didn't allow upcasting to t that have fewer associated types
+// than the source type.
+
+fn main() {}
diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.current.stderr b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.current.stderr
new file mode 100644
index 000000000..59c9d5737
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.current.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+ --> $DIR/illegal-upcast-from-impl.rs:16:66
+ |
+LL | fn illegal(x: &dyn Sub<Assoc = ()>) -> &dyn Super<Assoc = i32> { x }
+ | ----------------------- ^ expected trait `Super`, found trait `Sub`
+ | |
+ | expected `&dyn Super<Assoc = i32>` because of return type
+ |
+ = note: expected reference `&dyn Super<Assoc = i32>`
+ found reference `&dyn Sub<Assoc = ()>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.next.stderr b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.next.stderr
new file mode 100644
index 000000000..59c9d5737
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.next.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+ --> $DIR/illegal-upcast-from-impl.rs:16:66
+ |
+LL | fn illegal(x: &dyn Sub<Assoc = ()>) -> &dyn Super<Assoc = i32> { x }
+ | ----------------------- ^ expected trait `Super`, found trait `Sub`
+ | |
+ | expected `&dyn Super<Assoc = i32>` because of return type
+ |
+ = note: expected reference `&dyn Super<Assoc = i32>`
+ found reference `&dyn Sub<Assoc = ()>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs
new file mode 100644
index 000000000..774474281
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs
@@ -0,0 +1,23 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+#![feature(trait_upcasting)]
+
+trait Super {
+ type Assoc;
+}
+
+trait Sub: Super {}
+
+impl<T: ?Sized> Super for T {
+ type Assoc = i32;
+}
+
+fn illegal(x: &dyn Sub<Assoc = ()>) -> &dyn Super<Assoc = i32> { x }
+//~^ ERROR mismatched types
+
+// Want to make sure that we can't "upcast" to a supertrait that has a different
+// associated type that is instead provided by a blanket impl (and doesn't come
+// from the object bounds).
+
+fn main() {}
diff --git a/tests/ui/issues/issue-11515.stderr b/tests/ui/traits/trait-upcasting/issue-11515.current.stderr
index accd47f0f..97d66cccb 100644
--- a/tests/ui/issues/issue-11515.stderr
+++ b/tests/ui/traits/trait-upcasting/issue-11515.current.stderr
@@ -1,5 +1,5 @@
error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental
- --> $DIR/issue-11515.rs:9:38
+ --> $DIR/issue-11515.rs:10:38
|
LL | let test = Box::new(Test { func: closure });
| ^^^^^^^
diff --git a/tests/ui/traits/trait-upcasting/issue-11515.next.stderr b/tests/ui/traits/trait-upcasting/issue-11515.next.stderr
new file mode 100644
index 000000000..97d66cccb
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/issue-11515.next.stderr
@@ -0,0 +1,13 @@
+error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental
+ --> $DIR/issue-11515.rs:10:38
+ |
+LL | let test = Box::new(Test { func: closure });
+ | ^^^^^^^
+ |
+ = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information
+ = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable
+ = note: required when coercing `Box<(dyn Fn() + 'static)>` into `Box<(dyn FnMut() + 'static)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/issues/issue-11515.rs b/tests/ui/traits/trait-upcasting/issue-11515.rs
index b5c942f96..723f3a24f 100644
--- a/tests/ui/issues/issue-11515.rs
+++ b/tests/ui/traits/trait-upcasting/issue-11515.rs
@@ -1,9 +1,10 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
struct Test {
func: Box<dyn FnMut() + 'static>,
}
-
-
fn main() {
let closure: Box<dyn Fn() + 'static> = Box::new(|| ());
let test = Box::new(Test { func: closure }); //~ ERROR trait upcasting coercion is experimental [E0658]
diff --git a/tests/ui/traits/trait-upcasting/normalization.rs b/tests/ui/traits/trait-upcasting/normalization.rs
new file mode 100644
index 000000000..c78338b0d
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/normalization.rs
@@ -0,0 +1,20 @@
+// check-pass
+// issue: 114113
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+#![feature(trait_upcasting)]
+
+trait Mirror {
+ type Assoc;
+}
+impl<T> Mirror for T {
+ type Assoc = T;
+}
+
+trait Bar<T> {}
+trait Foo<T>: Bar<<T as Mirror>::Assoc> {}
+
+fn upcast<T>(x: &dyn Foo<T>) -> &dyn Bar<T> { x }
+
+fn main() {}
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-1.current.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-1.current.stderr
new file mode 100644
index 000000000..b612005fc
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-1.current.stderr
@@ -0,0 +1,9 @@
+error[E0605]: non-primitive cast: `&dyn Foo` as `&dyn Bar<_>`
+ --> $DIR/type-checking-test-1.rs:19:13
+ |
+LL | let _ = x as &dyn Bar<_>; // Ambiguous
+ | ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-1.next.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-1.next.stderr
new file mode 100644
index 000000000..b612005fc
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-1.next.stderr
@@ -0,0 +1,9 @@
+error[E0605]: non-primitive cast: `&dyn Foo` as `&dyn Bar<_>`
+ --> $DIR/type-checking-test-1.rs:19:13
+ |
+LL | let _ = x as &dyn Bar<_>; // Ambiguous
+ | ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-1.rs b/tests/ui/traits/trait-upcasting/type-checking-test-1.rs
index 6bc9f4a75..afea8521e 100644
--- a/tests/ui/traits/trait-upcasting/type-checking-test-1.rs
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-1.rs
@@ -1,3 +1,6 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
#![feature(trait_upcasting)]
trait Foo: Bar<i32> + Bar<u32> {}
@@ -15,7 +18,6 @@ fn test_specific(x: &dyn Foo) {
fn test_unknown_version(x: &dyn Foo) {
let _ = x as &dyn Bar<_>; // Ambiguous
//~^ ERROR non-primitive cast
- //~^^ ERROR the trait bound `&dyn Foo: Bar<_>` is not satisfied
}
fn test_infer_version(x: &dyn Foo) {
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-1.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-1.stderr
deleted file mode 100644
index 82b4e9bd7..000000000
--- a/tests/ui/traits/trait-upcasting/type-checking-test-1.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error[E0605]: non-primitive cast: `&dyn Foo` as `&dyn Bar<_>`
- --> $DIR/type-checking-test-1.rs:16:13
- |
-LL | let _ = x as &dyn Bar<_>; // Ambiguous
- | ^^^^^^^^^^^^^^^^ invalid cast
- |
-help: consider borrowing the value
- |
-LL | let _ = &x as &dyn Bar<_>; // Ambiguous
- | +
-
-error[E0277]: the trait bound `&dyn Foo: Bar<_>` is not satisfied
- --> $DIR/type-checking-test-1.rs:16:13
- |
-LL | let _ = x as &dyn Bar<_>; // Ambiguous
- | ^ the trait `Bar<_>` is not implemented for `&dyn Foo`
- |
- = note: required for the cast from `&&dyn Foo` to `&dyn Bar<_>`
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0277, E0605.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-2.rs b/tests/ui/traits/trait-upcasting/type-checking-test-2.rs
index 36b11dffd..b024b2775 100644
--- a/tests/ui/traits/trait-upcasting/type-checking-test-2.rs
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-2.rs
@@ -18,13 +18,11 @@ fn test_specific2(x: &dyn Foo<u32>) {
fn test_specific3(x: &dyn Foo<i32>) {
let _ = x as &dyn Bar<u32>; // Error
//~^ ERROR non-primitive cast
- //~^^ ERROR the trait bound `&dyn Foo<i32>: Bar<u32>` is not satisfied
}
fn test_infer_arg(x: &dyn Foo<u32>) {
let a = x as &dyn Bar<_>; // Ambiguous
//~^ ERROR non-primitive cast
- //~^^ ERROR the trait bound `&dyn Foo<u32>: Bar<_>` is not satisfied
let _ = a.bar();
}
diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr
index 856303ef4..3e59b9d33 100644
--- a/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr
+++ b/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr
@@ -2,41 +2,14 @@ error[E0605]: non-primitive cast: `&dyn Foo<i32>` as `&dyn Bar<u32>`
--> $DIR/type-checking-test-2.rs:19:13
|
LL | let _ = x as &dyn Bar<u32>; // Error
- | ^^^^^^^^^^^^^^^^^^ invalid cast
- |
-help: consider borrowing the value
- |
-LL | let _ = &x as &dyn Bar<u32>; // Error
- | +
-
-error[E0277]: the trait bound `&dyn Foo<i32>: Bar<u32>` is not satisfied
- --> $DIR/type-checking-test-2.rs:19:13
- |
-LL | let _ = x as &dyn Bar<u32>; // Error
- | ^ the trait `Bar<u32>` is not implemented for `&dyn Foo<i32>`
- |
- = note: required for the cast from `&&dyn Foo<i32>` to `&dyn Bar<u32>`
+ | ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
error[E0605]: non-primitive cast: `&dyn Foo<u32>` as `&dyn Bar<_>`
- --> $DIR/type-checking-test-2.rs:25:13
+ --> $DIR/type-checking-test-2.rs:24:13
|
LL | let a = x as &dyn Bar<_>; // Ambiguous
- | ^^^^^^^^^^^^^^^^ invalid cast
- |
-help: consider borrowing the value
- |
-LL | let a = &x as &dyn Bar<_>; // Ambiguous
- | +
-
-error[E0277]: the trait bound `&dyn Foo<u32>: Bar<_>` is not satisfied
- --> $DIR/type-checking-test-2.rs:25:13
- |
-LL | let a = x as &dyn Bar<_>; // Ambiguous
- | ^ the trait `Bar<_>` is not implemented for `&dyn Foo<u32>`
- |
- = note: required for the cast from `&&dyn Foo<u32>` to `&dyn Bar<_>`
+ | ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0277, E0605.
-For more information about an error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0605`.
diff --git a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.current.stderr b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.current.stderr
new file mode 100644
index 000000000..9f0993d65
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.current.stderr
@@ -0,0 +1,13 @@
+error[E0658]: cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental
+ --> $DIR/upcast-through-struct-tail.rs:10:5
+ |
+LL | x
+ | ^
+ |
+ = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information
+ = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable
+ = note: required when coercing `Box<Wrapper<(dyn A + 'a)>>` into `Box<Wrapper<(dyn B + 'a)>>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.next.stderr b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.next.stderr
new file mode 100644
index 000000000..9f0993d65
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.next.stderr
@@ -0,0 +1,13 @@
+error[E0658]: cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental
+ --> $DIR/upcast-through-struct-tail.rs:10:5
+ |
+LL | x
+ | ^
+ |
+ = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information
+ = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable
+ = note: required when coercing `Box<Wrapper<(dyn A + 'a)>>` into `Box<Wrapper<(dyn B + 'a)>>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs
new file mode 100644
index 000000000..42495f45f
--- /dev/null
+++ b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs
@@ -0,0 +1,14 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+
+struct Wrapper<T: ?Sized>(T);
+
+trait A: B {}
+trait B {}
+
+fn test<'a>(x: Box<Wrapper<dyn A + 'a>>) -> Box<Wrapper<dyn B + 'a>> {
+ x
+ //~^ ERROR cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental
+}
+
+fn main() {}
diff --git a/tests/ui/traits/vtable/multiple-markers.rs b/tests/ui/traits/vtable/multiple-markers.rs
new file mode 100644
index 000000000..1e6e30870
--- /dev/null
+++ b/tests/ui/traits/vtable/multiple-markers.rs
@@ -0,0 +1,47 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/113840>
+//
+// This test makes sure that multiple marker (method-less) traits can reuse the
+// same pointer for upcasting.
+//
+// build-fail
+#![crate_type = "lib"]
+#![feature(rustc_attrs)]
+
+// Markers
+trait M0 {}
+trait M1 {}
+trait M2 {}
+
+// Just a trait with a method
+trait T {
+ fn method(&self) {}
+}
+
+#[rustc_dump_vtable]
+trait A: M0 + M1 + M2 + T {} //~ error: vtable entries for `<S as A>`:
+
+#[rustc_dump_vtable]
+trait B: M0 + M1 + T + M2 {} //~ error: vtable entries for `<S as B>`:
+
+#[rustc_dump_vtable]
+trait C: M0 + T + M1 + M2 {} //~ error: vtable entries for `<S as C>`:
+
+#[rustc_dump_vtable]
+trait D: T + M0 + M1 + M2 {} //~ error: vtable entries for `<S as D>`:
+
+struct S;
+
+impl M0 for S {}
+impl M1 for S {}
+impl M2 for S {}
+impl T for S {}
+impl A for S {}
+impl B for S {}
+impl C for S {}
+impl D for S {}
+
+pub fn require_vtables() {
+ fn require_vtables(_: &dyn A, _: &dyn B, _: &dyn C, _: &dyn D) {}
+
+ require_vtables(&S, &S, &S, &S)
+}
diff --git a/tests/ui/traits/vtable/multiple-markers.stderr b/tests/ui/traits/vtable/multiple-markers.stderr
new file mode 100644
index 000000000..4497c703a
--- /dev/null
+++ b/tests/ui/traits/vtable/multiple-markers.stderr
@@ -0,0 +1,52 @@
+error: vtable entries for `<S as A>`: [
+ MetadataDropInPlace,
+ MetadataSize,
+ MetadataAlign,
+ Method(<S as T>::method),
+ ]
+ --> $DIR/multiple-markers.rs:21:1
+ |
+LL | trait A: M0 + M1 + M2 + T {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: vtable entries for `<S as B>`: [
+ MetadataDropInPlace,
+ MetadataSize,
+ MetadataAlign,
+ Method(<S as T>::method),
+ TraitVPtr(<S as M2>),
+ ]
+ --> $DIR/multiple-markers.rs:24:1
+ |
+LL | trait B: M0 + M1 + T + M2 {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: vtable entries for `<S as C>`: [
+ MetadataDropInPlace,
+ MetadataSize,
+ MetadataAlign,
+ Method(<S as T>::method),
+ TraitVPtr(<S as M1>),
+ TraitVPtr(<S as M2>),
+ ]
+ --> $DIR/multiple-markers.rs:27:1
+ |
+LL | trait C: M0 + T + M1 + M2 {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: vtable entries for `<S as D>`: [
+ MetadataDropInPlace,
+ MetadataSize,
+ MetadataAlign,
+ Method(<S as T>::method),
+ TraitVPtr(<S as M0>),
+ TraitVPtr(<S as M1>),
+ TraitVPtr(<S as M2>),
+ ]
+ --> $DIR/multiple-markers.rs:30:1
+ |
+LL | trait D: T + M0 + M1 + M2 {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/transmutability/issue-110892.rs b/tests/ui/transmutability/issue-110892.rs
new file mode 100644
index 000000000..ce926b399
--- /dev/null
+++ b/tests/ui/transmutability/issue-110892.rs
@@ -0,0 +1,40 @@
+// check-fail
+#![feature(generic_const_exprs, transmutability)]
+#![allow(incomplete_features)]
+
+mod assert {
+ use std::mem::{Assume, BikeshedIntrinsicFrom};
+
+ pub fn is_transmutable<
+ Src,
+ Dst,
+ Context,
+ const ASSUME_ALIGNMENT: bool,
+ const ASSUME_LIFETIMES: bool,
+ const ASSUME_SAFETY: bool,
+ const ASSUME_VALIDITY: bool,
+ >()
+ where
+ Dst: BikeshedIntrinsicFrom<
+ Src,
+ Context,
+ { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) }
+ >,
+ {}
+
+ // This should not cause an ICE
+ const fn from_options(
+ , //~ ERROR expected parameter name, found `,`
+ , //~ ERROR expected parameter name, found `,`
+ , //~ ERROR expected parameter name, found `,`
+ , //~ ERROR expected parameter name, found `,`
+ ) -> Assume {} //~ ERROR mismatched types
+}
+
+fn main() {
+ struct Context;
+ #[repr(C)] struct Src;
+ #[repr(C)] struct Dst;
+
+ assert::is_transmutable::<Src, Dst, Context, false, false, { true }, false>();
+}
diff --git a/tests/ui/transmutability/issue-110892.stderr b/tests/ui/transmutability/issue-110892.stderr
new file mode 100644
index 000000000..13654307a
--- /dev/null
+++ b/tests/ui/transmutability/issue-110892.stderr
@@ -0,0 +1,36 @@
+error: expected parameter name, found `,`
+ --> $DIR/issue-110892.rs:27:9
+ |
+LL | ,
+ | ^ expected parameter name
+
+error: expected parameter name, found `,`
+ --> $DIR/issue-110892.rs:28:9
+ |
+LL | ,
+ | ^ expected parameter name
+
+error: expected parameter name, found `,`
+ --> $DIR/issue-110892.rs:29:9
+ |
+LL | ,
+ | ^ expected parameter name
+
+error: expected parameter name, found `,`
+ --> $DIR/issue-110892.rs:30:9
+ |
+LL | ,
+ | ^ expected parameter name
+
+error[E0308]: mismatched types
+ --> $DIR/issue-110892.rs:31:10
+ |
+LL | const fn from_options(
+ | ------------ implicitly returns `()` as its body has no tail or `return` expression
+...
+LL | ) -> Assume {}
+ | ^^^^^^ expected `Assume`, found `()`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs
index 3ea80173a..709d8cdc7 100644
--- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs
+++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs
@@ -1,5 +1,4 @@
-// check-fail
-// FIXME(bryangarza): Change to check-pass when coinduction is supported for BikeshedIntrinsicFrom
+// check-pass
#![feature(transmutability)]
mod assert {
@@ -22,5 +21,5 @@ mod assert {
fn main() {
#[repr(C)] struct A(bool, &'static A);
#[repr(C)] struct B(u8, &'static B);
- assert::is_maybe_transmutable::<&'static A, &'static B>(); //~ ERROR overflow evaluating the requirement
+ assert::is_maybe_transmutable::<&'static A, &'static B>();
}
diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.stderr b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.stderr
deleted file mode 100644
index fae332e6a..000000000
--- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0275]: overflow evaluating the requirement `B: BikeshedIntrinsicFrom<A, assert::Context, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>`
- --> $DIR/recursive-wrapper-types-bit-compatible.rs:25:5
- |
-LL | assert::is_maybe_transmutable::<&'static A, &'static B>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: required by a bound in `is_maybe_transmutable`
- --> $DIR/recursive-wrapper-types-bit-compatible.rs:11:14
- |
-LL | pub fn is_maybe_transmutable<Src, Dst>()
- | --------------------- required by a bound in this function
-LL | where
-LL | Dst: BikeshedIntrinsicFrom<Src, Context, {
- | ______________^
-LL | | Assume {
-LL | | alignment: true,
-LL | | lifetimes: false,
-... |
-LL | | }
-LL | | }>
- | |__________^ required by this bound in `is_maybe_transmutable`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/transmutability/references/recursive-wrapper-types.rs b/tests/ui/transmutability/references/recursive-wrapper-types.rs
index 59d1ad84a..090c1fea6 100644
--- a/tests/ui/transmutability/references/recursive-wrapper-types.rs
+++ b/tests/ui/transmutability/references/recursive-wrapper-types.rs
@@ -1,5 +1,4 @@
-// check-fail
-// FIXME(bryangarza): Change to check-pass when coinduction is supported for BikeshedIntrinsicFrom
+// check-pass
#![feature(transmutability)]
mod assert {
@@ -22,6 +21,6 @@ mod assert {
fn main() {
#[repr(C)] struct A(&'static B);
#[repr(C)] struct B(&'static A);
- assert::is_maybe_transmutable::<&'static A, &'static B>(); //~ overflow evaluating the requirement
+ assert::is_maybe_transmutable::<&'static A, &'static B>();
assert::is_maybe_transmutable::<&'static B, &'static A>();
}
diff --git a/tests/ui/transmutability/references/recursive-wrapper-types.stderr b/tests/ui/transmutability/references/recursive-wrapper-types.stderr
deleted file mode 100644
index 35a60c226..000000000
--- a/tests/ui/transmutability/references/recursive-wrapper-types.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-error[E0275]: overflow evaluating the requirement `A: BikeshedIntrinsicFrom<B, assert::Context, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>`
- --> $DIR/recursive-wrapper-types.rs:25:5
- |
-LL | assert::is_maybe_transmutable::<&'static A, &'static B>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: required by a bound in `is_maybe_transmutable`
- --> $DIR/recursive-wrapper-types.rs:11:14
- |
-LL | pub fn is_maybe_transmutable<Src, Dst>()
- | --------------------- required by a bound in this function
-LL | where
-LL | Dst: BikeshedIntrinsicFrom<Src, Context, {
- | ______________^
-LL | | Assume {
-LL | | alignment: true,
-LL | | lifetimes: false,
-... |
-LL | | }
-LL | | }>
- | |__________^ required by this bound in `is_maybe_transmutable`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/treat-err-as-bug/delay_span_bug.rs b/tests/ui/treat-err-as-bug/delay_span_bug.rs
index 832afddf8..533c8d1ec 100644
--- a/tests/ui/treat-err-as-bug/delay_span_bug.rs
+++ b/tests/ui/treat-err-as-bug/delay_span_bug.rs
@@ -3,7 +3,7 @@
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
// error-pattern: [trigger_delay_span_bug] triggering a delay span bug
// normalize-stderr-test "note: .*\n\n" -> ""
-// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
+// normalize-stderr-test "thread 'rustc' panicked.*:\n.*\n" -> ""
// rustc-env:RUST_BACKTRACE=0
#![feature(rustc_attrs)]
diff --git a/tests/ui/treat-err-as-bug/err.rs b/tests/ui/treat-err-as-bug/err.rs
index de3e9ed6c..4090a706f 100644
--- a/tests/ui/treat-err-as-bug/err.rs
+++ b/tests/ui/treat-err-as-bug/err.rs
@@ -3,7 +3,7 @@
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
// error-pattern: [eval_to_allocation_raw] const-evaluating + checking `C`
// normalize-stderr-test "note: .*\n\n" -> ""
-// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
+// normalize-stderr-test "thread 'rustc' panicked.*:\n.*\n" -> ""
// rustc-env:RUST_BACKTRACE=0
#![crate_type = "rlib"]
diff --git a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr
index c943a4918..aa79b1a57 100644
--- a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr
+++ b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr
@@ -67,6 +67,7 @@ LL | | V2 = Self::V1 as u8 + 1, // OK; See #50072.
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
index dd56c59bf..5bd0f76c3 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
@@ -16,6 +16,7 @@ note: cycle used when checking item types in module `m`
|
LL | mod m {
| ^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
--> $DIR/auto-trait-leakage3.rs:7:20
@@ -34,6 +35,7 @@ note: cycle used when checking item types in module `m`
|
LL | mod m {
| ^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `auto_trait_leakage3[211d]::m::Foo::{opaque#0}` satisfies auto traits
--> $DIR/auto-trait-leakage3.rs:16:17
diff --git a/tests/ui/type-alias-impl-trait/broken_mir.rs b/tests/ui/type-alias-impl-trait/broken_mir.rs
new file mode 100644
index 000000000..b68e798fb
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/broken_mir.rs
@@ -0,0 +1,16 @@
+//! ICE: https://github.com/rust-lang/rust/issues/114121
+//! This test checks that MIR validation never constrains
+//! new hidden types that *differ* from the actual hidden types.
+//! This test used to ICE because oli-obk assumed mir validation
+//! was only ever run after opaque types were revealed in MIR.
+
+// compile-flags: -Zvalidate-mir
+// check-pass
+
+fn main() {
+ let _ = Some(()).into_iter().flat_map(|_| Some(()).into_iter().flat_map(func));
+}
+
+fn func(_: ()) -> impl Iterator<Item = ()> {
+ Some(()).into_iter().flat_map(|_| vec![])
+}
diff --git a/tests/ui/type-alias-impl-trait/coherence.rs b/tests/ui/type-alias-impl-trait/coherence.rs
index 077a31494..1700c800e 100644
--- a/tests/ui/type-alias-impl-trait/coherence.rs
+++ b/tests/ui/type-alias-impl-trait/coherence.rs
@@ -11,7 +11,7 @@ fn use_alias<T>(val: T) -> AliasOfForeignType<T> {
foreign_crate::ForeignType(val)
}
-impl<T> foreign_crate::ForeignTrait for AliasOfForeignType<T> {}
+impl foreign_crate::ForeignTrait for AliasOfForeignType<()> {}
//~^ ERROR only traits defined in the current crate can be implemented for arbitrary types
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/coherence.stderr b/tests/ui/type-alias-impl-trait/coherence.stderr
index c923eb08a..36bbb985e 100644
--- a/tests/ui/type-alias-impl-trait/coherence.stderr
+++ b/tests/ui/type-alias-impl-trait/coherence.stderr
@@ -1,10 +1,10 @@
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> $DIR/coherence.rs:14:1
|
-LL | impl<T> foreign_crate::ForeignTrait for AliasOfForeignType<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------
- | | |
- | | `AliasOfForeignType<T>` is not defined in the current crate
+LL | impl foreign_crate::ForeignTrait for AliasOfForeignType<()> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------
+ | | |
+ | | `AliasOfForeignType<()>` is not defined in the current crate
| impl doesn't use only types from inside the current crate
|
= note: define and implement a trait or new type instead
diff --git a/tests/ui/type-alias-impl-trait/coherence_generalization.rs b/tests/ui/type-alias-impl-trait/coherence_generalization.rs
index 679b2b0f1..1ec8877ea 100644
--- a/tests/ui/type-alias-impl-trait/coherence_generalization.rs
+++ b/tests/ui/type-alias-impl-trait/coherence_generalization.rs
@@ -2,6 +2,7 @@
// FIXME(type_alias_impl_trait): What does this test? This needs a comment
// explaining what we're worried about here.
+
#![feature(type_alias_impl_trait)]
trait Trait {}
type Opaque<T> = impl Sized;
@@ -9,7 +10,7 @@ fn foo<T>() -> Opaque<T> {
()
}
-impl<T, V> Trait for (T, V, V, u32) {}
-impl<U, V> Trait for (Opaque<U>, V, i32, V) {}
+impl<T, U, V> Trait for (T, U, V, V, u32) {}
+impl<U, V> Trait for (Opaque<U>, U, V, i32, V) {}
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.rs b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.rs
new file mode 100644
index 000000000..12ce6b14e
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.rs
@@ -0,0 +1,57 @@
+//! This test checks that we don't lose hidden types
+//! for *other* opaque types that we register and use
+//! to prove bounds while checking that a hidden type
+//! satisfies its opaque type's bounds.
+
+#![feature(trivial_bounds, type_alias_impl_trait)]
+#![allow(trivial_bounds)]
+
+mod sus {
+ use super::*;
+ pub type Sep = impl Sized + std::fmt::Display;
+ //~^ ERROR: concrete type differs from previous defining opaque type use
+ pub fn mk_sep() -> Sep {
+ String::from("hello")
+ }
+
+ pub trait Proj {
+ type Assoc;
+ }
+ impl Proj for () {
+ type Assoc = sus::Sep;
+ }
+
+ pub struct Bar<T: Proj> {
+ pub inner: <T as Proj>::Assoc,
+ pub _marker: T,
+ }
+ impl<T: Proj> Clone for Bar<T> {
+ fn clone(&self) -> Self {
+ todo!()
+ }
+ }
+ impl<T: Proj<Assoc = i32> + Copy> Copy for Bar<T> {}
+ // This allows producing `Tait`s via `From`, even though
+ // `define_tait` is not actually callable, and thus assumed
+ // `Bar<()>: Copy` even though it isn't.
+ pub type Tait = impl Copy + From<Bar<()>> + Into<Bar<()>>;
+ pub fn define_tait() -> Tait
+ where
+ // this proves `Bar<()>: Copy`, but `define_tait` is
+ // now uncallable
+ (): Proj<Assoc = i32>,
+ {
+ Bar { inner: 1i32, _marker: () }
+ }
+}
+
+fn copy_tait(x: sus::Tait) -> (sus::Tait, sus::Tait) {
+ (x, x)
+}
+
+fn main() {
+ let bar = sus::Bar { inner: sus::mk_sep(), _marker: () };
+ let (y, z) = copy_tait(bar.into()); // copy a string
+ drop(y.into()); // drop one instance
+ println!("{}", z.into().inner); // print the other
+}
diff --git a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr
new file mode 100644
index 000000000..85e8a600c
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr
@@ -0,0 +1,14 @@
+error: concrete type differs from previous defining opaque type use
+ --> $DIR/hidden_type_mismatch.rs:11:20
+ |
+LL | pub type Sep = impl Sized + std::fmt::Display;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, got `String`
+ |
+note: previous use here
+ --> $DIR/hidden_type_mismatch.rs:37:21
+ |
+LL | pub type Tait = impl Copy + From<Bar<()>> + Into<Bar<()>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.stderr b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
index 4d5f36747..41530dda9 100644
--- a/tests/ui/type-alias-impl-trait/inference-cycle.stderr
+++ b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
@@ -16,6 +16,7 @@ note: cycle used when checking item types in module `m`
|
LL | mod m {
| ^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}`
--> $DIR/inference-cycle.rs:5:20
@@ -34,6 +35,7 @@ note: cycle used when checking item types in module `m`
|
LL | mod m {
| ^^^^^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `inference_cycle[4ecc]::m::Foo::{opaque#0}` satisfies auto traits
--> $DIR/inference-cycle.rs:16:17
diff --git a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
index 2565a28b4..6148131b4 100644
--- a/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-53092-2.stderr
@@ -23,6 +23,7 @@ LL | | type Bug<T, U> = impl Fn(T) -> U + Copy;
LL | | CONST_BUG(0);
LL | | }
| |_^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0277]: the trait bound `U: From<T>` is not satisfied
--> $DIR/issue-53092-2.rs:9:5
diff --git a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
index 2c740ccc1..fdd8fa65b 100644
--- a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
+++ b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
@@ -1,5 +1,7 @@
#![feature(type_alias_impl_trait)]
// check-pass
+// revisions: default edition2021
+//[edition2021] compile-flags: --edition 2021
fn main() {
type T = impl Copy;
diff --git a/tests/ui/issues/issue-83190.rs b/tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs
index da931c3ed..11b659eec 100644
--- a/tests/ui/issues/issue-83190.rs
+++ b/tests/ui/type-alias-impl-trait/nested-rpit-with-lifetimes.rs
@@ -1,7 +1,7 @@
-// check-pass
-
// Regression test for issue #83190, triggering an ICE in borrowck.
+// check-pass
+
pub trait Any {}
impl<T> Any for T {}
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-hrtb.rs b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.rs
new file mode 100644
index 000000000..ba705d6f8
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.rs
@@ -0,0 +1,15 @@
+#![feature(type_alias_impl_trait)]
+
+trait Trait<'a> { type Assoc; }
+impl<'a> Trait<'a> for () { type Assoc = &'a str; }
+
+type WithoutLt = impl Sized;
+fn without_lt() -> impl for<'a> Trait<'a, Assoc = WithoutLt> {}
+//~^ ERROR captures lifetime that does not appear in bounds
+
+type WithLt<'a> = impl Sized + 'a;
+
+fn with_lt() -> impl for<'a> Trait<'a, Assoc = WithLt<'a>> {}
+//~^ ERROR expected generic lifetime parameter, found `'a`
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr
new file mode 100644
index 000000000..f20873055
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested-tait-hrtb.stderr
@@ -0,0 +1,23 @@
+error[E0700]: hidden type for `WithoutLt` captures lifetime that does not appear in bounds
+ --> $DIR/nested-tait-hrtb.rs:7:62
+ |
+LL | type WithoutLt = impl Sized;
+ | ---------- opaque type defined here
+LL | fn without_lt() -> impl for<'a> Trait<'a, Assoc = WithoutLt> {}
+ | -- ^^
+ | |
+ | hidden type `&'a str` captures the lifetime `'a` as defined here
+
+error[E0792]: expected generic lifetime parameter, found `'a`
+ --> $DIR/nested-tait-hrtb.rs:12:60
+ |
+LL | type WithLt<'a> = impl Sized + 'a;
+ | -- this generic parameter must be used with a generic lifetime parameter
+LL |
+LL | fn with_lt() -> impl for<'a> Trait<'a, Assoc = WithLt<'a>> {}
+ | ^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0700, E0792.
+For more information about an error, try `rustc --explain E0700`.
diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs
new file mode 100644
index 000000000..10588398c
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.rs
@@ -0,0 +1,21 @@
+// issue: 113314
+
+#![feature(type_alias_impl_trait)]
+
+type Op = impl std::fmt::Display;
+fn foo() -> Op { &"hello world" }
+
+fn transform<S>() -> impl std::fmt::Display {
+ &0usize
+}
+fn bad() -> Op {
+ transform::<Op>()
+ //~^ ERROR concrete type differs from previous defining opaque type use
+}
+
+fn main() {
+ let mut x = foo();
+ println!("{x}");
+ x = bad();
+ println!("{x}");
+}
diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr
new file mode 100644
index 000000000..7481557fc
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn-2.stderr
@@ -0,0 +1,14 @@
+error: concrete type differs from previous defining opaque type use
+ --> $DIR/recursive-tait-conflicting-defn-2.rs:12:5
+ |
+LL | transform::<Op>()
+ | ^^^^^^^^^^^^^^^^^ expected `&'static &'static str`, got `impl std::fmt::Display`
+ |
+note: previous use here
+ --> $DIR/recursive-tait-conflicting-defn-2.rs:6:18
+ |
+LL | fn foo() -> Op { &"hello world" }
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.rs b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.rs
new file mode 100644
index 000000000..e221f4f3f
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.rs
@@ -0,0 +1,34 @@
+// issue: 113596
+
+#![feature(type_alias_impl_trait)]
+
+trait Test {}
+
+struct A;
+
+impl Test for A {}
+
+struct B<T> {
+ inner: T,
+}
+
+impl<T: Test> Test for B<T> {}
+
+type TestImpl = impl Test;
+
+fn test() -> TestImpl {
+ A
+}
+
+fn make_option() -> Option<TestImpl> {
+ Some(test())
+}
+
+fn make_option2() -> Option<TestImpl> {
+ let inner = make_option().unwrap();
+
+ Some(B { inner })
+ //~^ ERROR concrete type differs from previous defining opaque type use
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr
new file mode 100644
index 000000000..e4209643b
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/recursive-tait-conflicting-defn.stderr
@@ -0,0 +1,14 @@
+error: concrete type differs from previous defining opaque type use
+ --> $DIR/recursive-tait-conflicting-defn.rs:30:3
+ |
+LL | Some(B { inner })
+ | ^^^^^^^^^^^^^^^^^ expected `A`, got `B<TestImpl>`
+ |
+note: previous use here
+ --> $DIR/recursive-tait-conflicting-defn.rs:20:3
+ |
+LL | A
+ | ^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/type-alias-impl-trait/reveal_local.stderr b/tests/ui/type-alias-impl-trait/reveal_local.stderr
index 0c5ef4a6f..813185c13 100644
--- a/tests/ui/type-alias-impl-trait/reveal_local.stderr
+++ b/tests/ui/type-alias-impl-trait/reveal_local.stderr
@@ -22,6 +22,7 @@ LL | |
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
--> $DIR/reveal_local.rs:5:12
@@ -46,6 +47,7 @@ LL | |
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
--> $DIR/reveal_local.rs:15:15
@@ -92,6 +94,7 @@ LL | |
LL | |
LL | | fn main() {}
| |____________^
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
--> $DIR/reveal_local.rs:25:15
diff --git a/tests/ui/type-alias-impl-trait/unconstrained-impl-param.rs b/tests/ui/type-alias-impl-trait/unconstrained-impl-param.rs
new file mode 100644
index 000000000..b35100670
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/unconstrained-impl-param.rs
@@ -0,0 +1,25 @@
+#![feature(type_alias_impl_trait)]
+
+use std::fmt::Display;
+
+type Opaque<X> = impl Sized + 'static;
+fn define<X>() -> Opaque<X> {}
+
+trait Trait {
+ type Assoc: Display;
+}
+impl<'a> Trait for Opaque<&'a str> {
+ //~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+ type Assoc = &'a str;
+}
+
+// ======= Exploit =======
+
+fn extend<T: Trait + 'static>(s: T::Assoc) -> Box<dyn Display> {
+ Box::new(s)
+}
+
+fn main() {
+ let val = extend::<Opaque<&'_ str>>(&String::from("blah blah blah"));
+ println!("{}", val);
+}
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.next.stderr b/tests/ui/type-alias-impl-trait/unconstrained-impl-param.stderr
index bf088ae8b..65139307f 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.next.stderr
+++ b/tests/ui/type-alias-impl-trait/unconstrained-impl-param.stderr
@@ -1,7 +1,7 @@
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
- --> $DIR/unconstrained-lt.rs:10:6
+ --> $DIR/unconstrained-impl-param.rs:11:6
|
-LL | impl<'a, T> Foo for T {
+LL | impl<'a> Trait for Opaque<&'a str> {
| ^^ unconstrained lifetime parameter
error: aborting due to previous error
diff --git a/tests/ui/type-alias-impl-trait/under-binder.rs b/tests/ui/type-alias-impl-trait/under-binder.rs
new file mode 100644
index 000000000..caf21d640
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/under-binder.rs
@@ -0,0 +1,9 @@
+#![feature(type_alias_impl_trait)]
+
+type Opaque<'a> = impl Sized + 'a;
+
+fn test(f: fn(u8)) -> fn(Opaque<'_>) {
+ f //~ ERROR E0792
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/under-binder.stderr b/tests/ui/type-alias-impl-trait/under-binder.stderr
new file mode 100644
index 000000000..82c4ec973
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/under-binder.stderr
@@ -0,0 +1,12 @@
+error[E0792]: expected generic lifetime parameter, found `'_`
+ --> $DIR/under-binder.rs:6:5
+ |
+LL | type Opaque<'a> = impl Sized + 'a;
+ | -- this generic parameter must be used with a generic lifetime parameter
+...
+LL | f
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/wf-check-rpit-lifetimes.rs b/tests/ui/type-alias-impl-trait/wf-check-rpit-lifetimes.rs
new file mode 100644
index 000000000..b92e15aad
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/wf-check-rpit-lifetimes.rs
@@ -0,0 +1,19 @@
+//check-pass
+
+pub struct Key;
+#[derive(Clone)]
+pub struct Value;
+
+use std::collections::HashMap;
+
+pub struct DiagnosticBuilder<'db> {
+ inner: HashMap<&'db Key, Vec<&'db Value>>,
+}
+
+impl<'db> DiagnosticBuilder<'db> {
+ pub fn iter<'a>(&'a self) -> impl Iterator<Item = (&'db Key, impl Iterator<Item = &'a Value>)> {
+ self.inner.iter().map(|(key, values)| (*key, values.iter().map(|v| *v)))
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/type/option-ref-advice.rs b/tests/ui/type/option-ref-advice.rs
new file mode 100644
index 000000000..2dcee5a2e
--- /dev/null
+++ b/tests/ui/type/option-ref-advice.rs
@@ -0,0 +1,11 @@
+// Regression test for https://github.com/rust-lang/rust/issues/100605
+
+fn takes_option(_arg: Option<&String>) {}
+
+fn main() {
+ takes_option(&None); //~ ERROR 6:18: 6:23: mismatched types [E0308]
+
+ let x = String::from("x");
+ let res = Some(x);
+ takes_option(&res); //~ ERROR 10:18: 10:22: mismatched types [E0308]
+}
diff --git a/tests/ui/issues/issue-100605.stderr b/tests/ui/type/option-ref-advice.stderr
index 6f11f4475..d4dbef301 100644
--- a/tests/ui/issues/issue-100605.stderr
+++ b/tests/ui/type/option-ref-advice.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/issue-100605.rs:4:18
+ --> $DIR/option-ref-advice.rs:6:18
|
LL | takes_option(&None);
| ------------ ^^^^^ expected `Option<&String>`, found `&Option<_>`
@@ -9,7 +9,7 @@ LL | takes_option(&None);
= note: expected enum `Option<&String>`
found reference `&Option<_>`
note: function defined here
- --> $DIR/issue-100605.rs:1:4
+ --> $DIR/option-ref-advice.rs:3:4
|
LL | fn takes_option(_arg: Option<&String>) {}
| ^^^^^^^^^^^^ ---------------------
@@ -20,7 +20,7 @@ LL + takes_option(None);
|
error[E0308]: mismatched types
- --> $DIR/issue-100605.rs:8:18
+ --> $DIR/option-ref-advice.rs:10:18
|
LL | takes_option(&res);
| ------------ ^^^^ expected `Option<&String>`, found `&Option<String>`
@@ -30,7 +30,7 @@ LL | takes_option(&res);
= note: expected enum `Option<&String>`
found reference `&Option<String>`
note: function defined here
- --> $DIR/issue-100605.rs:1:4
+ --> $DIR/option-ref-advice.rs:3:4
|
LL | fn takes_option(_arg: Option<&String>) {}
| ^^^^^^^^^^^^ ---------------------
diff --git a/tests/ui/typeck/apit-with-error-type-in-sig.rs b/tests/ui/typeck/apit-with-error-type-in-sig.rs
new file mode 100644
index 000000000..35990fc16
--- /dev/null
+++ b/tests/ui/typeck/apit-with-error-type-in-sig.rs
@@ -0,0 +1,8 @@
+type Foo = Bar;
+//~^ ERROR cannot find type `Bar` in this scope
+
+fn check(f: impl FnOnce(Foo), val: Foo) {
+ f(val);
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/apit-with-error-type-in-sig.stderr b/tests/ui/typeck/apit-with-error-type-in-sig.stderr
new file mode 100644
index 000000000..49b2eac1b
--- /dev/null
+++ b/tests/ui/typeck/apit-with-error-type-in-sig.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `Bar` in this scope
+ --> $DIR/apit-with-error-type-in-sig.rs:1:12
+ |
+LL | type Foo = Bar;
+ | ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/typeck/explain_clone_autoref.rs b/tests/ui/typeck/explain_clone_autoref.rs
index 4d2157470..88aaac469 100644
--- a/tests/ui/typeck/explain_clone_autoref.rs
+++ b/tests/ui/typeck/explain_clone_autoref.rs
@@ -11,3 +11,119 @@ fn clone_thing(nc: &NotClone) -> NotClone {
//~| NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
//~| NOTE expected `NotClone`, found `&NotClone`
}
+
+fn clone_thing2(nc: &NotClone) -> NotClone {
+ let nc: NotClone = nc.clone();
+ //~^ ERROR mismatched type
+ //~| NOTE expected due to this
+ //~| NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ //~| NOTE expected `NotClone`, found `&NotClone`
+ nc
+}
+
+fn clone_thing3(nc: &NotClone) -> NotClone {
+ //~^ NOTE expected `NotClone` because of return type
+ let nc = nc.clone();
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ nc
+ //~^ ERROR mismatched type
+ //~| NOTE expected `NotClone`, found `&NotClone`
+}
+
+fn clone_thing4(nc: &NotClone) -> NotClone {
+ //~^ NOTE expected `NotClone` because of return type
+ let nc = nc.clone();
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ let nc2 = nc;
+ nc2
+ //~^ ERROR mismatched type
+ //~| NOTE expected `NotClone`, found `&NotClone`
+}
+
+impl NotClone {
+ fn other_fn(&self) {}
+ fn get_ref_notclone(&self) -> &Self {
+ self
+ }
+}
+
+fn clone_thing5(nc: &NotClone) -> NotClone {
+ //~^ NOTE expected `NotClone` because of return type
+ let nc = nc.clone();
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ let nc2 = nc;
+ nc2.other_fn();
+ let nc3 = nc2;
+ nc3
+ //~^ ERROR mismatched type
+ //~| NOTE expected `NotClone`, found `&NotClone`
+}
+
+fn clone_thing6(nc: &NotClone) -> NotClone {
+ //~^ NOTE expected `NotClone` because of return type
+ let (ret, _) = (nc.clone(), 1);
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ let _ = nc.clone();
+ ret
+ //~^ ERROR mismatched type
+ //~| NOTE expected `NotClone`, found `&NotClone`
+}
+
+fn clone_thing7(nc: Vec<&NotClone>) -> NotClone {
+ //~^ NOTE expected `NotClone` because of return type
+ let ret = nc[0].clone();
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ ret
+ //~^ ERROR mismatched type
+ //~| NOTE expected `NotClone`, found `&NotClone`
+}
+
+fn clone_thing8(nc: &NotClone) -> NotClone {
+ //~^ NOTE expected `NotClone` because of return type
+ let ret = {
+ let a = nc.clone();
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ a
+ };
+ ret
+ //~^ ERROR mismatched type
+ //~| NOTE expected `NotClone`, found `&NotClone`
+}
+
+fn clone_thing9(nc: &NotClone) -> NotClone {
+ //~^ NOTE expected `NotClone` because of return type
+ let cl = || nc.clone();
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ let ret = cl();
+ ret
+ //~^ ERROR mismatched type
+ //~| NOTE expected `NotClone`, found `&NotClone`
+}
+
+fn clone_thing10(nc: &NotClone) -> (NotClone, NotClone) {
+ let (a, b) = {
+ let a = nc.clone();
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ (a, nc.clone())
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ };
+ (a, b)
+ //~^ ERROR mismatched type
+ //~| ERROR mismatched type
+ //~| NOTE expected `NotClone`, found `&NotClone`
+ //~| NOTE expected `NotClone`, found `&NotClone`
+}
+
+fn clone_thing11(nc: &NotClone) -> NotClone {
+ //~^ NOTE expected `NotClone` because of return type
+ let a = {
+ let nothing = nc.clone();
+ let a = nc.clone();
+ //~^ NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ let nothing = nc.clone();
+ a
+ };
+ a
+ //~^ ERROR mismatched type
+ //~| NOTE expected `NotClone`, found `&NotClone`
+}
diff --git a/tests/ui/typeck/explain_clone_autoref.stderr b/tests/ui/typeck/explain_clone_autoref.stderr
index 38cb7fe55..40d3df301 100644
--- a/tests/ui/typeck/explain_clone_autoref.stderr
+++ b/tests/ui/typeck/explain_clone_autoref.stderr
@@ -18,6 +18,219 @@ LL + #[derive(Clone)]
LL | struct NotClone;
|
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:16:24
+ |
+LL | let nc: NotClone = nc.clone();
+ | -------- ^^^^^^^^^^ expected `NotClone`, found `&NotClone`
+ | |
+ | expected due to this
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:16:24
+ |
+LL | let nc: NotClone = nc.clone();
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:28:5
+ |
+LL | fn clone_thing3(nc: &NotClone) -> NotClone {
+ | -------- expected `NotClone` because of return type
+...
+LL | nc
+ | ^^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:26:14
+ |
+LL | let nc = nc.clone();
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:38:5
+ |
+LL | fn clone_thing4(nc: &NotClone) -> NotClone {
+ | -------- expected `NotClone` because of return type
+...
+LL | nc2
+ | ^^^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:35:14
+ |
+LL | let nc = nc.clone();
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:57:5
+ |
+LL | fn clone_thing5(nc: &NotClone) -> NotClone {
+ | -------- expected `NotClone` because of return type
+...
+LL | nc3
+ | ^^^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:52:14
+ |
+LL | let nc = nc.clone();
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:67:5
+ |
+LL | fn clone_thing6(nc: &NotClone) -> NotClone {
+ | -------- expected `NotClone` because of return type
+...
+LL | ret
+ | ^^^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:64:21
+ |
+LL | let (ret, _) = (nc.clone(), 1);
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:76:5
+ |
+LL | fn clone_thing7(nc: Vec<&NotClone>) -> NotClone {
+ | -------- expected `NotClone` because of return type
+...
+LL | ret
+ | ^^^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:74:15
+ |
+LL | let ret = nc[0].clone();
+ | ^^^^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:88:5
+ |
+LL | fn clone_thing8(nc: &NotClone) -> NotClone {
+ | -------- expected `NotClone` because of return type
+...
+LL | ret
+ | ^^^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:84:17
+ |
+LL | let a = nc.clone();
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:98:5
+ |
+LL | fn clone_thing9(nc: &NotClone) -> NotClone {
+ | -------- expected `NotClone` because of return type
+...
+LL | ret
+ | ^^^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:95:17
+ |
+LL | let cl = || nc.clone();
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:110:6
+ |
+LL | (a, b)
+ | ^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:105:17
+ |
+LL | let a = nc.clone();
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:110:9
+ |
+LL | (a, b)
+ | ^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:107:13
+ |
+LL | (a, nc.clone())
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/explain_clone_autoref.rs:126:5
+ |
+LL | fn clone_thing11(nc: &NotClone) -> NotClone {
+ | -------- expected `NotClone` because of return type
+...
+LL | a
+ | ^ expected `NotClone`, found `&NotClone`
+ |
+note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
+ --> $DIR/explain_clone_autoref.rs:121:17
+ |
+LL | let a = nc.clone();
+ | ^^
+help: consider annotating `NotClone` with `#[derive(Clone)]`
+ |
+LL + #[derive(Clone)]
+LL | struct NotClone;
+ |
+
+error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.fixed b/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.fixed
new file mode 100644
index 000000000..b101cf1dc
--- /dev/null
+++ b/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.fixed
@@ -0,0 +1,55 @@
+// run-rustfix
+#![allow(dead_code)]
+
+ pub fn foo(x: &str) -> Result<(), Box<dyn std::error::Error>> {
+ Err(format!("error: {x}").into())
+ //~^ ERROR mismatched types
+ }
+
+ macro_rules! outer {
+ ($x: expr) => {
+ inner!($x)
+ }
+ }
+
+ macro_rules! inner {
+ ($x: expr) => {
+ format!("error: {}", $x).into()
+ //~^ ERROR mismatched types
+ }
+ }
+
+ fn bar(x: &str) -> Result<(), Box<dyn std::error::Error>> {
+ Err(outer!(x))
+ }
+
+ macro_rules! entire_fn_outer {
+ () => {
+ entire_fn!();
+ }
+ }
+
+ macro_rules! entire_fn {
+ () => {
+ pub fn baz(x: &str) -> Result<(), Box<dyn std::error::Error>> {
+ Err(format!("error: {x}").into())
+ //~^ ERROR mismatched types
+ }
+ }
+ }
+
+ entire_fn_outer!();
+
+macro_rules! nontrivial {
+ ($x: expr) => {
+ Err(format!("error: {}", $x).into())
+ //~^ ERROR mismatched types
+ }
+}
+
+pub fn qux(x: &str) -> Result<(), Box<dyn std::error::Error>> {
+ nontrivial!(x)
+}
+
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.rs b/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.rs
new file mode 100644
index 000000000..cfde912d8
--- /dev/null
+++ b/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.rs
@@ -0,0 +1,55 @@
+// run-rustfix
+#![allow(dead_code)]
+
+ pub fn foo(x: &str) -> Result<(), Box<dyn std::error::Error>> {
+ Err(format!("error: {x}"))
+ //~^ ERROR mismatched types
+ }
+
+ macro_rules! outer {
+ ($x: expr) => {
+ inner!($x)
+ }
+ }
+
+ macro_rules! inner {
+ ($x: expr) => {
+ format!("error: {}", $x)
+ //~^ ERROR mismatched types
+ }
+ }
+
+ fn bar(x: &str) -> Result<(), Box<dyn std::error::Error>> {
+ Err(outer!(x))
+ }
+
+ macro_rules! entire_fn_outer {
+ () => {
+ entire_fn!();
+ }
+ }
+
+ macro_rules! entire_fn {
+ () => {
+ pub fn baz(x: &str) -> Result<(), Box<dyn std::error::Error>> {
+ Err(format!("error: {x}"))
+ //~^ ERROR mismatched types
+ }
+ }
+ }
+
+ entire_fn_outer!();
+
+macro_rules! nontrivial {
+ ($x: expr) => {
+ Err(format!("error: {}", $x))
+ //~^ ERROR mismatched types
+ }
+}
+
+pub fn qux(x: &str) -> Result<(), Box<dyn std::error::Error>> {
+ nontrivial!(x)
+}
+
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.stderr b/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.stderr
new file mode 100644
index 000000000..e4834c030
--- /dev/null
+++ b/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.stderr
@@ -0,0 +1,59 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-110017-format-into-help-deletes-macro.rs:5:10
+ |
+LL | Err(format!("error: {x}"))
+ | ^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Error>`, found `String`
+ |
+ = note: expected struct `Box<dyn std::error::Error>`
+ found struct `String`
+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>`
+ |
+LL | Err(format!("error: {x}").into())
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/issue-110017-format-into-help-deletes-macro.rs:23:10
+ |
+LL | Err(outer!(x))
+ | ^^^^^^^^^ expected `Box<dyn Error>`, found `String`
+ |
+ = note: expected struct `Box<dyn std::error::Error>`
+ found struct `String`
+ = note: this error originates in the macro `format` which comes from the expansion of the macro `outer` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>`
+ |
+LL | format!("error: {}", $x).into()
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/issue-110017-format-into-help-deletes-macro.rs:41:2
+ |
+LL | entire_fn_outer!();
+ | ^^^^^^^^^^^^^^^^^^ expected `Box<dyn Error>`, found `String`
+ |
+ = note: expected struct `Box<dyn std::error::Error>`
+ found struct `String`
+ = note: this error originates in the macro `format` which comes from the expansion of the macro `entire_fn_outer` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>`
+ |
+LL | Err(format!("error: {x}").into())
+ | +++++++
+
+error[E0308]: mismatched types
+ --> $DIR/issue-110017-format-into-help-deletes-macro.rs:51:5
+ |
+LL | nontrivial!(x)
+ | ^^^^^^^^^^^^^^ expected `Box<dyn Error>`, found `String`
+ |
+ = note: expected struct `Box<dyn std::error::Error>`
+ found struct `String`
+ = note: this error originates in the macro `format` which comes from the expansion of the macro `nontrivial` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: call `Into::into` on this expression to convert `String` into `Box<dyn std::error::Error>`
+ |
+LL | Err(format!("error: {}", $x).into())
+ | +++++++
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.fixed b/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.fixed
new file mode 100644
index 000000000..29b6b8b86
--- /dev/null
+++ b/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.fixed
@@ -0,0 +1,37 @@
+// run-rustfix
+#![allow(dead_code)]
+
+// https://github.com/rust-lang/rust/issues/112007
+fn bug_report<W: std::fmt::Write>(w: &mut W) -> std::fmt::Result {
+ if true {
+ writeln!(w, "`;?` here ->")?;
+ } else {
+ return writeln!(w, "but not here");
+ //~^ ERROR mismatched types
+ };
+ Ok(())
+}
+
+macro_rules! baz {
+ ($w: expr) => {
+ bar!($w)
+ }
+}
+
+macro_rules! bar {
+ ($w: expr) => {
+ writeln!($w, "but not here")
+ //~^ ERROR mismatched types
+ }
+}
+
+fn foo<W: std::fmt::Write>(w: &mut W) -> std::fmt::Result {
+ if true {
+ writeln!(w, "`;?` here ->")?;
+ } else {
+ return baz!(w);
+ };
+ Ok(())
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.rs b/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.rs
new file mode 100644
index 000000000..bd731e02b
--- /dev/null
+++ b/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.rs
@@ -0,0 +1,37 @@
+// run-rustfix
+#![allow(dead_code)]
+
+// https://github.com/rust-lang/rust/issues/112007
+fn bug_report<W: std::fmt::Write>(w: &mut W) -> std::fmt::Result {
+ if true {
+ writeln!(w, "`;?` here ->")?;
+ } else {
+ writeln!(w, "but not here")
+ //~^ ERROR mismatched types
+ }
+ Ok(())
+}
+
+macro_rules! baz {
+ ($w: expr) => {
+ bar!($w)
+ }
+}
+
+macro_rules! bar {
+ ($w: expr) => {
+ writeln!($w, "but not here")
+ //~^ ERROR mismatched types
+ }
+}
+
+fn foo<W: std::fmt::Write>(w: &mut W) -> std::fmt::Result {
+ if true {
+ writeln!(w, "`;?` here ->")?;
+ } else {
+ baz!(w)
+ }
+ Ok(())
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.stderr b/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.stderr
new file mode 100644
index 000000000..df2e06e8f
--- /dev/null
+++ b/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.stderr
@@ -0,0 +1,50 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-112007-leaked-writeln-macro-internals.rs:9:9
+ |
+LL | / if true {
+LL | | writeln!(w, "`;?` here ->")?;
+LL | | } else {
+LL | | writeln!(w, "but not here")
+ | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Error>`
+LL | |
+LL | | }
+ | |_____- expected this to be `()`
+ |
+ = note: expected unit type `()`
+ found enum `Result<(), std::fmt::Error>`
+ = note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider using a semicolon here
+ |
+LL | };
+ | +
+help: you might have meant to return this value
+ |
+LL | return writeln!(w, "but not here");
+ | ++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/issue-112007-leaked-writeln-macro-internals.rs:32:9
+ |
+LL | / if true {
+LL | | writeln!(w, "`;?` here ->")?;
+LL | | } else {
+LL | | baz!(w)
+ | | ^^^^^^^ expected `()`, found `Result<(), Error>`
+LL | | }
+ | |_____- expected this to be `()`
+ |
+ = note: expected unit type `()`
+ found enum `Result<(), std::fmt::Error>`
+ = note: this error originates in the macro `writeln` which comes from the expansion of the macro `baz` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider using a semicolon here
+ |
+LL | };
+ | +
+help: you might have meant to return this value
+ |
+LL | return baz!(w);
+ | ++++++ +
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr
index c55930da2..f81736245 100644
--- a/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr
+++ b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr
@@ -38,10 +38,10 @@ LL | let _c = unsafe { _ptr2.offset_from(_ptr1) };
| ++++++++ ~~~~~~~~~~~~~ +++
error[E0608]: cannot index into a value of type `*const u32`
- --> $DIR/issue-112252-ptr-arithmetics-help.rs:9:14
+ --> $DIR/issue-112252-ptr-arithmetics-help.rs:9:19
|
LL | let _d = _ptr1[5];
- | ^^^^^^^^
+ | ^^^
|
help: consider using `wrapping_add` or `add` for indexing into raw pointer
|
diff --git a/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.rs b/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.rs
new file mode 100644
index 000000000..da2dae1c4
--- /dev/null
+++ b/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.rs
@@ -0,0 +1,15 @@
+struct RGB {
+ g: f64,
+ b: f64,
+}
+
+fn main() {
+ let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone());
+ //~^ ERROR cannot find value `e` in this scope
+ //~| ERROR cannot find value `e` in this scope
+ //~| ERROR mismatched types
+ let _ = RGB { r, g, b };
+ //~^ ERROR cannot find value `g` in this scope
+ //~| ERROR struct `RGB` has no field named `r`
+ //~| ERROR mismatched types
+}
diff --git a/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr b/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr
new file mode 100644
index 000000000..4ccfacfb0
--- /dev/null
+++ b/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr
@@ -0,0 +1,52 @@
+error[E0425]: cannot find value `e` in this scope
+ --> $DIR/issue-114423-ice-regression-in-suggestion.rs:7:51
+ |
+LL | let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone());
+ | ^ not found in this scope
+
+error[E0425]: cannot find value `e` in this scope
+ --> $DIR/issue-114423-ice-regression-in-suggestion.rs:7:62
+ |
+LL | let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone());
+ | ^ not found in this scope
+
+error[E0425]: cannot find value `g` in this scope
+ --> $DIR/issue-114423-ice-regression-in-suggestion.rs:11:22
+ |
+LL | let _ = RGB { r, g, b };
+ | ^ help: a local variable with a similar name exists: `b`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-114423-ice-regression-in-suggestion.rs:7:50
+ |
+LL | let (r, alone_in_path, b): (f32, f32, f32) = (e.clone(), e.clone());
+ | --------------- ^^^^^^^^^^^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 2 elements
+ | |
+ | expected due to this
+ |
+ = note: expected tuple `(f32, f32, f32)`
+ found tuple `(f32, f32)`
+
+error[E0560]: struct `RGB` has no field named `r`
+ --> $DIR/issue-114423-ice-regression-in-suggestion.rs:11:19
+ |
+LL | let _ = RGB { r, g, b };
+ | ^ `RGB` does not have this field
+ |
+ = note: all struct fields are already assigned
+
+error[E0308]: mismatched types
+ --> $DIR/issue-114423-ice-regression-in-suggestion.rs:11:25
+ |
+LL | let _ = RGB { r, g, b };
+ | ^ expected `f64`, found `f32`
+ |
+help: you can convert an `f32` to an `f64`
+ |
+LL | let _ = RGB { r, g, b: b.into() };
+ | ++ +++++++
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0308, E0425, E0560.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/mismatched-map-under-self.rs b/tests/ui/typeck/mismatched-map-under-self.rs
new file mode 100644
index 000000000..bedb7a190
--- /dev/null
+++ b/tests/ui/typeck/mismatched-map-under-self.rs
@@ -0,0 +1,17 @@
+pub trait Insertable {
+ type Values;
+
+ fn values(&self) -> Self::Values;
+}
+
+impl<T> Insertable for Option<T> {
+ type Values = ();
+
+ fn values(self) -> Self::Values {
+ //~^ ERROR method `values` has an incompatible type for trait
+ self.map(Insertable::values).unwrap_or_default()
+ //~^ ERROR type mismatch in function arguments
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr
new file mode 100644
index 000000000..51491407c
--- /dev/null
+++ b/tests/ui/typeck/mismatched-map-under-self.stderr
@@ -0,0 +1,37 @@
+error[E0053]: method `values` has an incompatible type for trait
+ --> $DIR/mismatched-map-under-self.rs:10:15
+ |
+LL | fn values(self) -> Self::Values {
+ | ^^^^
+ | |
+ | expected `&Option<T>`, found `Option<T>`
+ | help: change the self-receiver type to match the trait: `&self`
+ |
+note: type in trait
+ --> $DIR/mismatched-map-under-self.rs:4:15
+ |
+LL | fn values(&self) -> Self::Values;
+ | ^^^^^
+ = note: expected signature `fn(&Option<T>)`
+ found signature `fn(Option<T>)`
+
+error[E0631]: type mismatch in function arguments
+ --> $DIR/mismatched-map-under-self.rs:12:18
+ |
+LL | fn values(&self) -> Self::Values;
+ | --------------------------------- found signature defined here
+...
+LL | self.map(Insertable::values).unwrap_or_default()
+ | --- ^^^^^^^^^^^^^^^^^^ expected due to this
+ | |
+ | required by a bound introduced by this call
+ |
+ = note: expected function signature `fn(T) -> _`
+ found function signature `for<'a> fn(&'a _) -> _`
+note: required by a bound in `Option::<T>::map`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0053, E0631.
+For more information about an error, try `rustc --explain E0053`.
diff --git a/tests/ui/underscore-imports/cycle.rs b/tests/ui/underscore-imports/cycle.rs
index bacf9b2d5..c8a293687 100644
--- a/tests/ui/underscore-imports/cycle.rs
+++ b/tests/ui/underscore-imports/cycle.rs
@@ -2,6 +2,8 @@
// check-pass
+#![allow(noop_method_call)]
+
mod x {
pub use crate::y::*;
pub use std::ops::Deref as _;
diff --git a/tests/ui/underscore-imports/hygiene.rs b/tests/ui/underscore-imports/hygiene.rs
index c4db65245..7795ccb79 100644
--- a/tests/ui/underscore-imports/hygiene.rs
+++ b/tests/ui/underscore-imports/hygiene.rs
@@ -3,6 +3,7 @@
// check-pass
#![feature(decl_macro)]
+#![allow(noop_method_call)]
mod x {
pub use std::ops::Deref as _;
diff --git a/tests/ui/unop-move-semantics.stderr b/tests/ui/unop-move-semantics.stderr
index e47785c46..b6de7976a 100644
--- a/tests/ui/unop-move-semantics.stderr
+++ b/tests/ui/unop-move-semantics.stderr
@@ -7,7 +7,7 @@ LL | !x;
| -- `x` moved due to usage in operator
LL |
LL | x.clone();
- | ^^^^^^^^^ value borrowed here after move
+ | ^ value borrowed here after move
|
note: calling this operator moves the left-hand side
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL
diff --git a/tests/ui/unpretty/avoid-crash.stderr b/tests/ui/unpretty/avoid-crash.stderr
index 11cd3866f..15bcc277e 100644
--- a/tests/ui/unpretty/avoid-crash.stderr
+++ b/tests/ui/unpretty/avoid-crash.stderr
@@ -1,4 +1,4 @@
-error: pretty-print failed to write `/tmp/` due to $ERROR_MESSAGE
+error: failed to write `/tmp/` due to $ERROR_MESSAGE
error: aborting due to previous error
diff --git a/tests/ui/unsafe/unsafe-not-inherited.stderr b/tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr
index 3bc5ca5c9..5536efbc6 100644
--- a/tests/ui/unsafe/unsafe-not-inherited.stderr
+++ b/tests/ui/unsafe/unsafe-not-inherited.mirunsafeck.stderr
@@ -1,5 +1,5 @@
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
- --> $DIR/unsafe-not-inherited.rs:6:31
+ --> $DIR/unsafe-not-inherited.rs:8:31
|
LL | unsafe {static BAR: u64 = FOO;}
| ------ ^^^ use of mutable static
@@ -9,7 +9,7 @@ LL | unsafe {static BAR: u64 = FOO;}
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/unsafe-not-inherited.rs:18:13
+ --> $DIR/unsafe-not-inherited.rs:20:13
|
LL | unsafe {
| ------ items do not inherit unsafety from separate enclosing items
diff --git a/tests/ui/unsafe/unsafe-not-inherited.rs b/tests/ui/unsafe/unsafe-not-inherited.rs
index 6d797caa0..f9d9a5957 100644
--- a/tests/ui/unsafe/unsafe-not-inherited.rs
+++ b/tests/ui/unsafe/unsafe-not-inherited.rs
@@ -1,3 +1,5 @@
+// revisions: mirunsafeck thirunsafeck
+// [thirunsafeck]compile-flags: -Z thir-unsafeck
#![allow(unused, dead_code)]
static mut FOO: u64 = 0;
diff --git a/tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr b/tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr
new file mode 100644
index 000000000..88ea2e6d1
--- /dev/null
+++ b/tests/ui/unsafe/unsafe-not-inherited.thirunsafeck.stderr
@@ -0,0 +1,24 @@
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-not-inherited.rs:8:31
+ |
+LL | unsafe {static BAR: u64 = FOO;}
+ | ------ ^^^ use of mutable static
+ | |
+ | items do not inherit unsafety from separate enclosing items
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: call to unsafe function `unsafe_call` is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-not-inherited.rs:20:13
+ |
+LL | unsafe {
+ | ------ items do not inherit unsafety from separate enclosing items
+...
+LL | unsafe_call();
+ | ^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/unsized/issue-75899.rs b/tests/ui/unsized/issue-75899.rs
index abff17e11..719431032 100644
--- a/tests/ui/unsized/issue-75899.rs
+++ b/tests/ui/unsized/issue-75899.rs
@@ -1,3 +1,5 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
// check-pass
trait Trait {}
diff --git a/tests/ui/use/use-after-move-implicity-coerced-object.stderr b/tests/ui/use/use-after-move-implicity-coerced-object.stderr
index dfa0c0483..84487a8d0 100644
--- a/tests/ui/use/use-after-move-implicity-coerced-object.stderr
+++ b/tests/ui/use/use-after-move-implicity-coerced-object.stderr
@@ -8,7 +8,7 @@ LL | l.push(n);
| - value moved here
LL |
LL | let x = n.to_string();
- | ^^^^^^^^^^^^^ value borrowed here after move
+ | ^ value borrowed here after move
|
note: consider changing this parameter type in method `push` to borrow instead if owning the value isn't necessary
--> $DIR/use-after-move-implicity-coerced-object.rs:17:27
diff --git a/tests/ui/use/use-self-type.stderr b/tests/ui/use/use-self-type.stderr
index 3da04a851..498df34fe 100644
--- a/tests/ui/use/use-self-type.stderr
+++ b/tests/ui/use/use-self-type.stderr
@@ -1,8 +1,8 @@
-error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
+error[E0433]: failed to resolve: `Self` cannot be used in imports
--> $DIR/use-self-type.rs:7:16
|
LL | pub(in Self::f) struct Z;
- | ^^^^ `Self` is only available in impls, traits, and type definitions
+ | ^^^^ `Self` cannot be used in imports
error[E0432]: unresolved import `Self`
--> $DIR/use-self-type.rs:6:13
diff --git a/tests/ui/where-clauses/where-clause-bounds-inconsistency.rs b/tests/ui/where-clauses/where-clause-bounds-inconsistency.rs
index cf7d06b61..ea60fa708 100644
--- a/tests/ui/where-clauses/where-clause-bounds-inconsistency.rs
+++ b/tests/ui/where-clauses/where-clause-bounds-inconsistency.rs
@@ -14,7 +14,6 @@ trait Trait {
impl Trait for bool {
fn a<T: Bound>(&self, _: T) {}
- //^~ This gets rejected but should be accepted
fn b<T>(&self, _: T) where T: Bound {}
fn c<T: Bound>(&self, _: T) {}
fn d<T>(&self, _: T) where T: Bound {}
diff --git a/tests/ui/parser/type-alias-where-fixable.fixed b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.fixed
index 2f47c0d91..2f47c0d91 100644
--- a/tests/ui/parser/type-alias-where-fixable.fixed
+++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.fixed
diff --git a/tests/ui/parser/type-alias-where-fixable.rs b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs
index b20aa9398..b20aa9398 100644
--- a/tests/ui/parser/type-alias-where-fixable.rs
+++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs
diff --git a/tests/ui/parser/type-alias-where-fixable.stderr b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr
index f0acb388b..b4de05184 100644
--- a/tests/ui/parser/type-alias-where-fixable.stderr
+++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr
@@ -1,5 +1,5 @@
warning: where clause not allowed here
- --> $DIR/type-alias-where-fixable.rs:13:16
+ --> $DIR/where-clause-placement-assoc-type-in-impl.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:16:17
+ --> $DIR/where-clause-placement-assoc-type-in-impl.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:24:17
+ --> $DIR/where-clause-placement-assoc-type-in-impl.rs:24:17
|
LL | type Assoc2 where u32: Copy, i32: Copy = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.fixed b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.fixed
new file mode 100644
index 000000000..d171eba50
--- /dev/null
+++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.fixed
@@ -0,0 +1,15 @@
+// check-pass
+// run-rustfix
+
+#![feature(associated_type_defaults)]
+
+trait Trait {
+ // Not fine, suggests moving.
+ type Assoc = () where u32: Copy;
+ //~^ WARNING where clause not allowed here
+ // Not fine, suggests moving `u32: Copy`
+ type Assoc2 = () where i32: Copy, u32: Copy;
+ //~^ WARNING where clause not allowed here
+}
+
+fn main() {}
diff --git a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.rs b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.rs
new file mode 100644
index 000000000..59afee657
--- /dev/null
+++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.rs
@@ -0,0 +1,15 @@
+// check-pass
+// run-rustfix
+
+#![feature(associated_type_defaults)]
+
+trait Trait {
+ // Not fine, suggests moving.
+ type Assoc where u32: Copy = ();
+ //~^ WARNING where clause not allowed here
+ // Not fine, suggests moving `u32: Copy`
+ type Assoc2 where u32: Copy = () where i32: Copy;
+ //~^ WARNING where clause not allowed here
+}
+
+fn main() {}
diff --git a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.stderr b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.stderr
new file mode 100644
index 000000000..a81cb8c8c
--- /dev/null
+++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-trait.stderr
@@ -0,0 +1,29 @@
+warning: where clause not allowed here
+ --> $DIR/where-clause-placement-assoc-type-in-trait.rs:8:16
+ |
+LL | type Assoc where u32: Copy = ();
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
+ = note: `#[warn(deprecated_where_clause_location)]` on by default
+help: move it to the end of the type declaration
+ |
+LL - type Assoc where u32: Copy = ();
+LL + type Assoc = () where u32: Copy;
+ |
+
+warning: where clause not allowed here
+ --> $DIR/where-clause-placement-assoc-type-in-trait.rs:11:17
+ |
+LL | type Assoc2 where u32: Copy = () where i32: Copy;
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
+help: move it to the end of the type declaration
+ |
+LL - type Assoc2 where u32: Copy = () where i32: Copy;
+LL + type Assoc2 = () where i32: Copy, u32: Copy;
+ |
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/parser/type-alias-where.rs b/tests/ui/where-clauses/where-clause-placement-type-alias.rs
index 62e301cb4..62e301cb4 100644
--- a/tests/ui/parser/type-alias-where.rs
+++ b/tests/ui/where-clauses/where-clause-placement-type-alias.rs
diff --git a/tests/ui/where-clauses/where-clause-placement-type-alias.stderr b/tests/ui/where-clauses/where-clause-placement-type-alias.stderr
new file mode 100644
index 000000000..d341148b0
--- /dev/null
+++ b/tests/ui/where-clauses/where-clause-placement-type-alias.stderr
@@ -0,0 +1,20 @@
+error: where clauses are not allowed after the type for type aliases
+ --> $DIR/where-clause-placement-type-alias.rs:6:15
+ |
+LL | type Bar = () where u32: Copy;
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
+ = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable
+
+error: where clauses are not allowed after the type for type aliases
+ --> $DIR/where-clause-placement-type-alias.rs:8:15
+ |
+LL | type Baz = () where;
+ | ^^^^^
+ |
+ = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
+ = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+