]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #91149 - notriddle:notriddle/rustdoc-doctest-semicolon, r=jyn514
authorbors <bors@rust-lang.org>
Tue, 23 Nov 2021 23:48:55 +0000 (23:48 +0000)
committerbors <bors@rust-lang.org>
Tue, 23 Nov 2021 23:48:55 +0000 (23:48 +0000)
fix(doctest): detect extern crate items in statement doctests

This partially reverts #91026, because rustdoc needs to detect the extern statements, even when they appear inside implicit `main()`. It does not entirely revert it, so the old bug is still fixed, by duplicating some of the logic from `parse_mod` instead of trying to use it directly.

Fixes #91134

1471 files changed:
CONTRIBUTING.md
Cargo.lock
README.md
compiler/rustc_arena/src/lib.rs
compiler/rustc_ast_lowering/src/expr.rs
compiler/rustc_ast_lowering/src/lib.rs
compiler/rustc_ast_passes/src/feature_gate.rs
compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
compiler/rustc_borrowck/src/diagnostics/mod.rs
compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
compiler/rustc_codegen_llvm/src/attributes.rs
compiler/rustc_codegen_llvm/src/lib.rs
compiler/rustc_codegen_llvm/src/llvm/ffi.rs
compiler/rustc_const_eval/src/interpret/intrinsics.rs
compiler/rustc_const_eval/src/interpret/operand.rs
compiler/rustc_const_eval/src/interpret/place.rs
compiler/rustc_const_eval/src/transform/check_consts/resolver.rs
compiler/rustc_const_eval/src/transform/promote_consts.rs
compiler/rustc_driver/src/lib.rs
compiler/rustc_errors/src/emitter.rs
compiler/rustc_feature/src/active.rs
compiler/rustc_feature/src/builtin_attrs.rs
compiler/rustc_feature/src/lib.rs
compiler/rustc_hir/src/arena.rs
compiler/rustc_hir/src/hir.rs
compiler/rustc_hir/src/pat_util.rs
compiler/rustc_incremental/src/persist/load.rs
compiler/rustc_infer/src/infer/error_reporting/mod.rs
compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs
compiler/rustc_infer/src/infer/mod.rs
compiler/rustc_infer/src/lib.rs
compiler/rustc_interface/src/tests.rs
compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h
compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
compiler/rustc_macros/src/serialize.rs
compiler/rustc_middle/src/arena.rs
compiler/rustc_middle/src/lib.rs
compiler/rustc_middle/src/lint.rs
compiler/rustc_middle/src/middle/stability.rs
compiler/rustc_middle/src/traits/mod.rs
compiler/rustc_middle/src/ty/codec.rs
compiler/rustc_middle/src/ty/generics.rs
compiler/rustc_middle/src/ty/print/pretty.rs
compiler/rustc_middle/src/ty/sty.rs
compiler/rustc_mir_build/src/build/matches/mod.rs
compiler/rustc_mir_build/src/build/mod.rs
compiler/rustc_mir_build/src/check_unsafety.rs
compiler/rustc_mir_build/src/thir/pattern/check_match.rs
compiler/rustc_mir_dataflow/src/impls/mod.rs
compiler/rustc_parse/src/parser/expr.rs
compiler/rustc_parse/src/parser/mod.rs
compiler/rustc_parse/src/parser/pat.rs
compiler/rustc_passes/src/check_attr.rs
compiler/rustc_query_system/src/lib.rs
compiler/rustc_query_system/src/query/plumbing.rs
compiler/rustc_resolve/src/diagnostics.rs
compiler/rustc_resolve/src/imports.rs
compiler/rustc_resolve/src/late/diagnostics.rs
compiler/rustc_resolve/src/macros.rs
compiler/rustc_serialize/src/json.rs
compiler/rustc_serialize/src/serialize.rs
compiler/rustc_session/src/config.rs
compiler/rustc_session/src/lib.rs
compiler/rustc_session/src/options.rs
compiler/rustc_session/src/session.rs
compiler/rustc_span/src/hygiene.rs
compiler/rustc_span/src/lib.rs
compiler/rustc_span/src/source_map.rs
compiler/rustc_span/src/symbol.rs
compiler/rustc_target/src/spec/mod.rs
compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs
compiler/rustc_trait_selection/src/lib.rs
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
compiler/rustc_trait_selection/src/traits/mod.rs
compiler/rustc_trait_selection/src/traits/util.rs
compiler/rustc_trait_selection/src/traits/wf.rs
compiler/rustc_typeck/src/astconv/generics.rs
compiler/rustc_typeck/src/check/callee.rs
compiler/rustc_typeck/src/check/compare_method.rs
compiler/rustc_typeck/src/check/demand.rs
compiler/rustc_typeck/src/check/expr.rs
compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
compiler/rustc_typeck/src/check/method/confirm.rs
compiler/rustc_typeck/src/check/method/mod.rs
compiler/rustc_typeck/src/check/method/probe.rs
compiler/rustc_typeck/src/check/method/suggest.rs
compiler/rustc_typeck/src/collect.rs
library/alloc/src/rc.rs
library/alloc/src/sync.rs
library/alloc/src/vec/mod.rs
library/alloc/tests/lib.rs
library/alloc/tests/str.rs
library/core/src/char/convert.rs
library/core/src/char/methods.rs
library/core/src/lib.rs
library/core/src/num/f32.rs
library/core/src/num/f64.rs
library/core/src/num/mod.rs
library/core/src/primitive_docs.rs
library/core/src/str/converts.rs
library/core/src/str/error.rs
library/core/src/str/iter.rs
library/core/src/str/validations.rs
library/core/tests/lib.rs
library/core/tests/num/mod.rs
library/std/src/f32/tests.rs
library/std/src/fs/tests.rs
library/std/src/io/error.rs
library/std/src/keyword_docs.rs
library/std/src/lib.rs
library/std/src/primitive_docs.rs
library/std/src/process/tests.rs
library/std/src/sys/unix/kernel_copy.rs
library/std/src/sys/windows/c.rs
library/std/src/sys/windows/path.rs
library/std/src/sys/windows/path/tests.rs
library/std/src/sys/windows/process.rs
library/std/src/sys/windows/process/tests.rs
library/std/src/sys_common/wtf8.rs
library/std/src/thread/local.rs
library/stdarch
src/bootstrap/bootstrap.py
src/doc/book
src/doc/edition-guide
src/doc/embedded-book
src/doc/reference
src/doc/rust-by-example
src/doc/rustc-dev-guide
src/doc/rustdoc/src/unstable-features.md
src/doc/unstable-book/src/language-features/inline-const-pat.md [new file with mode: 0644]
src/doc/unstable-book/src/language-features/inline-const.md
src/librustdoc/clean/inline.rs
src/librustdoc/clean/mod.rs
src/librustdoc/clean/types.rs
src/librustdoc/clean/utils.rs
src/librustdoc/core.rs
src/librustdoc/externalfiles.rs
src/librustdoc/formats/cache.rs
src/librustdoc/html/markdown.rs
src/librustdoc/html/render/cache.rs
src/librustdoc/html/render/mod.rs
src/librustdoc/html/render/print_item.rs
src/librustdoc/html/static/css/rustdoc.css
src/librustdoc/html/static/css/themes/ayu.css
src/librustdoc/html/static/css/themes/dark.css
src/librustdoc/html/static/css/themes/light.css
src/librustdoc/html/static/js/main.js
src/librustdoc/html/templates/page.html
src/librustdoc/passes/unindent_comments.rs
src/librustdoc/passes/unindent_comments/tests.rs
src/test/assembly/stack-protector/stack-protector-heuristics-effect.rs [new file with mode: 0644]
src/test/assembly/stack-protector/stack-protector-target-support.rs [new file with mode: 0644]
src/test/codegen/stack-protector.rs [new file with mode: 0644]
src/test/incremental/hashes/for_loops.rs
src/test/incremental/hashes/trait_defs.rs
src/test/incremental/link_order/auxiliary/my_lib.rs
src/test/incremental/struct_change_field_name.rs
src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff
src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.continue.txt
src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline.txt
src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loops_branches.txt
src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_match.txt
src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.try_error_result.txt
src/test/rustdoc-gui/anchors.goml [new file with mode: 0644]
src/test/rustdoc-gui/headings.goml
src/test/rustdoc-gui/src/lib2/lib.rs
src/test/rustdoc-gui/toggle-click-deadspace.goml [new file with mode: 0644]
src/test/rustdoc/auxiliary/reexports.rs
src/test/rustdoc/enum-headings.rs [new file with mode: 0644]
src/test/rustdoc/reexports-priv.rs
src/test/rustdoc/reexports.rs
src/test/rustdoc/tuple-struct-fields-doc.rs
src/test/ui/abi/stack-protector.rs [new file with mode: 0644]
src/test/ui/absolute-paths-in-nested-use-groups.rs [deleted file]
src/test/ui/absolute-paths-in-nested-use-groups.stderr [deleted file]
src/test/ui/alignment-gep-tup-like-1.rs [deleted file]
src/test/ui/allocator/not-an-allocator.stderr
src/test/ui/array-slice-vec/byte-literals.rs [new file with mode: 0644]
src/test/ui/assignment-operator-unimplemented.rs [deleted file]
src/test/ui/assignment-operator-unimplemented.stderr [deleted file]
src/test/ui/associated-consts/associated-const-array-len.stderr
src/test/ui/associated-consts/issue-63496.stderr
src/test/ui/associated-item/issue-48027.stderr
src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr
src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr
src/test/ui/associated-types/associated-types-bound-failure.stderr
src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr
src/test/ui/associated-types/associated-types-no-suitable-bound.stderr
src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr
src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr
src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr
src/test/ui/associated-types/associated-types-unconstrained.stderr
src/test/ui/associated-types/issue-44153.stderr
src/test/ui/associated-types/issue-87261.rs
src/test/ui/associated-types/issue-87261.stderr
src/test/ui/associated-types/substs-ppaux.normal.stderr [new file with mode: 0644]
src/test/ui/associated-types/substs-ppaux.rs [new file with mode: 0644]
src/test/ui/associated-types/substs-ppaux.verbose.stderr [new file with mode: 0644]
src/test/ui/async-await/async-fn-nonsend.stderr
src/test/ui/async-await/dont-suggest-missing-await.stderr
src/test/ui/async-await/generator-desc.stderr
src/test/ui/async-await/issue-61076.rs
src/test/ui/async-await/issue-61076.stderr
src/test/ui/async-await/issue-64130-1-sync.stderr
src/test/ui/async-await/issue-64130-2-send.stderr
src/test/ui/async-await/issue-64130-3-other.rs
src/test/ui/async-await/issue-64130-3-other.stderr
src/test/ui/async-await/issue-64130-non-send-future-diags.stderr
src/test/ui/async-await/issue-68112.stderr
src/test/ui/async-await/issue-70594.stderr
src/test/ui/async-await/issue-71137.stderr
src/test/ui/async-await/issue-74497-lifetime-in-opaque.stderr
src/test/ui/async-await/issue-84841.stderr
src/test/ui/async-await/issues/issue-62009-1.stderr
src/test/ui/async-await/issues/issue-67893.stderr
src/test/ui/async-await/pin-needed-to-poll-2.stderr
src/test/ui/async-await/suggest-missing-await-closure.stderr
src/test/ui/async-await/suggest-missing-await.rs
src/test/ui/async-await/suggest-missing-await.stderr
src/test/ui/async-await/try-on-option-in-async.stderr
src/test/ui/atomic-print.rs [deleted file]
src/test/ui/attribute-with-no-generics-in-parameter-list.rs [deleted file]
src/test/ui/attribute-with-no-generics-in-parameter-list.stderr [deleted file]
src/test/ui/attributes/key-value-expansion.stderr
src/test/ui/attributes/suffixed-literal-meta.rs [new file with mode: 0644]
src/test/ui/attributes/suffixed-literal-meta.stderr [new file with mode: 0644]
src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo.rs [deleted file]
src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo2.rs [deleted file]
src/test/ui/auxiliary/extern-statics.rs [deleted file]
src/test/ui/auxiliary/impl_privacy_xc_2.rs [deleted file]
src/test/ui/auxiliary/link-cfg-works-transitive-dylib.rs [deleted file]
src/test/ui/auxiliary/link-cfg-works-transitive-rlib.rs [deleted file]
src/test/ui/auxiliary/llvm_pr32379.rs [deleted file]
src/test/ui/auxiliary/no-mangle-associated-fn.rs [deleted file]
src/test/ui/auxiliary/reachable-unnameable-items.rs [deleted file]
src/test/ui/backtrace-debuginfo-aux.rs [deleted file]
src/test/ui/backtrace-debuginfo.rs [deleted file]
src/test/ui/binop/operator-multidispatch.rs [new file with mode: 0644]
src/test/ui/binop/operator-overloading.rs [new file with mode: 0644]
src/test/ui/binop/placement-syntax.rs [new file with mode: 0644]
src/test/ui/binop/placement-syntax.stderr [new file with mode: 0644]
src/test/ui/blind-item-mixed-crate-use-item.rs [deleted file]
src/test/ui/blind-item-mixed-use-item.rs [deleted file]
src/test/ui/borrowck/immut-function-arguments.rs [new file with mode: 0644]
src/test/ui/borrowck/immut-function-arguments.stderr [new file with mode: 0644]
src/test/ui/borrowck/kindck-implicit-close-over-mut-var.rs [new file with mode: 0644]
src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr
src/test/ui/borrowck/return-local-binding-from-desugaring.rs
src/test/ui/borrowck/return-local-binding-from-desugaring.stderr
src/test/ui/box/into-boxed-slice-fail.stderr
src/test/ui/break-outside-loop.rs [deleted file]
src/test/ui/break-outside-loop.stderr [deleted file]
src/test/ui/break-while-condition.rs [deleted file]
src/test/ui/break-while-condition.stderr [deleted file]
src/test/ui/byte-literals.rs [deleted file]
src/test/ui/cast/casts-differing-anon.stderr
src/test/ui/cfg/crt-static-on-works.rs [new file with mode: 0644]
src/test/ui/chalkify/type_wf.stderr
src/test/ui/cleanup-arm-conditional.rs [deleted file]
src/test/ui/clone-with-exterior.rs [deleted file]
src/test/ui/closures/closure-expected.stderr
src/test/ui/closures/coerce-unsafe-to-closure.stderr
src/test/ui/closures/once-move-out-on-heap.rs [new file with mode: 0644]
src/test/ui/cmse-nonsecure/cmse-nonsecure-call/params-on-stack.stderr
src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr
src/test/ui/codegen/auxiliary/llvm_pr32379.rs [new file with mode: 0644]
src/test/ui/codegen/init-large-type.rs [new file with mode: 0644]
src/test/ui/codegen/llvm-pr32379.rs [new file with mode: 0644]
src/test/ui/coercion/retslot-cast.rs [new file with mode: 0644]
src/test/ui/coercion/retslot-cast.stderr [new file with mode: 0644]
src/test/ui/coherence/coherence-overlap-trait-alias.stderr
src/test/ui/compare-method/proj-outlives-region.stderr
src/test/ui/compare-method/region-extra-2.stderr
src/test/ui/compare-method/region-extra.stderr
src/test/ui/compare-method/region-unrelated.stderr
src/test/ui/compare-method/trait-bound-on-type-parameter.stderr
src/test/ui/compare-method/traits-misc-mismatch-1.stderr
src/test/ui/compare-method/traits-misc-mismatch-2.stderr
src/test/ui/const-generics/defaults/wfness.stderr
src/test/ui/const-generics/dont-evaluate-array-len-on-err-1.stderr
src/test/ui/const-generics/exhaustive-value.stderr
src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr
src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr
src/test/ui/const-generics/invariant.nll.stderr [new file with mode: 0644]
src/test/ui/const-generics/invariant.rs [new file with mode: 0644]
src/test/ui/const-generics/invariant.stderr [new file with mode: 0644]
src/test/ui/const-generics/occurs-check/unused-substs-1.stderr
src/test/ui/consts/closure-structural-match-issue-90013.rs
src/test/ui/consts/const-blocks/fn-call-in-const.rs
src/test/ui/consts/const-eval/simd/insert_extract.rs
src/test/ui/consts/issue-90878-2.rs [new file with mode: 0644]
src/test/ui/consts/issue-90878-2.stderr [new file with mode: 0644]
src/test/ui/consts/issue-90878-3.rs [new file with mode: 0644]
src/test/ui/consts/issue-90878-3.stderr [new file with mode: 0644]
src/test/ui/consts/issue-90878.rs [new file with mode: 0644]
src/test/ui/consts/issue-90878.stderr [new file with mode: 0644]
src/test/ui/consts/non-const-value-in-const.rs [new file with mode: 0644]
src/test/ui/consts/non-const-value-in-const.stderr [new file with mode: 0644]
src/test/ui/core-run-destroy.rs [deleted file]
src/test/ui/crt-static-on-works.rs [deleted file]
src/test/ui/cycle-generic-bound.rs [deleted file]
src/test/ui/derives/derive-assoc-type-not-impl.stderr
src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr
src/test/ui/derives/derives-span-Clone-enum.stderr
src/test/ui/derives/derives-span-Clone-struct.stderr
src/test/ui/derives/derives-span-Clone-tuple-struct.stderr
src/test/ui/derives/derives-span-Default-struct.stderr
src/test/ui/derives/derives-span-Default-tuple-struct.stderr
src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr
src/test/ui/derives/derives-span-Hash-enum.stderr
src/test/ui/derives/derives-span-Hash-struct.stderr
src/test/ui/derives/derives-span-Hash-tuple-struct.stderr
src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr
src/test/ui/derives/derives-span-Ord-enum.stderr
src/test/ui/derives/derives-span-Ord-struct.stderr
src/test/ui/derives/derives-span-Ord-tuple-struct.stderr
src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
src/test/ui/derives/derives-span-PartialOrd-enum.stderr
src/test/ui/derives/derives-span-PartialOrd-struct.stderr
src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
src/test/ui/derives/deriving-no-inner-impl-error-message.stderr
src/test/ui/did_you_mean/compatible-variants.rs [new file with mode: 0644]
src/test/ui/did_you_mean/compatible-variants.stderr [new file with mode: 0644]
src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr
src/test/ui/did_you_mean/issue-42764.rs
src/test/ui/did_you_mean/issue-42764.stderr
src/test/ui/drop/issue-90752-raw-ptr-shenanigans.rs [new file with mode: 0644]
src/test/ui/drop/issue-90752.rs [new file with mode: 0644]
src/test/ui/dropck/cleanup-arm-conditional.rs [new file with mode: 0644]
src/test/ui/dyn-trait-compatibility.rs [deleted file]
src/test/ui/dyn-trait-compatibility.stderr [deleted file]
src/test/ui/early-vtbl-resolution.rs [deleted file]
src/test/ui/edition-keywords-2015-2018.rs [deleted file]
src/test/ui/edition-keywords-2018-2018.rs [deleted file]
src/test/ui/editions/edition-keywords-2015-2018.rs [new file with mode: 0644]
src/test/ui/editions/edition-keywords-2018-2018.rs [new file with mode: 0644]
src/test/ui/empty/empty-attributes.rs [new file with mode: 0644]
src/test/ui/empty/empty-attributes.stderr [new file with mode: 0644]
src/test/ui/empty/empty-struct-unit-expr.stderr
src/test/ui/error-codes/E0275.stderr
src/test/ui/error-codes/E0276.stderr
src/test/ui/error-codes/E0283.stderr
src/test/ui/error-codes/E0365.rs
src/test/ui/error-codes/E0365.stderr
src/test/ui/error-codes/E0618.stderr
src/test/ui/export-fully-qualified.rs [deleted file]
src/test/ui/export-fully-qualified.stderr [deleted file]
src/test/ui/export-tag-variant.rs [deleted file]
src/test/ui/export-tag-variant.stderr [deleted file]
src/test/ui/export.rs [deleted file]
src/test/ui/export.stderr [deleted file]
src/test/ui/expr-block-slot.rs [deleted file]
src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
src/test/ui/extern/auxiliary/no-mangle-associated-fn.rs [new file with mode: 0644]
src/test/ui/extern/no-mangle-associated-fn.rs [new file with mode: 0644]
src/test/ui/feature-gates/feature-gate-associated_type_bounds.stderr
src/test/ui/feature-gates/feature-gate-inline_const_pat.rs [new file with mode: 0644]
src/test/ui/feature-gates/feature-gate-inline_const_pat.stderr [new file with mode: 0644]
src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
src/test/ui/float-literal-inference-restrictions.rs [deleted file]
src/test/ui/float-literal-inference-restrictions.stderr [deleted file]
src/test/ui/fmt/ifmt-unimpl.stderr
src/test/ui/fn/fun-call-variants.rs [new file with mode: 0644]
src/test/ui/for-loop-while/break-outside-loop.rs [new file with mode: 0644]
src/test/ui/for-loop-while/break-outside-loop.stderr [new file with mode: 0644]
src/test/ui/for-loop-while/break-while-condition.rs [new file with mode: 0644]
src/test/ui/for-loop-while/break-while-condition.stderr [new file with mode: 0644]
src/test/ui/for/for-c-in-str.rs
src/test/ui/for/for-c-in-str.stderr
src/test/ui/for/for-loop-bogosity.stderr
src/test/ui/for/for-loop-unconstrained-element-type.stderr
src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr
src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr
src/test/ui/fun-call-variants.rs [deleted file]
src/test/ui/generator/yield-outside-generator-issue-78653.stderr
src/test/ui/generic-associated-types/impl_bounds.stderr
src/test/ui/generic-associated-types/issue-86483.stderr
src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs
src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr
src/test/ui/half-open-range-patterns/range_pat_interactions0.rs
src/test/ui/half-open-range-patterns/range_pat_interactions3.rs
src/test/ui/half-open-range-patterns/range_pat_interactions3.stderr
src/test/ui/hrtb/issue-30786.migrate.stderr
src/test/ui/hrtb/issue-30786.nll.stderr
src/test/ui/hrtb/issue-62203-hrtb-ice.stderr
src/test/ui/hygiene/thread-local-not-in-prelude.rs [new file with mode: 0644]
src/test/ui/ignore-all-the-things.rs [deleted file]
src/test/ui/immut-function-arguments.rs [deleted file]
src/test/ui/immut-function-arguments.stderr [deleted file]
src/test/ui/impl-privacy-xc-2.rs [deleted file]
src/test/ui/impl-trait/issue-55872-1.stderr
src/test/ui/impl-trait/issues/issue-78722.stderr
src/test/ui/imports/absolute-paths-in-nested-use-groups.rs [new file with mode: 0644]
src/test/ui/imports/absolute-paths-in-nested-use-groups.stderr [new file with mode: 0644]
src/test/ui/imports/reexport-star.rs [new file with mode: 0644]
src/test/ui/inference/auxiliary/inference_unstable_iterator.rs
src/test/ui/inference/auxiliary/inference_unstable_itertools.rs
src/test/ui/inference/inference_unstable.rs
src/test/ui/inference/inference_unstable.stderr
src/test/ui/inference/issue-71732.stderr
src/test/ui/inference/newlambdas-ret-infer.rs [new file with mode: 0644]
src/test/ui/inference/newlambdas-ret-infer2.rs [new file with mode: 0644]
src/test/ui/inference/range-type-infer.rs [new file with mode: 0644]
src/test/ui/inference/tutorial-suffix-inference-test.rs [new file with mode: 0644]
src/test/ui/inference/tutorial-suffix-inference-test.stderr [new file with mode: 0644]
src/test/ui/inference/type-infer-generalize-ty-var.rs [new file with mode: 0644]
src/test/ui/init-large-type.rs [deleted file]
src/test/ui/inline-const/const-expr-array-init.rs
src/test/ui/inline-const/const-expr-basic.rs
src/test/ui/inline-const/const-expr-inference.rs
src/test/ui/inline-const/const-expr-lifetime-err.rs
src/test/ui/inline-const/const-expr-lifetime-err.stderr
src/test/ui/inline-const/const-expr-lifetime.rs
src/test/ui/inline-const/const-expr-macro.rs
src/test/ui/inline-const/const-expr-reference.rs
src/test/ui/inline-const/const-match-pat-generic.rs
src/test/ui/inline-const/const-match-pat-inference.rs
src/test/ui/inline-const/const-match-pat-lifetime-err.rs
src/test/ui/inline-const/const-match-pat-lifetime.rs
src/test/ui/inline-const/const-match-pat-range.rs
src/test/ui/inline-const/const-match-pat.rs
src/test/ui/issue-73914.rs [deleted file]
src/test/ui/issues/auxiliary/issue-69725.rs [deleted file]
src/test/ui/issues/issue-14853.stderr
src/test/ui/issues/issue-17651.stderr
src/test/ui/issues/issue-18611.stderr
src/test/ui/issues/issue-18937.rs
src/test/ui/issues/issue-18937.stderr
src/test/ui/issues/issue-20162.stderr
src/test/ui/issues/issue-20261.stderr
src/test/ui/issues/issue-20413.stderr
src/test/ui/issues/issue-20605.stderr
src/test/ui/issues/issue-21160.stderr
src/test/ui/issues/issue-21974.stderr
src/test/ui/issues/issue-23966.stderr
src/test/ui/issues/issue-24424.stderr
src/test/ui/issues/issue-28098.stderr
src/test/ui/issues/issue-29147.stderr
src/test/ui/issues/issue-31173.rs
src/test/ui/issues/issue-31173.stderr
src/test/ui/issues/issue-32709.stderr
src/test/ui/issues/issue-33941.rs
src/test/ui/issues/issue-33941.stderr
src/test/ui/issues/issue-34229.stderr
src/test/ui/issues/issue-34334.stderr
src/test/ui/issues/issue-35677.rs [deleted file]
src/test/ui/issues/issue-35677.stderr [deleted file]
src/test/ui/issues/issue-39970.stderr
src/test/ui/issues/issue-47706-trait.stderr
src/test/ui/issues/issue-47706.stderr
src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr
src/test/ui/issues/issue-5358-1.stderr
src/test/ui/issues/issue-54954.stderr
src/test/ui/issues/issue-58022.stderr
src/test/ui/issues/issue-66353.stderr
src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
src/test/ui/issues/issue-69683.stderr
src/test/ui/issues/issue-69725.rs [deleted file]
src/test/ui/issues/issue-69725.stderr [deleted file]
src/test/ui/issues/issue-72690.stderr
src/test/ui/iterators/integral.stderr
src/test/ui/iterators/ranges.stderr
src/test/ui/iterators/string.stderr
src/test/ui/kindck-implicit-close-over-mut-var.rs [deleted file]
src/test/ui/lang-items/issue-87573.rs [new file with mode: 0644]
src/test/ui/lang-items/issue-87573.stderr [new file with mode: 0644]
src/test/ui/layout/debug.stderr
src/test/ui/layout/hexagon-enum.stderr
src/test/ui/layout/thumb-enum.stderr
src/test/ui/leak-unique-as-tydesc.rs [deleted file]
src/test/ui/lifetimes/issue-34979.stderr
src/test/ui/link-cfg-works.rs [deleted file]
src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs [new file with mode: 0644]
src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs [new file with mode: 0644]
src/test/ui/linkage-attr/link-cfg-works.rs [new file with mode: 0644]
src/test/ui/lint-cap.rs [deleted file]
src/test/ui/lint/dead-code/anon-const-in-pat.rs
src/test/ui/lint/lint-cap.rs [new file with mode: 0644]
src/test/ui/lint/unused/unused-attr-duplicate.rs [new file with mode: 0644]
src/test/ui/lint/unused/unused-attr-duplicate.stderr [new file with mode: 0644]
src/test/ui/liveness-assign-imm-local-after-ret.rs [deleted file]
src/test/ui/liveness/liveness-assign-imm-local-after-ret.rs [new file with mode: 0644]
src/test/ui/llvm-pr32379.rs [deleted file]
src/test/ui/lub-if.nll.stderr [deleted file]
src/test/ui/lub-if.rs [deleted file]
src/test/ui/lub-if.stderr [deleted file]
src/test/ui/macros/macro-use-all-and-none.stderr
src/test/ui/map-types.rs [deleted file]
src/test/ui/map-types.stderr [deleted file]
src/test/ui/marker_trait_attr/region-overlap.stderr
src/test/ui/match-on-negative-integer-ranges.rs [deleted file]
src/test/ui/match/issue-91058.rs [new file with mode: 0644]
src/test/ui/match/issue-91058.stderr [new file with mode: 0644]
src/test/ui/match/match-on-negative-integer-ranges.rs [new file with mode: 0644]
src/test/ui/matches2021.rs [deleted file]
src/test/ui/maybe-bounds-where.rs [deleted file]
src/test/ui/maybe-bounds-where.stderr [deleted file]
src/test/ui/minmax-stability-issue-23687.rs [deleted file]
src/test/ui/mir/issue-73914.rs [new file with mode: 0644]
src/test/ui/mismatched_types/abridged.stderr
src/test/ui/mismatched_types/assignment-operator-unimplemented.rs [new file with mode: 0644]
src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr [new file with mode: 0644]
src/test/ui/mismatched_types/closure-arg-count.stderr
src/test/ui/mismatched_types/closure-arg-type-mismatch.nll.stderr
src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
src/test/ui/mismatched_types/float-literal-inference-restrictions.rs [new file with mode: 0644]
src/test/ui/mismatched_types/float-literal-inference-restrictions.stderr [new file with mode: 0644]
src/test/ui/mismatched_types/issue-36053-2.stderr
src/test/ui/missing-trait-bounds/auxiliary/issue-69725.rs [new file with mode: 0644]
src/test/ui/missing-trait-bounds/issue-35677.fixed [new file with mode: 0644]
src/test/ui/missing-trait-bounds/issue-35677.rs [new file with mode: 0644]
src/test/ui/missing-trait-bounds/issue-35677.stderr [new file with mode: 0644]
src/test/ui/missing-trait-bounds/issue-69725.fixed [new file with mode: 0644]
src/test/ui/missing-trait-bounds/issue-69725.rs [new file with mode: 0644]
src/test/ui/missing-trait-bounds/issue-69725.stderr [new file with mode: 0644]
src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.fixed [new file with mode: 0644]
src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.rs [new file with mode: 0644]
src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr [new file with mode: 0644]
src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs [new file with mode: 0644]
src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr [new file with mode: 0644]
src/test/ui/modules/issue-56411.rs
src/test/ui/modules/issue-56411.stderr
src/test/ui/moves/move-of-addr-of-mut.rs [new file with mode: 0644]
src/test/ui/moves/move-of-addr-of-mut.stderr [new file with mode: 0644]
src/test/ui/multi-panic.rs [deleted file]
src/test/ui/native-print-no-runtime.rs [deleted file]
src/test/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
src/test/ui/newlambdas-ret-infer.rs [deleted file]
src/test/ui/newlambdas-ret-infer2.rs [deleted file]
src/test/ui/newtype-temporary.rs [deleted file]
src/test/ui/nll/dont-print-desugared.stderr
src/test/ui/nll/issue-53773.stderr
src/test/ui/nll/lub-if.nll.stderr [new file with mode: 0644]
src/test/ui/nll/lub-if.rs [new file with mode: 0644]
src/test/ui/nll/lub-if.stderr [new file with mode: 0644]
src/test/ui/no-mangle-associated-fn.rs [deleted file]
src/test/ui/no-std-1.rs [deleted file]
src/test/ui/no-std-2.rs [deleted file]
src/test/ui/no-std-3.rs [deleted file]
src/test/ui/no-stdio.rs [deleted file]
src/test/ui/no-type-for-node-ice.rs [deleted file]
src/test/ui/no-type-for-node-ice.stderr [deleted file]
src/test/ui/no_send-struct.rs [deleted file]
src/test/ui/no_send-struct.stderr [deleted file]
src/test/ui/non-legacy-modes.rs [deleted file]
src/test/ui/not-sync.rs [deleted file]
src/test/ui/not-sync.stderr [deleted file]
src/test/ui/on-unimplemented/multiple-impls.stderr
src/test/ui/on-unimplemented/on-impl.stderr
src/test/ui/once-move-out-on-heap.rs [deleted file]
src/test/ui/operator-associativity.rs [deleted file]
src/test/ui/operator-multidispatch.rs [deleted file]
src/test/ui/operator-overloading.rs [deleted file]
src/test/ui/overloaded-calls-nontuple.rs [deleted file]
src/test/ui/overloaded-calls-nontuple.stderr [deleted file]
src/test/ui/overloaded/overloaded-calls-nontuple.rs [new file with mode: 0644]
src/test/ui/overloaded/overloaded-calls-nontuple.stderr [new file with mode: 0644]
src/test/ui/parser/attribute-with-no-generics-in-parameter-list.rs [new file with mode: 0644]
src/test/ui/parser/attribute-with-no-generics-in-parameter-list.stderr [new file with mode: 0644]
src/test/ui/parser/auxiliary/issue-21146-inc.rs [deleted file]
src/test/ui/parser/auxiliary/issue-89971-outer-attr-following-inner-attr-ice.rs [deleted file]
src/test/ui/parser/dyn-trait-compatibility.rs [new file with mode: 0644]
src/test/ui/parser/dyn-trait-compatibility.stderr [new file with mode: 0644]
src/test/ui/parser/fn-header-semantic-fail.stderr
src/test/ui/parser/issue-10392-2.fixed [deleted file]
src/test/ui/parser/issue-10392-2.rs [deleted file]
src/test/ui/parser/issue-10392-2.stderr [deleted file]
src/test/ui/parser/issue-10392.rs [deleted file]
src/test/ui/parser/issue-10392.stderr [deleted file]
src/test/ui/parser/issue-10636-1.rs [deleted file]
src/test/ui/parser/issue-10636-1.stderr [deleted file]
src/test/ui/parser/issue-10636-2.rs [deleted file]
src/test/ui/parser/issue-10636-2.stderr [deleted file]
src/test/ui/parser/issue-13483.rs [deleted file]
src/test/ui/parser/issue-13483.stderr [deleted file]
src/test/ui/parser/issue-14303-enum.rs [deleted file]
src/test/ui/parser/issue-14303-enum.stderr [deleted file]
src/test/ui/parser/issue-14303-fn-def.rs [deleted file]
src/test/ui/parser/issue-14303-fn-def.stderr [deleted file]
src/test/ui/parser/issue-14303-fncall.full.stderr [deleted file]
src/test/ui/parser/issue-14303-fncall.generic_arg.stderr [deleted file]
src/test/ui/parser/issue-14303-fncall.rs [deleted file]
src/test/ui/parser/issue-14303-impl.rs [deleted file]
src/test/ui/parser/issue-14303-impl.stderr [deleted file]
src/test/ui/parser/issue-14303-path.rs [deleted file]
src/test/ui/parser/issue-14303-path.stderr [deleted file]
src/test/ui/parser/issue-14303-struct.rs [deleted file]
src/test/ui/parser/issue-14303-struct.stderr [deleted file]
src/test/ui/parser/issue-14303-trait.rs [deleted file]
src/test/ui/parser/issue-14303-trait.stderr [deleted file]
src/test/ui/parser/issue-15914.rs [deleted file]
src/test/ui/parser/issue-15914.stderr [deleted file]
src/test/ui/parser/issue-15980.rs [deleted file]
src/test/ui/parser/issue-15980.stderr [deleted file]
src/test/ui/parser/issue-1655.rs [deleted file]
src/test/ui/parser/issue-1655.stderr [deleted file]
src/test/ui/parser/issue-17383.rs [deleted file]
src/test/ui/parser/issue-17383.stderr [deleted file]
src/test/ui/parser/issue-17718-const-mut.rs [deleted file]
src/test/ui/parser/issue-17718-const-mut.stderr [deleted file]
src/test/ui/parser/issue-17904-2.rs [deleted file]
src/test/ui/parser/issue-17904-2.stderr [deleted file]
src/test/ui/parser/issue-17904.rs [deleted file]
src/test/ui/parser/issue-17904.stderr [deleted file]
src/test/ui/parser/issue-1802-1.rs [deleted file]
src/test/ui/parser/issue-1802-1.stderr [deleted file]
src/test/ui/parser/issue-1802-2.rs [deleted file]
src/test/ui/parser/issue-1802-2.stderr [deleted file]
src/test/ui/parser/issue-19096.rs [deleted file]
src/test/ui/parser/issue-19096.stderr [deleted file]
src/test/ui/parser/issue-19398.rs [deleted file]
src/test/ui/parser/issue-19398.stderr [deleted file]
src/test/ui/parser/issue-20616-1.rs [deleted file]
src/test/ui/parser/issue-20616-1.stderr [deleted file]
src/test/ui/parser/issue-20616-2.rs [deleted file]
src/test/ui/parser/issue-20616-2.stderr [deleted file]
src/test/ui/parser/issue-20616-3.rs [deleted file]
src/test/ui/parser/issue-20616-3.stderr [deleted file]
src/test/ui/parser/issue-20616-4.rs [deleted file]
src/test/ui/parser/issue-20616-4.stderr [deleted file]
src/test/ui/parser/issue-20616-5.rs [deleted file]
src/test/ui/parser/issue-20616-5.stderr [deleted file]
src/test/ui/parser/issue-20616-6.rs [deleted file]
src/test/ui/parser/issue-20616-6.stderr [deleted file]
src/test/ui/parser/issue-20616-7.rs [deleted file]
src/test/ui/parser/issue-20616-7.stderr [deleted file]
src/test/ui/parser/issue-20616-8.rs [deleted file]
src/test/ui/parser/issue-20616-8.stderr [deleted file]
src/test/ui/parser/issue-20616-9.rs [deleted file]
src/test/ui/parser/issue-20616-9.stderr [deleted file]
src/test/ui/parser/issue-20711-2.rs [deleted file]
src/test/ui/parser/issue-20711-2.stderr [deleted file]
src/test/ui/parser/issue-20711.rs [deleted file]
src/test/ui/parser/issue-20711.stderr [deleted file]
src/test/ui/parser/issue-21146.rs [deleted file]
src/test/ui/parser/issue-21146.stderr [deleted file]
src/test/ui/parser/issue-21153.rs [deleted file]
src/test/ui/parser/issue-21153.stderr [deleted file]
src/test/ui/parser/issue-21475.rs [deleted file]
src/test/ui/parser/issue-22647.rs [deleted file]
src/test/ui/parser/issue-22647.stderr [deleted file]
src/test/ui/parser/issue-22712.rs [deleted file]
src/test/ui/parser/issue-22712.stderr [deleted file]
src/test/ui/parser/issue-2354-1.rs [deleted file]
src/test/ui/parser/issue-2354-1.stderr [deleted file]
src/test/ui/parser/issue-2354.rs [deleted file]
src/test/ui/parser/issue-2354.stderr [deleted file]
src/test/ui/parser/issue-23620-invalid-escapes.rs [deleted file]
src/test/ui/parser/issue-23620-invalid-escapes.stderr [deleted file]
src/test/ui/parser/issue-24197.rs [deleted file]
src/test/ui/parser/issue-24197.stderr [deleted file]
src/test/ui/parser/issue-24375.rs [deleted file]
src/test/ui/parser/issue-24375.stderr [deleted file]
src/test/ui/parser/issue-24780.rs [deleted file]
src/test/ui/parser/issue-24780.stderr [deleted file]
src/test/ui/parser/issue-27255.rs [deleted file]
src/test/ui/parser/issue-27255.stderr [deleted file]
src/test/ui/parser/issue-30318.fixed [deleted file]
src/test/ui/parser/issue-30318.rs [deleted file]
src/test/ui/parser/issue-30318.stderr [deleted file]
src/test/ui/parser/issue-3036.fixed [deleted file]
src/test/ui/parser/issue-3036.rs [deleted file]
src/test/ui/parser/issue-3036.stderr [deleted file]
src/test/ui/parser/issue-31804.rs [deleted file]
src/test/ui/parser/issue-31804.stderr [deleted file]
src/test/ui/parser/issue-32214.rs [deleted file]
src/test/ui/parser/issue-32214.stderr [deleted file]
src/test/ui/parser/issue-32446.rs [deleted file]
src/test/ui/parser/issue-32446.stderr [deleted file]
src/test/ui/parser/issue-32501.rs [deleted file]
src/test/ui/parser/issue-32501.stderr [deleted file]
src/test/ui/parser/issue-32505.rs [deleted file]
src/test/ui/parser/issue-32505.stderr [deleted file]
src/test/ui/parser/issue-33262.rs [deleted file]
src/test/ui/parser/issue-33262.stderr [deleted file]
src/test/ui/parser/issue-33413.rs [deleted file]
src/test/ui/parser/issue-33413.stderr [deleted file]
src/test/ui/parser/issue-33418.fixed [deleted file]
src/test/ui/parser/issue-33418.rs [deleted file]
src/test/ui/parser/issue-33418.stderr [deleted file]
src/test/ui/parser/issue-33455.rs [deleted file]
src/test/ui/parser/issue-33455.stderr [deleted file]
src/test/ui/parser/issue-34222-1.rs [deleted file]
src/test/ui/parser/issue-34222-1.stderr [deleted file]
src/test/ui/parser/issue-34255-1.rs [deleted file]
src/test/ui/parser/issue-34255-1.stderr [deleted file]
src/test/ui/parser/issue-35813-postfix-after-cast.rs [deleted file]
src/test/ui/parser/issue-35813-postfix-after-cast.stderr [deleted file]
src/test/ui/parser/issue-41155.rs [deleted file]
src/test/ui/parser/issue-41155.stderr [deleted file]
src/test/ui/parser/issue-43196.rs [deleted file]
src/test/ui/parser/issue-43196.stderr [deleted file]
src/test/ui/parser/issue-43692.rs [deleted file]
src/test/ui/parser/issue-43692.stderr [deleted file]
src/test/ui/parser/issue-44021.rs [deleted file]
src/test/ui/parser/issue-44021.stderr [deleted file]
src/test/ui/parser/issue-44406.rs [deleted file]
src/test/ui/parser/issue-44406.stderr [deleted file]
src/test/ui/parser/issue-45296.rs [deleted file]
src/test/ui/parser/issue-45296.stderr [deleted file]
src/test/ui/parser/issue-46186.fixed [deleted file]
src/test/ui/parser/issue-46186.rs [deleted file]
src/test/ui/parser/issue-46186.stderr [deleted file]
src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs [deleted file]
src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr [deleted file]
src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items.rs [deleted file]
src/test/ui/parser/issue-48508-aux.rs [deleted file]
src/test/ui/parser/issue-48508.rs [deleted file]
src/test/ui/parser/issue-48636.fixed [deleted file]
src/test/ui/parser/issue-48636.rs [deleted file]
src/test/ui/parser/issue-48636.stderr [deleted file]
src/test/ui/parser/issue-49040.rs [deleted file]
src/test/ui/parser/issue-49040.stderr [deleted file]
src/test/ui/parser/issue-51602.rs [deleted file]
src/test/ui/parser/issue-51602.stderr [deleted file]
src/test/ui/parser/issue-52496.rs [deleted file]
src/test/ui/parser/issue-52496.stderr [deleted file]
src/test/ui/parser/issue-54521-1.rs [deleted file]
src/test/ui/parser/issue-54521-2.fixed [deleted file]
src/test/ui/parser/issue-54521-2.rs [deleted file]
src/test/ui/parser/issue-54521-2.stderr [deleted file]
src/test/ui/parser/issue-54521-3.fixed [deleted file]
src/test/ui/parser/issue-54521-3.rs [deleted file]
src/test/ui/parser/issue-54521-3.stderr [deleted file]
src/test/ui/parser/issue-5544-a.rs [deleted file]
src/test/ui/parser/issue-5544-a.stderr [deleted file]
src/test/ui/parser/issue-5544-b.rs [deleted file]
src/test/ui/parser/issue-5544-b.stderr [deleted file]
src/test/ui/parser/issue-56031.rs [deleted file]
src/test/ui/parser/issue-56031.stderr [deleted file]
src/test/ui/parser/issue-57198.rs [deleted file]
src/test/ui/parser/issue-57198.stderr [deleted file]
src/test/ui/parser/issue-57684.fixed [deleted file]
src/test/ui/parser/issue-57684.rs [deleted file]
src/test/ui/parser/issue-57684.stderr [deleted file]
src/test/ui/parser/issue-57819.fixed [deleted file]
src/test/ui/parser/issue-57819.rs [deleted file]
src/test/ui/parser/issue-57819.stderr [deleted file]
src/test/ui/parser/issue-5806.rs [deleted file]
src/test/ui/parser/issue-5806.stderr [deleted file]
src/test/ui/parser/issue-58094-missing-right-square-bracket.rs [deleted file]
src/test/ui/parser/issue-58094-missing-right-square-bracket.stderr [deleted file]
src/test/ui/parser/issue-58856-1.rs [deleted file]
src/test/ui/parser/issue-58856-1.stderr [deleted file]
src/test/ui/parser/issue-58856-2.rs [deleted file]
src/test/ui/parser/issue-58856-2.stderr [deleted file]
src/test/ui/parser/issue-59418.rs [deleted file]
src/test/ui/parser/issue-59418.stderr [deleted file]
src/test/ui/parser/issue-60075.rs [deleted file]
src/test/ui/parser/issue-60075.stderr [deleted file]
src/test/ui/parser/issue-62524.rs [deleted file]
src/test/ui/parser/issue-62524.stderr [deleted file]
src/test/ui/parser/issue-62546.rs [deleted file]
src/test/ui/parser/issue-62546.stderr [deleted file]
src/test/ui/parser/issue-62554.rs [deleted file]
src/test/ui/parser/issue-62554.stderr [deleted file]
src/test/ui/parser/issue-62660.rs [deleted file]
src/test/ui/parser/issue-62660.stderr [deleted file]
src/test/ui/parser/issue-62881.rs [deleted file]
src/test/ui/parser/issue-62881.stderr [deleted file]
src/test/ui/parser/issue-62894.rs [deleted file]
src/test/ui/parser/issue-62894.stderr [deleted file]
src/test/ui/parser/issue-62895.rs [deleted file]
src/test/ui/parser/issue-62895.stderr [deleted file]
src/test/ui/parser/issue-62913.rs [deleted file]
src/test/ui/parser/issue-62913.stderr [deleted file]
src/test/ui/parser/issue-62973.rs [deleted file]
src/test/ui/parser/issue-62973.stderr [deleted file]
src/test/ui/parser/issue-63115-range-pat-interpolated.rs [deleted file]
src/test/ui/parser/issue-63116.rs [deleted file]
src/test/ui/parser/issue-63116.stderr [deleted file]
src/test/ui/parser/issue-63135.rs [deleted file]
src/test/ui/parser/issue-63135.stderr [deleted file]
src/test/ui/parser/issue-64732.rs [deleted file]
src/test/ui/parser/issue-64732.stderr [deleted file]
src/test/ui/parser/issue-65041-empty-vis-matcher-in-enum.rs [deleted file]
src/test/ui/parser/issue-65041-empty-vis-matcher-in-trait.rs [deleted file]
src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.rs [deleted file]
src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.stderr [deleted file]
src/test/ui/parser/issue-65257-invalid-var-decl-recovery.rs [deleted file]
src/test/ui/parser/issue-65257-invalid-var-decl-recovery.stderr [deleted file]
src/test/ui/parser/issue-65846-rollback-gating-failing-matcher.rs [deleted file]
src/test/ui/parser/issue-6610.rs [deleted file]
src/test/ui/parser/issue-6610.stderr [deleted file]
src/test/ui/parser/issue-66357-unexpected-unreachable.rs [deleted file]
src/test/ui/parser/issue-66357-unexpected-unreachable.stderr [deleted file]
src/test/ui/parser/issue-66473.rs [deleted file]
src/test/ui/parser/issue-66473.stderr [deleted file]
src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.fixed [deleted file]
src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.rs [deleted file]
src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.stderr [deleted file]
src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.rs [deleted file]
src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.stderr [deleted file]
src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.rs [deleted file]
src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.stderr [deleted file]
src/test/ui/parser/issue-68629.rs [deleted file]
src/test/ui/parser/issue-68629.stderr [deleted file]
src/test/ui/parser/issue-68730.rs [deleted file]
src/test/ui/parser/issue-68730.stderr [deleted file]
src/test/ui/parser/issue-68788-in-trait-item-propagation.rs [deleted file]
src/test/ui/parser/issue-68890-2.rs [deleted file]
src/test/ui/parser/issue-68890-2.stderr [deleted file]
src/test/ui/parser/issue-68890.rs [deleted file]
src/test/ui/parser/issue-68890.stderr [deleted file]
src/test/ui/parser/issue-70050-ntliteral-accepts-negated-lit.rs [deleted file]
src/test/ui/parser/issue-70388-recover-dotdotdot-rest-pat.rs [deleted file]
src/test/ui/parser/issue-70388-recover-dotdotdot-rest-pat.stderr [deleted file]
src/test/ui/parser/issue-70388-without-witness.fixed [deleted file]
src/test/ui/parser/issue-70388-without-witness.rs [deleted file]
src/test/ui/parser/issue-70388-without-witness.stderr [deleted file]
src/test/ui/parser/issue-70549-resolve-after-recovered-self-ctor.rs [deleted file]
src/test/ui/parser/issue-70549-resolve-after-recovered-self-ctor.stderr [deleted file]
src/test/ui/parser/issue-70552-ascription-in-parens-after-call.rs [deleted file]
src/test/ui/parser/issue-70552-ascription-in-parens-after-call.stderr [deleted file]
src/test/ui/parser/issue-70583-block-is-empty-1.rs [deleted file]
src/test/ui/parser/issue-70583-block-is-empty-1.stderr [deleted file]
src/test/ui/parser/issue-70583-block-is-empty-2.rs [deleted file]
src/test/ui/parser/issue-70583-block-is-empty-2.stderr [deleted file]
src/test/ui/parser/issue-7222.rs [deleted file]
src/test/ui/parser/issue-72253.rs [deleted file]
src/test/ui/parser/issue-72253.stderr [deleted file]
src/test/ui/parser/issue-72373.rs [deleted file]
src/test/ui/parser/issue-72373.stderr [deleted file]
src/test/ui/parser/issue-73568-lifetime-after-mut.rs [deleted file]
src/test/ui/parser/issue-73568-lifetime-after-mut.stderr [deleted file]
src/test/ui/parser/issue-75599.rs [deleted file]
src/test/ui/parser/issue-76437-async.rs [deleted file]
src/test/ui/parser/issue-76437-async.stderr [deleted file]
src/test/ui/parser/issue-76437-const-async-unsafe.rs [deleted file]
src/test/ui/parser/issue-76437-const-async-unsafe.stderr [deleted file]
src/test/ui/parser/issue-76437-const-async.rs [deleted file]
src/test/ui/parser/issue-76437-const-async.stderr [deleted file]
src/test/ui/parser/issue-76437-const.rs [deleted file]
src/test/ui/parser/issue-76437-const.stderr [deleted file]
src/test/ui/parser/issue-76437-pub-crate-unsafe.rs [deleted file]
src/test/ui/parser/issue-76437-pub-crate-unsafe.stderr [deleted file]
src/test/ui/parser/issue-76437-unsafe.rs [deleted file]
src/test/ui/parser/issue-76437-unsafe.stderr [deleted file]
src/test/ui/parser/issue-76597.fixed [deleted file]
src/test/ui/parser/issue-76597.rs [deleted file]
src/test/ui/parser/issue-76597.stderr [deleted file]
src/test/ui/parser/issue-7970b.rs [deleted file]
src/test/ui/parser/issue-7970b.stderr [deleted file]
src/test/ui/parser/issue-81806.rs [deleted file]
src/test/ui/parser/issue-81806.stderr [deleted file]
src/test/ui/parser/issue-83639.rs [deleted file]
src/test/ui/parser/issue-83639.stderr [deleted file]
src/test/ui/parser/issue-84104.rs [deleted file]
src/test/ui/parser/issue-84104.stderr [deleted file]
src/test/ui/parser/issue-84117.rs [deleted file]
src/test/ui/parser/issue-84117.stderr [deleted file]
src/test/ui/parser/issue-84148-1.rs [deleted file]
src/test/ui/parser/issue-84148-1.stderr [deleted file]
src/test/ui/parser/issue-84148-2.rs [deleted file]
src/test/ui/parser/issue-84148-2.stderr [deleted file]
src/test/ui/parser/issue-8537.rs [deleted file]
src/test/ui/parser/issue-8537.stderr [deleted file]
src/test/ui/parser/issue-86895.rs [deleted file]
src/test/ui/parser/issue-86895.stderr [deleted file]
src/test/ui/parser/issue-87086-colon-path-sep.rs [deleted file]
src/test/ui/parser/issue-87086-colon-path-sep.stderr [deleted file]
src/test/ui/parser/issue-87197-missing-semicolon.fixed [deleted file]
src/test/ui/parser/issue-87197-missing-semicolon.rs [deleted file]
src/test/ui/parser/issue-87197-missing-semicolon.stderr [deleted file]
src/test/ui/parser/issue-87217-keyword-order/const-async-const.rs [deleted file]
src/test/ui/parser/issue-87217-keyword-order/const-async-const.stderr [deleted file]
src/test/ui/parser/issue-87217-keyword-order/several-kw-jump.rs [deleted file]
src/test/ui/parser/issue-87217-keyword-order/several-kw-jump.stderr [deleted file]
src/test/ui/parser/issue-87217-keyword-order/wrong-async.rs [deleted file]
src/test/ui/parser/issue-87217-keyword-order/wrong-async.stderr [deleted file]
src/test/ui/parser/issue-87217-keyword-order/wrong-const.rs [deleted file]
src/test/ui/parser/issue-87217-keyword-order/wrong-const.stderr [deleted file]
src/test/ui/parser/issue-87217-keyword-order/wrong-unsafe.rs [deleted file]
src/test/ui/parser/issue-87217-keyword-order/wrong-unsafe.stderr [deleted file]
src/test/ui/parser/issue-87635.rs [deleted file]
src/test/ui/parser/issue-87635.stderr [deleted file]
src/test/ui/parser/issue-87812-path.rs [deleted file]
src/test/ui/parser/issue-87812-path.stderr [deleted file]
src/test/ui/parser/issue-87812.rs [deleted file]
src/test/ui/parser/issue-87812.stderr [deleted file]
src/test/ui/parser/issue-88276-unary-plus.fixed [deleted file]
src/test/ui/parser/issue-88276-unary-plus.rs [deleted file]
src/test/ui/parser/issue-88276-unary-plus.stderr [deleted file]
src/test/ui/parser/issue-88583-union-as-ident.rs [deleted file]
src/test/ui/parser/issue-88770.rs [deleted file]
src/test/ui/parser/issue-88770.stderr [deleted file]
src/test/ui/parser/issue-88818.rs [deleted file]
src/test/ui/parser/issue-88818.stderr [deleted file]
src/test/ui/parser/issue-89388.rs [deleted file]
src/test/ui/parser/issue-89388.stderr [deleted file]
src/test/ui/parser/issue-89396.fixed [deleted file]
src/test/ui/parser/issue-89396.rs [deleted file]
src/test/ui/parser/issue-89396.stderr [deleted file]
src/test/ui/parser/issue-89574.rs [deleted file]
src/test/ui/parser/issue-89574.stderr [deleted file]
src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.rs [deleted file]
src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.stderr [deleted file]
src/test/ui/parser/issue-90728.rs [new file with mode: 0644]
src/test/ui/parser/issue-90728.stderr [new file with mode: 0644]
src/test/ui/parser/issues/auxiliary/issue-21146-inc.rs [new file with mode: 0644]
src/test/ui/parser/issues/auxiliary/issue-89971-outer-attr-following-inner-attr-ice.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-10392-2.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-10392-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-10392-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-10392.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-10392.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-10636-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-10636-1.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-10636-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-10636-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-13483.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-13483.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-enum.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-enum.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-fn-def.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-fn-def.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-fncall.full.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-fncall.generic_arg.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-fncall.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-impl.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-impl.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-path.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-path.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-struct.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-struct.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-trait.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-14303-trait.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-15914.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-15914.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-15980.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-15980.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-1655.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-1655.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-17383.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-17383.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-17718-const-mut.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-17718-const-mut.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-17904-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-17904-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-17904.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-17904.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-1802-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-1802-1.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-1802-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-1802-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-19096.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-19096.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-19398.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-19398.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-1.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-3.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-3.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-4.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-4.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-5.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-5.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-6.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-6.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-7.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-7.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-8.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-8.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-9.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20616-9.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20711-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20711-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-20711.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-20711.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-21146.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-21146.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-21153.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-21153.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-21475.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-22647.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-22647.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-22712.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-22712.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-2354-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-2354-1.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-2354.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-2354.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-23620-invalid-escapes.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-23620-invalid-escapes.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-24197.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-24197.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-24375.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-24375.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-24780.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-24780.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-27255.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-27255.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-30318.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-30318.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-30318.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-3036.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-3036.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-3036.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-31804.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-31804.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-32214.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-32214.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-32446.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-32446.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-32501.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-32501.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-32505.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-32505.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-33262.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-33262.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-33413.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-33413.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-33418.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-33418.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-33418.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-33455.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-33455.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-34222-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-34222-1.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-34255-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-34255-1.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-35813-postfix-after-cast.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-41155.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-41155.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-43196.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-43196.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-43692.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-43692.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-44021.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-44021.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-44406.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-44406.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-45296.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-45296.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-46186.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-46186.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-46186.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-48508-aux.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-48508.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-48636.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-48636.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-48636.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-49040.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-49040.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-51602.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-51602.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-52496.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-52496.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-54521-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-54521-2.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-54521-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-54521-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-54521-3.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-54521-3.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-54521-3.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-5544-a.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-5544-a.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-5544-b.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-5544-b.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-56031.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-56031.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-57198.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-57198.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-57684.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-57684.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-57684.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-57819.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-57819.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-57819.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-5806.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-5806.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-58094-missing-right-square-bracket.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-58856-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-58856-1.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-58856-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-58856-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-59418.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-59418.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-60075.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-60075.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-62524.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-62524.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-62546.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-62546.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-62554.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-62554.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-62660.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-62660.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-62881.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-62881.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-62894.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-62894.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-62895.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-62895.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-62913.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-62913.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-62973.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-62973.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-63115-range-pat-interpolated.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-63116.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-63116.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-63135.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-63135.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-64732.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-64732.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-65041-empty-vis-matcher-in-enum.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-65041-empty-vis-matcher-in-trait.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-65846-rollback-gating-failing-matcher.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-6610.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-6610.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-66357-unexpected-unreachable.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-66357-unexpected-unreachable.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-66473.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-66473.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-68629.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-68629.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-68730.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-68730.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-68788-in-trait-item-propagation.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-68890-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-68890-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-68890.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-68890.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-70050-ntliteral-accepts-negated-lit.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-70388-without-witness.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-70388-without-witness.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-70388-without-witness.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-70552-ascription-in-parens-after-call.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-70552-ascription-in-parens-after-call.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-70583-block-is-empty-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-70583-block-is-empty-1.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-70583-block-is-empty-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-70583-block-is-empty-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-7222.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-72253.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-72253.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-72373.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-72373.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-73568-lifetime-after-mut.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-73568-lifetime-after-mut.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-75599.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-async.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-async.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-const-async-unsafe.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-const-async-unsafe.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-const-async.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-const-async.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-const.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-const.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-pub-crate-unsafe.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-unsafe.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-76437-unsafe.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-76597.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-76597.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-76597.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-7970b.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-7970b.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-81806.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-81806.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-83639.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-83639.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-84104.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-84104.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-84117.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-84117.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-84148-1.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-84148-1.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-84148-2.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-84148-2.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-8537.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-8537.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-86895.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-86895.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87086-colon-path-sep.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87086-colon-path-sep.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87197-missing-semicolon.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-87197-missing-semicolon.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87197-missing-semicolon.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87635.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87635.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87812-path.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87812-path.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-87812.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-87812.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-88276-unary-plus.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-88276-unary-plus.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-88276-unary-plus.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-88583-union-as-ident.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-88770.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-88770.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-88818.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-88818.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-89388.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-89388.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-89396.fixed [new file with mode: 0644]
src/test/ui/parser/issues/issue-89396.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-89396.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-89574.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-89574.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr [new file with mode: 0644]
src/test/ui/parser/issues/issue-90993.rs [new file with mode: 0644]
src/test/ui/parser/issues/issue-90993.stderr [new file with mode: 0644]
src/test/ui/parser/operator-associativity.rs [new file with mode: 0644]
src/test/ui/parser/struct-literal-in-for.stderr
src/test/ui/pathless-extern-ok.rs [deleted file]
src/test/ui/pattern/ignore-all-the-things.rs [new file with mode: 0644]
src/test/ui/pattern/non-structural-match-types.rs
src/test/ui/pattern/pat-type-err-let-stmt.stderr
src/test/ui/placement-syntax.rs [deleted file]
src/test/ui/placement-syntax.stderr [deleted file]
src/test/ui/privacy/auxiliary/impl_privacy_xc_2.rs [new file with mode: 0644]
src/test/ui/privacy/auxiliary/reachable-unnameable-items.rs [new file with mode: 0644]
src/test/ui/privacy/crate-private-reexport.rs [new file with mode: 0644]
src/test/ui/privacy/crate-private-reexport.stderr [new file with mode: 0644]
src/test/ui/privacy/export-tag-variant.rs [new file with mode: 0644]
src/test/ui/privacy/export-tag-variant.stderr [new file with mode: 0644]
src/test/ui/privacy/impl-privacy-xc-2.rs [new file with mode: 0644]
src/test/ui/privacy/private-variant-reexport.rs
src/test/ui/privacy/private-variant-reexport.stderr
src/test/ui/privacy/reachable-unnameable-items.rs [new file with mode: 0644]
src/test/ui/process/core-run-destroy.rs [new file with mode: 0644]
src/test/ui/process/multi-panic.rs [new file with mode: 0644]
src/test/ui/process/no-stdio.rs [new file with mode: 0644]
src/test/ui/process/try-wait.rs [new file with mode: 0644]
src/test/ui/project-cache-issue-37154.rs [deleted file]
src/test/ui/pure-sum.rs [deleted file]
src/test/ui/range-type-infer.rs [deleted file]
src/test/ui/range/range-1.stderr
src/test/ui/range/range_traits-1.stderr
src/test/ui/raw-fat-ptr.rs [deleted file]
src/test/ui/reachable-unnameable-items.rs [deleted file]
src/test/ui/reachable/unreachable-loop-patterns.rs
src/test/ui/reachable/unreachable-loop-patterns.stderr
src/test/ui/reexport-star.rs [deleted file]
src/test/ui/regions/regions-bounded-method-type-parameters.stderr
src/test/ui/regions/regions-close-object-into-object-5.stderr
src/test/ui/regions/wf-bound-region-in-object-type.rs [new file with mode: 0644]
src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo.rs [new file with mode: 0644]
src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo2.rs [new file with mode: 0644]
src/test/ui/resolve/blind-item-mixed-crate-use-item.rs [new file with mode: 0644]
src/test/ui/resolve/blind-item-mixed-use-item.rs [new file with mode: 0644]
src/test/ui/resolve/export-fully-qualified.rs [new file with mode: 0644]
src/test/ui/resolve/export-fully-qualified.stderr [new file with mode: 0644]
src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
src/test/ui/resolve/no-std-1.rs [new file with mode: 0644]
src/test/ui/resolve/no-std-2.rs [new file with mode: 0644]
src/test/ui/resolve/no-std-3.rs [new file with mode: 0644]
src/test/ui/resolve/pathless-extern-ok.rs [new file with mode: 0644]
src/test/ui/resolve/privacy-enum-ctor.stderr
src/test/ui/retslot-cast.rs [deleted file]
src/test/ui/retslot-cast.stderr [deleted file]
src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr
src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs
src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr
src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr
src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr
src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stock.stderr
src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr
src/test/ui/runtime/atomic-print.rs [new file with mode: 0644]
src/test/ui/runtime/backtrace-debuginfo-aux.rs [new file with mode: 0644]
src/test/ui/runtime/backtrace-debuginfo.rs [new file with mode: 0644]
src/test/ui/runtime/native-print-no-runtime.rs [new file with mode: 0644]
src/test/ui/rust-2018/uniform-paths/macro-rules.rs
src/test/ui/rust-2018/uniform-paths/macro-rules.stderr
src/test/ui/safe-extern-statics-mut.mir.stderr [deleted file]
src/test/ui/safe-extern-statics-mut.rs [deleted file]
src/test/ui/safe-extern-statics-mut.thir.stderr [deleted file]
src/test/ui/safe-extern-statics.mir.stderr [deleted file]
src/test/ui/safe-extern-statics.rs [deleted file]
src/test/ui/safe-extern-statics.thir.stderr [deleted file]
src/test/ui/simd/intrinsic/generic-elements-pass.rs
src/test/ui/span/issue-29595.stderr
src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr
src/test/ui/stability-attribute/stability-in-private-module.rs [new file with mode: 0644]
src/test/ui/stability-attribute/stability-in-private-module.stderr [new file with mode: 0644]
src/test/ui/stability-attribute/suggest-vec-allocator-api.rs [new file with mode: 0644]
src/test/ui/stability-attribute/suggest-vec-allocator-api.stderr [new file with mode: 0644]
src/test/ui/stability-in-private-module.rs [deleted file]
src/test/ui/stability-in-private-module.stderr [deleted file]
src/test/ui/stack-protector/warn-stack-protector-unsupported.all.stderr [new file with mode: 0644]
src/test/ui/stack-protector/warn-stack-protector-unsupported.basic.stderr [new file with mode: 0644]
src/test/ui/stack-protector/warn-stack-protector-unsupported.rs [new file with mode: 0644]
src/test/ui/stack-protector/warn-stack-protector-unsupported.strong.stderr [new file with mode: 0644]
src/test/ui/static/auxiliary/extern-statics.rs [new file with mode: 0644]
src/test/ui/static/safe-extern-statics-mut.mir.stderr [new file with mode: 0644]
src/test/ui/static/safe-extern-statics-mut.rs [new file with mode: 0644]
src/test/ui/static/safe-extern-statics-mut.thir.stderr [new file with mode: 0644]
src/test/ui/static/safe-extern-statics.mir.stderr [new file with mode: 0644]
src/test/ui/static/safe-extern-statics.rs [new file with mode: 0644]
src/test/ui/static/safe-extern-statics.thir.stderr [new file with mode: 0644]
src/test/ui/static/thread-local-in-ctfe.rs [new file with mode: 0644]
src/test/ui/static/thread-local-in-ctfe.stderr [new file with mode: 0644]
src/test/ui/statics/issue-91050-1.rs [new file with mode: 0644]
src/test/ui/statics/issue-91050-2.rs [new file with mode: 0644]
src/test/ui/stdlib-unit-tests/matches2021.rs [new file with mode: 0644]
src/test/ui/stdlib-unit-tests/minmax-stability-issue-23687.rs [new file with mode: 0644]
src/test/ui/stdlib-unit-tests/not-sync.rs [new file with mode: 0644]
src/test/ui/stdlib-unit-tests/not-sync.stderr [new file with mode: 0644]
src/test/ui/stdlib-unit-tests/raw-fat-ptr.rs [new file with mode: 0644]
src/test/ui/stdlib-unit-tests/volatile-fat-ptr.rs [new file with mode: 0644]
src/test/ui/str/str-idx.stderr
src/test/ui/str/str-mut-idx.stderr
src/test/ui/structs/struct-path-alias-bounds.stderr
src/test/ui/substs-ppaux.normal.stderr [deleted file]
src/test/ui/substs-ppaux.rs [deleted file]
src/test/ui/substs-ppaux.verbose.stderr [deleted file]
src/test/ui/suffixed-literal-meta.rs [deleted file]
src/test/ui/suffixed-literal-meta.stderr [deleted file]
src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr
src/test/ui/suggestions/boxed-variant-field.rs
src/test/ui/suggestions/boxed-variant-field.stderr
src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
src/test/ui/suggestions/issue-62843.stderr
src/test/ui/suggestions/issue-72766.stderr
src/test/ui/suggestions/issue-81839.stderr
src/test/ui/suggestions/issue-84973.stderr
src/test/ui/suggestions/issue-90974.rs [new file with mode: 0644]
src/test/ui/suggestions/issue-90974.stderr [new file with mode: 0644]
src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr
src/test/ui/suggestions/match-prev-arm-needing-semi.rs
src/test/ui/suggestions/match-prev-arm-needing-semi.stderr
src/test/ui/suggestions/missing-trait-bound-for-op.fixed [deleted file]
src/test/ui/suggestions/missing-trait-bound-for-op.rs [deleted file]
src/test/ui/suggestions/missing-trait-bound-for-op.stderr [deleted file]
src/test/ui/suggestions/missing-trait-bounds-for-method-call.rs [deleted file]
src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr [deleted file]
src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr
src/test/ui/suggestions/opaque-type-error.stderr
src/test/ui/suggestions/slice-issue-87994.stderr
src/test/ui/suggestions/suggest-change-mut.stderr
src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr
src/test/ui/suggestions/suggest-remove-refs-1.stderr
src/test/ui/suggestions/suggest-remove-refs-2.stderr
src/test/ui/suggestions/suggest-remove-refs-3.stderr
src/test/ui/syntax-trait-polarity-feature-gate.rs [deleted file]
src/test/ui/syntax-trait-polarity-feature-gate.stderr [deleted file]
src/test/ui/synthetic-param.rs [deleted file]
src/test/ui/synthetic-param.stderr [deleted file]
src/test/ui/tail-direct.rs [deleted file]
src/test/ui/tcp-stress.rs [deleted file]
src/test/ui/thread-local-in-ctfe.rs [deleted file]
src/test/ui/thread-local-in-ctfe.stderr [deleted file]
src/test/ui/thread-local-not-in-prelude.rs [deleted file]
src/test/ui/threads-sendsync/clone-with-exterior.rs [new file with mode: 0644]
src/test/ui/threads-sendsync/tcp-stress.rs [new file with mode: 0644]
src/test/ui/traits/alignment-gep-tup-like-1.rs [new file with mode: 0644]
src/test/ui/traits/bad-method-typaram-kind.stderr
src/test/ui/traits/bad-sized.stderr
src/test/ui/traits/bound/on-structs-and-enums-locals.stderr
src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr
src/test/ui/traits/cycle-generic-bound.rs [new file with mode: 0644]
src/test/ui/traits/early-vtbl-resolution.rs [new file with mode: 0644]
src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr
src/test/ui/traits/issue-71136.stderr
src/test/ui/traits/issue-77982.stderr
src/test/ui/traits/issue-79458.stderr
src/test/ui/traits/issue-85735.stderr
src/test/ui/traits/map-types.rs [new file with mode: 0644]
src/test/ui/traits/map-types.stderr [new file with mode: 0644]
src/test/ui/traits/negative-impls/negated-auto-traits-error.stderr
src/test/ui/traits/no_send-struct.rs [new file with mode: 0644]
src/test/ui/traits/no_send-struct.stderr [new file with mode: 0644]
src/test/ui/traits/reservation-impl/no-use.stderr
src/test/ui/traits/static-method-generic-inference.stderr
src/test/ui/traits/suggest-where-clause.stderr
src/test/ui/traits/vtable-res-trait-param.stderr
src/test/ui/traits/vtable/vtable-diamond.stderr
src/test/ui/traits/vtable/vtable-multi-level.stderr
src/test/ui/traits/vtable/vtable-multiple.stderr
src/test/ui/traits/vtable/vtable-non-object-safe.stderr
src/test/ui/traits/vtable/vtable-vacant.stderr
src/test/ui/trivial-bounds/trivial-bounds-leak.stderr
src/test/ui/try-block/try-block-bad-type.stderr
src/test/ui/try-block/try-block-in-while.stderr
src/test/ui/try-block/try-is-identifier-edition2015.rs [new file with mode: 0644]
src/test/ui/try-is-identifier-edition2015.rs [deleted file]
src/test/ui/try-trait/bad-interconversion.stderr
src/test/ui/try-trait/option-to-result.stderr
src/test/ui/try-trait/try-on-option-diagnostics.stderr
src/test/ui/try-trait/try-on-option.stderr
src/test/ui/try-trait/try-operator-on-main.stderr
src/test/ui/try-wait.rs [deleted file]
src/test/ui/tutorial-suffix-inference-test.rs [deleted file]
src/test/ui/tutorial-suffix-inference-test.stderr [deleted file]
src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr
src/test/ui/type-ascription.rs [deleted file]
src/test/ui/type-infer-generalize-ty-var.rs [deleted file]
src/test/ui/type/type-ascription.rs [new file with mode: 0644]
src/test/ui/type/type-check-defaults.stderr
src/test/ui/type/type-check/issue-40294.stderr
src/test/ui/type/type-params-in-different-spaces-2.stderr
src/test/ui/typeck/issue-46112.stderr
src/test/ui/typeck/no-type-for-node-ice.rs [new file with mode: 0644]
src/test/ui/typeck/no-type-for-node-ice.stderr [new file with mode: 0644]
src/test/ui/typeck/project-cache-issue-37154.rs [new file with mode: 0644]
src/test/ui/typeck/ufcs-type-params.rs [new file with mode: 0644]
src/test/ui/typeck/unify-return-ty.rs [new file with mode: 0644]
src/test/ui/ufcs-type-params.rs [deleted file]
src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr
src/test/ui/unevaluated_fixed_size_array_len.stderr
src/test/ui/unify-return-ty.rs [deleted file]
src/test/ui/union/union-generic.mirunsafeck.stderr
src/test/ui/union/union-generic.thirunsafeck.stderr
src/test/ui/unsized/issue-71659.stderr
src/test/ui/unsized/maybe-bounds-where.rs [new file with mode: 0644]
src/test/ui/unsized/maybe-bounds-where.stderr [new file with mode: 0644]
src/test/ui/volatile-fat-ptr.rs [deleted file]
src/test/ui/wasm-import-module.rs [deleted file]
src/test/ui/wasm-import-module.stderr [deleted file]
src/test/ui/wasm/wasm-import-module.rs [new file with mode: 0644]
src/test/ui/wasm/wasm-import-module.stderr [new file with mode: 0644]
src/test/ui/wf-bound-region-in-object-type.rs [deleted file]
src/test/ui/wf/wf-foreign-fn-decl-ret.stderr
src/test/ui/where-clauses/where-clause-method-substituion.stderr
src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr
src/tools/cargo
src/tools/clippy/clippy_lints/src/loops/explicit_counter_loop.rs
src/tools/clippy/clippy_lints/src/loops/manual_memcpy.rs
src/tools/clippy/clippy_lints/src/loops/mod.rs
src/tools/clippy/clippy_lints/src/loops/never_loop.rs
src/tools/clippy/clippy_lints/src/loops/single_element_loop.rs
src/tools/clippy/clippy_lints/src/loops/utils.rs
src/tools/clippy/clippy_lints/src/misc.rs
src/tools/clippy/clippy_lints/src/pattern_type_mismatch.rs
src/tools/clippy/clippy_lints/src/types/borrowed_box.rs
src/tools/clippy/clippy_lints/src/unit_types/let_unit_value.rs
src/tools/clippy/clippy_utils/src/higher.rs
src/tools/clippy/tests/ui/author/for_loop.stdout
src/tools/rust-analyzer
src/tools/rustdoc-gui/tester.js
src/tools/tidy/src/style.rs
src/tools/tidy/src/ui_tests.rs

index 2827a46ae6f73e13c34d9159f8f953facd8d3270..223fd0065bf4a0cd78ba6847a3ec694f3e0da5eb 100644 (file)
@@ -3,13 +3,14 @@
 Thank you for your interest in contributing to Rust! There are many ways to contribute
 and we appreciate all of them.
 
+The best way to get started is by asking for help in the [#new
+members](https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members)
+Zulip stream. We have lots of docs below of how to get started on your own, but
+the Zulip stream is the best place to *ask* for help.
+
 Documentation for contributing to Rust is located in the [Guide to Rustc Development](https://rustc-dev-guide.rust-lang.org/),
 commonly known as the [rustc-dev-guide]. Despite the name, this guide documents
-not just how to develop rustc (the Rust compiler), but also how to contribute to any part
-of the Rust project.
-
-To get started with contributing, please read the [Contributing to Rust] chapter of the guide.
-That chapter explains how to get your development environment set up and how to get help.
+not just how to develop rustc (the Rust compiler), but also how to contribute to the standard library and rustdoc.
 
 ## About the [rustc-dev-guide]
 
index 28b922cf9137f05f49d30a80f53ba02bb03afb00..51ed441d0dbe7cfbdc2054899ee317ae9d0a082c 100644 (file)
@@ -888,9 +888,9 @@ dependencies = [
 
 [[package]]
 name = "curl"
-version = "0.4.40"
+version = "0.4.41"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "877cc2f9b8367e32b6dabb9d581557e651cb3aa693a37f8679091bbf42687d5d"
+checksum = "1bc6d233563261f8db6ffb83bbaad5a73837a6e6b28868e926337ebbdece0be3"
 dependencies = [
  "curl-sys",
  "libc",
@@ -903,9 +903,9 @@ dependencies = [
 
 [[package]]
 name = "curl-sys"
-version = "0.4.50+curl-7.79.1"
+version = "0.4.51+curl-7.80.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4856b76919dd599f31236bb18db5f5bd36e2ce131e64f857ca5c259665b76171"
+checksum = "d130987e6a6a34fe0889e1083022fa48cd90e6709a84be3fb8dd95801de5af20"
 dependencies = [
  "cc",
  "libc",
index 32fab9fc25de558febac046ab9b8f705e4fcd0d7..78edac9d12c13258b1d8b94ea9dd0d62244c577f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -7,7 +7,10 @@ standard library, and documentation.
 
 **Note: this README is for _users_ rather than _contributors_.
 If you wish to _contribute_ to the compiler, you should read the
-[Getting Started][gettingstarted] section of the rustc-dev-guide instead.**
+[Getting Started][gettingstarted] section of the rustc-dev-guide instead.
+You can ask for help in the [#new members Zulip stream][new-members].**
+
+[new-members]: https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members
 
 ## Quick Start
 
index e54fcaf6fc1b7dce988fda82a63f630d0f00f649..6f9ecb9cd21e094afbc71354b6dcac6e1565a517 100644 (file)
@@ -111,7 +111,7 @@ fn default() -> TypedArena<T> {
             // alloc() will trigger a grow().
             ptr: Cell::new(ptr::null_mut()),
             end: Cell::new(ptr::null_mut()),
-            chunks: RefCell::new(vec![]),
+            chunks: Default::default(),
             _own: PhantomData,
         }
     }
@@ -325,13 +325,17 @@ fn drop(&mut self) {
 
 unsafe impl<T: Send> Send for TypedArena<T> {}
 
+/// An arena that can hold objects of multiple different types that impl `Copy`
+/// and/or satisfy `!mem::needs_drop`.
 pub struct DroplessArena {
     /// A pointer to the start of the free space.
     start: Cell<*mut u8>,
 
     /// A pointer to the end of free space.
     ///
-    /// The allocation proceeds from the end of the chunk towards the start.
+    /// The allocation proceeds downwards from the end of the chunk towards the
+    /// start. (This is slightly simpler and faster than allocating upwards,
+    /// see <https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html>.)
     /// When this pointer crosses the start pointer, a new chunk is allocated.
     end: Cell<*mut u8>,
 
@@ -516,10 +520,14 @@ pub fn alloc_from_iter<T, I: IntoIterator<Item = T>>(&self, iter: I) -> &mut [T]
     }
 }
 
+// Declare an `Arena` containing one dropless arena and many typed arenas (the
+// types of the typed arenas are specified by the arguments). The dropless
+// arena will be used for any types that impl `Copy`, and also for any of the
+// specified types that satisfy `!mem::needs_drop`.
 #[rustc_macro_transparency = "semitransparent"]
-pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) {
+pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) {
     #[derive(Default)]
-    pub struct Arena<$tcx> {
+    pub struct Arena<'tcx> {
         pub dropless: $crate::DroplessArena,
         $($name: $crate::TypedArena<$ty>,)*
     }
@@ -532,6 +540,7 @@ fn allocate_from_iter<'a>(
         ) -> &'a mut [Self];
     }
 
+    // Any type that impls `Copy` can be arena-allocated in the `DroplessArena`.
     impl<'tcx, T: Copy> ArenaAllocatable<'tcx, ()> for T {
         #[inline]
         fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self {
@@ -544,12 +553,11 @@ fn allocate_from_iter<'a>(
         ) -> &'a mut [Self] {
             arena.dropless.alloc_from_iter(iter)
         }
-
     }
     $(
-        impl<$tcx> ArenaAllocatable<$tcx, $ty> for $ty {
+        impl<'tcx> ArenaAllocatable<'tcx, $ty> for $ty {
             #[inline]
-            fn allocate_on<'a>(self, arena: &'a Arena<$tcx>) -> &'a mut Self {
+            fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self {
                 if !::std::mem::needs_drop::<Self>() {
                     arena.dropless.alloc(self)
                 } else {
@@ -559,7 +567,7 @@ fn allocate_on<'a>(self, arena: &'a Arena<$tcx>) -> &'a mut Self {
 
             #[inline]
             fn allocate_from_iter<'a>(
-                arena: &'a Arena<$tcx>,
+                arena: &'a Arena<'tcx>,
                 iter: impl ::std::iter::IntoIterator<Item = Self>,
             ) -> &'a mut [Self] {
                 if !::std::mem::needs_drop::<Self>() {
@@ -577,6 +585,7 @@ pub fn alloc<T: ArenaAllocatable<'tcx, U>, U>(&self, value: T) -> &mut T {
             value.allocate_on(self)
         }
 
+        // Any type that impls `Copy` can have slices be arena-allocated in the `DroplessArena`.
         #[inline]
         pub fn alloc_slice<T: ::std::marker::Copy>(&self, value: &[T]) -> &mut [T] {
             if value.is_empty() {
index 405e9035c4c1922f392a6b6502ff7d36d6cec885..a0a63620c08a9e02fae235ec9ed36a2b56a71cb5 100644 (file)
@@ -13,7 +13,7 @@
 use rustc_span::hygiene::ExpnId;
 use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned};
 use rustc_span::symbol::{sym, Ident, Symbol};
-use rustc_span::{hygiene::ForLoopLoc, DUMMY_SP};
+use rustc_span::DUMMY_SP;
 
 impl<'hir> LoweringContext<'_, 'hir> {
     fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] {
@@ -1308,16 +1308,13 @@ fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::Expr
     /// Desugar `ExprForLoop` from: `[opt_ident]: for <pat> in <head> <body>` into:
     /// ```rust
     /// {
-    ///     let result = match ::std::iter::IntoIterator::into_iter(<head>) {
+    ///     let result = match IntoIterator::into_iter(<head>) {
     ///         mut iter => {
     ///             [opt_ident]: loop {
-    ///                 let mut __next;
-    ///                 match ::std::iter::Iterator::next(&mut iter) {
-    ///                     ::std::option::Option::Some(val) => __next = val,
-    ///                     ::std::option::Option::None => break
+    ///                 match Iterator::next(&mut iter) {
+    ///                     None => break,
+    ///                     Some(<pat>) => <body>,
     ///                 };
-    ///                 let <pat> = __next;
-    ///                 StmtKind::Expr(<body>);
     ///             }
     ///         }
     ///     };
@@ -1332,133 +1329,75 @@ fn lower_expr_for(
         body: &Block,
         opt_label: Option<Label>,
     ) -> hir::Expr<'hir> {
-        // expand <head>
         let head = self.lower_expr_mut(head);
-        let desugared_span =
-            self.mark_span_with_reason(DesugaringKind::ForLoop(ForLoopLoc::Head), head.span, None);
-        let e_span = self.lower_span(e.span);
-
-        let iter = Ident::with_dummy_span(sym::iter);
-
-        let next_ident = Ident::with_dummy_span(sym::__next);
-        let (next_pat, next_pat_hid) = self.pat_ident_binding_mode(
-            desugared_span,
-            next_ident,
-            hir::BindingAnnotation::Mutable,
-        );
-
-        // `::std::option::Option::Some(val) => __next = val`
-        let pat_arm = {
-            let val_ident = Ident::with_dummy_span(sym::val);
-            let pat_span = self.lower_span(pat.span);
-            let (val_pat, val_pat_hid) = self.pat_ident(pat_span, val_ident);
-            let val_expr = self.expr_ident(pat_span, val_ident, val_pat_hid);
-            let next_expr = self.expr_ident(pat_span, next_ident, next_pat_hid);
-            let assign = self.arena.alloc(self.expr(
-                pat_span,
-                hir::ExprKind::Assign(next_expr, val_expr, self.lower_span(pat_span)),
-                ThinVec::new(),
-            ));
-            let some_pat = self.pat_some(pat_span, val_pat);
-            self.arm(some_pat, assign)
-        };
+        let pat = self.lower_pat(pat);
+        let for_span =
+            self.mark_span_with_reason(DesugaringKind::ForLoop, self.lower_span(e.span), None);
+        let head_span = self.mark_span_with_reason(DesugaringKind::ForLoop, head.span, None);
+        let pat_span = self.mark_span_with_reason(DesugaringKind::ForLoop, pat.span, None);
 
-        // `::std::option::Option::None => break`
-        let break_arm = {
+        // `None => break`
+        let none_arm = {
             let break_expr =
-                self.with_loop_scope(e.id, |this| this.expr_break_alloc(e_span, ThinVec::new()));
-            let pat = self.pat_none(e_span);
+                self.with_loop_scope(e.id, |this| this.expr_break_alloc(for_span, ThinVec::new()));
+            let pat = self.pat_none(for_span);
             self.arm(pat, break_expr)
         };
 
+        // Some(<pat>) => <body>,
+        let some_arm = {
+            let some_pat = self.pat_some(pat_span, pat);
+            let body_block = self.with_loop_scope(e.id, |this| this.lower_block(body, false));
+            let body_expr = self.arena.alloc(self.expr_block(body_block, ThinVec::new()));
+            self.arm(some_pat, body_expr)
+        };
+
         // `mut iter`
+        let iter = Ident::with_dummy_span(sym::iter);
         let (iter_pat, iter_pat_nid) =
-            self.pat_ident_binding_mode(desugared_span, iter, hir::BindingAnnotation::Mutable);
+            self.pat_ident_binding_mode(head_span, iter, hir::BindingAnnotation::Mutable);
 
-        // `match ::std::iter::Iterator::next(&mut iter) { ... }`
+        // `match Iterator::next(&mut iter) { ... }`
         let match_expr = {
-            let iter = self.expr_ident(desugared_span, iter, iter_pat_nid);
-            let ref_mut_iter = self.expr_mut_addr_of(desugared_span, iter);
+            let iter = self.expr_ident(head_span, iter, iter_pat_nid);
+            let ref_mut_iter = self.expr_mut_addr_of(head_span, iter);
             let next_expr = self.expr_call_lang_item_fn(
-                desugared_span,
+                head_span,
                 hir::LangItem::IteratorNext,
                 arena_vec![self; ref_mut_iter],
             );
-            let arms = arena_vec![self; pat_arm, break_arm];
+            let arms = arena_vec![self; none_arm, some_arm];
 
-            self.expr_match(desugared_span, next_expr, arms, hir::MatchSource::ForLoopDesugar)
+            self.expr_match(head_span, next_expr, arms, hir::MatchSource::ForLoopDesugar)
         };
-        let match_stmt = self.stmt_expr(desugared_span, match_expr);
-
-        let next_expr = self.expr_ident(desugared_span, next_ident, next_pat_hid);
-
-        // `let mut __next`
-        let next_let = self.stmt_let_pat(
-            None,
-            desugared_span,
-            None,
-            next_pat,
-            hir::LocalSource::ForLoopDesugar,
-        );
+        let match_stmt = self.stmt_expr(for_span, match_expr);
 
-        // `let <pat> = __next`
-        let pat = self.lower_pat(pat);
-        let pat_let = self.stmt_let_pat(
-            None,
-            desugared_span,
-            Some(next_expr),
-            pat,
-            hir::LocalSource::ForLoopDesugar,
-        );
-
-        let body_block = self.with_loop_scope(e.id, |this| this.lower_block(body, false));
-        let body_expr = self.expr_block(body_block, ThinVec::new());
-        let body_stmt = self.stmt_expr(body_block.span, body_expr);
-
-        let loop_block = self.block_all(
-            e_span,
-            arena_vec![self; next_let, match_stmt, pat_let, body_stmt],
-            None,
-        );
+        let loop_block = self.block_all(for_span, arena_vec![self; match_stmt], None);
 
         // `[opt_ident]: loop { ... }`
         let kind = hir::ExprKind::Loop(
             loop_block,
             self.lower_label(opt_label),
             hir::LoopSource::ForLoop,
-            self.lower_span(e_span.with_hi(head.span.hi())),
+            self.lower_span(for_span.with_hi(head.span.hi())),
         );
-        let loop_expr = self.arena.alloc(hir::Expr {
-            hir_id: self.lower_node_id(e.id),
-            kind,
-            span: self.lower_span(e.span),
-        });
+        let loop_expr =
+            self.arena.alloc(hir::Expr { hir_id: self.lower_node_id(e.id), kind, span: for_span });
 
         // `mut iter => { ... }`
         let iter_arm = self.arm(iter_pat, loop_expr);
 
-        let into_iter_span = self.mark_span_with_reason(
-            DesugaringKind::ForLoop(ForLoopLoc::IntoIter),
-            head.span,
-            None,
-        );
-
         // `match ::std::iter::IntoIterator::into_iter(<head>) { ... }`
         let into_iter_expr = {
             self.expr_call_lang_item_fn(
-                into_iter_span,
+                head_span,
                 hir::LangItem::IntoIterIntoIter,
                 arena_vec![self; head],
             )
         };
 
-        // #82462: to correctly diagnose borrow errors, the block that contains
-        // the iter expr needs to have a span that covers the loop body.
-        let desugared_full_span =
-            self.mark_span_with_reason(DesugaringKind::ForLoop(ForLoopLoc::Head), e_span, None);
-
         let match_expr = self.arena.alloc(self.expr_match(
-            desugared_full_span,
+            for_span,
             into_iter_expr,
             arena_vec![self; iter_arm],
             hir::MatchSource::ForLoopDesugar,
@@ -1472,7 +1411,7 @@ fn lower_expr_for(
         // surrounding scope of the `match` since the `match` is not a terminating scope.
         //
         // Also, add the attributes to the outer returned expr node.
-        self.expr_drop_temps_mut(desugared_full_span, match_expr, attrs.into())
+        self.expr_drop_temps_mut(for_span, match_expr, attrs.into())
     }
 
     /// Desugar `ExprKind::Try` from: `<expr>?` into:
index 79464a751721751ddfcce69776513184901395dd..2b3a538772ecbc62d57ae5cea8eb7e34665a9e46 100644 (file)
@@ -84,7 +84,7 @@ macro_rules! arena_vec {
 mod pat;
 mod path;
 
-rustc_hir::arena_types!(rustc_arena::declare_arena, 'tcx);
+rustc_hir::arena_types!(rustc_arena::declare_arena);
 
 struct LoweringContext<'a, 'hir: 'a> {
     /// Used to assign IDs to HIR nodes that do not directly correspond to AST nodes.
@@ -1338,10 +1338,7 @@ fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_, 'hir>) ->
                             pure_wrt_drop: false,
                             bounds: hir_bounds,
                             span: self.lower_span(span),
-                            kind: hir::GenericParamKind::Type {
-                                default: None,
-                                synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
-                            },
+                            kind: hir::GenericParamKind::Type { default: None, synthetic: true },
                         });
 
                         hir::TyKind::Path(hir::QPath::Resolved(
@@ -1954,12 +1951,7 @@ fn lower_generic_param(
                     default: default.as_ref().map(|x| {
                         self.lower_ty(x, ImplTraitContext::Disallowed(ImplTraitPosition::Other))
                     }),
-                    synthetic: param
-                        .attrs
-                        .iter()
-                        .filter(|attr| attr.has_name(sym::rustc_synthetic))
-                        .map(|_| hir::SyntheticTyParamKind::FromAttr)
-                        .next(),
+                    synthetic: false,
                 };
 
                 (hir::ParamName::Plain(self.lower_ident(param.ident)), kind)
index b011a2e8117af32bad24e55ed9bdb9082016a9f6..6a19984f8ea4612e82289b7c95d09839ca65a4e4 100644 (file)
@@ -719,6 +719,7 @@ macro_rules! gate_all {
     gate_all!(const_trait_impl, "const trait impls are experimental");
     gate_all!(half_open_range_patterns, "half-open range patterns are unstable");
     gate_all!(inline_const, "inline-const is experimental");
+    gate_all!(inline_const_pat, "inline-const in pattern position is experimental");
     gate_all!(
         const_generics_defaults,
         "default values for const generic parameters are experimental"
index 79973ab170cad8e362dd85199181b79b2e4c24ff..db8268c8e2e89bfbdd275d68956328e1f5d14503 100644 (file)
@@ -13,7 +13,7 @@
 use rustc_middle::ty::adjustment::PointerCast;
 use rustc_middle::ty::{self, RegionVid, TyCtxt};
 use rustc_span::symbol::Symbol;
-use rustc_span::Span;
+use rustc_span::{sym, DesugaringKind, Span};
 
 use crate::region_infer::BlameConstraint;
 use crate::{
@@ -135,7 +135,16 @@ pub(crate) fn add_explanation_to_diagnostic<'tcx>(
                 should_note_order,
             } => {
                 let local_decl = &body.local_decls[dropped_local];
-                let (dtor_desc, type_desc) = match local_decl.ty.kind() {
+                let mut ty = local_decl.ty;
+                if local_decl.source_info.span.desugaring_kind() == Some(DesugaringKind::ForLoop) {
+                    if let ty::Adt(adt, substs) = local_decl.ty.kind() {
+                        if tcx.is_diagnostic_item(sym::Option, adt.did) {
+                            // in for loop desugaring, only look at the `Some(..)` inner type
+                            ty = substs.type_at(0);
+                        }
+                    }
+                }
+                let (dtor_desc, type_desc) = match ty.kind() {
                     // If type is an ADT that implements Drop, then
                     // simplify output by reporting just the ADT name.
                     ty::Adt(adt, _substs) if adt.has_dtor(tcx) && !adt.is_box() => {
index a4df277a7b0844ad4e7fd3dda5505889fa9ce7d4..79623e26eb710d304d4556ad30a335aa42a07fbe 100644 (file)
 use rustc_middle::ty::print::Print;
 use rustc_middle::ty::{self, DefIdTree, Instance, Ty, TyCtxt};
 use rustc_mir_dataflow::move_paths::{InitLocation, LookupResult};
-use rustc_span::{
-    hygiene::{DesugaringKind, ForLoopLoc},
-    symbol::sym,
-    Span,
-};
+use rustc_span::{hygiene::DesugaringKind, symbol::sym, Span};
 use rustc_target::abi::VariantIdx;
 
 use super::borrow_set::BorrowData;
@@ -955,10 +951,8 @@ pub(super) fn move_spans(
             let kind = kind.unwrap_or_else(|| {
                 // This isn't a 'special' use of `self`
                 debug!("move_spans: method_did={:?}, fn_call_span={:?}", method_did, fn_call_span);
-                let implicit_into_iter = matches!(
-                    fn_call_span.desugaring_kind(),
-                    Some(DesugaringKind::ForLoop(ForLoopLoc::IntoIter))
-                );
+                let implicit_into_iter = Some(method_did) == tcx.lang_items().into_iter_fn()
+                    && fn_call_span.desugaring_kind() == Some(DesugaringKind::ForLoop);
                 let parent_self_ty = parent
                     .filter(|did| tcx.def_kind(*did) == rustc_hir::def::DefKind::Impl)
                     .and_then(|did| match tcx.type_of(did).kind() {
index d5ff4c6766f0fd2c9ee48ccf3c60515c83107872..46e2a99a0d0940cd381dafef4ee1fda32267913b 100644 (file)
@@ -445,15 +445,23 @@ pub(crate) fn report_mutability_error(
                                 },
                             ))) => {
                                 // check if the RHS is from desugaring
-                                let locations = self.body.find_assignments(local);
-                                let opt_assignment_rhs_span = locations
-                                    .first()
-                                    .map(|&location| self.body.source_info(location).span);
-                                let opt_desugaring_kind =
-                                    opt_assignment_rhs_span.and_then(|span| span.desugaring_kind());
-                                match opt_desugaring_kind {
+                                let opt_assignment_rhs_span =
+                                    self.body.find_assignments(local).first().map(|&location| {
+                                        let stmt = &self.body[location.block].statements
+                                            [location.statement_index];
+                                        match stmt.kind {
+                                            mir::StatementKind::Assign(box (
+                                                _,
+                                                mir::Rvalue::Use(mir::Operand::Copy(place)),
+                                            )) => {
+                                                self.body.local_decls[place.local].source_info.span
+                                            }
+                                            _ => self.body.source_info(location).span,
+                                        }
+                                    });
+                                match opt_assignment_rhs_span.and_then(|s| s.desugaring_kind()) {
                                     // on for loops, RHS points to the iterator part
-                                    Some(DesugaringKind::ForLoop(_)) => {
+                                    Some(DesugaringKind::ForLoop) => {
                                         self.suggest_similar_mut_method_for_for_loop(&mut err);
                                         Some((
                                             false,
index 659cf9ea070b1b6f5811852850e7d770a20c0ee5..8e6329a997f141bc990713c125a43d54a7c9be80 100644 (file)
@@ -12,7 +12,7 @@
 use rustc_session::config::OptLevel;
 use rustc_session::Session;
 use rustc_target::spec::abi::Abi;
-use rustc_target::spec::{FramePointer, SanitizerSet, StackProbeType};
+use rustc_target::spec::{FramePointer, SanitizerSet, StackProbeType, StackProtector};
 
 use crate::attributes;
 use crate::llvm::AttributePlace::Function;
@@ -161,6 +161,17 @@ fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
     }
 }
 
+fn set_stackprotector(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
+    let sspattr = match cx.sess().stack_protector() {
+        StackProtector::None => return,
+        StackProtector::All => Attribute::StackProtectReq,
+        StackProtector::Strong => Attribute::StackProtectStrong,
+        StackProtector::Basic => Attribute::StackProtect,
+    };
+
+    sspattr.apply_llfn(Function, llfn)
+}
+
 pub fn apply_target_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
     let target_cpu = SmallCStr::new(llvm_util::target_cpu(cx.tcx.sess));
     llvm::AddFunctionAttrStringValue(
@@ -271,6 +282,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
     set_frame_pointer_type(cx, llfn);
     set_instrument_function(cx, llfn);
     set_probestack(cx, llfn);
+    set_stackprotector(cx, llfn);
 
     if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) {
         Attribute::Cold.apply_llfn(Function, llfn);
index 64fedb7bc1a5cbb7b20559e67dd126d563a9e403..c66d7d872c915033221259803e77391f9210d98f 100644 (file)
@@ -288,6 +288,31 @@ fn print(&self, req: PrintRequest, sess: &Session) {
                 }
                 println!();
             }
+            PrintRequest::StackProtectorStrategies => {
+                println!(
+                    r#"Available stack protector strategies:
+    all
+        Generate stack canaries in all functions.
+
+    strong
+        Generate stack canaries in a function if it either:
+        - has a local variable of `[T; N]` type, regardless of `T` and `N`
+        - takes the address of a local variable.
+
+          (Note that a local variable being borrowed is not equivalent to its
+          address being taken: e.g. some borrows may be removed by optimization,
+          while by-value argument passing may be implemented with reference to a
+          local stack variable in the ABI.)
+
+    basic
+        Generate stack canaries in functions with:
+        - local variables of `[T; N]` type, where `T` is byte-sized and `N` > 8.
+
+    none
+        Do not generate stack canaries.
+"#
+                );
+            }
             req => llvm_util::print(req, sess),
         }
     }
index 749eec459aca1334be2f17da146280b6cb3fcc5c..1d255c075598078f616ef704c1470bcb4d064a33 100644 (file)
@@ -166,6 +166,9 @@ pub enum Attribute {
     InaccessibleMemOnly = 27,
     SanitizeHWAddress = 28,
     WillReturn = 29,
+    StackProtectReq = 30,
+    StackProtectStrong = 31,
+    StackProtect = 32,
 }
 
 /// LLVMIntPredicate
index 698742fe98ceb0e5868c2510b9cb9f4c6a955630..44da27a43db0a01e08d9c46db4ef4fc8be2c4e70 100644 (file)
@@ -413,48 +413,33 @@ pub fn emulate_intrinsic(
             sym::simd_insert => {
                 let index = u64::from(self.read_scalar(&args[1])?.to_u32()?);
                 let elem = &args[2];
-                let input = &args[0];
-                let (len, e_ty) = input.layout.ty.simd_size_and_type(*self.tcx);
+                let (input, input_len) = self.operand_to_simd(&args[0])?;
+                let (dest, dest_len) = self.place_to_simd(dest)?;
+                assert_eq!(input_len, dest_len, "Return vector length must match input length");
                 assert!(
-                    index < len,
-                    "Index `{}` must be in bounds of vector type `{}`: `[0, {})`",
+                    index < dest_len,
+                    "Index `{}` must be in bounds of vector with length {}`",
                     index,
-                    e_ty,
-                    len
-                );
-                assert_eq!(
-                    input.layout, dest.layout,
-                    "Return type `{}` must match vector type `{}`",
-                    dest.layout.ty, input.layout.ty
-                );
-                assert_eq!(
-                    elem.layout.ty, e_ty,
-                    "Scalar element type `{}` must match vector element type `{}`",
-                    elem.layout.ty, e_ty
+                    dest_len
                 );
 
-                for i in 0..len {
-                    let place = self.place_index(dest, i)?;
-                    let value = if i == index { *elem } else { self.operand_index(input, i)? };
-                    self.copy_op(&value, &place)?;
+                for i in 0..dest_len {
+                    let place = self.mplace_index(&dest, i)?;
+                    let value =
+                        if i == index { *elem } else { self.mplace_index(&input, i)?.into() };
+                    self.copy_op(&value, &place.into())?;
                 }
             }
             sym::simd_extract => {
                 let index = u64::from(self.read_scalar(&args[1])?.to_u32()?);
-                let (len, e_ty) = args[0].layout.ty.simd_size_and_type(*self.tcx);
+                let (input, input_len) = self.operand_to_simd(&args[0])?;
                 assert!(
-                    index < len,
-                    "index `{}` is out-of-bounds of vector type `{}` with length `{}`",
+                    index < input_len,
+                    "index `{}` must be in bounds of vector with length `{}`",
                     index,
-                    e_ty,
-                    len
-                );
-                assert_eq!(
-                    e_ty, dest.layout.ty,
-                    "Return type `{}` must match vector element type `{}`",
-                    dest.layout.ty, e_ty
+                    input_len
                 );
-                self.copy_op(&self.operand_index(&args[0], index)?, dest)?;
+                self.copy_op(&self.mplace_index(&input, index)?.into(), dest)?;
             }
             sym::likely | sym::unlikely | sym::black_box => {
                 // These just return their argument
index b6682b13ed2168e4556dc602007da80cdb3b6294..de9e94ce2ac0c820137e5edcb9c3f68ce20f848e 100644 (file)
@@ -437,6 +437,18 @@ pub fn operand_projection(
         })
     }
 
+    /// Converts a repr(simd) operand into an operand where `place_index` accesses the SIMD elements.
+    /// Also returns the number of elements.
+    pub fn operand_to_simd(
+        &self,
+        base: &OpTy<'tcx, M::PointerTag>,
+    ) -> InterpResult<'tcx, (MPlaceTy<'tcx, M::PointerTag>, u64)> {
+        // Basically we just transmute this place into an array following simd_size_and_type.
+        // This only works in memory, but repr(simd) types should never be immediates anyway.
+        assert!(base.layout.ty.is_simd());
+        self.mplace_to_simd(&base.assert_mem_place())
+    }
+
     /// Read from a local. Will not actually access the local if reading from a ZST.
     /// Will not access memory, instead an indirect `Operand` is returned.
     ///
index d425b84bdaf26d508773a623b5b70f9d58663e42..d7f2853fc86f508a26d70aa3b61580c97db0a2f6 100644 (file)
@@ -200,7 +200,7 @@ pub(super) fn len(&self, cx: &impl HasDataLayout) -> InterpResult<'tcx, u64> {
             }
         } else {
             // Go through the layout.  There are lots of types that support a length,
-            // e.g., SIMD types.
+            // e.g., SIMD types. (But not all repr(simd) types even have FieldsShape::Array!)
             match self.layout.fields {
                 FieldsShape::Array { count, .. } => Ok(count),
                 _ => bug!("len not supported on sized type {:?}", self.layout.ty),
@@ -533,6 +533,22 @@ pub(super) fn mplace_projection(
         })
     }
 
+    /// Converts a repr(simd) place into a place where `place_index` accesses the SIMD elements.
+    /// Also returns the number of elements.
+    pub fn mplace_to_simd(
+        &self,
+        base: &MPlaceTy<'tcx, M::PointerTag>,
+    ) -> InterpResult<'tcx, (MPlaceTy<'tcx, M::PointerTag>, u64)> {
+        // Basically we just transmute this place into an array following simd_size_and_type.
+        // (Transmuting is okay since this is an in-memory place. We also double-check the size
+        // stays the same.)
+        let (len, e_ty) = base.layout.ty.simd_size_and_type(*self.tcx);
+        let array = self.tcx.mk_array(e_ty, len);
+        let layout = self.layout_of(array)?;
+        assert_eq!(layout.size, base.layout.size);
+        Ok((MPlaceTy { layout, ..*base }, len))
+    }
+
     /// Gets the place of a field inside the place, and also the field's type.
     /// Just a convenience function, but used quite a bit.
     /// This is the only projection that might have a side-effect: We cannot project
@@ -594,6 +610,16 @@ pub fn place_projection(
         })
     }
 
+    /// Converts a repr(simd) place into a place where `place_index` accesses the SIMD elements.
+    /// Also returns the number of elements.
+    pub fn place_to_simd(
+        &mut self,
+        base: &PlaceTy<'tcx, M::PointerTag>,
+    ) -> InterpResult<'tcx, (MPlaceTy<'tcx, M::PointerTag>, u64)> {
+        let mplace = self.force_allocation(base)?;
+        self.mplace_to_simd(&mplace)
+    }
+
     /// Computes a place. You should only use this if you intend to write into this
     /// place; for reading, a more efficient alternative is `eval_place_for_read`.
     pub fn eval_place(
index fcce829eba4121a23c0f0336cd0023ec2310b6dd..b70b38754c956584ccacb244e409be91cd6b4e57 100644 (file)
@@ -264,7 +264,7 @@ fn transfer_function(&self, state: &'a mut State) -> TransferFunction<'a, 'mir,
     }
 }
 
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Debug, PartialEq, Eq)]
 pub(super) struct State {
     /// Describes whether a local contains qualif.
     pub qualif: BitSet<Local>,
@@ -273,6 +273,19 @@ pub(super) struct State {
     pub borrow: BitSet<Local>,
 }
 
+impl Clone for State {
+    fn clone(&self) -> Self {
+        State { qualif: self.qualif.clone(), borrow: self.borrow.clone() }
+    }
+
+    // Data flow engine when possible uses `clone_from` for domain values.
+    // Providing an implementation will avoid some intermediate memory allocations.
+    fn clone_from(&mut self, other: &Self) {
+        self.qualif.clone_from(&other.qualif);
+        self.borrow.clone_from(&other.borrow);
+    }
+}
+
 impl State {
     #[inline]
     pub(super) fn contains(&self, local: Local) -> bool {
index 7bf378601e053317963dcdc036129b94c05be7e3..a92b20f5cb520ae147c0ddfd3be48fc532738870 100644 (file)
@@ -93,17 +93,8 @@ pub fn is_promotable(&self) -> bool {
 /// returned value in a promoted MIR, unless it's a subset
 /// of a larger candidate.
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub enum Candidate {
-    /// Borrow of a constant temporary, candidate for lifetime extension.
-    Ref(Location),
-}
-
-impl Candidate {
-    fn source_info(&self, body: &Body<'_>) -> SourceInfo {
-        match self {
-            Candidate::Ref(location) => *body.source_info(*location),
-        }
-    }
+pub struct Candidate {
+    location: Location,
 }
 
 struct Collector<'a, 'tcx> {
@@ -167,7 +158,7 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
 
         match *rvalue {
             Rvalue::Ref(..) => {
-                self.candidates.push(Candidate::Ref(location));
+                self.candidates.push(Candidate { location });
             }
             _ => {}
         }
@@ -209,36 +200,33 @@ fn deref(&self) -> &Self::Target {
 
 impl<'tcx> Validator<'_, 'tcx> {
     fn validate_candidate(&self, candidate: Candidate) -> Result<(), Unpromotable> {
-        match candidate {
-            Candidate::Ref(loc) => {
-                let statement = &self.body[loc.block].statements[loc.statement_index];
-                match &statement.kind {
-                    StatementKind::Assign(box (_, Rvalue::Ref(_, kind, place))) => {
-                        // We can only promote interior borrows of promotable temps (non-temps
-                        // don't get promoted anyway).
-                        self.validate_local(place.local)?;
-
-                        // The reference operation itself must be promotable.
-                        // (Needs to come after `validate_local` to avoid ICEs.)
-                        self.validate_ref(*kind, place)?;
-
-                        // We do not check all the projections (they do not get promoted anyway),
-                        // but we do stay away from promoting anything involving a dereference.
-                        if place.projection.contains(&ProjectionElem::Deref) {
-                            return Err(Unpromotable);
-                        }
+        let loc = candidate.location;
+        let statement = &self.body[loc.block].statements[loc.statement_index];
+        match &statement.kind {
+            StatementKind::Assign(box (_, Rvalue::Ref(_, kind, place))) => {
+                // We can only promote interior borrows of promotable temps (non-temps
+                // don't get promoted anyway).
+                self.validate_local(place.local)?;
+
+                // The reference operation itself must be promotable.
+                // (Needs to come after `validate_local` to avoid ICEs.)
+                self.validate_ref(*kind, place)?;
 
-                        // We cannot promote things that need dropping, since the promoted value
-                        // would not get dropped.
-                        if self.qualif_local::<qualifs::NeedsDrop>(place.local) {
-                            return Err(Unpromotable);
-                        }
+                // We do not check all the projections (they do not get promoted anyway),
+                // but we do stay away from promoting anything involving a dereference.
+                if place.projection.contains(&ProjectionElem::Deref) {
+                    return Err(Unpromotable);
+                }
 
-                        Ok(())
-                    }
-                    _ => bug!(),
+                // We cannot promote things that need dropping, since the promoted value
+                // would not get dropped.
+                if self.qualif_local::<qualifs::NeedsDrop>(place.local) {
+                    return Err(Unpromotable);
                 }
+
+                Ok(())
             }
+            _ => bug!(),
         }
     }
 
@@ -871,58 +859,55 @@ fn promote_candidate(mut self, candidate: Candidate, next_promoted_id: usize) ->
                 }))
             };
             let (blocks, local_decls) = self.source.basic_blocks_and_local_decls_mut();
-            match candidate {
-                Candidate::Ref(loc) => {
-                    let statement = &mut blocks[loc.block].statements[loc.statement_index];
-                    match statement.kind {
-                        StatementKind::Assign(box (
-                            _,
-                            Rvalue::Ref(ref mut region, borrow_kind, ref mut place),
-                        )) => {
-                            // Use the underlying local for this (necessarily interior) borrow.
-                            let ty = local_decls.local_decls()[place.local].ty;
-                            let span = statement.source_info.span;
-
-                            let ref_ty = tcx.mk_ref(
-                                tcx.lifetimes.re_erased,
-                                ty::TypeAndMut { ty, mutbl: borrow_kind.to_mutbl_lossy() },
-                            );
-
-                            *region = tcx.lifetimes.re_erased;
-
-                            let mut projection = vec![PlaceElem::Deref];
-                            projection.extend(place.projection);
-                            place.projection = tcx.intern_place_elems(&projection);
-
-                            // Create a temp to hold the promoted reference.
-                            // This is because `*r` requires `r` to be a local,
-                            // otherwise we would use the `promoted` directly.
-                            let mut promoted_ref = LocalDecl::new(ref_ty, span);
-                            promoted_ref.source_info = statement.source_info;
-                            let promoted_ref = local_decls.push(promoted_ref);
-                            assert_eq!(self.temps.push(TempState::Unpromotable), promoted_ref);
-
-                            let promoted_ref_statement = Statement {
-                                source_info: statement.source_info,
-                                kind: StatementKind::Assign(Box::new((
-                                    Place::from(promoted_ref),
-                                    Rvalue::Use(promoted_operand(ref_ty, span)),
-                                ))),
-                            };
-                            self.extra_statements.push((loc, promoted_ref_statement));
-
-                            Rvalue::Ref(
-                                tcx.lifetimes.re_erased,
-                                borrow_kind,
-                                Place {
-                                    local: mem::replace(&mut place.local, promoted_ref),
-                                    projection: List::empty(),
-                                },
-                            )
-                        }
-                        _ => bug!(),
-                    }
+            let loc = candidate.location;
+            let statement = &mut blocks[loc.block].statements[loc.statement_index];
+            match statement.kind {
+                StatementKind::Assign(box (
+                    _,
+                    Rvalue::Ref(ref mut region, borrow_kind, ref mut place),
+                )) => {
+                    // Use the underlying local for this (necessarily interior) borrow.
+                    let ty = local_decls.local_decls()[place.local].ty;
+                    let span = statement.source_info.span;
+
+                    let ref_ty = tcx.mk_ref(
+                        tcx.lifetimes.re_erased,
+                        ty::TypeAndMut { ty, mutbl: borrow_kind.to_mutbl_lossy() },
+                    );
+
+                    *region = tcx.lifetimes.re_erased;
+
+                    let mut projection = vec![PlaceElem::Deref];
+                    projection.extend(place.projection);
+                    place.projection = tcx.intern_place_elems(&projection);
+
+                    // Create a temp to hold the promoted reference.
+                    // This is because `*r` requires `r` to be a local,
+                    // otherwise we would use the `promoted` directly.
+                    let mut promoted_ref = LocalDecl::new(ref_ty, span);
+                    promoted_ref.source_info = statement.source_info;
+                    let promoted_ref = local_decls.push(promoted_ref);
+                    assert_eq!(self.temps.push(TempState::Unpromotable), promoted_ref);
+
+                    let promoted_ref_statement = Statement {
+                        source_info: statement.source_info,
+                        kind: StatementKind::Assign(Box::new((
+                            Place::from(promoted_ref),
+                            Rvalue::Use(promoted_operand(ref_ty, span)),
+                        ))),
+                    };
+                    self.extra_statements.push((loc, promoted_ref_statement));
+
+                    Rvalue::Ref(
+                        tcx.lifetimes.re_erased,
+                        borrow_kind,
+                        Place {
+                            local: mem::replace(&mut place.local, promoted_ref),
+                            projection: List::empty(),
+                        },
+                    )
                 }
+                _ => bug!(),
             }
         };
 
@@ -964,17 +949,13 @@ pub fn promote_candidates<'tcx>(
 
     let mut extra_statements = vec![];
     for candidate in candidates.into_iter().rev() {
-        match candidate {
-            Candidate::Ref(Location { block, statement_index }) => {
-                if let StatementKind::Assign(box (place, _)) =
-                    &body[block].statements[statement_index].kind
-                {
-                    if let Some(local) = place.as_local() {
-                        if temps[local] == TempState::PromotedOut {
-                            // Already promoted.
-                            continue;
-                        }
-                    }
+        let Location { block, statement_index } = candidate.location;
+        if let StatementKind::Assign(box (place, _)) = &body[block].statements[statement_index].kind
+        {
+            if let Some(local) = place.as_local() {
+                if temps[local] == TempState::PromotedOut {
+                    // Already promoted.
+                    continue;
                 }
             }
         }
@@ -982,7 +963,7 @@ pub fn promote_candidates<'tcx>(
         // Declare return place local so that `mir::Body::new` doesn't complain.
         let initial_locals = iter::once(LocalDecl::new(tcx.types.never, body.span)).collect();
 
-        let mut scope = body.source_scopes[candidate.source_info(body).scope].clone();
+        let mut scope = body.source_scopes[body.source_info(candidate.location).scope].clone();
         scope.parent_scope = None;
 
         let promoted = Body::new(
index 09fe3a552a0a624df7a317ffef7209f6a0b91ca2..6ff94341142fda67563b9f412857a987ab1256f3 100644 (file)
@@ -736,7 +736,12 @@ fn print_crate_info(
                         println!("{}", cfg);
                     }
                 }
-                RelocationModels | CodeModels | TlsModels | TargetCPUs | TargetFeatures => {
+                RelocationModels
+                | CodeModels
+                | TlsModels
+                | TargetCPUs
+                | StackProtectorStrategies
+                | TargetFeatures => {
                     codegen_backend.print(*req, sess);
                 }
                 // Any output here interferes with Cargo's parsing of other printed output
index e16ff9741229148c75827914ede58af494849180..6b79962ddd6095bc600d8d0766b5ce557d8b8a14 100644 (file)
@@ -1266,22 +1266,37 @@ fn emit_message_default(
             }
             self.msg_to_buffer(&mut buffer, msg, max_line_num_len, "note", None);
         } else {
+            let mut label_width = 0;
             // The failure note level itself does not provide any useful diagnostic information
             if *level != Level::FailureNote {
                 buffer.append(0, level.to_str(), Style::Level(*level));
+                label_width += level.to_str().len();
             }
             // only render error codes, not lint codes
             if let Some(DiagnosticId::Error(ref code)) = *code {
                 buffer.append(0, "[", Style::Level(*level));
                 buffer.append(0, &code, Style::Level(*level));
                 buffer.append(0, "]", Style::Level(*level));
+                label_width += 2 + code.len();
             }
             let header_style = if is_secondary { Style::HeaderMsg } else { Style::MainHeaderMsg };
             if *level != Level::FailureNote {
                 buffer.append(0, ": ", header_style);
+                label_width += 2;
             }
             for &(ref text, _) in msg.iter() {
-                buffer.append(0, &replace_tabs(text), header_style);
+                // Account for newlines to align output to its label.
+                for (line, text) in replace_tabs(text).lines().enumerate() {
+                    buffer.append(
+                        0 + line,
+                        &format!(
+                            "{}{}",
+                            if line == 0 { String::new() } else { " ".repeat(label_width) },
+                            text
+                        ),
+                        header_style,
+                    );
+                }
             }
         }
 
index 608581306bef5be5e906a698b537dedc33f312ec..c34ecc966d0ae21989ab921b6502f9bb3615ecc2 100644 (file)
@@ -409,7 +409,9 @@ pub fn set(&self, features: &mut Features, span: Span) {
     /// Allows associated types in inherent impls.
     (incomplete, inherent_associated_types, "1.52.0", Some(8995), None),
     /// Allow anonymous constants from an inline `const` block
-    (incomplete, inline_const, "1.49.0", Some(76001), None),
+    (active, inline_const, "1.49.0", Some(76001), None),
+    /// Allow anonymous constants from an inline `const` block in pattern position
+    (incomplete, inline_const_pat, "1.58.0", Some(76001), None),
     /// Allows using `pointer` and `reference` in intra-doc links
     (active, intra_doc_pointers, "1.51.0", Some(80896), None),
     /// Allows `#[instruction_set(_)]` attribute
index 7212bbf38c7f215555ef2a3c086e2b20b3dfaa3d..f25b2d8f566c08eede2513d580e8bcbb32b4e7d7 100644 (file)
@@ -1,5 +1,6 @@
 //! Built-in attributes and `cfg` flag gating.
 
+use AttributeDuplicates::*;
 use AttributeGate::*;
 use AttributeType::*;
 
@@ -88,11 +89,66 @@ fn is_deprecated(&self) -> bool {
 /// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now.
 #[derive(Clone, Copy, Default)]
 pub struct AttributeTemplate {
+    /// If `true`, the attribute is allowed to be a bare word like `#[test]`.
     pub word: bool,
+    /// If `Some`, the attribute is allowed to take a list of items like `#[allow(..)]`.
     pub list: Option<&'static str>,
+    /// If `Some`, the attribute is allowed to be a name/value pair where the
+    /// value is a string, like `#[must_use = "reason"]`.
     pub name_value_str: Option<&'static str>,
 }
 
+/// How to handle multiple duplicate attributes on the same item.
+#[derive(Clone, Copy, Default)]
+pub enum AttributeDuplicates {
+    /// Duplicates of this attribute are allowed.
+    ///
+    /// This should only be used with attributes where duplicates have semantic
+    /// meaning, or some kind of "additive" behavior. For example, `#[warn(..)]`
+    /// can be specified multiple times, and it combines all the entries. Or use
+    /// this if there is validation done elsewhere.
+    #[default]
+    DuplicatesOk,
+    /// Duplicates after the first attribute will be an unused_attribute warning.
+    ///
+    /// This is usually used for "word" attributes, where they are used as a
+    /// boolean marker, like `#[used]`. It is not necessarily wrong that there
+    /// are duplicates, but the others should probably be removed.
+    WarnFollowing,
+    /// Same as `WarnFollowing`, but only issues warnings for word-style attributes.
+    ///
+    /// This is only for special cases, for example multiple `#[macro_use]` can
+    /// be warned, but multiple `#[macro_use(...)]` should not because the list
+    /// form has different meaning from the word form.
+    WarnFollowingWordOnly,
+    /// Duplicates after the first attribute will be an error.
+    ///
+    /// This should be used where duplicates would be ignored, but carry extra
+    /// meaning that could cause confusion. For example, `#[stable(since="1.0")]
+    /// #[stable(since="2.0")]`, which version should be used for `stable`?
+    ErrorFollowing,
+    /// Duplicates preceding the last instance of the attribute will be an error.
+    ///
+    /// This is the same as `ErrorFollowing`, except the last attribute is the
+    /// one that is "used". This is typically used in cases like codegen
+    /// attributes which usually only honor the last attribute.
+    ErrorPreceding,
+    /// Duplicates after the first attribute will be an unused_attribute warning
+    /// with a note that this will be an error in the future.
+    ///
+    /// This should be used for attributes that should be `ErrorFollowing`, but
+    /// because older versions of rustc silently accepted (and ignored) the
+    /// attributes, this is used to transition.
+    FutureWarnFollowing,
+    /// Duplicates preceding the last instance of the attribute will be a
+    /// warning, with a note that this will be an error in the future.
+    ///
+    /// This is the same as `FutureWarnFollowing`, except the last attribute is
+    /// the one that is "used". Ideally these can eventually migrate to
+    /// `ErrorPreceding`.
+    FutureWarnPreceding,
+}
+
 /// A convenience macro for constructing attribute templates.
 /// E.g., `template!(Word, List: "description")` means that the attribute
 /// supports forms `#[attr]` and `#[attr(description)]`.
@@ -114,36 +170,45 @@ macro_rules! template {
 }
 
 macro_rules! ungated {
-    ($attr:ident, $typ:expr, $tpl:expr $(,)?) => {
-        BuiltinAttribute { name: sym::$attr, type_: $typ, template: $tpl, gate: Ungated }
+    ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr $(,)?) => {
+        BuiltinAttribute {
+            name: sym::$attr,
+            type_: $typ,
+            template: $tpl,
+            gate: Ungated,
+            duplicates: $duplicates,
+        }
     };
 }
 
 macro_rules! gated {
-    ($attr:ident, $typ:expr, $tpl:expr, $gate:ident, $msg:expr $(,)?) => {
+    ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $gate:ident, $msg:expr $(,)?) => {
         BuiltinAttribute {
             name: sym::$attr,
             type_: $typ,
             template: $tpl,
+            duplicates: $duplicates,
             gate: Gated(Stability::Unstable, sym::$gate, $msg, cfg_fn!($gate)),
         }
     };
-    ($attr:ident, $typ:expr, $tpl:expr, $msg:expr $(,)?) => {
+    ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $msg:expr $(,)?) => {
         BuiltinAttribute {
             name: sym::$attr,
             type_: $typ,
             template: $tpl,
+            duplicates: $duplicates,
             gate: Gated(Stability::Unstable, sym::$attr, $msg, cfg_fn!($attr)),
         }
     };
 }
 
 macro_rules! rustc_attr {
-    (TEST, $attr:ident, $typ:expr, $tpl:expr $(,)?) => {
+    (TEST, $attr:ident, $typ:expr, $tpl:expr, $duplicate:expr $(,)?) => {
         rustc_attr!(
             $attr,
             $typ,
             $tpl,
+            $duplicate,
             concat!(
                 "the `#[",
                 stringify!($attr),
@@ -152,11 +217,12 @@ macro_rules! rustc_attr {
             ),
         )
     };
-    ($attr:ident, $typ:expr, $tpl:expr, $msg:expr $(,)?) => {
+    ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $msg:expr $(,)?) => {
         BuiltinAttribute {
             name: sym::$attr,
             type_: $typ,
             template: $tpl,
+            duplicates: $duplicates,
             gate: Gated(Stability::Unstable, sym::rustc_attrs, $msg, cfg_fn!(rustc_attrs)),
         }
     };
@@ -175,6 +241,7 @@ pub struct BuiltinAttribute {
     pub name: Symbol,
     pub type_: AttributeType,
     pub template: AttributeTemplate,
+    pub duplicates: AttributeDuplicates,
     pub gate: AttributeGate,
 }
 
@@ -186,42 +253,48 @@ pub struct BuiltinAttribute {
     // ==========================================================================
 
     // Conditional compilation:
-    ungated!(cfg, Normal, template!(List: "predicate")),
-    ungated!(cfg_attr, Normal, template!(List: "predicate, attr1, attr2, ...")),
+    ungated!(cfg, Normal, template!(List: "predicate"), DuplicatesOk),
+    ungated!(cfg_attr, Normal, template!(List: "predicate, attr1, attr2, ..."), DuplicatesOk),
 
     // Testing:
-    ungated!(ignore, Normal, template!(Word, NameValueStr: "reason")),
+    ungated!(ignore, Normal, template!(Word, NameValueStr: "reason"), WarnFollowing),
     ungated!(
         should_panic, Normal,
-        template!(Word, List: r#"expected = "reason"#, NameValueStr: "reason"),
+        template!(Word, List: r#"expected = "reason"#, NameValueStr: "reason"), FutureWarnFollowing,
     ),
     // FIXME(Centril): This can be used on stable but shouldn't.
-    ungated!(reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name")),
+    ungated!(reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name"), ErrorFollowing),
 
     // Macros:
-    ungated!(automatically_derived, Normal, template!(Word)),
-    // FIXME(#14407)
-    ungated!(macro_use, Normal, template!(Word, List: "name1, name2, ...")),
-    ungated!(macro_escape, Normal, template!(Word)), // Deprecated synonym for `macro_use`.
-    ungated!(macro_export, Normal, template!(Word, List: "local_inner_macros")),
-    ungated!(proc_macro, Normal, template!(Word)),
+    ungated!(automatically_derived, Normal, template!(Word), WarnFollowing),
+    ungated!(macro_use, Normal, template!(Word, List: "name1, name2, ..."), WarnFollowingWordOnly),
+    ungated!(macro_escape, Normal, template!(Word), WarnFollowing), // Deprecated synonym for `macro_use`.
+    ungated!(macro_export, Normal, template!(Word, List: "local_inner_macros"), WarnFollowing),
+    ungated!(proc_macro, Normal, template!(Word), ErrorFollowing),
     ungated!(
         proc_macro_derive, Normal,
-        template!(List: "TraitName, /*opt*/ attributes(name1, name2, ...)"),
+        template!(List: "TraitName, /*opt*/ attributes(name1, name2, ...)"), ErrorFollowing,
     ),
-    ungated!(proc_macro_attribute, Normal, template!(Word)),
+    ungated!(proc_macro_attribute, Normal, template!(Word), ErrorFollowing),
 
     // Lints:
-    ungated!(warn, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)),
-    ungated!(allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)),
-    ungated!(forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)),
-    ungated!(deny, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)),
-    ungated!(must_use, Normal, template!(Word, NameValueStr: "reason")),
+    ungated!(
+        warn, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk
+    ),
+    ungated!(
+        allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk
+    ),
+    ungated!(
+        forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk
+    ),
+    ungated!(
+        deny, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), DuplicatesOk
+    ),
+    ungated!(must_use, Normal, template!(Word, NameValueStr: "reason"), FutureWarnFollowing),
     gated!(
-        must_not_suspend, Normal, template!(Word, NameValueStr: "reason"), must_not_suspend,
-        experimental!(must_not_suspend)
+        must_not_suspend, Normal, template!(Word, NameValueStr: "reason"), WarnFollowing,
+        must_not_suspend, experimental!(must_not_suspend)
     ),
-    // FIXME(#14407)
     ungated!(
         deprecated, Normal,
         template!(
@@ -229,78 +302,86 @@ pub struct BuiltinAttribute {
             List: r#"/*opt*/ since = "version", /*opt*/ note = "reason""#,
             NameValueStr: "reason"
         ),
+        // This has special duplicate handling in E0550 to handle duplicates with rustc_deprecated
+        DuplicatesOk
     ),
 
     // Crate properties:
-    ungated!(crate_name, CrateLevel, template!(NameValueStr: "name")),
-    ungated!(crate_type, CrateLevel, template!(NameValueStr: "bin|lib|...")),
-    ungated!(crate_id, CrateLevel, template!(NameValueStr: "ignored")),
+    ungated!(crate_name, CrateLevel, template!(NameValueStr: "name"), FutureWarnFollowing),
+    ungated!(crate_type, CrateLevel, template!(NameValueStr: "bin|lib|..."), FutureWarnFollowing),
+    // crate_id is deprecated
+    ungated!(crate_id, CrateLevel, template!(NameValueStr: "ignored"), FutureWarnFollowing),
 
     // ABI, linking, symbols, and FFI
     ungated!(
         link, Normal,
         template!(List: r#"name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...""#),
+        DuplicatesOk,
     ),
-    ungated!(link_name, Normal, template!(NameValueStr: "name")),
-    ungated!(no_link, Normal, template!(Word)),
-    ungated!(repr, Normal, template!(List: "C")),
-    ungated!(export_name, Normal, template!(NameValueStr: "name")),
-    ungated!(link_section, Normal, template!(NameValueStr: "name")),
-    ungated!(no_mangle, Normal, template!(Word)),
-    ungated!(used, Normal, template!(Word)),
+    ungated!(link_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding),
+    ungated!(no_link, Normal, template!(Word), WarnFollowing),
+    ungated!(repr, Normal, template!(List: "C"), DuplicatesOk),
+    ungated!(export_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding),
+    ungated!(link_section, Normal, template!(NameValueStr: "name"), FutureWarnPreceding),
+    ungated!(no_mangle, Normal, template!(Word), WarnFollowing),
+    ungated!(used, Normal, template!(Word), WarnFollowing),
 
     // Limits:
-    ungated!(recursion_limit, CrateLevel, template!(NameValueStr: "N")),
-    ungated!(type_length_limit, CrateLevel, template!(NameValueStr: "N")),
+    ungated!(recursion_limit, CrateLevel, template!(NameValueStr: "N"), FutureWarnFollowing),
+    ungated!(type_length_limit, CrateLevel, template!(NameValueStr: "N"), FutureWarnFollowing),
     gated!(
-        const_eval_limit, CrateLevel, template!(NameValueStr: "N"), const_eval_limit,
-        experimental!(const_eval_limit)
+        const_eval_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing,
+        const_eval_limit, experimental!(const_eval_limit)
     ),
     gated!(
-        move_size_limit, CrateLevel, template!(NameValueStr: "N"), large_assignments,
-        experimental!(move_size_limit)
+        move_size_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing,
+        large_assignments, experimental!(move_size_limit)
     ),
 
     // Entry point:
-    ungated!(main, Normal, template!(Word)),
-    ungated!(start, Normal, template!(Word)),
-    ungated!(no_start, CrateLevel, template!(Word)),
-    ungated!(no_main, CrateLevel, template!(Word)),
+    ungated!(main, Normal, template!(Word), WarnFollowing),
+    ungated!(start, Normal, template!(Word), WarnFollowing),
+    ungated!(no_start, CrateLevel, template!(Word), WarnFollowing),
+    ungated!(no_main, CrateLevel, template!(Word), WarnFollowing),
 
     // Modules, prelude, and resolution:
-    ungated!(path, Normal, template!(NameValueStr: "file")),
-    ungated!(no_std, CrateLevel, template!(Word)),
-    ungated!(no_implicit_prelude, Normal, template!(Word)),
-    ungated!(non_exhaustive, Normal, template!(Word)),
+    ungated!(path, Normal, template!(NameValueStr: "file"), FutureWarnFollowing),
+    ungated!(no_std, CrateLevel, template!(Word), WarnFollowing),
+    ungated!(no_implicit_prelude, Normal, template!(Word), WarnFollowing),
+    ungated!(non_exhaustive, Normal, template!(Word), WarnFollowing),
 
     // Runtime
-    ungated!(windows_subsystem, Normal, template!(NameValueStr: "windows|console")),
-    ungated!(panic_handler, Normal, template!(Word)), // RFC 2070
+    ungated!(
+        windows_subsystem, Normal,
+        template!(NameValueStr: "windows|console"), FutureWarnFollowing
+    ),
+    ungated!(panic_handler, Normal, template!(Word), WarnFollowing), // RFC 2070
 
     // Code generation:
-    ungated!(inline, Normal, template!(Word, List: "always|never")),
-    ungated!(cold, Normal, template!(Word)),
-    ungated!(no_builtins, Normal, template!(Word)),
-    ungated!(target_feature, Normal, template!(List: r#"enable = "name""#)),
-    ungated!(track_caller, Normal, template!(Word)),
+    ungated!(inline, Normal, template!(Word, List: "always|never"), FutureWarnFollowing),
+    ungated!(cold, Normal, template!(Word), WarnFollowing),
+    ungated!(no_builtins, Normal, template!(Word), WarnFollowing),
+    ungated!(target_feature, Normal, template!(List: r#"enable = "name""#), DuplicatesOk),
+    ungated!(track_caller, Normal, template!(Word), WarnFollowing),
     gated!(
         no_sanitize, Normal,
-        template!(List: "address, memory, thread"),
+        template!(List: "address, memory, thread"), DuplicatesOk,
         experimental!(no_sanitize)
     ),
-    gated!(no_coverage, Normal, template!(Word), experimental!(no_coverage)),
+    gated!(no_coverage, Normal, template!(Word), WarnFollowing, experimental!(no_coverage)),
 
-    // FIXME: #14408 assume docs are used since rustdoc looks at them.
-    ungated!(doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string")),
+    ungated!(
+        doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk
+    ),
 
     // ==========================================================================
     // Unstable attributes:
     // ==========================================================================
 
     // Linking:
-    gated!(naked, Normal, template!(Word), naked_functions, experimental!(naked)),
+    gated!(naked, Normal, template!(Word), WarnFollowing, naked_functions, experimental!(naked)),
     gated!(
-        link_ordinal, Normal, template!(List: "ordinal"), raw_dylib,
+        link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, raw_dylib,
         experimental!(link_ordinal)
     ),
 
@@ -309,6 +390,7 @@ pub struct BuiltinAttribute {
         name: sym::plugin,
         type_: CrateLevel,
         template: template!(List: "name"),
+        duplicates: DuplicatesOk,
         gate: Gated(
             Stability::Deprecated(
                 "https://github.com/rust-lang/rust/pull/64675",
@@ -321,42 +403,52 @@ pub struct BuiltinAttribute {
     },
 
     // Testing:
-    gated!(allow_fail, Normal, template!(Word), experimental!(allow_fail)),
+    gated!(allow_fail, Normal, template!(Word), WarnFollowing, experimental!(allow_fail)),
     gated!(
-        test_runner, CrateLevel, template!(List: "path"), custom_test_frameworks,
+        test_runner, CrateLevel, template!(List: "path"), ErrorFollowing, custom_test_frameworks,
         "custom test frameworks are an unstable feature",
     ),
     // RFC #1268
-    gated!(marker, Normal, template!(Word), marker_trait_attr, experimental!(marker)),
     gated!(
-        thread_local, Normal, template!(Word),
+        marker, Normal, template!(Word), WarnFollowing, marker_trait_attr, experimental!(marker)
+    ),
+    gated!(
+        thread_local, Normal, template!(Word), WarnFollowing,
         "`#[thread_local]` is an experimental feature, and does not currently handle destructors",
     ),
-    gated!(no_core, CrateLevel, template!(Word), experimental!(no_core)),
+    gated!(no_core, CrateLevel, template!(Word), WarnFollowing, experimental!(no_core)),
     // RFC 2412
     gated!(
-        optimize, Normal, template!(List: "size|speed"), optimize_attribute,
+        optimize, Normal, template!(List: "size|speed"), ErrorPreceding, optimize_attribute,
         experimental!(optimize),
     ),
     // RFC 2867
-    gated!(instruction_set, Normal, template!(List: "set"), isa_attribute, experimental!(instruction_set)),
+    gated!(
+        instruction_set, Normal, template!(List: "set"), ErrorPreceding,
+        isa_attribute, experimental!(instruction_set)
+    ),
 
-    gated!(ffi_returns_twice, Normal, template!(Word), experimental!(ffi_returns_twice)),
-    gated!(ffi_pure, Normal, template!(Word), experimental!(ffi_pure)),
-    gated!(ffi_const, Normal, template!(Word), experimental!(ffi_const)),
     gated!(
-        register_attr, CrateLevel, template!(List: "attr1, attr2, ..."),
+        ffi_returns_twice, Normal, template!(Word), WarnFollowing, experimental!(ffi_returns_twice)
+    ),
+    gated!(ffi_pure, Normal, template!(Word), WarnFollowing, experimental!(ffi_pure)),
+    gated!(ffi_const, Normal, template!(Word), WarnFollowing, experimental!(ffi_const)),
+    gated!(
+        register_attr, CrateLevel, template!(List: "attr1, attr2, ..."), DuplicatesOk,
         experimental!(register_attr),
     ),
     gated!(
-        register_tool, CrateLevel, template!(List: "tool1, tool2, ..."),
+        register_tool, CrateLevel, template!(List: "tool1, tool2, ..."), DuplicatesOk,
         experimental!(register_tool),
     ),
 
-    gated!(cmse_nonsecure_entry, Normal, template!(Word), experimental!(cmse_nonsecure_entry)),
+    gated!(
+        cmse_nonsecure_entry, Normal, template!(Word), WarnFollowing,
+        experimental!(cmse_nonsecure_entry)
+    ),
     // RFC 2632
     gated!(
-        default_method_body_is_const, Normal, template!(Word), const_trait_impl,
+        default_method_body_is_const, Normal, template!(Word), WarnFollowing, const_trait_impl,
         "`default_method_body_is_const` is a temporary placeholder for declaring default bodies \
         as `const`, which may be removed or renamed in the future."
     ),
@@ -365,34 +457,33 @@ pub struct BuiltinAttribute {
     // Internal attributes: Stability, deprecation, and unsafe:
     // ==========================================================================
 
-    ungated!(feature, CrateLevel, template!(List: "name1, name1, ...")),
-    // FIXME(#14407) -- only looked at on-demand so we can't
-    // guarantee they'll have already been checked.
+    ungated!(feature, CrateLevel, template!(List: "name1, name1, ..."), DuplicatesOk),
+    // DuplicatesOk since it has its own validation
     ungated!(
         rustc_deprecated, Normal,
-        template!(List: r#"since = "version", reason = "...""#)
+        template!(List: r#"since = "version", reason = "...""#), DuplicatesOk // See E0550
+    ),
+    // DuplicatesOk since it has its own validation
+    ungated!(
+        stable, Normal, template!(List: r#"feature = "name", since = "version""#), DuplicatesOk
     ),
-    // FIXME(#14407)
-    ungated!(stable, Normal, template!(List: r#"feature = "name", since = "version""#)),
-    // FIXME(#14407)
     ungated!(
         unstable, Normal,
-        template!(List: r#"feature = "name", reason = "...", issue = "N""#),
+        template!(List: r#"feature = "name", reason = "...", issue = "N""#), DuplicatesOk,
     ),
-    // FIXME(#14407)
-    ungated!(rustc_const_unstable, Normal, template!(List: r#"feature = "name""#)),
-    // FIXME(#14407)
-    ungated!(rustc_const_stable, Normal, template!(List: r#"feature = "name""#)),
+    ungated!(rustc_const_unstable, Normal, template!(List: r#"feature = "name""#), DuplicatesOk),
+    ungated!(rustc_const_stable, Normal, template!(List: r#"feature = "name""#), DuplicatesOk),
     gated!(
-        allow_internal_unstable, Normal, template!(Word, List: "feat1, feat2, ..."),
+        allow_internal_unstable, Normal, template!(Word, List: "feat1, feat2, ..."), DuplicatesOk,
         "allow_internal_unstable side-steps feature gating and stability checks",
     ),
     gated!(
-        rustc_allow_const_fn_unstable, Normal, template!(Word, List: "feat1, feat2, ..."),
+        rustc_allow_const_fn_unstable, Normal,
+        template!(Word, List: "feat1, feat2, ..."), DuplicatesOk,
         "rustc_allow_const_fn_unstable side-steps feature gating and stability checks"
     ),
     gated!(
-        allow_internal_unsafe, Normal, template!(Word),
+        allow_internal_unsafe, Normal, template!(Word), WarnFollowing,
         "allow_internal_unsafe side-steps the unsafe_code lint",
     ),
 
@@ -400,9 +491,9 @@ pub struct BuiltinAttribute {
     // Internal attributes: Type system related:
     // ==========================================================================
 
-    gated!(fundamental, Normal, template!(Word), experimental!(fundamental)),
+    gated!(fundamental, Normal, template!(Word), WarnFollowing, experimental!(fundamental)),
     gated!(
-        may_dangle, Normal, template!(Word), dropck_eyepatch,
+        may_dangle, Normal, template!(Word), WarnFollowing, dropck_eyepatch,
         "`may_dangle` has unstable semantics and may be removed in the future",
     ),
 
@@ -410,26 +501,32 @@ pub struct BuiltinAttribute {
     // Internal attributes: Runtime related:
     // ==========================================================================
 
-    rustc_attr!(rustc_allocator, Normal, template!(Word), IMPL_DETAIL),
-    rustc_attr!(rustc_allocator_nounwind, Normal, template!(Word), IMPL_DETAIL),
-    gated!(alloc_error_handler, Normal, template!(Word), experimental!(alloc_error_handler)),
+    rustc_attr!(rustc_allocator, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
+    rustc_attr!(rustc_allocator_nounwind, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
+    gated!(
+        alloc_error_handler, Normal, template!(Word), WarnFollowing,
+        experimental!(alloc_error_handler)
+    ),
     gated!(
-        default_lib_allocator, Normal, template!(Word), allocator_internals,
+        default_lib_allocator, Normal, template!(Word), WarnFollowing, allocator_internals,
         experimental!(default_lib_allocator),
     ),
     gated!(
-        needs_allocator, Normal, template!(Word), allocator_internals,
+        needs_allocator, Normal, template!(Word), WarnFollowing, allocator_internals,
         experimental!(needs_allocator),
     ),
-    gated!(panic_runtime, Normal, template!(Word), experimental!(panic_runtime)),
-    gated!(needs_panic_runtime, Normal, template!(Word), experimental!(needs_panic_runtime)),
+    gated!(panic_runtime, Normal, template!(Word), WarnFollowing, experimental!(panic_runtime)),
     gated!(
-        compiler_builtins, Normal, template!(Word),
+        needs_panic_runtime, Normal, template!(Word), WarnFollowing,
+        experimental!(needs_panic_runtime)
+    ),
+    gated!(
+        compiler_builtins, Normal, template!(Word), WarnFollowing,
         "the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \
         which contains compiler-rt intrinsics and will never be stable",
     ),
     gated!(
-        profiler_runtime, Normal, template!(Word),
+        profiler_runtime, Normal, template!(Word), WarnFollowing,
         "the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
         which contains the profiler runtime and will never be stable",
     ),
@@ -439,10 +536,12 @@ pub struct BuiltinAttribute {
     // ==========================================================================
 
     gated!(
-        linkage, Normal, template!(NameValueStr: "external|internal|..."),
+        linkage, Normal, template!(NameValueStr: "external|internal|..."), ErrorPreceding,
         "the `linkage` attribute is experimental and not portable across platforms",
     ),
-    rustc_attr!(rustc_std_internal_symbol, Normal, template!(Word), INTERNAL_UNSTABLE),
+    rustc_attr!(
+        rustc_std_internal_symbol, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE
+    ),
 
     // ==========================================================================
     // Internal attributes, Macro related:
@@ -450,13 +549,13 @@ pub struct BuiltinAttribute {
 
     rustc_attr!(
         rustc_builtin_macro, Normal,
-        template!(Word, List: "name, /*opt*/ attributes(name1, name2, ...)"),
+        template!(Word, List: "name, /*opt*/ attributes(name1, name2, ...)"), ErrorFollowing,
         IMPL_DETAIL,
     ),
-    rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), INTERNAL_UNSTABLE),
+    rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE),
     rustc_attr!(
         rustc_macro_transparency, Normal,
-        template!(NameValueStr: "transparent|semitransparent|opaque"),
+        template!(NameValueStr: "transparent|semitransparent|opaque"), ErrorFollowing,
         "used internally for testing macro hygiene",
     ),
 
@@ -470,39 +569,49 @@ pub struct BuiltinAttribute {
             List: r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#,
             NameValueStr: "message"
         ),
+        ErrorFollowing,
         INTERNAL_UNSTABLE
     ),
     // Enumerates "identity-like" conversion methods to suggest on type mismatch.
-    rustc_attr!(rustc_conversion_suggestion, Normal, template!(Word), INTERNAL_UNSTABLE),
+    rustc_attr!(
+        rustc_conversion_suggestion, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE
+    ),
     // Prevents field reads in the marked trait or method to be considered
     // during dead code analysis.
-    rustc_attr!(rustc_trivial_field_reads, Normal, template!(Word), INTERNAL_UNSTABLE),
+    rustc_attr!(
+        rustc_trivial_field_reads, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE
+    ),
 
     // ==========================================================================
     // Internal attributes, Const related:
     // ==========================================================================
 
-    rustc_attr!(rustc_promotable, Normal, template!(Word), IMPL_DETAIL),
-    rustc_attr!(rustc_legacy_const_generics, Normal, template!(List: "N"), INTERNAL_UNSTABLE),
+    rustc_attr!(rustc_promotable, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
+    rustc_attr!(
+        rustc_legacy_const_generics, Normal, template!(List: "N"), ErrorFollowing,
+        INTERNAL_UNSTABLE
+    ),
     // Do not const-check this function's body. It will always get replaced during CTFE.
-    rustc_attr!(rustc_do_not_const_check, Normal, template!(Word), INTERNAL_UNSTABLE),
+    rustc_attr!(
+        rustc_do_not_const_check, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE
+    ),
 
     // ==========================================================================
     // Internal attributes, Layout related:
     // ==========================================================================
 
     rustc_attr!(
-        rustc_layout_scalar_valid_range_start, Normal, template!(List: "value"),
+        rustc_layout_scalar_valid_range_start, Normal, template!(List: "value"), ErrorFollowing,
         "the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable \
         niche optimizations in libcore and will never be stable",
     ),
     rustc_attr!(
-        rustc_layout_scalar_valid_range_end, Normal, template!(List: "value"),
+        rustc_layout_scalar_valid_range_end, Normal, template!(List: "value"), ErrorFollowing,
         "the `#[rustc_layout_scalar_valid_range_end]` attribute is just used to enable \
         niche optimizations in libcore and will never be stable",
     ),
     rustc_attr!(
-        rustc_nonnull_optimization_guaranteed, Normal, template!(Word),
+        rustc_nonnull_optimization_guaranteed, Normal, template!(Word), WarnFollowing,
         "the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to enable \
         niche optimizations in libcore and will never be stable",
     ),
@@ -511,13 +620,14 @@ pub struct BuiltinAttribute {
     // Internal attributes, Misc:
     // ==========================================================================
     gated!(
-        lang, Normal, template!(NameValueStr: "name"), lang_items,
+        lang, Normal, template!(NameValueStr: "name"), DuplicatesOk, lang_items,
         "language items are subject to change",
     ),
     BuiltinAttribute {
         name: sym::rustc_diagnostic_item,
         type_: Normal,
         template: template!(NameValueStr: "name"),
+        duplicates: ErrorFollowing,
         gate: Gated(
             Stability::Unstable,
             sym::rustc_attrs,
@@ -527,41 +637,43 @@ pub struct BuiltinAttribute {
     },
     gated!(
         // Used in resolve:
-        prelude_import, Normal, template!(Word),
+        prelude_import, Normal, template!(Word), WarnFollowing,
         "`#[prelude_import]` is for use by rustc only",
     ),
     gated!(
-        rustc_paren_sugar, Normal, template!(Word), unboxed_closures,
+        rustc_paren_sugar, Normal, template!(Word), WarnFollowing, unboxed_closures,
         "unboxed_closures are still evolving",
     ),
     rustc_attr!(
-        rustc_inherit_overflow_checks, Normal, template!(Word),
+        rustc_inherit_overflow_checks, Normal, template!(Word), WarnFollowing,
         "the `#[rustc_inherit_overflow_checks]` attribute is just used to control \
         overflow checking behavior of several libcore functions that are inlined \
         across crates and will never be stable",
     ),
-    rustc_attr!(rustc_reservation_impl, Normal, template!(NameValueStr: "reservation message"),
-                "the `#[rustc_reservation_impl]` attribute is internally used \
-                 for reserving for `for<T> From<!> for T` impl"
+    rustc_attr!(
+        rustc_reservation_impl, Normal,
+        template!(NameValueStr: "reservation message"), ErrorFollowing,
+        "the `#[rustc_reservation_impl]` attribute is internally used \
+         for reserving for `for<T> From<!> for T` impl"
     ),
     rustc_attr!(
-        rustc_test_marker, Normal, template!(Word),
+        rustc_test_marker, Normal, template!(Word), WarnFollowing,
         "the `#[rustc_test_marker]` attribute is used internally to track tests",
     ),
     rustc_attr!(
-        rustc_unsafe_specialization_marker, Normal, template!(Word),
+        rustc_unsafe_specialization_marker, Normal, template!(Word), WarnFollowing,
         "the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"
     ),
     rustc_attr!(
-        rustc_specialization_trait, Normal, template!(Word),
+        rustc_specialization_trait, Normal, template!(Word), WarnFollowing,
         "the `#[rustc_specialization_trait]` attribute is used to check specializations"
     ),
     rustc_attr!(
-        rustc_main, Normal, template!(Word),
+        rustc_main, Normal, template!(Word), WarnFollowing,
         "the `#[rustc_main]` attribute is used internally to specify test entry point function",
     ),
     rustc_attr!(
-        rustc_skip_array_during_method_dispatch, Normal, template!(Word),
+        rustc_skip_array_during_method_dispatch, Normal, template!(Word), WarnFollowing,
         "the `#[rustc_skip_array_during_method_dispatch]` attribute is used to exclude a trait \
         from method dispatch when the receiver is an array, for compatibility in editions < 2021."
     ),
@@ -570,49 +682,53 @@ pub struct BuiltinAttribute {
     // Internal attributes, Testing:
     // ==========================================================================
 
-    rustc_attr!(TEST, rustc_outlives, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_capture_analysis, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_insignificant_dtor, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_strict_coherence, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_variance, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_layout, Normal, template!(List: "field1, field2, ...")),
-    rustc_attr!(TEST, rustc_regions, Normal, template!(Word)),
+    rustc_attr!(TEST, rustc_outlives, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_capture_analysis, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_insignificant_dtor, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_strict_coherence, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_variance, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_layout, Normal, template!(List: "field1, field2, ..."), WarnFollowing),
+    rustc_attr!(TEST, rustc_regions, Normal, template!(Word), WarnFollowing),
     rustc_attr!(
         TEST, rustc_error, Normal,
-        template!(Word, List: "delay_span_bug_from_inside_query")
+        template!(Word, List: "delay_span_bug_from_inside_query"), WarnFollowingWordOnly
+    ),
+    rustc_attr!(TEST, rustc_dump_user_substs, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(
+        TEST, rustc_if_this_changed, Normal, template!(Word, List: "DepNode"), DuplicatesOk
+    ),
+    rustc_attr!(
+        TEST, rustc_then_this_would_need, Normal, template!(List: "DepNode"), DuplicatesOk
     ),
-    rustc_attr!(TEST, rustc_dump_user_substs, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_if_this_changed, Normal, template!(Word, List: "DepNode")),
-    rustc_attr!(TEST, rustc_then_this_would_need, Normal, template!(List: "DepNode")),
     rustc_attr!(
         TEST, rustc_clean, Normal,
         template!(List: r#"cfg = "...", /*opt*/ label = "...", /*opt*/ except = "...""#),
+        DuplicatesOk,
     ),
     rustc_attr!(
         TEST, rustc_partition_reused, Normal,
-        template!(List: r#"cfg = "...", module = "...""#),
+        template!(List: r#"cfg = "...", module = "...""#), DuplicatesOk,
     ),
     rustc_attr!(
         TEST, rustc_partition_codegened, Normal,
-        template!(List: r#"cfg = "...", module = "...""#),
+        template!(List: r#"cfg = "...", module = "...""#), DuplicatesOk,
     ),
     rustc_attr!(
         TEST, rustc_expected_cgu_reuse, Normal,
-        template!(List: r#"cfg = "...", module = "...", kind = "...""#),
-    ),
-    rustc_attr!(TEST, rustc_synthetic, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_symbol_name, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_polymorphize_error, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_def_path, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_mir, Normal, template!(List: "arg1, arg2, ...")),
-    rustc_attr!(TEST, rustc_dump_program_clauses, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_dump_env_program_clauses, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_object_lifetime_default, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_dump_vtable, Normal, template!(Word)),
-    rustc_attr!(TEST, rustc_dummy, Normal, template!(Word /* doesn't matter*/)),
+        template!(List: r#"cfg = "...", module = "...", kind = "...""#), DuplicatesOk,
+    ),
+    rustc_attr!(TEST, rustc_symbol_name, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_polymorphize_error, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_def_path, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_mir, Normal, template!(List: "arg1, arg2, ..."), DuplicatesOk),
+    rustc_attr!(TEST, rustc_dump_program_clauses, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_dump_env_program_clauses, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_object_lifetime_default, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_dump_vtable, Normal, template!(Word), WarnFollowing),
+    rustc_attr!(TEST, rustc_dummy, Normal, template!(Word /* doesn't matter*/), DuplicatesOk),
     gated!(
-        omit_gdb_pretty_printer_section, Normal, template!(Word),
+        omit_gdb_pretty_printer_section, Normal, template!(Word), WarnFollowing,
         "the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite",
     ),
 ];
index b25aab21e491afa1a54ac74cf7ad3fb7bff7bcc5..bfc537cfae2cb9365e41917064f2e55b10af621a 100644 (file)
@@ -11,6 +11,7 @@
 //! even if it is stabilized or removed, *do not remove it*. Instead, move the
 //! symbol to the `accepted` or `removed` modules respectively.
 
+#![feature(derive_default_enum)]
 #![feature(once_cell)]
 
 mod accepted;
@@ -146,6 +147,7 @@ pub fn find_feature_issue(feature: Symbol, issue: GateIssue) -> Option<NonZeroU3
 
 pub use accepted::ACCEPTED_FEATURES;
 pub use active::{Features, ACTIVE_FEATURES, INCOMPATIBLE_FEATURES};
+pub use builtin_attrs::AttributeDuplicates;
 pub use builtin_attrs::{
     deprecated_attributes, find_gated_cfg, is_builtin_attr_name, AttributeGate, AttributeTemplate,
     AttributeType, BuiltinAttribute, GatedCfg, BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP,
index 5091a7bccc55b0d036c1ae4405e378f78685628b..f19ca497d8bf257f4a8853302366a54ad6c70dc7 100644 (file)
@@ -1,52 +1,52 @@
-/// This declares a list of types which can be allocated by `Arena`.
+/// This higher-order macro declares a list of types which can be allocated by `Arena`.
 ///
 /// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]`,
 /// where `T` is the type listed. These impls will appear in the implement_ty_decoder! macro.
 #[macro_export]
 macro_rules! arena_types {
-    ($macro:path, $tcx:lifetime) => (
+    ($macro:path) => (
         $macro!([
             // HIR types
-            [] hir_krate: rustc_hir::Crate<$tcx>,
-            [] arm: rustc_hir::Arm<$tcx>,
-            [] asm_operand: (rustc_hir::InlineAsmOperand<$tcx>, Span),
+            [] hir_krate: rustc_hir::Crate<'tcx>,
+            [] arm: rustc_hir::Arm<'tcx>,
+            [] asm_operand: (rustc_hir::InlineAsmOperand<'tcx>, Span),
             [] asm_template: rustc_ast::InlineAsmTemplatePiece,
             [] attribute: rustc_ast::Attribute,
-            [] block: rustc_hir::Block<$tcx>,
-            [] bare_fn_ty: rustc_hir::BareFnTy<$tcx>,
-            [] body: rustc_hir::Body<$tcx>,
-            [] generic_arg: rustc_hir::GenericArg<$tcx>,
-            [] generic_args: rustc_hir::GenericArgs<$tcx>,
-            [] generic_bound: rustc_hir::GenericBound<$tcx>,
-            [] generic_param: rustc_hir::GenericParam<$tcx>,
-            [] expr: rustc_hir::Expr<$tcx>,
-            [] expr_field: rustc_hir::ExprField<$tcx>,
-            [] pat_field: rustc_hir::PatField<$tcx>,
-            [] fn_decl: rustc_hir::FnDecl<$tcx>,
-            [] foreign_item: rustc_hir::ForeignItem<$tcx>,
+            [] block: rustc_hir::Block<'tcx>,
+            [] bare_fn_ty: rustc_hir::BareFnTy<'tcx>,
+            [] body: rustc_hir::Body<'tcx>,
+            [] generic_arg: rustc_hir::GenericArg<'tcx>,
+            [] generic_args: rustc_hir::GenericArgs<'tcx>,
+            [] generic_bound: rustc_hir::GenericBound<'tcx>,
+            [] generic_param: rustc_hir::GenericParam<'tcx>,
+            [] expr: rustc_hir::Expr<'tcx>,
+            [] expr_field: rustc_hir::ExprField<'tcx>,
+            [] pat_field: rustc_hir::PatField<'tcx>,
+            [] fn_decl: rustc_hir::FnDecl<'tcx>,
+            [] foreign_item: rustc_hir::ForeignItem<'tcx>,
             [] foreign_item_ref: rustc_hir::ForeignItemRef,
-            [] impl_item: rustc_hir::ImplItem<$tcx>,
+            [] impl_item: rustc_hir::ImplItem<'tcx>,
             [] impl_item_ref: rustc_hir::ImplItemRef,
-            [] item: rustc_hir::Item<$tcx>,
-            [] inline_asm: rustc_hir::InlineAsm<$tcx>,
-            [] llvm_inline_asm: rustc_hir::LlvmInlineAsm<$tcx>,
-            [] local: rustc_hir::Local<$tcx>,
-            [] mod_: rustc_hir::Mod<$tcx>,
-            [] owner_info: rustc_hir::OwnerInfo<$tcx>,
-            [] param: rustc_hir::Param<$tcx>,
-            [] pat: rustc_hir::Pat<$tcx>,
-            [] path: rustc_hir::Path<$tcx>,
-            [] path_segment: rustc_hir::PathSegment<$tcx>,
-            [] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>,
-            [] qpath: rustc_hir::QPath<$tcx>,
-            [] stmt: rustc_hir::Stmt<$tcx>,
-            [] field_def: rustc_hir::FieldDef<$tcx>,
-            [] trait_item: rustc_hir::TraitItem<$tcx>,
+            [] item: rustc_hir::Item<'tcx>,
+            [] inline_asm: rustc_hir::InlineAsm<'tcx>,
+            [] llvm_inline_asm: rustc_hir::LlvmInlineAsm<'tcx>,
+            [] local: rustc_hir::Local<'tcx>,
+            [] mod_: rustc_hir::Mod<'tcx>,
+            [] owner_info: rustc_hir::OwnerInfo<'tcx>,
+            [] param: rustc_hir::Param<'tcx>,
+            [] pat: rustc_hir::Pat<'tcx>,
+            [] path: rustc_hir::Path<'tcx>,
+            [] path_segment: rustc_hir::PathSegment<'tcx>,
+            [] poly_trait_ref: rustc_hir::PolyTraitRef<'tcx>,
+            [] qpath: rustc_hir::QPath<'tcx>,
+            [] stmt: rustc_hir::Stmt<'tcx>,
+            [] field_def: rustc_hir::FieldDef<'tcx>,
+            [] trait_item: rustc_hir::TraitItem<'tcx>,
             [] trait_item_ref: rustc_hir::TraitItemRef,
-            [] ty: rustc_hir::Ty<$tcx>,
-            [] type_binding: rustc_hir::TypeBinding<$tcx>,
-            [] variant: rustc_hir::Variant<$tcx>,
-            [] where_predicate: rustc_hir::WherePredicate<$tcx>,
-        ], $tcx);
+            [] ty: rustc_hir::Ty<'tcx>,
+            [] type_binding: rustc_hir::TypeBinding<'tcx>,
+            [] variant: rustc_hir::Variant<'tcx>,
+            [] where_predicate: rustc_hir::WherePredicate<'tcx>,
+        ]);
     )
 }
index e00c5789fe9c780951482eee5a77c574917a2236..c67d3df3dedd85b9d4457e50ecdcf9b669809ebd 100644 (file)
@@ -504,7 +504,7 @@ pub enum GenericParamKind<'hir> {
     },
     Type {
         default: Option<&'hir Ty<'hir>>,
-        synthetic: Option<SyntheticTyParamKind>,
+        synthetic: bool,
     },
     Const {
         ty: &'hir Ty<'hir>,
@@ -577,16 +577,6 @@ pub fn spans(&self) -> MultiSpan {
     }
 }
 
-/// Synthetic type parameters are converted to another form during lowering; this allows
-/// us to track the original form they had, and is useful for error messages.
-#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, Debug)]
-#[derive(HashStable_Generic)]
-pub enum SyntheticTyParamKind {
-    ImplTrait,
-    // Created by the `#[rustc_synthetic]` attribute.
-    FromAttr,
-}
-
 /// A where-clause in a definition.
 #[derive(Debug, HashStable_Generic)]
 pub struct WhereClause<'hir> {
@@ -1831,8 +1821,6 @@ pub fn last_segment_span(&self) -> Span {
 pub enum LocalSource {
     /// A `match _ { .. }`.
     Normal,
-    /// A desugared `for _ in _ { .. }` loop.
-    ForLoopDesugar,
     /// When lowering async functions, we create locals within the `async move` so that
     /// all parameters are dropped after the future is polled.
     ///
index b1f78a83e7407a01451ee175414f5fcafacc78e2..b30076100bb2c5f665aeb164db7a6208f522b838 100644 (file)
@@ -2,6 +2,7 @@
 use crate::def_id::DefId;
 use crate::hir::{self, HirId, PatKind};
 use rustc_data_structures::stable_set::FxHashSet;
+use rustc_span::hygiene::DesugaringKind;
 use rustc_span::symbol::Ident;
 use rustc_span::Span;
 
@@ -143,4 +144,14 @@ pub fn contains_explicit_ref_binding(&self) -> Option<hir::Mutability> {
         });
         result
     }
+
+    /// If the pattern is `Some(<pat>)` from a desugared for loop, returns the inner pattern
+    pub fn for_loop_some(&self) -> Option<&Self> {
+        if self.span.desugaring_kind() == Some(DesugaringKind::ForLoop) {
+            if let hir::PatKind::Struct(_, [pat_field], _) = self.kind {
+                return Some(pat_field.pat);
+            }
+        }
+        None
+    }
 }
index 5f5e83774dad803882b6cfc528297062d9797007..9c6e2aeb50a761a4299a5222ea8050f6539cc79a 100644 (file)
@@ -6,6 +6,7 @@
 use rustc_middle::ty::OnDiskCache;
 use rustc_serialize::opaque::Decoder;
 use rustc_serialize::Decodable;
+use rustc_session::config::IncrementalStateAssertion;
 use rustc_session::Session;
 use std::path::Path;
 
@@ -16,6 +17,7 @@
 
 type WorkProductMap = FxHashMap<WorkProductId, WorkProduct>;
 
+#[derive(Debug)]
 pub enum LoadResult<T> {
     Ok { data: T },
     DataOutOfDate,
@@ -24,6 +26,26 @@ pub enum LoadResult<T> {
 
 impl<T: Default> LoadResult<T> {
     pub fn open(self, sess: &Session) -> T {
+        // Check for errors when using `-Zassert-incremental-state`
+        match (sess.opts.assert_incr_state, &self) {
+            (Some(IncrementalStateAssertion::NotLoaded), LoadResult::Ok { .. }) => {
+                sess.fatal(
+                    "We asserted that the incremental cache should not be loaded, \
+                         but it was loaded.",
+                );
+            }
+            (
+                Some(IncrementalStateAssertion::Loaded),
+                LoadResult::Error { .. } | LoadResult::DataOutOfDate,
+            ) => {
+                sess.fatal(
+                    "We asserted that an existing incremental cache directory should \
+                         be successfully loaded, but it was not.",
+                );
+            }
+            _ => {}
+        };
+
         match self {
             LoadResult::Error { message } => {
                 sess.warn(&message);
@@ -33,7 +55,7 @@ pub fn open(self, sess: &Session) -> T {
                 if let Err(err) = delete_all_session_dir_contents(sess) {
                     sess.err(&format!(
                         "Failed to delete invalidated or incompatible \
-                                      incremental compilation session directory contents `{}`: {}.",
+                         incremental compilation session directory contents `{}`: {}.",
                         dep_graph_path(sess).display(),
                         err
                     ));
index c25ec1356e2300ea366eca972e26d392825d85e6..85226e60bdbdbac5705bfb528a0dd87b37f1e91b 100644 (file)
@@ -310,6 +310,34 @@ pub fn unexpected_hidden_region_diagnostic(
     err
 }
 
+/// Structurally compares two types, modulo any inference variables.
+///
+/// Returns `true` if two types are equal, or if one type is an inference variable compatible
+/// with the other type. A TyVar inference type is compatible with any type, and an IntVar or
+/// FloatVar inference type are compatible with themselves or their concrete types (Int and
+/// Float types, respectively). When comparing two ADTs, these rules apply recursively.
+pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool {
+    match (&a.kind(), &b.kind()) {
+        (&ty::Adt(did_a, substs_a), &ty::Adt(did_b, substs_b)) => {
+            if did_a != did_b {
+                return false;
+            }
+
+            substs_a.types().zip(substs_b.types()).all(|(a, b)| same_type_modulo_infer(a, b))
+        }
+        (&ty::Int(_), &ty::Infer(ty::InferTy::IntVar(_)))
+        | (&ty::Infer(ty::InferTy::IntVar(_)), &ty::Int(_) | &ty::Infer(ty::InferTy::IntVar(_)))
+        | (&ty::Float(_), &ty::Infer(ty::InferTy::FloatVar(_)))
+        | (
+            &ty::Infer(ty::InferTy::FloatVar(_)),
+            &ty::Float(_) | &ty::Infer(ty::InferTy::FloatVar(_)),
+        )
+        | (&ty::Infer(ty::InferTy::TyVar(_)), _)
+        | (_, &ty::Infer(ty::InferTy::TyVar(_))) => true,
+        _ => a == b,
+    }
+}
+
 impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
     pub fn report_region_errors(&self, errors: &Vec<RegionResolutionError<'tcx>>) {
         debug!("report_region_errors(): {} errors to start", errors.len());
@@ -1667,11 +1695,23 @@ enum Mismatch<'a> {
             }
             _ => exp_found,
         };
-        debug!("exp_found {:?} terr {:?}", exp_found, terr);
+        debug!("exp_found {:?} terr {:?} cause.code {:?}", exp_found, terr, cause.code);
         if let Some(exp_found) = exp_found {
-            self.suggest_as_ref_where_appropriate(span, &exp_found, diag);
-            self.suggest_accessing_field_where_appropriate(cause, &exp_found, diag);
-            self.suggest_await_on_expect_found(cause, span, &exp_found, diag);
+            let should_suggest_fixes = if let ObligationCauseCode::Pattern { root_ty, .. } =
+                &cause.code
+            {
+                // Skip if the root_ty of the pattern is not the same as the expected_ty.
+                // If these types aren't equal then we've probably peeled off a layer of arrays.
+                same_type_modulo_infer(self.resolve_vars_if_possible(*root_ty), exp_found.expected)
+            } else {
+                true
+            };
+
+            if should_suggest_fixes {
+                self.suggest_as_ref_where_appropriate(span, &exp_found, diag);
+                self.suggest_accessing_field_where_appropriate(cause, &exp_found, diag);
+                self.suggest_await_on_expect_found(cause, span, &exp_found, diag);
+            }
         }
 
         // In some (most?) cases cause.body_id points to actual body, but in some cases
@@ -1761,7 +1801,7 @@ fn suggest_await_on_expect_found(
             self.get_impl_future_output_ty(exp_found.expected),
             self.get_impl_future_output_ty(exp_found.found),
         ) {
-            (Some(exp), Some(found)) if ty::TyS::same_type(exp, found) => match &cause.code {
+            (Some(exp), Some(found)) if same_type_modulo_infer(exp, found) => match &cause.code {
                 ObligationCauseCode::IfExpression(box IfExpressionCause { then, .. }) => {
                     diag.multipart_suggestion(
                         "consider `await`ing on both `Future`s",
@@ -1793,7 +1833,7 @@ fn suggest_await_on_expect_found(
                     diag.help("consider `await`ing on both `Future`s");
                 }
             },
-            (_, Some(ty)) if ty::TyS::same_type(exp_found.expected, ty) => {
+            (_, Some(ty)) if same_type_modulo_infer(exp_found.expected, ty) => {
                 diag.span_suggestion_verbose(
                     exp_span.shrink_to_hi(),
                     "consider `await`ing on the `Future`",
@@ -1801,7 +1841,7 @@ fn suggest_await_on_expect_found(
                     Applicability::MaybeIncorrect,
                 );
             }
-            (Some(ty), _) if ty::TyS::same_type(ty, exp_found.found) => match cause.code {
+            (Some(ty), _) if same_type_modulo_infer(ty, exp_found.found) => match cause.code {
                 ObligationCauseCode::Pattern { span: Some(span), .. }
                 | ObligationCauseCode::IfExpression(box IfExpressionCause { then: span, .. }) => {
                     diag.span_suggestion_verbose(
@@ -1851,7 +1891,7 @@ fn suggest_accessing_field_where_appropriate(
                 .iter()
                 .filter(|field| field.vis.is_accessible_from(field.did, self.tcx))
                 .map(|field| (field.ident.name, field.ty(self.tcx, expected_substs)))
-                .find(|(_, ty)| ty::TyS::same_type(ty, exp_found.found))
+                .find(|(_, ty)| same_type_modulo_infer(ty, exp_found.found))
             {
                 if let ObligationCauseCode::Pattern { span: Some(span), .. } = cause.code {
                     if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
@@ -1916,7 +1956,7 @@ fn suggest_as_ref_where_appropriate(
                                         | (_, ty::Infer(_))
                                         | (ty::Param(_), _)
                                         | (ty::Infer(_), _) => {}
-                                        _ if ty::TyS::same_type(exp_ty, found_ty) => {}
+                                        _ if same_type_modulo_infer(exp_ty, found_ty) => {}
                                         _ => show_suggestion = false,
                                     };
                                 }
@@ -2113,10 +2153,19 @@ pub fn construct_generic_bound_failure(
                         None
                     },
                     self.tcx.generics_of(owner.to_def_id()),
+                    hir.span(hir_id),
                 )
             });
+
+        let span = match generics {
+            // This is to get around the trait identity obligation, that has a `DUMMY_SP` as signal
+            // for other diagnostics, so we need to recover it here.
+            Some((_, _, node)) if span.is_dummy() => node,
+            _ => span,
+        };
+
         let type_param_span = match (generics, bound_kind) {
-            (Some((_, ref generics)), GenericKind::Param(ref param)) => {
+            (Some((_, ref generics, _)), GenericKind::Param(ref param)) => {
                 // Account for the case where `param` corresponds to `Self`,
                 // which doesn't have the expected type argument.
                 if !(generics.has_self && param.index == 0) {
@@ -2153,7 +2202,7 @@ pub fn construct_generic_bound_failure(
         };
         let new_lt = generics
             .as_ref()
-            .and_then(|(parent_g, g)| {
+            .and_then(|(parent_g, g, _)| {
                 let mut possible = (b'a'..=b'z').map(|c| format!("'{}", c as char));
                 let mut lts_names = g
                     .params
@@ -2175,7 +2224,7 @@ pub fn construct_generic_bound_failure(
             .unwrap_or("'lt".to_string());
         let add_lt_sugg = generics
             .as_ref()
-            .and_then(|(_, g)| g.params.first())
+            .and_then(|(_, g, _)| g.params.first())
             .and_then(|param| param.def_id.as_local())
             .map(|def_id| {
                 (
index e00003face9ced40b6f7d3e13367b05b4e7d68cc..a7e019a53ee13586c835b1991c38109fa0e32915 100644 (file)
@@ -5,13 +5,12 @@
 use rustc_hir::def::{DefKind, Namespace};
 use rustc_hir::def_id::DefId;
 use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
-use rustc_hir::{Body, Expr, ExprKind, FnRetTy, HirId, Local, Pat};
+use rustc_hir::{Body, Expr, ExprKind, FnRetTy, HirId, Local, MatchSource, Pat};
 use rustc_middle::hir::map::Map;
 use rustc_middle::infer::unify_key::ConstVariableOriginKind;
 use rustc_middle::ty::print::Print;
 use rustc_middle::ty::subst::{GenericArg, GenericArgKind};
 use rustc_middle::ty::{self, DefIdTree, InferConst, Ty, TyCtxt};
-use rustc_span::source_map::DesugaringKind;
 use rustc_span::symbol::kw;
 use rustc_span::Span;
 use std::borrow::Cow;
@@ -26,6 +25,7 @@ struct FindHirNodeVisitor<'a, 'tcx> {
     found_closure: Option<&'tcx Expr<'tcx>>,
     found_method_call: Option<&'tcx Expr<'tcx>>,
     found_exact_method_call: Option<&'tcx Expr<'tcx>>,
+    found_for_loop_iter: Option<&'tcx Expr<'tcx>>,
     found_use_diagnostic: Option<UseDiagnostic<'tcx>>,
 }
 
@@ -41,6 +41,7 @@ fn new(infcx: &'a InferCtxt<'a, 'tcx>, target: GenericArg<'tcx>, target_span: Sp
             found_closure: None,
             found_method_call: None,
             found_exact_method_call: None,
+            found_for_loop_iter: None,
             found_use_diagnostic: None,
         }
     }
@@ -111,6 +112,15 @@ fn visit_body(&mut self, body: &'tcx Body<'tcx>) {
     }
 
     fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
+        if let ExprKind::Match(scrutinee, [_, arm], MatchSource::ForLoopDesugar) = expr.kind {
+            if let Some(pat) = arm.pat.for_loop_some() {
+                if let Some(ty) = self.node_ty_contains_target(pat.hir_id) {
+                    self.found_for_loop_iter = Some(scrutinee);
+                    self.found_node_ty = Some(ty);
+                    return;
+                }
+            }
+        }
         if let ExprKind::MethodCall(_, call_span, exprs, _) = expr.kind {
             if call_span == self.target_span
                 && Some(self.target)
@@ -643,10 +653,7 @@ pub fn emit_inference_failure_err(
             let msg = if let Some(simple_ident) = pattern.simple_ident() {
                 match pattern.span.desugaring_kind() {
                     None => format!("consider giving `{}` {}", simple_ident, suffix),
-                    Some(DesugaringKind::ForLoop(_)) => {
-                        "the element type for this iterator is not specified".to_string()
-                    }
-                    _ => format!("this needs {}", suffix),
+                    Some(_) => format!("this needs {}", suffix),
                 }
             } else {
                 format!("consider giving this pattern {}", suffix)
@@ -719,6 +726,11 @@ pub fn emit_inference_failure_err(
                 //    = note: type must be known at this point
                 self.annotate_method_call(segment, e, &mut err);
             }
+        } else if let Some(scrutinee) = local_visitor.found_for_loop_iter {
+            err.span_label(
+                scrutinee.span,
+                "the element type for this iterator is not specified".to_string(),
+            );
         }
         // Instead of the following:
         // error[E0282]: type annotations needed
index c6ccd9b60a9c44ba0a788cc067c95ca7aae116b4..2aaebed28ced759939b87cb4269f916357896325 100644 (file)
@@ -192,14 +192,16 @@ pub(super) fn try_report_static_impl_trait(&self) -> Option<ErrorReported> {
                 ObligationCauseCode::MatchImpl(parent, ..) => &parent.code,
                 _ => &cause.code,
             };
-            if let ObligationCauseCode::ItemObligation(item_def_id) = *code {
+            if let (ObligationCauseCode::ItemObligation(item_def_id), None) =
+                (code, override_error_code)
+            {
                 // Same case of `impl Foo for dyn Bar { fn qux(&self) {} }` introducing a `'static`
                 // lifetime as above, but called using a fully-qualified path to the method:
                 // `Foo::qux(bar)`.
                 let mut v = TraitObjectVisitor(FxHashSet::default());
                 v.visit_ty(param.param_ty);
                 if let Some((ident, self_ty)) =
-                    self.get_impl_ident_and_self_ty_from_trait(item_def_id, &v.0)
+                    self.get_impl_ident_and_self_ty_from_trait(*item_def_id, &v.0)
                 {
                     if self.suggest_constrain_dyn_trait_in_impl(&mut err, &v.0, ident, self_ty) {
                         override_error_code = Some(ident);
index b874947cc69682393a86dfcdae04b9d6ba8541d2..2fd01c2d595fabe187d8019f1ad04f757b093976 100644 (file)
@@ -95,9 +95,10 @@ pub struct InferOk<'tcx, T> {
 /// This is used so that the region values inferred by HIR region solving are
 /// not exposed, and so that we can avoid doing work in HIR typeck that MIR
 /// typeck will also do.
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone, Debug, Default)]
 pub enum RegionckMode {
     /// The default mode: report region errors, don't erase regions.
+    #[default]
     Solve,
     /// Erase the results of region after solving.
     Erase {
@@ -108,12 +109,6 @@ pub enum RegionckMode {
     },
 }
 
-impl Default for RegionckMode {
-    fn default() -> Self {
-        RegionckMode::Solve
-    }
-}
-
 impl RegionckMode {
     /// Indicates that the MIR borrowck will repeat these region
     /// checks, so we should ignore errors if NLL is (unconditionally)
index d0f1ff649d058a0558f80ef9258234fac1fd165a..e4b407e7c112d838057df364b0d4de3c1f13e5d3 100644 (file)
@@ -15,6 +15,7 @@
 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
 #![feature(bool_to_option)]
 #![feature(box_patterns)]
+#![feature(derive_default_enum)]
 #![feature(extend_one)]
 #![feature(iter_zip)]
 #![feature(let_else)]
index 6b666d7c292221863d8455186d0c17812e312b98..24d4b05042133f548219983d00a898cc059debe7 100644 (file)
@@ -20,7 +20,9 @@
 use rustc_span::symbol::sym;
 use rustc_span::SourceFileHashAlgorithm;
 use rustc_target::spec::{CodeModel, LinkerFlavor, MergeFunctions, PanicStrategy};
-use rustc_target::spec::{RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, TlsModel};
+use rustc_target::spec::{
+    RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TlsModel,
+};
 
 use std::collections::{BTreeMap, BTreeSet};
 use std::iter::FromIterator;
@@ -636,6 +638,7 @@ macro_rules! untracked {
 
     // Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
     // This list is in alphabetical order.
+    untracked!(assert_incr_state, Some(String::from("loaded")));
     untracked!(ast_json, true);
     untracked!(ast_json_noexpand, true);
     untracked!(borrowck, String::from("other"));
@@ -712,8 +715,8 @@ macro_rules! tracked {
     // This list is in alphabetical order.
     tracked!(allow_features, Some(vec![String::from("lang_items")]));
     tracked!(always_encode_mir, true);
-    tracked!(assume_incomplete_release, true);
     tracked!(asm_comments, true);
+    tracked!(assume_incomplete_release, true);
     tracked!(binary_dep_depinfo, true);
     tracked!(chalk, true);
     tracked!(codegen_backend, Some("abc".to_string()));
@@ -730,8 +733,8 @@ macro_rules! tracked {
     tracked!(human_readable_cgu_names, true);
     tracked!(inline_in_all_cgus, Some(true));
     tracked!(inline_mir, Some(true));
-    tracked!(inline_mir_threshold, Some(123));
     tracked!(inline_mir_hint_threshold, Some(123));
+    tracked!(inline_mir_threshold, Some(123));
     tracked!(instrument_coverage, Some(InstrumentCoverage::All));
     tracked!(instrument_mcount, true);
     tracked!(link_only, true);
@@ -751,6 +754,7 @@ macro_rules! tracked {
     tracked!(panic_abort_tests, true);
     tracked!(panic_in_drop, PanicStrategy::Abort);
     tracked!(partially_uninit_const_threshold, Some(123));
+    tracked!(pick_stable_methods_before_any_unstable, false);
     tracked!(plt, Some(true));
     tracked!(polonius, true);
     tracked!(precise_enum_drop_elaboration, false);
@@ -762,7 +766,6 @@ macro_rules! tracked {
     tracked!(relax_elf_relocations, Some(true));
     tracked!(relro_level, Some(RelroLevel::Full));
     tracked!(remap_cwd_prefix, Some(PathBuf::from("abc")));
-    tracked!(simulate_remapped_rust_src_base, Some(PathBuf::from("/rustc/abc")));
     tracked!(report_delayed_bugs, true);
     tracked!(sanitizer, SanitizerSet::ADDRESS);
     tracked!(sanitizer_memory_track_origins, 2);
@@ -770,15 +773,17 @@ macro_rules! tracked {
     tracked!(saturating_float_casts, Some(true));
     tracked!(share_generics, Some(true));
     tracked!(show_span, Some(String::from("abc")));
+    tracked!(simulate_remapped_rust_src_base, Some(PathBuf::from("/rustc/abc")));
     tracked!(src_hash_algorithm, Some(SourceFileHashAlgorithm::Sha1));
+    tracked!(stack_protector, StackProtector::All);
     tracked!(symbol_mangling_version, Some(SymbolManglingVersion::V0));
     tracked!(teach, true);
     tracked!(thinlto, Some(true));
     tracked!(thir_unsafeck, true);
-    tracked!(tune_cpu, Some(String::from("abc")));
     tracked!(tls_model, Some(TlsModel::GeneralDynamic));
     tracked!(trap_unreachable, Some(false));
     tracked!(treat_err_as_bug, NonZeroUsize::new(1));
+    tracked!(tune_cpu, Some(String::from("abc")));
     tracked!(unleash_the_miri_inside_of_you, true);
     tracked!(use_ctors_section, Some(true));
     tracked!(verify_llvm_ir, true);
index ebe495872c4a6653a4f898ac72c7adcf0ad81008..e2ce7da0e84afc0eca5ad033ef8a7d4e253efaaa 100644 (file)
@@ -79,6 +79,9 @@ enum LLVMRustAttribute {
   InaccessibleMemOnly = 27,
   SanitizeHWAddress = 28,
   WillReturn = 29,
+  StackProtectReq = 30,
+  StackProtectStrong = 31,
+  StackProtect = 32,
 };
 
 typedef struct OpaqueRustString *RustStringRef;
index e77d29bed7122fd466e77cb5c226df615fe409b8..bb6d42c1a9cbb0c3d42b644863808511802d3854 100644 (file)
@@ -124,8 +124,18 @@ extern "C" LLVMValueRef LLVMRustGetOrInsertFunction(LLVMModuleRef M,
 
 extern "C" LLVMValueRef
 LLVMRustGetOrInsertGlobal(LLVMModuleRef M, const char *Name, size_t NameLen, LLVMTypeRef Ty) {
+  Module *Mod = unwrap(M);
   StringRef NameRef(Name, NameLen);
-  return wrap(unwrap(M)->getOrInsertGlobal(NameRef, unwrap(Ty)));
+
+  // We don't use Module::getOrInsertGlobal because that returns a Constant*,
+  // which may either be the real GlobalVariable*, or a constant bitcast of it
+  // if our type doesn't match the original declaration. We always want the
+  // GlobalVariable* so we can access linkage, visibility, etc.
+  GlobalVariable *GV = Mod->getGlobalVariable(NameRef, true);
+  if (!GV)
+    GV = new GlobalVariable(*Mod, unwrap(Ty), false,
+                            GlobalValue::ExternalLinkage, nullptr, NameRef);
+  return wrap(GV);
 }
 
 extern "C" LLVMValueRef
@@ -203,6 +213,12 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) {
     return Attribute::SanitizeHWAddress;
   case WillReturn:
     return Attribute::WillReturn;
+  case StackProtectReq:
+    return Attribute::StackProtectReq;
+  case StackProtectStrong:
+    return Attribute::StackProtectStrong;
+  case StackProtect:
+    return Attribute::StackProtect;
   }
   report_fatal_error("bad AttributeKind");
 }
index 7bc669f2b005c53fc86c89970270b62f617dd799..66e6b571beb2b84bbc1acf3961a372191259de75 100644 (file)
@@ -247,13 +247,24 @@ fn encodable_body(
                     })
                     .collect();
 
-                let result = quote! { ::rustc_serialize::Encoder::emit_enum_variant(
-                    __encoder,
-                   #variant_name,
-                   #variant_idx,
-                   #field_idx,
-                   |__encoder| { ::std::result::Result::Ok({ #encode_fields }) }
-                ) };
+                let result = if field_idx != 0 {
+                    quote! {
+                        ::rustc_serialize::Encoder::emit_enum_variant(
+                            __encoder,
+                            #variant_name,
+                            #variant_idx,
+                            #field_idx,
+                            |__encoder| { ::std::result::Result::Ok({ #encode_fields }) }
+                        )
+                    }
+                } else {
+                    quote! {
+                        ::rustc_serialize::Encoder::emit_fieldless_enum_variant::<#variant_idx>(
+                            __encoder,
+                            #variant_name,
+                        )
+                    }
+                };
                 variant_idx += 1;
                 result
             });
index 2bcc2a4f7cff7685329d9ce5dc854053737ec3ef..ee2e190e7cd44b7e698956f795101075a0f2423c 100644 (file)
@@ -1,33 +1,33 @@
-/// This declares a list of types which can be allocated by `Arena`.
+/// This higher-order macro declares a list of types which can be allocated by `Arena`.
 ///
 /// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type
 /// listed. These impls will appear in the implement_ty_decoder! macro.
 #[macro_export]
 macro_rules! arena_types {
-    ($macro:path, $tcx:lifetime) => (
+    ($macro:path) => (
         $macro!([
             [] layout: rustc_target::abi::Layout,
-            [] fn_abi: rustc_target::abi::call::FnAbi<$tcx, rustc_middle::ty::Ty<$tcx>>,
+            [] fn_abi: rustc_target::abi::call::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>,
             // AdtDef are interned and compared by address
             [] adt_def: rustc_middle::ty::AdtDef,
-            [] steal_thir: rustc_data_structures::steal::Steal<rustc_middle::thir::Thir<$tcx>>,
-            [] steal_mir: rustc_data_structures::steal::Steal<rustc_middle::mir::Body<$tcx>>,
-            [decode] mir: rustc_middle::mir::Body<$tcx>,
+            [] steal_thir: rustc_data_structures::steal::Steal<rustc_middle::thir::Thir<'tcx>>,
+            [] steal_mir: rustc_data_structures::steal::Steal<rustc_middle::mir::Body<'tcx>>,
+            [decode] mir: rustc_middle::mir::Body<'tcx>,
             [] steal_promoted:
                 rustc_data_structures::steal::Steal<
                     rustc_index::vec::IndexVec<
                         rustc_middle::mir::Promoted,
-                        rustc_middle::mir::Body<$tcx>
+                        rustc_middle::mir::Body<'tcx>
                     >
                 >,
             [decode] promoted:
                 rustc_index::vec::IndexVec<
                     rustc_middle::mir::Promoted,
-                    rustc_middle::mir::Body<$tcx>
+                    rustc_middle::mir::Body<'tcx>
                 >,
-            [decode] typeck_results: rustc_middle::ty::TypeckResults<$tcx>,
+            [decode] typeck_results: rustc_middle::ty::TypeckResults<'tcx>,
             [decode] borrowck_result:
-                rustc_middle::mir::BorrowCheckResult<$tcx>,
+                rustc_middle::mir::BorrowCheckResult<'tcx>,
             [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult,
             [decode] code_region: rustc_middle::mir::coverage::CodeRegion,
             [] const_allocs: rustc_middle::mir::interpret::Allocation,
@@ -78,14 +78,14 @@ macro_rules! arena_types {
             [] foreign_modules: Vec<rustc_session::cstore::ForeignModule>,
             [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
             [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
-            [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>,
+            [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<'tcx>,
             [] attribute: rustc_ast::Attribute,
             [] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
             [] hir_id_set: rustc_hir::HirIdSet,
 
             // Interned types
-            [] tys: rustc_middle::ty::TyS<$tcx>,
-            [] predicates: rustc_middle::ty::PredicateInner<$tcx>,
+            [] tys: rustc_middle::ty::TyS<'tcx>,
+            [] predicates: rustc_middle::ty::PredicateInner<'tcx>,
 
             // Note that this deliberately duplicates items in the `rustc_hir::arena`,
             // since we need to allocate this type on both the `rustc_hir` arena
@@ -97,8 +97,8 @@ macro_rules! arena_types {
             [decode] used_trait_imports: rustc_data_structures::fx::FxHashSet<rustc_hir::def_id::LocalDefId>,
 
             [] dep_kind: rustc_middle::dep_graph::DepKindStruct,
-        ], $tcx);
+        ]);
     )
 }
 
-arena_types!(rustc_arena::declare_arena, 'tcx);
+arena_types!(rustc_arena::declare_arena);
index 0894b80507581458cb006426ed59e7b33158347e..9ce9f65a49066bb88064a3e6786a551a8a52de8a 100644 (file)
@@ -30,6 +30,7 @@
 #![feature(bool_to_option)]
 #![feature(box_patterns)]
 #![feature(core_intrinsics)]
+#![feature(derive_default_enum)]
 #![feature(discriminant_kind)]
 #![feature(exhaustive_patterns)]
 #![feature(if_let_guard)]
index 0e70d49ef49d25faa9f12189bb36f4b394d4b220..881b14278e99ed7186329facf09a70210e997ed0 100644 (file)
@@ -395,7 +395,7 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
     match expn_data.kind {
         ExpnKind::Inlined
         | ExpnKind::Root
-        | ExpnKind::Desugaring(DesugaringKind::ForLoop(_) | DesugaringKind::WhileLoop) => false,
+        | ExpnKind::Desugaring(DesugaringKind::ForLoop | DesugaringKind::WhileLoop) => false,
         ExpnKind::AstPass(_) | ExpnKind::Desugaring(_) => true, // well, it's "external"
         ExpnKind::Macro(MacroKind::Bang, _) => {
             // Dummy span for the `def_site` means it's an external macro.
index 597622b2ebf907dd000a1412c1a5ed4103a9721d..8a5fc5feeb71b2d65dc0192c2f7dea996db2e224 100644 (file)
@@ -3,7 +3,7 @@
 
 pub use self::StabilityLevel::*;
 
-use crate::ty::{self, TyCtxt};
+use crate::ty::{self, DefIdTree, TyCtxt};
 use rustc_ast::NodeId;
 use rustc_attr::{self as attr, ConstStability, Deprecation, Stability};
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
@@ -90,6 +90,7 @@ pub fn report_unstable(
     feature: Symbol,
     reason: Option<Symbol>,
     issue: Option<NonZeroU32>,
+    suggestion: Option<(Span, String, String, Applicability)>,
     is_soft: bool,
     span: Span,
     soft_handler: impl FnOnce(&'static Lint, Span, &str),
@@ -116,8 +117,12 @@ pub fn report_unstable(
         if is_soft {
             soft_handler(SOFT_UNSTABLE, span, &msg)
         } else {
-            feature_err_issue(&sess.parse_sess, feature, span, GateIssue::Library(issue), &msg)
-                .emit();
+            let mut err =
+                feature_err_issue(&sess.parse_sess, feature, span, GateIssue::Library(issue), &msg);
+            if let Some((inner_types, ref msg, sugg, applicability)) = suggestion {
+                err.span_suggestion(inner_types, msg, sugg, applicability);
+            }
+            err.emit();
         }
     }
 }
@@ -271,7 +276,13 @@ pub enum EvalResult {
     Allow,
     /// We cannot use the item because it is unstable and we did not provide the
     /// corresponding feature gate.
-    Deny { feature: Symbol, reason: Option<Symbol>, issue: Option<NonZeroU32>, is_soft: bool },
+    Deny {
+        feature: Symbol,
+        reason: Option<Symbol>,
+        issue: Option<NonZeroU32>,
+        suggestion: Option<(Span, String, String, Applicability)>,
+        is_soft: bool,
+    },
     /// The item does not have the `#[stable]` or `#[unstable]` marker assigned.
     Unmarked,
 }
@@ -292,6 +303,32 @@ fn skip_stability_check_due_to_privacy(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
     }
 }
 
+// See issue #83250.
+fn suggestion_for_allocator_api(
+    tcx: TyCtxt<'_>,
+    def_id: DefId,
+    span: Span,
+    feature: Symbol,
+) -> Option<(Span, String, String, Applicability)> {
+    if feature == sym::allocator_api {
+        if let Some(trait_) = tcx.parent(def_id) {
+            if tcx.is_diagnostic_item(sym::Vec, trait_) {
+                let sm = tcx.sess.parse_sess.source_map();
+                let inner_types = sm.span_extend_to_prev_char(span, '<', true);
+                if let Ok(snippet) = sm.span_to_snippet(inner_types) {
+                    return Some((
+                        inner_types,
+                        "consider wrapping the inner types in tuple".to_string(),
+                        format!("({})", snippet),
+                        Applicability::MaybeIncorrect,
+                    ));
+                }
+            }
+        }
+    }
+    None
+}
+
 impl<'tcx> TyCtxt<'tcx> {
     /// Evaluates the stability of an item.
     ///
@@ -406,7 +443,8 @@ pub fn eval_stability(
                     }
                 }
 
-                EvalResult::Deny { feature, reason, issue, is_soft }
+                let suggestion = suggestion_for_allocator_api(self, def_id, span, feature);
+                EvalResult::Deny { feature, reason, issue, suggestion, is_soft }
             }
             Some(_) => {
                 // Stable APIs are always ok to call and deprecated APIs are
@@ -457,9 +495,16 @@ pub fn check_optional_stability(
         };
         match self.eval_stability(def_id, id, span, method_span) {
             EvalResult::Allow => {}
-            EvalResult::Deny { feature, reason, issue, is_soft } => {
-                report_unstable(self.sess, feature, reason, issue, is_soft, span, soft_handler)
-            }
+            EvalResult::Deny { feature, reason, issue, suggestion, is_soft } => report_unstable(
+                self.sess,
+                feature,
+                reason,
+                issue,
+                suggestion,
+                is_soft,
+                span,
+                soft_handler,
+            ),
             EvalResult::Unmarked => unmarked(span, def_id),
         }
     }
index 245df6361076f93a5c5eceeab0661828f39d129c..49071e7995b4cd972de134c8c1d1958277c50b54 100644 (file)
@@ -23,6 +23,7 @@
 
 use std::borrow::Cow;
 use std::fmt;
+use std::hash::{Hash, Hasher};
 use std::ops::Deref;
 
 pub use self::select::{EvaluationCache, EvaluationResult, OverflowError, SelectionCache};
@@ -108,7 +109,7 @@ fn deref(&self) -> &Self::Target {
     }
 }
 
-#[derive(Clone, Debug, PartialEq, Eq, Hash, Lift)]
+#[derive(Clone, Debug, PartialEq, Eq, Lift)]
 pub struct ObligationCauseData<'tcx> {
     pub span: Span,
 
@@ -123,6 +124,14 @@ pub struct ObligationCauseData<'tcx> {
     pub code: ObligationCauseCode<'tcx>,
 }
 
+impl Hash for ObligationCauseData<'_> {
+    fn hash<H: Hasher>(&self, state: &mut H) {
+        self.body_id.hash(state);
+        self.span.hash(state);
+        std::mem::discriminant(&self.code).hash(state);
+    }
+}
+
 impl<'tcx> ObligationCause<'tcx> {
     #[inline]
     pub fn new(
index 434008ecb1f4f1348fa6f8a4742867445baa85ec..3f2b987b1e6307f1f8ad224cccc151487cbb02d1 100644 (file)
@@ -417,17 +417,17 @@ fn $name(&mut self) -> Result<$ty, Self::Error> {
 macro_rules! impl_arena_allocatable_decoder {
     ([]$args:tt) => {};
     ([decode $(, $attrs:ident)*]
-     [[$name:ident: $ty:ty], $tcx:lifetime]) => {
-        impl<$tcx, D: TyDecoder<$tcx>> RefDecodable<$tcx, D> for $ty {
+     [$name:ident: $ty:ty]) => {
+        impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for $ty {
             #[inline]
-            fn decode(decoder: &mut D) -> Result<&$tcx Self, D::Error> {
+            fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> {
                 decode_arena_allocable(decoder)
             }
         }
 
-        impl<$tcx, D: TyDecoder<$tcx>> RefDecodable<$tcx, D> for [$ty] {
+        impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [$ty] {
             #[inline]
-            fn decode(decoder: &mut D) -> Result<&$tcx Self, D::Error> {
+            fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> {
                 decode_arena_allocable_slice(decoder)
             }
         }
@@ -438,15 +438,15 @@ fn decode(decoder: &mut D) -> Result<&$tcx Self, D::Error> {
 }
 
 macro_rules! impl_arena_allocatable_decoders {
-    ([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) => {
+    ([$($a:tt $name:ident: $ty:ty,)*]) => {
         $(
-            impl_arena_allocatable_decoder!($a [[$name: $ty], $tcx]);
+            impl_arena_allocatable_decoder!($a [$name: $ty]);
         )*
     }
 }
 
-rustc_hir::arena_types!(impl_arena_allocatable_decoders, 'tcx);
-arena_types!(impl_arena_allocatable_decoders, 'tcx);
+rustc_hir::arena_types!(impl_arena_allocatable_decoders);
+arena_types!(impl_arena_allocatable_decoders);
 
 #[macro_export]
 macro_rules! implement_ty_decoder {
index 0f89581ae669c43f031343ed0ac4b30f7ed8bf8f..f53f1871508d7d22da0be0eaedcf7220a8c8617d 100644 (file)
@@ -3,7 +3,6 @@
 use crate::ty::subst::{Subst, SubstsRef};
 use rustc_ast as ast;
 use rustc_data_structures::fx::FxHashMap;
-use rustc_hir as hir;
 use rustc_hir::def_id::DefId;
 use rustc_span::symbol::Symbol;
 use rustc_span::Span;
 #[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable)]
 pub enum GenericParamDefKind {
     Lifetime,
-    Type {
-        has_default: bool,
-        object_lifetime_default: ObjectLifetimeDefault,
-        synthetic: Option<hir::SyntheticTyParamKind>,
-    },
-    Const {
-        has_default: bool,
-    },
+    Type { has_default: bool, object_lifetime_default: ObjectLifetimeDefault, synthetic: bool },
+    Const { has_default: bool },
 }
 
 impl GenericParamDefKind {
@@ -202,15 +195,7 @@ pub fn const_param(&'tcx self, param: &ParamConst, tcx: TyCtxt<'tcx>) -> &Generi
     /// Returns `true` if `params` has `impl Trait`.
     pub fn has_impl_trait(&'tcx self) -> bool {
         self.params.iter().any(|param| {
-            matches!(
-                param.kind,
-                ty::GenericParamDefKind::Type {
-                    synthetic: Some(
-                        hir::SyntheticTyParamKind::ImplTrait | hir::SyntheticTyParamKind::FromAttr,
-                    ),
-                    ..
-                }
-            )
+            matches!(param.kind, ty::GenericParamDefKind::Type { synthetic: true, .. })
         })
     }
 }
index 5d9e7aaf72f8eece66bbee1f08eaab6b1f74aa70..3846cf19d915b339eaa7fb729950fccbb432f62f 100644 (file)
@@ -649,30 +649,74 @@ fn pretty_print_type(mut self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error>
 
                     let mut first = true;
                     let mut is_sized = false;
+                    let mut is_future = false;
+                    let mut future_output_ty = None;
+
                     p!("impl");
                     for (predicate, _) in bounds {
                         let predicate = predicate.subst(self.tcx(), substs);
                         let bound_predicate = predicate.kind();
-                        if let ty::PredicateKind::Trait(pred) = bound_predicate.skip_binder() {
-                            let trait_ref = bound_predicate.rebind(pred.trait_ref);
-                            // Don't print +Sized, but rather +?Sized if absent.
-                            if Some(trait_ref.def_id()) == self.tcx().lang_items().sized_trait() {
-                                is_sized = true;
-                                continue;
+
+                        match bound_predicate.skip_binder() {
+                            ty::PredicateKind::Projection(projection_predicate) => {
+                                let Some(future_trait) = self.tcx().lang_items().future_trait() else { continue };
+                                let future_output_def_id =
+                                    self.tcx().associated_item_def_ids(future_trait)[0];
+
+                                if projection_predicate.projection_ty.item_def_id
+                                    == future_output_def_id
+                                {
+                                    // We don't account for multiple `Future::Output = Ty` contraints.
+                                    is_future = true;
+                                    future_output_ty = Some(projection_predicate.ty);
+                                }
                             }
+                            ty::PredicateKind::Trait(pred) => {
+                                let trait_ref = bound_predicate.rebind(pred.trait_ref);
+                                // Don't print +Sized, but rather +?Sized if absent.
+                                if Some(trait_ref.def_id()) == self.tcx().lang_items().sized_trait()
+                                {
+                                    is_sized = true;
+                                    continue;
+                                }
 
-                            p!(
-                                write("{}", if first { " " } else { "+" }),
-                                print(trait_ref.print_only_trait_path())
-                            );
-                            first = false;
+                                if Some(trait_ref.def_id())
+                                    == self.tcx().lang_items().future_trait()
+                                {
+                                    is_future = true;
+                                    continue;
+                                }
+
+                                p!(
+                                    write("{}", if first { " " } else { " + " }),
+                                    print(trait_ref.print_only_trait_path())
+                                );
+
+                                first = false;
+                            }
+                            _ => {}
                         }
                     }
+
+                    if is_future {
+                        p!(write("{}Future", if first { " " } else { " + " }));
+                        first = false;
+
+                        if let Some(future_output_ty) = future_output_ty {
+                            // Don't print projection types, which we (unfortunately) see often
+                            // in the error outputs involving async blocks.
+                            if !matches!(future_output_ty.kind(), ty::Projection(_)) {
+                                p!("<Output = ", print(future_output_ty), ">");
+                            }
+                        }
+                    }
+
                     if !is_sized {
-                        p!(write("{}?Sized", if first { " " } else { "+" }));
+                        p!(write("{}?Sized", if first { " " } else { " + " }));
                     } else if first {
                         p!(" Sized");
                     }
+
                     Ok(self)
                 });
             }
index 610f9bd8f82d740168bf57cc2ed88c13fe4ea41e..7e054d1e17fcdadc00a82218659acdcdcb6504f1 100644 (file)
@@ -1805,10 +1805,13 @@ pub fn sequence_element_type(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
     pub fn simd_size_and_type(&self, tcx: TyCtxt<'tcx>) -> (u64, Ty<'tcx>) {
         match self.kind() {
             Adt(def, substs) => {
+                assert!(def.repr.simd(), "`simd_size_and_type` called on non-SIMD type");
                 let variant = def.non_enum_variant();
                 let f0_ty = variant.fields[0].ty(tcx, substs);
 
                 match f0_ty.kind() {
+                    // If the first field is an array, we assume it is the only field and its
+                    // elements are the SIMD components.
                     Array(f0_elem_ty, f0_len) => {
                         // FIXME(repr_simd): https://github.com/rust-lang/rust/pull/78863#discussion_r522784112
                         // The way we evaluate the `N` in `[T; N]` here only works since we use
@@ -1816,6 +1819,8 @@ pub fn simd_size_and_type(&self, tcx: TyCtxt<'tcx>) -> (u64, Ty<'tcx>) {
                         // if we use it in generic code. See the `simd-array-trait` ui test.
                         (f0_len.eval_usize(tcx, ParamEnv::empty()) as u64, f0_elem_ty)
                     }
+                    // Otherwise, the fields of this Adt are the SIMD components (and we assume they
+                    // all have the same type).
                     _ => (variant.fields.len() as u64, f0_ty),
                 }
             }
@@ -2258,10 +2263,11 @@ pub fn is_trivially_sized(&self, tcx: TyCtxt<'tcx>) -> bool {
 /// a miscompilation or unsoundness.
 ///
 /// When in doubt, use `VarianceDiagInfo::default()`
-#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
+#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
 pub enum VarianceDiagInfo<'tcx> {
     /// No additional information - this is the default.
     /// We will not add any additional information to error messages.
+    #[default]
     None,
     /// We switched our variance because a type occurs inside
     /// the generic argument of a mutable reference or pointer
@@ -2296,9 +2302,3 @@ pub fn xform(self, other: VarianceDiagInfo<'tcx>) -> VarianceDiagInfo<'tcx> {
         }
     }
 }
-
-impl<'tcx> Default for VarianceDiagInfo<'tcx> {
-    fn default() -> Self {
-        Self::None
-    }
-}
index 6320d5d47497f52f1c8355e3bf293e5c63e6cc54..e3a05e01ea8f089a0750aa4498fb04d439d50df2 100644 (file)
@@ -1606,13 +1606,12 @@ fn test_candidates<'pat, 'b, 'c>(
         // encounter a candidate where the test is not relevant; at
         // that point, we stop sorting.
         while let Some(candidate) = candidates.first_mut() {
-            if let Some(idx) = self.sort_candidate(&match_place.clone(), &test, candidate) {
-                let (candidate, rest) = candidates.split_first_mut().unwrap();
-                target_candidates[idx].push(candidate);
-                candidates = rest;
-            } else {
+            let Some(idx) = self.sort_candidate(&match_place.clone(), &test, candidate) else {
                 break;
-            }
+            };
+            let (candidate, rest) = candidates.split_first_mut().unwrap();
+            target_candidates[idx].push(candidate);
+            candidates = rest;
         }
         // at least the first candidate ought to be tested
         assert!(total_candidate_count > candidates.len());
index 4108ad50470b711f217ecdcfe9d07b24672e10cc..cb94e759972378899e45da2959035b5b0368ecc3 100644 (file)
@@ -966,59 +966,58 @@ fn args_and_body(
                 DropKind::Value,
             );
 
-            if let Some(arg) = arg_opt {
-                let pat = match tcx.hir().get(arg.pat.hir_id) {
-                    Node::Pat(pat) | Node::Binding(pat) => pat,
-                    node => bug!("pattern became {:?}", node),
-                };
-                let pattern = pat_from_hir(tcx, self.param_env, self.typeck_results, pat);
-                let original_source_scope = self.source_scope;
-                let span = pattern.span;
-                self.set_correct_source_scope_for_arg(arg.hir_id, original_source_scope, span);
-                match *pattern.kind {
-                    // Don't introduce extra copies for simple bindings
-                    PatKind::Binding {
-                        mutability,
-                        var,
-                        mode: BindingMode::ByValue,
-                        subpattern: None,
-                        ..
-                    } => {
-                        self.local_decls[local].mutability = mutability;
-                        self.local_decls[local].source_info.scope = self.source_scope;
-                        self.local_decls[local].local_info = if let Some(kind) = self_binding {
-                            Some(Box::new(LocalInfo::User(ClearCrossCrate::Set(
-                                BindingForm::ImplicitSelf(*kind),
-                            ))))
-                        } else {
-                            let binding_mode = ty::BindingMode::BindByValue(mutability);
-                            Some(Box::new(LocalInfo::User(ClearCrossCrate::Set(BindingForm::Var(
-                                VarBindingForm {
-                                    binding_mode,
-                                    opt_ty_info,
-                                    opt_match_place: Some((Some(place), span)),
-                                    pat_span: span,
-                                },
-                            )))))
-                        };
-                        self.var_indices.insert(var, LocalsForNode::One(local));
-                    }
-                    _ => {
-                        scope = self.declare_bindings(
-                            scope,
-                            expr.span,
-                            &pattern,
-                            matches::ArmHasGuard(false),
-                            Some((Some(&place), span)),
-                        );
-                        let place_builder = PlaceBuilder::from(local);
-                        unpack!(
-                            block = self.place_into_pattern(block, pattern, place_builder, false)
-                        );
-                    }
+            let Some(arg) = arg_opt else {
+                continue;
+            };
+            let pat = match tcx.hir().get(arg.pat.hir_id) {
+                Node::Pat(pat) | Node::Binding(pat) => pat,
+                node => bug!("pattern became {:?}", node),
+            };
+            let pattern = pat_from_hir(tcx, self.param_env, self.typeck_results, pat);
+            let original_source_scope = self.source_scope;
+            let span = pattern.span;
+            self.set_correct_source_scope_for_arg(arg.hir_id, original_source_scope, span);
+            match *pattern.kind {
+                // Don't introduce extra copies for simple bindings
+                PatKind::Binding {
+                    mutability,
+                    var,
+                    mode: BindingMode::ByValue,
+                    subpattern: None,
+                    ..
+                } => {
+                    self.local_decls[local].mutability = mutability;
+                    self.local_decls[local].source_info.scope = self.source_scope;
+                    self.local_decls[local].local_info = if let Some(kind) = self_binding {
+                        Some(Box::new(LocalInfo::User(ClearCrossCrate::Set(
+                            BindingForm::ImplicitSelf(*kind),
+                        ))))
+                    } else {
+                        let binding_mode = ty::BindingMode::BindByValue(mutability);
+                        Some(Box::new(LocalInfo::User(ClearCrossCrate::Set(BindingForm::Var(
+                            VarBindingForm {
+                                binding_mode,
+                                opt_ty_info,
+                                opt_match_place: Some((Some(place), span)),
+                                pat_span: span,
+                            },
+                        )))))
+                    };
+                    self.var_indices.insert(var, LocalsForNode::One(local));
+                }
+                _ => {
+                    scope = self.declare_bindings(
+                        scope,
+                        expr.span,
+                        &pattern,
+                        matches::ArmHasGuard(false),
+                        Some((Some(&place), span)),
+                    );
+                    let place_builder = PlaceBuilder::from(local);
+                    unpack!(block = self.place_into_pattern(block, pattern, place_builder, false));
                 }
-                self.source_scope = original_source_scope;
             }
+            self.source_scope = original_source_scope;
         }
 
         // Enter the argument pattern bindings source scope, if it exists.
index 0e82b187201422d4983f105718266d74e946fb1d..7940bd1f33dc1bb35eacf2459708a02195c6d657 100644 (file)
@@ -256,23 +256,22 @@ fn visit_pat(&mut self, pat: &Pat<'tcx>) {
             }
             PatKind::Binding { mode: BindingMode::ByRef(borrow_kind), ty, .. } => {
                 if self.inside_adt {
-                    if let ty::Ref(_, ty, _) = ty.kind() {
-                        match borrow_kind {
-                            BorrowKind::Shallow | BorrowKind::Shared | BorrowKind::Unique => {
-                                if !ty.is_freeze(self.tcx.at(pat.span), self.param_env) {
-                                    self.requires_unsafe(pat.span, BorrowOfLayoutConstrainedField);
-                                }
-                            }
-                            BorrowKind::Mut { .. } => {
-                                self.requires_unsafe(pat.span, MutationOfLayoutConstrainedField);
-                            }
-                        }
-                    } else {
+                    let ty::Ref(_, ty, _) = ty.kind() else {
                         span_bug!(
                             pat.span,
                             "BindingMode::ByRef in pattern, but found non-reference type {}",
                             ty
                         );
+                    };
+                    match borrow_kind {
+                        BorrowKind::Shallow | BorrowKind::Shared | BorrowKind::Unique => {
+                            if !ty.is_freeze(self.tcx.at(pat.span), self.param_env) {
+                                self.requires_unsafe(pat.span, BorrowOfLayoutConstrainedField);
+                            }
+                        }
+                        BorrowKind::Mut { .. } => {
+                            self.requires_unsafe(pat.span, MutationOfLayoutConstrainedField);
+                        }
                     }
                 }
                 visit::walk_pat(self, pat);
index e28fd2c50814fa48428cb9afc2a0649b12ea2be8..d74c53fae533b425eac31501a70a6240edf2a825 100644 (file)
@@ -74,19 +74,16 @@ fn visit_local(&mut self, loc: &'tcx hir::Local<'tcx>) {
 
         let (msg, sp) = match loc.source {
             hir::LocalSource::Normal => ("local binding", Some(loc.span)),
-            hir::LocalSource::ForLoopDesugar => ("`for` loop binding", None),
             hir::LocalSource::AsyncFn => ("async fn binding", None),
             hir::LocalSource::AwaitDesugar => ("`await` future binding", None),
             hir::LocalSource::AssignDesugar(_) => ("destructuring assignment binding", None),
         };
         self.check_irrefutable(&loc.pat, msg, sp);
-        self.check_patterns(&loc.pat, Irrefutable);
     }
 
     fn visit_param(&mut self, param: &'tcx hir::Param<'tcx>) {
         intravisit::walk_param(self, param);
         self.check_irrefutable(&param.pat, "function argument", None);
-        self.check_patterns(&param.pat, Irrefutable);
     }
 }
 
@@ -161,12 +158,12 @@ fn check_let(&mut self, pat: &'tcx hir::Pat<'tcx>, expr: &hir::Expr<'_>, span: S
     fn check_match(
         &mut self,
         scrut: &hir::Expr<'_>,
-        arms: &'tcx [hir::Arm<'tcx>],
+        hir_arms: &'tcx [hir::Arm<'tcx>],
         source: hir::MatchSource,
     ) {
         let mut cx = self.new_cx(scrut.hir_id);
 
-        for arm in arms {
+        for arm in hir_arms {
             // Check the arm for some things unrelated to exhaustiveness.
             self.check_patterns(&arm.pat, Refutable);
             if let Some(hir::Guard::IfLet(ref pat, _)) = arm.guard {
@@ -178,7 +175,7 @@ fn check_match(
 
         let mut have_errors = false;
 
-        let arms: Vec<_> = arms
+        let arms: Vec<_> = hir_arms
             .iter()
             .map(|hir::Arm { pat, guard, .. }| MatchArm {
                 pat: self.lower_pattern(&mut cx, pat, &mut have_errors),
@@ -196,6 +193,9 @@ fn check_match(
         let report = compute_match_usefulness(&cx, &arms, scrut.hir_id, scrut_ty);
 
         match source {
+            // Don't report arm reachability of desugared `match $iter.into_iter() { iter => .. }`
+            // when the iterator is an uninhabited type. unreachable_code will trigger instead.
+            hir::MatchSource::ForLoopDesugar if arms.len() == 1 => {}
             hir::MatchSource::ForLoopDesugar | hir::MatchSource::Normal => {
                 report_arm_reachability(&cx, &report)
             }
@@ -208,7 +208,13 @@ fn check_match(
         let is_empty_match = arms.is_empty();
         let witnesses = report.non_exhaustiveness_witnesses;
         if !witnesses.is_empty() {
-            non_exhaustive_match(&cx, scrut_ty, scrut.span, witnesses, is_empty_match);
+            if source == hir::MatchSource::ForLoopDesugar && hir_arms.len() == 2 {
+                // the for loop pattern is not irrefutable
+                let pat = hir_arms[1].pat.for_loop_some().unwrap();
+                self.check_irrefutable(pat, "`for` loop binding", None);
+            } else {
+                non_exhaustive_match(&cx, scrut_ty, scrut.span, witnesses, is_empty_match);
+            }
         }
     }
 
@@ -225,6 +231,7 @@ fn check_irrefutable(&self, pat: &'tcx Pat<'tcx>, origin: &str, sp: Option<Span>
         let witnesses = report.non_exhaustiveness_witnesses;
         if witnesses.is_empty() {
             // The pattern is irrefutable.
+            self.check_patterns(pat, Irrefutable);
             return;
         }
 
index 91dddc6cd55c5d415b76548051dd488b0774bb4a..2585701f60c66b5ff2e0c90f4d418f98bd973a44 100644 (file)
@@ -4,17 +4,18 @@
 
 use rustc_index::bit_set::BitSet;
 use rustc_index::vec::Idx;
+use rustc_middle::mir::visit::{MirVisitable, Visitor};
 use rustc_middle::mir::{self, Body, Location};
 use rustc_middle::ty::{self, TyCtxt};
 
-use crate::drop_flag_effects;
 use crate::drop_flag_effects_for_function_entry;
 use crate::drop_flag_effects_for_location;
 use crate::elaborate_drops::DropFlagState;
 use crate::framework::SwitchIntEdgeEffects;
-use crate::move_paths::{HasMoveData, InitIndex, InitKind, MoveData, MovePathIndex};
+use crate::move_paths::{HasMoveData, InitIndex, InitKind, LookupResult, MoveData, MovePathIndex};
 use crate::on_lookup_result_bits;
 use crate::MoveDataParamEnv;
+use crate::{drop_flag_effects, on_all_children_bits};
 use crate::{lattice, AnalysisDomain, GenKill, GenKillAnalysis};
 
 mod borrowed_locals;
@@ -307,22 +308,45 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> {
     fn statement_effect(
         &self,
         trans: &mut impl GenKill<Self::Idx>,
-        _statement: &mir::Statement<'tcx>,
+        statement: &mir::Statement<'tcx>,
         location: Location,
     ) {
         drop_flag_effects_for_location(self.tcx, self.body, self.mdpe, location, |path, s| {
             Self::update_bits(trans, path, s)
+        });
+
+        if !self.tcx.sess.opts.debugging_opts.precise_enum_drop_elaboration {
+            return;
+        }
+
+        // Mark all places as "maybe init" if they are mutably borrowed. See #90752.
+        for_each_mut_borrow(statement, location, |place| {
+            let LookupResult::Exact(mpi) = self.move_data().rev_lookup.find(place.as_ref()) else { return };
+            on_all_children_bits(self.tcx, self.body, self.move_data(), mpi, |child| {
+                trans.gen(child);
+            })
         })
     }
 
     fn terminator_effect(
         &self,
         trans: &mut impl GenKill<Self::Idx>,
-        _terminator: &mir::Terminator<'tcx>,
+        terminator: &mir::Terminator<'tcx>,
         location: Location,
     ) {
         drop_flag_effects_for_location(self.tcx, self.body, self.mdpe, location, |path, s| {
             Self::update_bits(trans, path, s)
+        });
+
+        if !self.tcx.sess.opts.debugging_opts.precise_enum_drop_elaboration {
+            return;
+        }
+
+        for_each_mut_borrow(terminator, location, |place| {
+            let LookupResult::Exact(mpi) = self.move_data().rev_lookup.find(place.as_ref()) else { return };
+            on_all_children_bits(self.tcx, self.body, self.move_data(), mpi, |child| {
+                trans.gen(child);
+            })
         })
     }
 
@@ -427,7 +451,10 @@ fn statement_effect(
     ) {
         drop_flag_effects_for_location(self.tcx, self.body, self.mdpe, location, |path, s| {
             Self::update_bits(trans, path, s)
-        })
+        });
+
+        // Unlike in `MaybeInitializedPlaces` above, we don't need to change the state when a
+        // mutable borrow occurs. Places cannot become uninitialized through a mutable reference.
     }
 
     fn terminator_effect(
@@ -438,7 +465,7 @@ fn terminator_effect(
     ) {
         drop_flag_effects_for_location(self.tcx, self.body, self.mdpe, location, |path, s| {
             Self::update_bits(trans, path, s)
-        })
+        });
     }
 
     fn call_return_effect(
@@ -704,3 +731,37 @@ fn switch_on_enum_discriminant(
         _ => None,
     }
 }
+
+struct OnMutBorrow<F>(F);
+
+impl<F> Visitor<'_> for OnMutBorrow<F>
+where
+    F: FnMut(&mir::Place<'_>),
+{
+    fn visit_rvalue(&mut self, rvalue: &mir::Rvalue<'_>, location: Location) {
+        // FIXME: Does `&raw const foo` allow mutation? See #90413.
+        match rvalue {
+            mir::Rvalue::Ref(_, mir::BorrowKind::Mut { .. }, place)
+            | mir::Rvalue::AddressOf(_, place) => (self.0)(place),
+
+            _ => {}
+        }
+
+        self.super_rvalue(rvalue, location)
+    }
+}
+
+/// Calls `f` for each mutable borrow or raw reference in the program.
+///
+/// This DOES NOT call `f` for a shared borrow of a type with interior mutability.  That's okay for
+/// initializedness, because we cannot move from an `UnsafeCell` (outside of `core::cell`), but
+/// other analyses will likely need to check for `!Freeze`.
+fn for_each_mut_borrow<'tcx>(
+    mir: &impl MirVisitable<'tcx>,
+    location: Location,
+    f: impl FnMut(&mir::Place<'_>),
+) {
+    let mut vis = OnMutBorrow(f);
+
+    mir.apply(location, &mut vis);
+}
index 3d29d305021090512f8dcdf3b86afa1084ec1cbd..3669a4fce9cbf9ba0048156ca6e697cd93d07ebb 100644 (file)
@@ -1032,6 +1032,8 @@ enum FloatComponent {
             [IdentLike(_), Punct('+' | '-')] |
             // 1e+2 | 1e-2
             [IdentLike(_), Punct('+' | '-'), IdentLike(_)] |
+            // 1.2e+ | 1.2e-
+            [IdentLike(_), Punct('.'), IdentLike(_), Punct('+' | '-')] |
             // 1.2e+3 | 1.2e-3
             [IdentLike(_), Punct('.'), IdentLike(_), Punct('+' | '-'), IdentLike(_)] => {
                 // See the FIXME about `TokenCursor` above.
@@ -1241,7 +1243,7 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
         } else if self.eat_keyword(kw::Unsafe) {
             self.parse_block_expr(None, lo, BlockCheckMode::Unsafe(ast::UserProvided), attrs)
         } else if self.check_inline_const(0) {
-            self.parse_const_block(lo.to(self.token.span))
+            self.parse_const_block(lo.to(self.token.span), false)
         } else if self.is_do_catch_block() {
             self.recover_do_catch(attrs)
         } else if self.is_try_block() {
index e50b983ec621680f962c302772932cd74ff0a06a..9212aaa87d1947fdce1deecfb60ac460b662485b 100644 (file)
@@ -1095,8 +1095,12 @@ fn parse_constness(&mut self) -> Const {
     }
 
     /// Parses inline const expressions.
-    fn parse_const_block(&mut self, span: Span) -> PResult<'a, P<Expr>> {
-        self.sess.gated_spans.gate(sym::inline_const, span);
+    fn parse_const_block(&mut self, span: Span, pat: bool) -> PResult<'a, P<Expr>> {
+        if pat {
+            self.sess.gated_spans.gate(sym::inline_const_pat, span);
+        } else {
+            self.sess.gated_spans.gate(sym::inline_const, span);
+        }
         self.eat_keyword(kw::Const);
         let blk = self.parse_block()?;
         let anon_const = AnonConst {
index b03b54599815270c70d46c62e2c785d08a2e19f2..bb3947bb47a2550bd5e82d3a633fd7c006bcbf28 100644 (file)
@@ -437,7 +437,7 @@ fn parse_pat_with_range_pat(
             PatKind::Box(pat)
         } else if self.check_inline_const(0) {
             // Parse `const pat`
-            let const_expr = self.parse_const_block(lo.to(self.token.span))?;
+            let const_expr = self.parse_const_block(lo.to(self.token.span), true)?;
 
             if let Some(re) = self.parse_range_end() {
                 self.parse_pat_range_begin_with(const_expr, re)?
@@ -817,7 +817,7 @@ pub(super) fn inclusive_range_with_incorrect_end(&mut self, span: Span) {
             // Ensure the user doesn't receive unhelpful unexpected token errors
             self.bump();
             if self.is_pat_range_end_start(0) {
-                let _ = self.parse_pat_range_end();
+                let _ = self.parse_pat_range_end().map_err(|mut e| e.cancel());
             }
 
             self.error_inclusive_range_with_extra_equals(span_with_eq);
@@ -884,7 +884,7 @@ fn is_pat_range_end_start(&self, dist: usize) -> bool {
 
     fn parse_pat_range_end(&mut self) -> PResult<'a, P<Expr>> {
         if self.check_inline_const(0) {
-            self.parse_const_block(self.token.span)
+            self.parse_const_block(self.token.span, true)
         } else if self.check_path() {
             let lo = self.token.span;
             let (qself, path) = if self.eat_lt() {
index 6ff2259dc5b0a9f34896513c0bc8bcc4e45de3f2..2def57cf02a61564b412ba20da6af37c1bccd5a5 100644 (file)
@@ -9,9 +9,9 @@
 use rustc_middle::ty::TyCtxt;
 
 use rustc_ast::{ast, AttrStyle, Attribute, Lit, LitKind, NestedMetaItem};
-use rustc_data_structures::fx::{FxHashMap, FxHashSet};
+use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::{pluralize, struct_span_err, Applicability};
-use rustc_feature::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
+use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
 use rustc_hir as hir;
 use rustc_hir::def_id::LocalDefId;
 use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
@@ -23,6 +23,7 @@
 use rustc_session::parse::feature_err;
 use rustc_span::symbol::{sym, Symbol};
 use rustc_span::{MultiSpan, Span, DUMMY_SP};
+use std::collections::hash_map::Entry;
 
 pub(crate) fn target_from_impl_item<'tcx>(
     tcx: TyCtxt<'tcx>,
@@ -69,7 +70,7 @@ fn check_attributes(
         let mut doc_aliases = FxHashMap::default();
         let mut is_valid = true;
         let mut specified_inline = None;
-        let mut seen = FxHashSet::default();
+        let mut seen = FxHashMap::default();
         let attrs = self.tcx.hir().attrs(hir_id);
         for attr in attrs {
             let attr_is_valid = match attr.name_or_empty() {
@@ -148,6 +149,8 @@ fn check_attributes(
                 _ => {}
             }
 
+            let builtin = attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name));
+
             if hir_id != CRATE_HIR_ID {
                 if let Some(BuiltinAttribute { type_: AttributeType::CrateLevel, .. }) =
                     attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name))
@@ -165,21 +168,37 @@ fn check_attributes(
                 }
             }
 
-            // Duplicate attributes
-            match attr.name_or_empty() {
-                name @ sym::macro_use => {
-                    let args = attr.meta_item_list().unwrap_or_else(Vec::new);
-                    let args: Vec<_> = args.iter().map(|arg| arg.name_or_empty()).collect();
-                    if !seen.insert((name, args)) {
-                        self.tcx.struct_span_lint_hir(
-                            UNUSED_ATTRIBUTES,
-                            hir_id,
+            if let Some(BuiltinAttribute { duplicates, .. }) = builtin {
+                check_duplicates(self.tcx, attr, hir_id, *duplicates, &mut seen);
+            }
+
+            // Warn on useless empty attributes.
+            if matches!(
+                attr.name_or_empty(),
+                sym::macro_use
+                    | sym::allow
+                    | sym::warn
+                    | sym::deny
+                    | sym::forbid
+                    | sym::feature
+                    | sym::repr
+                    | sym::target_feature
+            ) && attr.meta_item_list().map_or(false, |list| list.is_empty())
+            {
+                self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
+                    lint.build("unused attribute")
+                        .span_suggestion(
                             attr.span,
-                            |lint| lint.build("unused attribute").emit(),
-                        );
-                    }
-                }
-                _ => {}
+                            "remove this attribute",
+                            String::new(),
+                            Applicability::MachineApplicable,
+                        )
+                        .note(&format!(
+                            "attribute `{}` with an empty list has no effect",
+                            attr.name_or_empty()
+                        ))
+                        .emit();
+                });
             }
         }
 
@@ -1990,3 +2009,77 @@ fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
 pub(crate) fn provide(providers: &mut Providers) {
     *providers = Providers { check_mod_attrs, ..*providers };
 }
+
+fn check_duplicates(
+    tcx: TyCtxt<'_>,
+    attr: &Attribute,
+    hir_id: HirId,
+    duplicates: AttributeDuplicates,
+    seen: &mut FxHashMap<Symbol, Span>,
+) {
+    use AttributeDuplicates::*;
+    if matches!(duplicates, WarnFollowingWordOnly) && !attr.is_word() {
+        return;
+    }
+    match duplicates {
+        DuplicatesOk => {}
+        WarnFollowing | FutureWarnFollowing | WarnFollowingWordOnly | FutureWarnPreceding => {
+            match seen.entry(attr.name_or_empty()) {
+                Entry::Occupied(mut entry) => {
+                    let (this, other) = if matches!(duplicates, FutureWarnPreceding) {
+                        let to_remove = entry.insert(attr.span);
+                        (to_remove, attr.span)
+                    } else {
+                        (attr.span, *entry.get())
+                    };
+                    tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, this, |lint| {
+                        let mut db = lint.build("unused attribute");
+                        db.span_note(other, "attribute also specified here").span_suggestion(
+                            this,
+                            "remove this attribute",
+                            String::new(),
+                            Applicability::MachineApplicable,
+                        );
+                        if matches!(duplicates, FutureWarnFollowing | FutureWarnPreceding) {
+                            db.warn(
+                                "this was previously accepted by the compiler but is \
+                                 being phased out; it will become a hard error in \
+                                 a future release!",
+                            );
+                        }
+                        db.emit();
+                    });
+                }
+                Entry::Vacant(entry) => {
+                    entry.insert(attr.span);
+                }
+            }
+        }
+        ErrorFollowing | ErrorPreceding => match seen.entry(attr.name_or_empty()) {
+            Entry::Occupied(mut entry) => {
+                let (this, other) = if matches!(duplicates, ErrorPreceding) {
+                    let to_remove = entry.insert(attr.span);
+                    (to_remove, attr.span)
+                } else {
+                    (attr.span, *entry.get())
+                };
+                tcx.sess
+                    .struct_span_err(
+                        this,
+                        &format!("multiple `{}` attributes", attr.name_or_empty()),
+                    )
+                    .span_note(other, "attribute also specified here")
+                    .span_suggestion(
+                        this,
+                        "remove this attribute",
+                        String::new(),
+                        Applicability::MachineApplicable,
+                    )
+                    .emit();
+            }
+            Entry::Vacant(entry) => {
+                entry.insert(attr.span);
+            }
+        },
+    }
+}
index 1b992cdb0c94b2f0a3fbc7c491aa3bfc2fecff08..b1295ba48ccb96e0824498f02c4f4a5113e9951f 100644 (file)
@@ -6,6 +6,7 @@
 #![feature(let_else)]
 #![feature(min_specialization)]
 #![feature(thread_local_const_init)]
+#![feature(extern_types)]
 
 #[macro_use]
 extern crate tracing;
index 9703f0c3d9605269089498686272447cc188bb9e..b08db39e245a80ecb59dbd2a078e1bc3b9d83219 100644 (file)
@@ -18,6 +18,7 @@
 use rustc_data_structures::sync::{Lock, LockGuard};
 use rustc_data_structures::thin_vec::ThinVec;
 use rustc_errors::{DiagnosticBuilder, FatalError};
+use rustc_session::Session;
 use rustc_span::{Span, DUMMY_SP};
 use std::cell::Cell;
 use std::collections::hash_map::Entry;
@@ -595,38 +596,86 @@ fn incremental_verify_ich<CTX, K, V: Debug>(
     debug!("END verify_ich({:?})", dep_node);
 
     if Some(new_hash) != old_hash {
-        let run_cmd = if let Some(crate_name) = &tcx.sess().opts.crate_name {
-            format!("`cargo clean -p {}` or `cargo clean`", crate_name)
-        } else {
-            "`cargo clean`".to_string()
-        };
+        incremental_verify_ich_cold(tcx.sess(), DebugArg::from(&dep_node), DebugArg::from(&result));
+    }
+}
 
-        // When we emit an error message and panic, we try to debug-print the `DepNode`
-        // and query result. Unforunately, this can cause us to run additional queries,
-        // which may result in another fingerprint mismatch while we're in the middle
-        // of processing this one. To avoid a double-panic (which kills the process
-        // before we can print out the query static), we print out a terse
-        // but 'safe' message if we detect a re-entrant call to this method.
-        thread_local! {
-            static INSIDE_VERIFY_PANIC: Cell<bool> = const { Cell::new(false) };
-        };
+// This DebugArg business is largely a mirror of std::fmt::ArgumentV1, which is
+// currently not exposed publicly.
+//
+// The PR which added this attempted to use `&dyn Debug` instead, but that
+// showed statistically significant worse compiler performance. It's not
+// actually clear what the cause there was -- the code should be cold. If this
+// can be replaced with `&dyn Debug` with on perf impact, then it probably
+// should be.
+extern "C" {
+    type Opaque;
+}
 
-        let old_in_panic = INSIDE_VERIFY_PANIC.with(|in_panic| in_panic.replace(true));
+struct DebugArg<'a> {
+    value: &'a Opaque,
+    fmt: fn(&Opaque, &mut std::fmt::Formatter<'_>) -> std::fmt::Result,
+}
 
-        if old_in_panic {
-            tcx.sess().struct_err("internal compiler error: re-entrant incremental verify failure, suppressing message")
-                .emit();
-        } else {
-            tcx.sess().struct_err(&format!("internal compiler error: encountered incremental compilation error with {:?}", dep_node))
+impl<'a, T> From<&'a T> for DebugArg<'a>
+where
+    T: std::fmt::Debug,
+{
+    fn from(value: &'a T) -> DebugArg<'a> {
+        DebugArg {
+            value: unsafe { std::mem::transmute(value) },
+            fmt: unsafe {
+                std::mem::transmute(<T as std::fmt::Debug>::fmt as fn(_, _) -> std::fmt::Result)
+            },
+        }
+    }
+}
+
+impl std::fmt::Debug for DebugArg<'_> {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        (self.fmt)(self.value, f)
+    }
+}
+
+// Note that this is marked #[cold] and intentionally takes the equivalent of
+// `dyn Debug` for its arguments, as we want to avoid generating a bunch of
+// different implementations for LLVM to chew on (and filling up the final
+// binary, too).
+#[cold]
+fn incremental_verify_ich_cold(sess: &Session, dep_node: DebugArg<'_>, result: DebugArg<'_>) {
+    let run_cmd = if let Some(crate_name) = &sess.opts.crate_name {
+        format!("`cargo clean -p {}` or `cargo clean`", crate_name)
+    } else {
+        "`cargo clean`".to_string()
+    };
+
+    // When we emit an error message and panic, we try to debug-print the `DepNode`
+    // and query result. Unfortunately, this can cause us to run additional queries,
+    // which may result in another fingerprint mismatch while we're in the middle
+    // of processing this one. To avoid a double-panic (which kills the process
+    // before we can print out the query static), we print out a terse
+    // but 'safe' message if we detect a re-entrant call to this method.
+    thread_local! {
+        static INSIDE_VERIFY_PANIC: Cell<bool> = const { Cell::new(false) };
+    };
+
+    let old_in_panic = INSIDE_VERIFY_PANIC.with(|in_panic| in_panic.replace(true));
+
+    if old_in_panic {
+        sess.struct_err(
+            "internal compiler error: re-entrant incremental verify failure, suppressing message",
+        )
+        .emit();
+    } else {
+        sess.struct_err(&format!("internal compiler error: encountered incremental compilation error with {:?}", dep_node))
                 .help(&format!("This is a known issue with the compiler. Run {} to allow your project to compile", run_cmd))
                 .note(&"Please follow the instructions below to create a bug report with the provided information")
                 .note(&"See <https://github.com/rust-lang/rust/issues/84970> for more information")
                 .emit();
-            panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result);
-        }
-
-        INSIDE_VERIFY_PANIC.with(|in_panic| in_panic.set(old_in_panic));
+        panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result);
     }
+
+    INSIDE_VERIFY_PANIC.with(|in_panic| in_panic.set(old_in_panic));
 }
 
 /// Ensure that either this query has all green inputs or been executed.
index c46a18e51031abd33a261a31a0f84a99d088f026..2e4cb4ff7270d75cd451d9b0f3e3ef301667ec56 100644 (file)
@@ -450,12 +450,24 @@ impl<'a> Resolver<'a> {
                 // let foo =...
                 //     ^^^ given this Span
                 // ------- get this Span to have an applicable suggestion
+
+                // edit:
+                // only do this if the const and usage of the non-constant value are on the same line
+                // the further the two are apart, the higher the chance of the suggestion being wrong
+                // also make sure that the pos for the suggestion is not 0 (ICE #90878)
+
                 let sp =
                     self.session.source_map().span_extend_to_prev_str(ident.span, current, true);
-                if sp.lo().0 == 0 {
+
+                let pos_for_suggestion = sp.lo().0.saturating_sub(current.len() as u32);
+
+                if sp.lo().0 == 0
+                    || pos_for_suggestion == 0
+                    || self.session.source_map().is_multiline(sp)
+                {
                     err.span_label(ident.span, &format!("this would need to be a `{}`", sugg));
                 } else {
-                    let sp = sp.with_lo(BytePos(sp.lo().0 - current.len() as u32));
+                    let sp = sp.with_lo(BytePos(pos_for_suggestion));
                     err.span_suggestion(
                         sp,
                         &format!("consider using `{}` instead of `{}`", sugg, current),
index 4262c1e9051ee57a1694c34aab3281198c4edf81..bf4cece8bde8d7f563c247fd7927732cb2d752e8 100644 (file)
@@ -1180,11 +1180,17 @@ fn finalize_import(&mut self, import: &'b Import<'b>) -> Option<UnresolvedImport
 
         let mut reexport_error = None;
         let mut any_successful_reexport = false;
+        let mut crate_private_reexport = false;
         self.r.per_ns(|this, ns| {
             if let Ok(binding) = source_bindings[ns].get() {
                 let vis = import.vis.get();
                 if !binding.vis.is_at_least(vis, &*this) {
                     reexport_error = Some((ns, binding));
+                    if let ty::Visibility::Restricted(binding_def_id) = binding.vis {
+                        if binding_def_id.is_top_level_module() {
+                            crate_private_reexport = true;
+                        }
+                    }
                 } else {
                     any_successful_reexport = true;
                 }
@@ -1207,24 +1213,34 @@ fn finalize_import(&mut self, import: &'b Import<'b>) -> Option<UnresolvedImport
                     import.span,
                     &msg,
                 );
-            } else if ns == TypeNS {
-                struct_span_err!(
-                    self.r.session,
-                    import.span,
-                    E0365,
-                    "`{}` is private, and cannot be re-exported",
-                    ident
-                )
-                .span_label(import.span, format!("re-export of private `{}`", ident))
-                .note(&format!("consider declaring type or module `{}` with `pub`", ident))
-                .emit();
             } else {
-                let msg = format!("`{}` is private, and cannot be re-exported", ident);
-                let note_msg =
-                    format!("consider marking `{}` as `pub` in the imported module", ident,);
-                struct_span_err!(self.r.session, import.span, E0364, "{}", &msg)
-                    .span_note(import.span, &note_msg)
-                    .emit();
+                let error_msg = if crate_private_reexport {
+                    format!(
+                        "`{}` is only public within the crate, and cannot be re-exported outside",
+                        ident
+                    )
+                } else {
+                    format!("`{}` is private, and cannot be re-exported", ident)
+                };
+
+                if ns == TypeNS {
+                    let label_msg = if crate_private_reexport {
+                        format!("re-export of crate public `{}`", ident)
+                    } else {
+                        format!("re-export of private `{}`", ident)
+                    };
+
+                    struct_span_err!(self.r.session, import.span, E0365, "{}", error_msg)
+                        .span_label(import.span, label_msg)
+                        .note(&format!("consider declaring type or module `{}` with `pub`", ident))
+                        .emit();
+                } else {
+                    let note_msg =
+                        format!("consider marking `{}` as `pub` in the imported module", ident);
+                    struct_span_err!(self.r.session, import.span, E0364, "{}", error_msg)
+                        .span_note(import.span, &note_msg)
+                        .emit();
+                }
             }
         }
 
index 4acbb11b13f76295a290e49519088776416e605b..d506931b516e73d3f6d72c234021ed433861a8bf 100644 (file)
@@ -1810,12 +1810,10 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
                     let (span, sugg) = if let Some(param) = generics.params.iter().find(|p| {
                         !matches!(
                             p.kind,
-                            hir::GenericParamKind::Type {
-                                synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
-                                ..
-                            } | hir::GenericParamKind::Lifetime {
-                                kind: hir::LifetimeParamKind::Elided,
-                            }
+                            hir::GenericParamKind::Type { synthetic: true, .. }
+                                | hir::GenericParamKind::Lifetime {
+                                    kind: hir::LifetimeParamKind::Elided,
+                                }
                         )
                     }) {
                         (param.span.shrink_to_lo(), format!("{}, ", lifetime_ref))
@@ -2042,12 +2040,10 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
                         if let Some(param) = generics.params.iter().find(|p| {
                             !matches!(
                                 p.kind,
-                                hir::GenericParamKind::Type {
-                                    synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
-                                    ..
-                                } | hir::GenericParamKind::Lifetime {
-                                    kind: hir::LifetimeParamKind::Elided
-                                }
+                                hir::GenericParamKind::Type { synthetic: true, .. }
+                                    | hir::GenericParamKind::Lifetime {
+                                        kind: hir::LifetimeParamKind::Elided
+                                    }
                             )
                         }) {
                             (param.span.shrink_to_lo(), "'a, ".to_string())
index 31fd9b989e1c81827e523e30c52c8ad71018989f..28dbce0471eaf87a92adf72e408c66799b9aad2a 100644 (file)
@@ -1133,6 +1133,7 @@ fn check_stability_and_deprecation(
                         feature,
                         reason,
                         issue,
+                        None,
                         is_soft,
                         span,
                         soft_handler,
index e5369b4bbfdeafc494ad5b1d796a7925341304dc..df78e1bcbf63cca6cdbfbe0fae38fcc224364ad3 100644 (file)
@@ -589,6 +589,13 @@ fn emit_enum_variant<F>(&mut self, name: &str, _id: usize, cnt: usize, f: F) ->
         }
     }
 
+    fn emit_fieldless_enum_variant<const ID: usize>(
+        &mut self,
+        name: &str,
+    ) -> Result<(), Self::Error> {
+        escape_str(self.writer, name)
+    }
+
     fn emit_enum_variant_arg<F>(&mut self, first: bool, f: F) -> EncodeResult
     where
         F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
@@ -885,6 +892,13 @@ fn emit_enum_variant<F>(&mut self, name: &str, _id: usize, cnt: usize, f: F) ->
         }
     }
 
+    fn emit_fieldless_enum_variant<const ID: usize>(
+        &mut self,
+        name: &str,
+    ) -> Result<(), Self::Error> {
+        escape_str(self.writer, name)
+    }
+
     fn emit_enum_variant_arg<F>(&mut self, first: bool, f: F) -> EncodeResult
     where
         F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
index e32e4493726dbb7d279c66e1451a10d99ccfc41b..96a2231b5906ac8235813276c4540c968971e875 100644 (file)
@@ -58,6 +58,20 @@ fn emit_enum_variant<F>(
         f(self)
     }
 
+    // We put the field index in a const generic to allow the emit_usize to be
+    // compiled into a more efficient form. In practice, the variant index is
+    // known at compile-time, and that knowledge allows much more efficient
+    // codegen than we'd otherwise get. LLVM isn't always able to make the
+    // optimization that would otherwise be necessary here, likely due to the
+    // multiple levels of inlining and const-prop that are needed.
+    #[inline]
+    fn emit_fieldless_enum_variant<const ID: usize>(
+        &mut self,
+        _v_name: &str,
+    ) -> Result<(), Self::Error> {
+        self.emit_usize(ID)
+    }
+
     #[inline]
     fn emit_enum_variant_arg<F>(&mut self, _first: bool, f: F) -> Result<(), Self::Error>
     where
index 5e6bbe0391881a0aab66f198697b2a9725b92599..ab3c122053c5ebd777d5c65d17fbdb48dcc59118 100644 (file)
@@ -165,6 +165,18 @@ pub enum LinkerPluginLto {
     Disabled,
 }
 
+/// Used with `-Z assert-incr-state`.
+#[derive(Clone, Copy, PartialEq, Hash, Debug)]
+pub enum IncrementalStateAssertion {
+    /// Found and loaded an existing session directory.
+    ///
+    /// Note that this says nothing about whether any particular query
+    /// will be found to be red or green.
+    Loaded,
+    /// Did not load an existing session directory.
+    NotLoaded,
+}
+
 impl LinkerPluginLto {
     pub fn enabled(&self) -> bool {
         match *self {
@@ -323,9 +335,10 @@ fn default() -> Self {
 }
 
 /// Parameter to control path trimming.
-#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
 pub enum TrimmedDefPaths {
     /// `try_print_trimmed_def_path` never prints a trimmed path and never calls the expensive query
+    #[default]
     Never,
     /// `try_print_trimmed_def_path` calls the expensive query, the query doesn't call `delay_good_path_bug`
     Always,
@@ -333,12 +346,6 @@ pub enum TrimmedDefPaths {
     GoodPath,
 }
 
-impl Default for TrimmedDefPaths {
-    fn default() -> Self {
-        Self::Never
-    }
-}
-
 /// Use tree-based collections to cheaply get a deterministic `Hash` implementation.
 /// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
 /// dependency tracking for command-line arguments. Also only hash keys, since tracking
@@ -526,6 +533,7 @@ pub enum PrintRequest {
     TlsModels,
     TargetSpec,
     NativeStaticLibs,
+    StackProtectorStrategies,
 }
 
 #[derive(Copy, Clone)]
@@ -704,6 +712,7 @@ pub fn host_triple() -> &'static str {
 impl Default for Options {
     fn default() -> Options {
         Options {
+            assert_incr_state: None,
             crate_types: Vec::new(),
             optimize: OptLevel::No,
             debuginfo: DebugInfo::None,
@@ -1097,8 +1106,8 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
             "print",
             "Compiler information to print on stdout",
             "[crate-name|file-names|sysroot|target-libdir|cfg|target-list|\
-             target-cpus|target-features|relocation-models|\
-             code-models|tls-models|target-spec-json|native-static-libs]",
+             target-cpus|target-features|relocation-models|code-models|\
+             tls-models|target-spec-json|native-static-libs|stack-protector-strategies]",
         ),
         opt::flagmulti_s("g", "", "Equivalent to -C debuginfo=2"),
         opt::flagmulti_s("O", "", "Equivalent to -C opt-level=2"),
@@ -1514,6 +1523,7 @@ fn collect_print_requests(
         "code-models" => PrintRequest::CodeModels,
         "tls-models" => PrintRequest::TlsModels,
         "native-static-libs" => PrintRequest::NativeStaticLibs,
+        "stack-protector-strategies" => PrintRequest::StackProtectorStrategies,
         "target-spec-json" => {
             if dopts.unstable_options {
                 PrintRequest::TargetSpec
@@ -1626,6 +1636,21 @@ fn select_debuginfo(
     }
 }
 
+crate fn parse_assert_incr_state(
+    opt_assertion: &Option<String>,
+    error_format: ErrorOutputType,
+) -> Option<IncrementalStateAssertion> {
+    match opt_assertion {
+        Some(s) if s.as_str() == "loaded" => Some(IncrementalStateAssertion::Loaded),
+        Some(s) if s.as_str() == "not-loaded" => Some(IncrementalStateAssertion::NotLoaded),
+        Some(s) => early_error(
+            error_format,
+            &format!("unexpected incremental state assertion value: {}", s),
+        ),
+        None => None,
+    }
+}
+
 fn parse_native_lib_kind(
     matches: &getopts::Matches,
     kind: &str,
@@ -2015,6 +2040,9 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
 
     let incremental = cg.incremental.as_ref().map(PathBuf::from);
 
+    let assert_incr_state =
+        parse_assert_incr_state(&debugging_opts.assert_incr_state, error_format);
+
     if debugging_opts.profile && incremental.is_some() {
         early_error(
             error_format,
@@ -2179,6 +2207,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
     };
 
     Options {
+        assert_incr_state,
         crate_types,
         optimize: opt_level,
         debuginfo,
@@ -2462,7 +2491,9 @@ pub fn needs_analysis(&self) -> bool {
     use rustc_span::edition::Edition;
     use rustc_span::RealFileName;
     use rustc_target::spec::{CodeModel, MergeFunctions, PanicStrategy, RelocModel};
-    use rustc_target::spec::{RelroLevel, SanitizerSet, SplitDebuginfo, TargetTriple, TlsModel};
+    use rustc_target::spec::{
+        RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TargetTriple, TlsModel,
+    };
     use std::collections::hash_map::DefaultHasher;
     use std::collections::BTreeMap;
     use std::hash::Hash;
@@ -2536,6 +2567,7 @@ fn hash(
         Edition,
         LinkerPluginLto,
         SplitDebuginfo,
+        StackProtector,
         SwitchWithOptPath,
         SymbolManglingVersion,
         SourceFileHashAlgorithm,
index 6c86f86ecd9bb210a4d71b1d7eca891bd44a52ec..399b616915ee10b419cd0c5e878fee1b75466e10 100644 (file)
@@ -1,4 +1,5 @@
 #![feature(crate_visibility_modifier)]
+#![feature(derive_default_enum)]
 #![feature(min_specialization)]
 #![feature(once_cell)]
 #![recursion_limit = "256"]
index 3f279a045f159746637894ff9733b217f80c643b..a84e16b9dc31ad1f1ca967866eae9ca11a239d36 100644 (file)
@@ -4,9 +4,10 @@
 use crate::lint;
 use crate::search_paths::SearchPath;
 use crate::utils::NativeLib;
-
 use rustc_target::spec::{CodeModel, LinkerFlavor, MergeFunctions, PanicStrategy, SanitizerSet};
-use rustc_target::spec::{RelocModel, RelroLevel, SplitDebuginfo, TargetTriple, TlsModel};
+use rustc_target::spec::{
+    RelocModel, RelroLevel, SplitDebuginfo, StackProtector, TargetTriple, TlsModel,
+};
 
 use rustc_feature::UnstableFeatures;
 use rustc_span::edition::Edition;
@@ -150,6 +151,7 @@ pub struct Options {
         /// If `Some`, enable incremental compilation, using the given
         /// directory to store intermediate results.
         incremental: Option<PathBuf> [UNTRACKED],
+        assert_incr_state: Option<IncrementalStateAssertion> [UNTRACKED],
 
         debugging_opts: DebuggingOptions [SUBSTRUCT],
         prints: Vec<PrintRequest> [UNTRACKED],
@@ -385,6 +387,8 @@ mod desc {
     pub const parse_split_debuginfo: &str =
         "one of supported split-debuginfo modes (`off`, `packed`, or `unpacked`)";
     pub const parse_gcc_ld: &str = "one of: no value, `lld`";
+    pub const parse_stack_protector: &str =
+        "one of (`none` (default), `basic`, `strong`, or `all`)";
 }
 
 mod parse {
@@ -917,6 +921,14 @@ mod parse {
         }
         true
     }
+
+    crate fn parse_stack_protector(slot: &mut StackProtector, v: Option<&str>) -> bool {
+        match v.and_then(|s| StackProtector::from_str(s).ok()) {
+            Some(ssp) => *slot = ssp,
+            _ => return false,
+        }
+        true
+    }
 }
 
 options! {
@@ -1046,6 +1058,9 @@ mod parse {
         "make cfg(version) treat the current version as incomplete (default: no)"),
     asm_comments: bool = (false, parse_bool, [TRACKED],
         "generate comments into the assembly (may change behavior) (default: no)"),
+    assert_incr_state: Option<String> = (None, parse_opt_string, [UNTRACKED],
+        "assert that the incremental cache is in given state: \
+         either `loaded` or `not-loaded`."),
     ast_json: bool = (false, parse_bool, [UNTRACKED],
         "print the AST as JSON and halt (default: no)"),
     ast_json_noexpand: bool = (false, parse_bool, [UNTRACKED],
@@ -1237,6 +1252,8 @@ mod parse {
         and set the maximum total size of a const allocation for which this is allowed (default: never)"),
     perf_stats: bool = (false, parse_bool, [UNTRACKED],
         "print some performance-related statistics (default: no)"),
+    pick_stable_methods_before_any_unstable: bool = (true, parse_bool, [TRACKED],
+        "try to pick stable methods first before picking any unstable methods (default: yes)"),
     plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
         "whether to use the PLT when calling into shared libraries;
         only has effect for PIC code on systems with ELF binaries
@@ -1325,6 +1342,8 @@ mod parse {
         "exclude spans when debug-printing compiler state (default: no)"),
     src_hash_algorithm: Option<SourceFileHashAlgorithm> = (None, parse_src_file_hash, [TRACKED],
         "hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`)"),
+    stack_protector: StackProtector = (StackProtector::None, parse_stack_protector, [TRACKED],
+        "control stack smash protection strategy (`rustc --print stack-protector-strategies` for details)"),
     strip: Strip = (Strip::None, parse_strip, [UNTRACKED],
         "tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)"),
     split_dwarf_inlining: bool = (true, parse_bool, [UNTRACKED],
index 74b3cfa44c31aaa0e8847ddd5705daa841566e62..69494e6d9b36a491620c6eda245eb90c0ea44e36 100644 (file)
@@ -27,7 +27,9 @@
 use rustc_span::{sym, SourceFileHashAlgorithm, Symbol};
 use rustc_target::asm::InlineAsmArch;
 use rustc_target::spec::{CodeModel, PanicStrategy, RelocModel, RelroLevel};
-use rustc_target::spec::{SanitizerSet, SplitDebuginfo, Target, TargetTriple, TlsModel};
+use rustc_target::spec::{
+    SanitizerSet, SplitDebuginfo, StackProtector, Target, TargetTriple, TlsModel,
+};
 
 use std::cell::{self, RefCell};
 use std::env;
@@ -732,6 +734,14 @@ pub fn split_debuginfo(&self) -> SplitDebuginfo {
         self.opts.cg.split_debuginfo.unwrap_or(self.target.split_debuginfo)
     }
 
+    pub fn stack_protector(&self) -> StackProtector {
+        if self.target.options.supports_stack_protector {
+            self.opts.debugging_opts.stack_protector
+        } else {
+            StackProtector::None
+        }
+    }
+
     pub fn target_can_use_split_dwarf(&self) -> bool {
         !self.target.is_like_windows && !self.target.is_like_osx
     }
@@ -1411,6 +1421,15 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
             sess.err("`-Zsanitizer=cfi` requires `-Clto`");
         }
     }
+
+    if sess.opts.debugging_opts.stack_protector != StackProtector::None {
+        if !sess.target.options.supports_stack_protector {
+            sess.warn(&format!(
+                "`-Z stack-protector={}` is not supported for target {} and will be ignored",
+                sess.opts.debugging_opts.stack_protector, sess.opts.target_triple
+            ))
+        }
+    }
 }
 
 /// Holds data on the current incremental compilation session, if there is one.
index 724d1904dc33c7125d7231f2190abc64d7d4f7c9..d590776676bef53dd3067f5bc6b542a0c21fcefd 100644 (file)
@@ -1099,18 +1099,11 @@ pub enum DesugaringKind {
     OpaqueTy,
     Async,
     Await,
-    ForLoop(ForLoopLoc),
+    ForLoop,
     LetElse,
     WhileLoop,
 }
 
-/// A location in the desugaring of a `for` loop
-#[derive(Clone, Copy, PartialEq, Debug, Encodable, Decodable, HashStable_Generic)]
-pub enum ForLoopLoc {
-    Head,
-    IntoIter,
-}
-
 impl DesugaringKind {
     /// The description wording should combine well with "desugaring of {}".
     pub fn descr(self) -> &'static str {
@@ -1121,7 +1114,7 @@ pub fn descr(self) -> &'static str {
             DesugaringKind::QuestionMark => "operator `?`",
             DesugaringKind::TryBlock => "`try` block",
             DesugaringKind::OpaqueTy => "`impl Trait`",
-            DesugaringKind::ForLoop(_) => "`for` loop",
+            DesugaringKind::ForLoop => "`for` loop",
             DesugaringKind::LetElse => "`let...else`",
             DesugaringKind::WhileLoop => "`while` loop",
         }
index dfc64f37e4c46b84c7e1ee9a02ee1282a6feba67..66c01140abc17e1e8c1360f92633933cb4931f3f 100644 (file)
@@ -41,7 +41,7 @@
 use edition::Edition;
 pub mod hygiene;
 use hygiene::Transparency;
-pub use hygiene::{DesugaringKind, ExpnKind, ForLoopLoc, MacroKind};
+pub use hygiene::{DesugaringKind, ExpnKind, MacroKind};
 pub use hygiene::{ExpnData, ExpnHash, ExpnId, LocalExpnId, SyntaxContext};
 pub mod def_id;
 use def_id::{CrateNum, DefId, DefPathHash, LocalDefId, LOCAL_CRATE};
@@ -1935,6 +1935,7 @@ pub struct Loc {
 #[derive(Debug)]
 pub struct SourceFileAndLine {
     pub sf: Lrc<SourceFile>,
+    /// Index of line, starting from 0.
     pub line: usize,
 }
 #[derive(Debug)]
index 74958c4984962573984f2ab580136548643d845b..7414d201f511d099b79cba7748fdfc8abe47fe79 100644 (file)
@@ -593,14 +593,19 @@ pub fn span_to_snippet(&self, sp: Span) -> Result<String, SpanSnippetError> {
     }
 
     pub fn span_to_margin(&self, sp: Span) -> Option<usize> {
-        match self.span_to_prev_source(sp) {
-            Err(_) => None,
-            Ok(source) => {
-                let last_line = source.rsplit_once('\n').unwrap_or(("", &source)).1;
+        Some(self.indentation_before(sp)?.len())
+    }
 
-                Some(last_line.len() - last_line.trim_start().len())
-            }
-        }
+    pub fn indentation_before(&self, sp: Span) -> Option<String> {
+        self.span_to_source(sp, |src, start_index, _| {
+            let before = &src[..start_index];
+            let last_line = before.rsplit_once('\n').map_or(before, |(_, last)| last);
+            Ok(last_line
+                .split_once(|c: char| !c.is_whitespace())
+                .map_or(last_line, |(indent, _)| indent)
+                .to_string())
+        })
+        .ok()
     }
 
     /// Returns the source snippet as `String` before the given `Span`.
index 99fa9f000944df2b6e66f6227ac44f85105641dd..c34cf822765f73615e32d650a0c12db821c3aa4b 100644 (file)
         __D,
         __H,
         __S,
-        __next,
         __try_var,
         _args,
         _d,
         alloc_layout,
         alloc_zeroed,
         allocator,
+        allocator_api,
         allocator_internals,
         allow,
         allow_fail,
         inlateout,
         inline,
         inline_const,
+        inline_const_pat,
         inout,
         instruction_set,
         intel,
         rustc_std_internal_symbol,
         rustc_strict_coherence,
         rustc_symbol_name,
-        rustc_synthetic,
         rustc_test_marker,
         rustc_then_this_would_need,
         rustc_trivial_field_reads,
index 0771f9985350020449f02ec968c3b4fb78f81b1d..0d49c7f6ee8b96417f9cec71d98744a79c6a5a3d 100644 (file)
@@ -712,6 +712,59 @@ fn to_json(&self) -> Json {
     }
 }
 
+/// Controls use of stack canaries.
+#[derive(Clone, Copy, Debug, PartialEq, Hash, Eq)]
+pub enum StackProtector {
+    /// Disable stack canary generation.
+    None,
+
+    /// On LLVM, mark all generated LLVM functions with the `ssp` attribute (see
+    /// llvm/docs/LangRef.rst). This triggers stack canary generation in
+    /// functions which contain an array of a byte-sized type with more than
+    /// eight elements.
+    Basic,
+
+    /// On LLVM, mark all generated LLVM functions with the `sspstrong`
+    /// attribute (see llvm/docs/LangRef.rst). This triggers stack canary
+    /// generation in functions which either contain an array, or which take
+    /// the address of a local variable.
+    Strong,
+
+    /// Generate stack canaries in all functions.
+    All,
+}
+
+impl StackProtector {
+    fn as_str(&self) -> &'static str {
+        match self {
+            StackProtector::None => "none",
+            StackProtector::Basic => "basic",
+            StackProtector::Strong => "strong",
+            StackProtector::All => "all",
+        }
+    }
+}
+
+impl FromStr for StackProtector {
+    type Err = ();
+
+    fn from_str(s: &str) -> Result<StackProtector, ()> {
+        Ok(match s {
+            "none" => StackProtector::None,
+            "basic" => StackProtector::Basic,
+            "strong" => StackProtector::Strong,
+            "all" => StackProtector::All,
+            _ => return Err(()),
+        })
+    }
+}
+
+impl fmt::Display for StackProtector {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_str(self.as_str())
+    }
+}
+
 macro_rules! supported_targets {
     ( $(($( $triple:literal, )+ $module:ident ),)+ ) => {
         $(mod $module;)+
@@ -1360,6 +1413,10 @@ pub struct TargetOptions {
 
     /// Whether or not the DWARF `.debug_aranges` section should be generated.
     pub generate_arange_section: bool,
+
+    /// Whether the target supports stack canary checks. `true` by default,
+    /// since this is most common among tier 1 and tier 2 targets.
+    pub supports_stack_protector: bool,
 }
 
 impl Default for TargetOptions {
@@ -1466,6 +1523,7 @@ fn default() -> TargetOptions {
             default_adjusted_cabi: None,
             c_enum_min_bits: 32,
             generate_arange_section: true,
+            supports_stack_protector: true,
         }
     }
 }
@@ -2052,6 +2110,7 @@ macro_rules! key {
         key!(default_adjusted_cabi, Option<Abi>)?;
         key!(c_enum_min_bits, u64);
         key!(generate_arange_section, bool);
+        key!(supports_stack_protector, bool);
 
         if base.is_builtin {
             // This can cause unfortunate ICEs later down the line.
@@ -2292,6 +2351,7 @@ macro_rules! target_option_val {
         target_option_val!(supported_sanitizers);
         target_option_val!(c_enum_min_bits);
         target_option_val!(generate_arange_section);
+        target_option_val!(supports_stack_protector);
 
         if let Some(abi) = self.default_adjusted_cabi {
             d.insert("default-adjusted-cabi".to_string(), Abi::name(abi).to_json());
index 083262cf3514c2509eada87ea4934c46b023c3d8..ba32a312910d89ba38daed726c57d89d5f449680 100644 (file)
@@ -44,6 +44,10 @@ pub fn target() -> Target {
             // produce kernel functions that call other kernel functions.
             // This behavior is not supported by PTX ISA.
             merge_functions: MergeFunctions::Disabled,
+
+            // The LLVM backend does not support stack canaries for this target
+            supports_stack_protector: false,
+
             ..Default::default()
         },
     }
index 1a049e6ec649da4bcd0c63408e40b7e5106f6d0a..1820e33b19bf4fc0ae332bc78aeb3ab8e6359d23 100644 (file)
@@ -14,6 +14,7 @@
 #![feature(bool_to_option)]
 #![feature(box_patterns)]
 #![feature(drain_filter)]
+#![feature(derive_default_enum)]
 #![feature(hash_drain_filter)]
 #![feature(in_band_lifetimes)]
 #![feature(iter_zip)]
index 0bf01afb575dab54163f53b3862763f2788e79cd..a90140a9b50b924ded3a3ec7e52e5c2b3bbbcb45 100644 (file)
@@ -27,7 +27,7 @@
 use rustc_session::Limit;
 use rustc_span::def_id::LOCAL_CRATE;
 use rustc_span::symbol::{kw, sym, Ident, Symbol};
-use rustc_span::{BytePos, DesugaringKind, ExpnKind, ForLoopLoc, MultiSpan, Span, DUMMY_SP};
+use rustc_span::{BytePos, DesugaringKind, ExpnKind, MultiSpan, Span, DUMMY_SP};
 use rustc_target::spec::abi;
 use std::fmt;
 
@@ -290,9 +290,10 @@ fn suggest_restriction(
     } else {
         // Trivial case: `T` needs an extra bound: `T: Bound`.
         let (sp, suggestion) = match (
-            generics.params.iter().find(|p| {
-                !matches!(p.kind, hir::GenericParamKind::Type { synthetic: Some(_), .. })
-            }),
+            generics
+                .params
+                .iter()
+                .find(|p| !matches!(p.kind, hir::GenericParamKind::Type { synthetic: true, .. })),
             super_traits,
         ) {
             (_, None) => predicate_constraint(
@@ -684,7 +685,7 @@ fn suggest_add_reference_to_arg(
             &obligation.cause.code
         {
             parent_code.clone()
-        } else if let ExpnKind::Desugaring(DesugaringKind::ForLoop(ForLoopLoc::IntoIter)) =
+        } else if let ExpnKind::Desugaring(DesugaringKind::ForLoop) =
             span.ctxt().outer_expn_data().kind
         {
             Lrc::new(obligation.cause.code.clone())
@@ -764,8 +765,7 @@ fn suggest_add_reference_to_arg(
                     // This if is to prevent a special edge-case
                     if matches!(
                         span.ctxt().outer_expn_data().kind,
-                        ExpnKind::Root
-                            | ExpnKind::Desugaring(DesugaringKind::ForLoop(ForLoopLoc::IntoIter))
+                        ExpnKind::Root | ExpnKind::Desugaring(DesugaringKind::ForLoop)
                     ) {
                         // We don't want a borrowing suggestion on the fields in structs,
                         // ```
@@ -1957,15 +1957,9 @@ fn note_obligation_cause_code<T>(
                     region, object_ty,
                 ));
             }
-            ObligationCauseCode::ItemObligation(item_def_id) => {
-                let item_name = tcx.def_path_str(item_def_id);
-                let msg = format!("required by `{}`", item_name);
-                let sp = tcx
-                    .hir()
-                    .span_if_local(item_def_id)
-                    .unwrap_or_else(|| tcx.def_span(item_def_id));
-                let sp = tcx.sess.source_map().guess_head_span(sp);
-                err.span_note(sp, &msg);
+            ObligationCauseCode::ItemObligation(_item_def_id) => {
+                // We hold the `DefId` of the item introducing the obligation, but displaying it
+                // doesn't add user usable information. It always point at an associated item.
             }
             ObligationCauseCode::BindingObligation(item_def_id, span) => {
                 let item_name = tcx.def_path_str(item_def_id);
index 91671994c5ace9c87c31ddc0e1750a7277244ae4..4bc22d5d73543f9b30a32c9130dffdba5a348d85 100644 (file)
 pub use rustc_infer::traits::*;
 
 /// Whether to skip the leak check, as part of a future compatibility warning step.
-#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+///
+/// The "default" for skip-leak-check corresponds to the current
+/// behavior (do not skip the leak check) -- not the behavior we are
+/// transitioning into.
+#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
 pub enum SkipLeakCheck {
     Yes,
+    #[default]
     No,
 }
 
@@ -94,15 +99,6 @@ fn is_yes(self) -> bool {
     }
 }
 
-/// The "default" for skip-leak-check corresponds to the current
-/// behavior (do not skip the leak check) -- not the behavior we are
-/// transitioning into.
-impl Default for SkipLeakCheck {
-    fn default() -> Self {
-        SkipLeakCheck::No
-    }
-}
-
 /// The mode that trait queries run in.
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
 pub enum TraitQueryMode {
index ed49abbbedc92dfe8415a16f377c45f0c84ba567..6d2323abba465e152e76ed1c23538c725626fb4e 100644 (file)
@@ -9,7 +9,9 @@
 use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness};
 
 use super::{Normalized, Obligation, ObligationCause, PredicateObligation, SelectionContext};
-pub use rustc_infer::traits::util::*;
+pub use rustc_infer::traits::{self, util::*};
+
+use std::iter;
 
 ///////////////////////////////////////////////////////////////////////////
 // `TraitAliasExpander` iterator
@@ -229,11 +231,16 @@ pub fn predicates_for_generics<'tcx>(
 ) -> impl Iterator<Item = PredicateObligation<'tcx>> {
     debug!("predicates_for_generics(generic_bounds={:?})", generic_bounds);
 
-    generic_bounds.predicates.into_iter().map(move |predicate| Obligation {
-        cause: cause.clone(),
-        recursion_depth,
-        param_env,
-        predicate,
+    iter::zip(generic_bounds.predicates, generic_bounds.spans).map(move |(predicate, span)| {
+        let cause = match cause.code {
+            traits::ItemObligation(def_id) if !span.is_dummy() => traits::ObligationCause::new(
+                cause.span,
+                cause.body_id,
+                traits::BindingObligation(def_id, span),
+            ),
+            _ => cause.clone(),
+        };
+        Obligation { cause, recursion_depth, param_env, predicate }
     })
 }
 
index cb47ba9c360da14401081cfc132e70e61a678641..2a66684e2a2a0937a498866a831992877c24f02e 100644 (file)
@@ -709,7 +709,12 @@ fn nominal_obligations(
 
         iter::zip(iter::zip(predicates.predicates, predicates.spans), origins.into_iter().rev())
             .map(|((pred, span), origin_def_id)| {
-                let cause = self.cause(traits::BindingObligation(origin_def_id, span));
+                let code = if span.is_dummy() {
+                    traits::MiscObligation
+                } else {
+                    traits::BindingObligation(origin_def_id, span)
+                };
+                let cause = self.cause(code);
                 traits::Obligation::with_depth(cause, self.recursion_depth, self.param_env, pred)
             })
             .filter(|pred| !pred.has_escaping_bound_vars())
index 2f187997b55de0fbf10a7028524a44649b5d3a68..e8bd038fed7a5b1ddf8cebbcaab388178266d5cf 100644 (file)
@@ -464,16 +464,7 @@ pub(crate) fn check_generic_arg_count(
                 .params
                 .iter()
                 .filter(|param| {
-                    matches!(
-                        param.kind,
-                        ty::GenericParamDefKind::Type {
-                            synthetic: Some(
-                                hir::SyntheticTyParamKind::ImplTrait
-                                    | hir::SyntheticTyParamKind::FromAttr
-                            ),
-                            ..
-                        }
-                    )
+                    matches!(param.kind, ty::GenericParamDefKind::Type { synthetic: true, .. })
                 })
                 .count()
         } else {
index 5d22e300774d3b624d31a6029ddf99751280705c..635ed93819319e536cfea9c1572d528c9e269c99 100644 (file)
@@ -349,9 +349,12 @@ fn confirm_builtin_call(
             ty::FnPtr(sig) => (sig, None),
             ref t => {
                 let mut unit_variant = None;
+                let mut removal_span = call_expr.span;
                 if let ty::Adt(adt_def, ..) = t {
                     if adt_def.is_enum() {
                         if let hir::ExprKind::Call(expr, _) = call_expr.kind {
+                            removal_span =
+                                expr.span.shrink_to_hi().to(call_expr.span.shrink_to_hi());
                             unit_variant =
                                 self.tcx.sess.source_map().span_to_snippet(expr.span).ok();
                         }
@@ -379,14 +382,13 @@ fn confirm_builtin_call(
                 );
 
                 if let Some(ref path) = unit_variant {
-                    err.span_suggestion(
-                        call_expr.span,
+                    err.span_suggestion_verbose(
+                        removal_span,
                         &format!(
-                            "`{}` is a unit variant, you need to write it \
-                                 without the parentheses",
+                            "`{}` is a unit variant, you need to write it without the parentheses",
                             path
                         ),
-                        path.to_string(),
+                        String::new(),
                         Applicability::MachineApplicable,
                     );
                 }
index cbfd8747ecf0091b16c6c711ee9e83c4771d5c3e..4d4662f73a9556023a59408bb35103ec7563856c 100644 (file)
@@ -210,12 +210,8 @@ fn compare_predicate_entailment<'tcx>(
     let normalize_cause = traits::ObligationCause::misc(impl_m_span, impl_m_hir_id);
     let param_env =
         ty::ParamEnv::new(tcx.intern_predicates(&hybrid_preds.predicates), Reveal::UserFacing);
-    let param_env = traits::normalize_param_env_or_error(
-        tcx,
-        impl_m.def_id,
-        param_env,
-        normalize_cause.clone(),
-    );
+    let param_env =
+        traits::normalize_param_env_or_error(tcx, impl_m.def_id, param_env, normalize_cause);
 
     tcx.infer_ctxt().enter(|infcx| {
         let inh = Inherited::new(infcx, impl_m.def_id.expect_local());
@@ -226,12 +222,15 @@ fn compare_predicate_entailment<'tcx>(
         let mut selcx = traits::SelectionContext::new(&infcx);
 
         let impl_m_own_bounds = impl_m_predicates.instantiate_own(tcx, impl_to_placeholder_substs);
-        for predicate in impl_m_own_bounds.predicates {
+        for (predicate, span) in iter::zip(impl_m_own_bounds.predicates, impl_m_own_bounds.spans) {
+            let normalize_cause = traits::ObligationCause::misc(span, impl_m_hir_id);
             let traits::Normalized { value: predicate, obligations } =
-                traits::normalize(&mut selcx, param_env, normalize_cause.clone(), predicate);
+                traits::normalize(&mut selcx, param_env, normalize_cause, predicate);
 
             inh.register_predicates(obligations);
-            inh.register_predicate(traits::Obligation::new(cause.clone(), param_env, predicate));
+            let mut cause = cause.clone();
+            cause.make_mut().span = span;
+            inh.register_predicate(traits::Obligation::new(cause, param_env, predicate));
         }
 
         // We now need to check that the signature of the impl method is
@@ -280,6 +279,12 @@ fn compare_predicate_entailment<'tcx>(
 
         let sub_result = infcx.at(&cause, param_env).sup(trait_fty, impl_fty).map(
             |InferOk { obligations, .. }| {
+                // FIXME: We'd want to keep more accurate spans than "the method signature" when
+                // processing the comparison between the trait and impl fn, but we sadly lose them
+                // and point at the whole signature when a trait bound or specific input or output
+                // type would be more appropriate. In other places we have a `Vec<Span>`
+                // corresponding to their `Vec<Predicate>`, but we don't have that here.
+                // Fixing this would improve the output of test `issue-83765.rs`.
                 inh.register_predicates(obligations);
             },
         );
@@ -607,10 +612,7 @@ fn compare_number_of_generics<'tcx>(
                         .params
                         .iter()
                         .filter_map(|p| match p.kind {
-                            GenericParamKind::Type {
-                                synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
-                                ..
-                            } => Some(p.span),
+                            GenericParamKind::Type { synthetic: true, .. } => Some(p.span),
                             _ => None,
                         })
                         .collect();
@@ -627,10 +629,7 @@ fn compare_number_of_generics<'tcx>(
                 .params
                 .iter()
                 .filter_map(|p| match p.kind {
-                    GenericParamKind::Type {
-                        synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
-                        ..
-                    } => Some(p.span),
+                    GenericParamKind::Type { synthetic: true, .. } => Some(p.span),
                     _ => None,
                 })
                 .collect();
@@ -823,7 +822,7 @@ fn compare_synthetic_generics<'tcx>(
             match (impl_synthetic, trait_synthetic) {
                 // The case where the impl method uses `impl Trait` but the trait method uses
                 // explicit generics
-                (Some(hir::SyntheticTyParamKind::ImplTrait), None) => {
+                (true, false) => {
                     err.span_label(impl_span, "expected generic parameter, found `impl Trait`");
                     (|| {
                         // try taking the name from the trait impl
@@ -864,7 +863,7 @@ fn compare_synthetic_generics<'tcx>(
                 }
                 // The case where the trait method uses `impl Trait`, but the impl method uses
                 // explicit generics.
-                (None, Some(hir::SyntheticTyParamKind::ImplTrait)) => {
+                (false, true) => {
                     err.span_label(impl_span, "expected `impl Trait`, found generic parameter");
                     (|| {
                         let impl_m = impl_m.def_id.as_local()?;
@@ -1391,12 +1390,13 @@ pub fn check_type_bounds<'tcx>(
 
         let impl_ty_hir_id = tcx.hir().local_def_id_to_hir_id(impl_ty.def_id.expect_local());
         let normalize_cause = traits::ObligationCause::misc(impl_ty_span, impl_ty_hir_id);
-        let mk_cause = |span| {
-            ObligationCause::new(
-                impl_ty_span,
-                impl_ty_hir_id,
-                ObligationCauseCode::BindingObligation(trait_ty.def_id, span),
-            )
+        let mk_cause = |span: Span| {
+            let code = if span.is_dummy() {
+                traits::MiscObligation
+            } else {
+                traits::BindingObligation(trait_ty.def_id, span)
+            };
+            ObligationCause::new(impl_ty_span, impl_ty_hir_id, code)
         };
 
         let obligations = tcx
index 9bbe52591472885655471958f9bf7632c42385b4..ece2d7b4f3793f0aaa93b48e50a9fdcddae69491 100644 (file)
@@ -199,7 +199,50 @@ fn suggest_compatible_variants(
                 return;
             }
 
-            let mut compatible_variants = expected_adt
+            // If the expression is of type () and it's the return expression of a block,
+            // we suggest adding a separate return expression instead.
+            // (To avoid things like suggesting `Ok(while .. { .. })`.)
+            if expr_ty.is_unit() {
+                if let Some(hir::Node::Block(&hir::Block {
+                    span: block_span, expr: Some(e), ..
+                })) = self.tcx.hir().find(self.tcx.hir().get_parent_node(expr.hir_id))
+                {
+                    if e.hir_id == expr.hir_id {
+                        if let Some(span) = expr.span.find_ancestor_inside(block_span) {
+                            let return_suggestions =
+                                if self.tcx.is_diagnostic_item(sym::Result, expected_adt.did) {
+                                    vec!["Ok(())".to_string()]
+                                } else if self.tcx.is_diagnostic_item(sym::Option, expected_adt.did)
+                                {
+                                    vec!["None".to_string(), "Some(())".to_string()]
+                                } else {
+                                    return;
+                                };
+                            if let Some(indent) =
+                                self.tcx.sess.source_map().indentation_before(span.shrink_to_lo())
+                            {
+                                // Add a semicolon, except after `}`.
+                                let semicolon =
+                                    match self.tcx.sess.source_map().span_to_snippet(span) {
+                                        Ok(s) if s.ends_with('}') => "",
+                                        _ => ";",
+                                    };
+                                err.span_suggestions(
+                                    span.shrink_to_hi(),
+                                    "try adding an expression at the end of the block",
+                                    return_suggestions
+                                        .into_iter()
+                                        .map(|r| format!("{}\n{}{}", semicolon, indent, r)),
+                                    Applicability::MaybeIncorrect,
+                                );
+                            }
+                            return;
+                        }
+                    }
+                }
+            }
+
+            let compatible_variants: Vec<String> = expected_adt
                 .variants
                 .iter()
                 .filter(|variant| variant.fields.len() == 1)
@@ -220,19 +263,33 @@ fn suggest_compatible_variants(
                         None
                     }
                 })
-                .peekable();
+                .collect();
 
-            if compatible_variants.peek().is_some() {
-                if let Ok(expr_text) = self.tcx.sess.source_map().span_to_snippet(expr.span) {
-                    let suggestions = compatible_variants.map(|v| format!("{}({})", v, expr_text));
-                    let msg = "try using a variant of the expected enum";
-                    err.span_suggestions(
-                        expr.span,
-                        msg,
-                        suggestions,
-                        Applicability::MaybeIncorrect,
-                    );
-                }
+            if let [variant] = &compatible_variants[..] {
+                // Just a single matching variant.
+                err.multipart_suggestion(
+                    &format!("try wrapping the expression in `{}`", variant),
+                    vec![
+                        (expr.span.shrink_to_lo(), format!("{}(", variant)),
+                        (expr.span.shrink_to_hi(), ")".to_string()),
+                    ],
+                    Applicability::MaybeIncorrect,
+                );
+            } else if compatible_variants.len() > 1 {
+                // More than one matching variant.
+                err.multipart_suggestions(
+                    &format!(
+                        "try wrapping the expression in a variant of `{}`",
+                        self.tcx.def_path_str(expected_adt.did)
+                    ),
+                    compatible_variants.into_iter().map(|variant| {
+                        vec![
+                            (expr.span.shrink_to_lo(), format!("{}(", variant)),
+                            (expr.span.shrink_to_hi(), ")".to_string()),
+                        ]
+                    }),
+                    Applicability::MaybeIncorrect,
+                );
             }
         }
     }
index 5c79a067e9f047e74a66005f0365ed5620136d8a..c9fa0fd72fc50cce251f16072821e7a7f61ba806 100644 (file)
@@ -2025,7 +2025,7 @@ fn ban_take_value_of_method(&self, expr: &hir::Expr<'_>, expr_t: Ty<'tcx>, field
     fn point_at_param_definition(&self, err: &mut DiagnosticBuilder<'_>, param: ty::ParamTy) {
         let generics = self.tcx.generics_of(self.body_id.owner.to_def_id());
         let generic_param = generics.type_param(&param, self.tcx);
-        if let ty::GenericParamDefKind::Type { synthetic: Some(..), .. } = generic_param.kind {
+        if let ty::GenericParamDefKind::Type { synthetic: true, .. } = generic_param.kind {
             return;
         }
         let param_def_id = generic_param.def_id;
index aae59eee99142878d26722dd366ee69124370527..142a0a8fc2501e922c4a35058f87537cec07aed7 100644 (file)
@@ -586,38 +586,6 @@ pub fn add_wf_bounds(&self, substs: SubstsRef<'tcx>, expr: &hir::Expr<'_>) {
         }
     }
 
-    /// Given a fully substituted set of bounds (`generic_bounds`), and the values with which each
-    /// type/region parameter was instantiated (`substs`), creates and registers suitable
-    /// trait/region obligations.
-    ///
-    /// For example, if there is a function:
-    ///
-    /// ```
-    /// fn foo<'a,T:'a>(...)
-    /// ```
-    ///
-    /// and a reference:
-    ///
-    /// ```
-    /// let f = foo;
-    /// ```
-    ///
-    /// Then we will create a fresh region variable `'$0` and a fresh type variable `$1` for `'a`
-    /// and `T`. This routine will add a region obligation `$1:'$0` and register it locally.
-    pub fn add_obligations_for_parameters(
-        &self,
-        cause: traits::ObligationCause<'tcx>,
-        predicates: ty::InstantiatedPredicates<'tcx>,
-    ) {
-        assert!(!predicates.has_escaping_bound_vars());
-
-        debug!("add_obligations_for_parameters(predicates={:?})", predicates);
-
-        for obligation in traits::predicates_for_generics(cause, self.param_env, predicates) {
-            self.register_predicate(obligation);
-        }
-    }
-
     // FIXME(arielb1): use this instead of field.ty everywhere
     // Only for fields! Returns <none> for methods>
     // Indifferent to privacy flags
@@ -1522,20 +1490,14 @@ fn inferred_kind(
 
     /// Add all the obligations that are required, substituting and normalized appropriately.
     #[tracing::instrument(level = "debug", skip(self, span, def_id, substs))]
-    fn add_required_obligations(&self, span: Span, def_id: DefId, substs: &SubstsRef<'tcx>) {
-        let (bounds, spans) = self.instantiate_bounds(span, def_id, &substs);
+    crate fn add_required_obligations(&self, span: Span, def_id: DefId, substs: &SubstsRef<'tcx>) {
+        let (bounds, _) = self.instantiate_bounds(span, def_id, &substs);
 
-        for (i, mut obligation) in traits::predicates_for_generics(
+        for obligation in traits::predicates_for_generics(
             traits::ObligationCause::new(span, self.body_id, traits::ItemObligation(def_id)),
             self.param_env,
             bounds,
-        )
-        .enumerate()
-        {
-            // This makes the error point at the bound, but we want to point at the argument
-            if let Some(span) = spans.get(i) {
-                obligation.cause.make_mut().code = traits::BindingObligation(def_id, *span);
-            }
+        ) {
             self.register_predicate(obligation);
         }
     }
index 7d9483201f6a547c5e3ae407e473a8ad19f7e729..a119a6838b8d2f3e900d74f7bd8a144b8daa5c01 100644 (file)
@@ -509,10 +509,7 @@ pub fn check_struct_path(
             self.write_user_type_annotation_from_substs(hir_id, did, substs, None);
 
             // Check bounds on type arguments used in the path.
-            let (bounds, _) = self.instantiate_bounds(path_span, did, substs);
-            let cause =
-                traits::ObligationCause::new(path_span, self.body_id, traits::ItemObligation(did));
-            self.add_obligations_for_parameters(cause, bounds);
+            self.add_required_obligations(path_span, did, substs);
 
             Some((variant, ty))
         } else {
index e7e4e72f6c1d987160a5c7708c6f413df08fae72..dabfe92190b33ade90375e7742bca4c22da47513 100644 (file)
@@ -120,7 +120,12 @@ fn confirm(
         // We won't add these if we encountered an illegal sized bound, so that we can use
         // a custom error in that case.
         if illegal_sized_bound.is_none() {
-            self.add_obligations(self.tcx.mk_fn_ptr(method_sig), all_substs, method_predicates);
+            self.add_obligations(
+                self.tcx.mk_fn_ptr(method_sig),
+                all_substs,
+                method_predicates,
+                pick.item.def_id,
+            );
         }
 
         // Create the final `MethodCallee`.
@@ -471,16 +476,23 @@ fn add_obligations(
         fty: Ty<'tcx>,
         all_substs: SubstsRef<'tcx>,
         method_predicates: ty::InstantiatedPredicates<'tcx>,
+        def_id: DefId,
     ) {
         debug!(
-            "add_obligations: fty={:?} all_substs={:?} method_predicates={:?}",
-            fty, all_substs, method_predicates
+            "add_obligations: fty={:?} all_substs={:?} method_predicates={:?} def_id={:?}",
+            fty, all_substs, method_predicates, def_id
         );
 
-        self.add_obligations_for_parameters(
-            traits::ObligationCause::misc(self.span, self.body_id),
+        // FIXME: could replace with the following, but we already calculated `method_predicates`,
+        // so we just call `predicates_for_generics` directly to avoid redoing work.
+        // `self.add_required_obligations(self.span, def_id, &all_substs);`
+        for obligation in traits::predicates_for_generics(
+            traits::ObligationCause::new(self.span, self.body_id, traits::ItemObligation(def_id)),
+            self.param_env,
             method_predicates,
-        );
+        ) {
+            self.register_predicate(obligation);
+        }
 
         // this is a projection from a trait reference, so we have to
         // make sure that the trait reference inputs are well-formed.
index f0f2470e80a8c69ec416c5e7934edffdf34448f9..dbc1d4ec193772ffea2c3cdf8d430278c860a13c 100644 (file)
@@ -12,6 +12,7 @@
 pub use self::MethodError::*;
 
 use crate::check::FnCtxt;
+use crate::ObligationCause;
 use rustc_data_structures::sync::Lrc;
 use rustc_errors::{Applicability, DiagnosticBuilder};
 use rustc_hir as hir;
@@ -71,7 +72,8 @@ pub enum MethodError<'tcx> {
 #[derive(Debug)]
 pub struct NoMatchData<'tcx> {
     pub static_candidates: Vec<CandidateSource>,
-    pub unsatisfied_predicates: Vec<(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)>,
+    pub unsatisfied_predicates:
+        Vec<(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>, Option<ObligationCause<'tcx>>)>,
     pub out_of_scope_traits: Vec<DefId>,
     pub lev_candidate: Option<ty::AssocItem>,
     pub mode: probe::Mode,
@@ -80,7 +82,11 @@ pub struct NoMatchData<'tcx> {
 impl<'tcx> NoMatchData<'tcx> {
     pub fn new(
         static_candidates: Vec<CandidateSource>,
-        unsatisfied_predicates: Vec<(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)>,
+        unsatisfied_predicates: Vec<(
+            ty::Predicate<'tcx>,
+            Option<ty::Predicate<'tcx>>,
+            Option<ObligationCause<'tcx>>,
+        )>,
         out_of_scope_traits: Vec<DefId>,
         lev_candidate: Option<ty::AssocItem>,
         mode: probe::Mode,
index 6eeb28e32f1e996b99432b3b2016d8e9881d0c25..9fd7e8c4daa2043c0ea4cfde26934575a84be8a0 100644 (file)
@@ -78,7 +78,8 @@ struct ProbeContext<'a, 'tcx> {
 
     /// Collects near misses when trait bounds for type parameters are unsatisfied and is only used
     /// for error reporting
-    unsatisfied_predicates: Vec<(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)>,
+    unsatisfied_predicates:
+        Vec<(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>, Option<ObligationCause<'tcx>>)>,
 
     is_suggestion: IsSuggestion,
 
@@ -92,7 +93,7 @@ fn deref(&self) -> &Self::Target {
     }
 }
 
-#[derive(Debug)]
+#[derive(Debug, Clone)]
 struct Candidate<'tcx> {
     // Candidates are (I'm not quite sure, but they are mostly) basically
     // some metadata on top of a `ty::AssocItem` (without substs).
@@ -132,7 +133,7 @@ struct Candidate<'tcx> {
     import_ids: SmallVec<[LocalDefId; 1]>,
 }
 
-#[derive(Debug)]
+#[derive(Debug, Clone)]
 enum CandidateKind<'tcx> {
     InherentImplCandidate(
         SubstsRef<'tcx>,
@@ -204,6 +205,7 @@ pub struct Pick<'tcx> {
     /// Indicates that we want to add an autoref (and maybe also unsize it), or if the receiver is
     /// `*mut T`, convert it to `*const T`.
     pub autoref_or_ptr_adjustment: Option<AutorefOrPtrAdjustment<'tcx>>,
+    pub self_ty: Ty<'tcx>,
 }
 
 #[derive(Clone, Debug, PartialEq, Eq)]
@@ -1101,13 +1103,37 @@ fn pick(mut self) -> PickResult<'tcx> {
     }
 
     fn pick_core(&mut self) -> Option<PickResult<'tcx>> {
-        let steps = self.steps.clone();
+        let mut unstable_candidates = Vec::new();
+        let pick = self.pick_all_method(Some(&mut unstable_candidates));
+
+        // In this case unstable picking is done by `pick_method`.
+        if !self.tcx.sess.opts.debugging_opts.pick_stable_methods_before_any_unstable {
+            return pick;
+        }
 
-        // find the first step that works
+        match pick {
+            // Emit a lint if there are unstable candidates alongside the stable ones.
+            //
+            // We suppress warning if we're picking the method only because it is a
+            // suggestion.
+            Some(Ok(ref p)) if !self.is_suggestion.0 && !unstable_candidates.is_empty() => {
+                self.emit_unstable_name_collision_hint(p, &unstable_candidates);
+                pick
+            }
+            Some(_) => pick,
+            None => self.pick_all_method(None),
+        }
+    }
+
+    fn pick_all_method(
+        &mut self,
+        mut unstable_candidates: Option<&mut Vec<(Candidate<'tcx>, Symbol)>>,
+    ) -> Option<PickResult<'tcx>> {
+        let steps = self.steps.clone();
         steps
             .iter()
             .filter(|step| {
-                debug!("pick_core: step={:?}", step);
+                debug!("pick_all_method: step={:?}", step);
                 // skip types that are from a type error or that would require dereferencing
                 // a raw pointer
                 !step.self_ty.references_error() && !step.from_unsafe_deref
@@ -1123,11 +1149,30 @@ fn pick_core(&mut self) -> Option<PickResult<'tcx>> {
                     .unwrap_or_else(|_| {
                         span_bug!(self.span, "{:?} was applicable but now isn't?", step.self_ty)
                     });
-                self.pick_by_value_method(step, self_ty).or_else(|| {
-                    self.pick_autorefd_method(step, self_ty, hir::Mutability::Not)
-                        .or_else(|| self.pick_autorefd_method(step, self_ty, hir::Mutability::Mut))
-                        .or_else(|| self.pick_const_ptr_method(step, self_ty))
-                })
+                self.pick_by_value_method(step, self_ty, unstable_candidates.as_deref_mut())
+                    .or_else(|| {
+                        self.pick_autorefd_method(
+                            step,
+                            self_ty,
+                            hir::Mutability::Not,
+                            unstable_candidates.as_deref_mut(),
+                        )
+                        .or_else(|| {
+                            self.pick_autorefd_method(
+                                step,
+                                self_ty,
+                                hir::Mutability::Mut,
+                                unstable_candidates.as_deref_mut(),
+                            )
+                        })
+                        .or_else(|| {
+                            self.pick_const_ptr_method(
+                                step,
+                                self_ty,
+                                unstable_candidates.as_deref_mut(),
+                            )
+                        })
+                    })
             })
             .next()
     }
@@ -1142,12 +1187,13 @@ fn pick_by_value_method(
         &mut self,
         step: &CandidateStep<'tcx>,
         self_ty: Ty<'tcx>,
+        unstable_candidates: Option<&mut Vec<(Candidate<'tcx>, Symbol)>>,
     ) -> Option<PickResult<'tcx>> {
         if step.unsize {
             return None;
         }
 
-        self.pick_method(self_ty).map(|r| {
+        self.pick_method(self_ty, unstable_candidates).map(|r| {
             r.map(|mut pick| {
                 pick.autoderefs = step.autoderefs;
 
@@ -1170,6 +1216,7 @@ fn pick_autorefd_method(
         step: &CandidateStep<'tcx>,
         self_ty: Ty<'tcx>,
         mutbl: hir::Mutability,
+        unstable_candidates: Option<&mut Vec<(Candidate<'tcx>, Symbol)>>,
     ) -> Option<PickResult<'tcx>> {
         let tcx = self.tcx;
 
@@ -1177,7 +1224,7 @@ fn pick_autorefd_method(
         let region = tcx.lifetimes.re_erased;
 
         let autoref_ty = tcx.mk_ref(region, ty::TypeAndMut { ty: self_ty, mutbl });
-        self.pick_method(autoref_ty).map(|r| {
+        self.pick_method(autoref_ty, unstable_candidates).map(|r| {
             r.map(|mut pick| {
                 pick.autoderefs = step.autoderefs;
                 pick.autoref_or_ptr_adjustment = Some(AutorefOrPtrAdjustment::Autoref {
@@ -1196,6 +1243,7 @@ fn pick_const_ptr_method(
         &mut self,
         step: &CandidateStep<'tcx>,
         self_ty: Ty<'tcx>,
+        unstable_candidates: Option<&mut Vec<(Candidate<'tcx>, Symbol)>>,
     ) -> Option<PickResult<'tcx>> {
         // Don't convert an unsized reference to ptr
         if step.unsize {
@@ -1209,7 +1257,7 @@ fn pick_const_ptr_method(
 
         let const_self_ty = ty::TypeAndMut { ty, mutbl: hir::Mutability::Not };
         let const_ptr_ty = self.tcx.mk_ptr(const_self_ty);
-        self.pick_method(const_ptr_ty).map(|r| {
+        self.pick_method(const_ptr_ty, unstable_candidates).map(|r| {
             r.map(|mut pick| {
                 pick.autoderefs = step.autoderefs;
                 pick.autoref_or_ptr_adjustment = Some(AutorefOrPtrAdjustment::ToConstPtr);
@@ -1218,8 +1266,8 @@ fn pick_const_ptr_method(
         })
     }
 
-    fn pick_method(&mut self, self_ty: Ty<'tcx>) -> Option<PickResult<'tcx>> {
-        debug!("pick_method(self_ty={})", self.ty_to_string(self_ty));
+    fn pick_method_with_unstable(&mut self, self_ty: Ty<'tcx>) -> Option<PickResult<'tcx>> {
+        debug!("pick_method_with_unstable(self_ty={})", self.ty_to_string(self_ty));
 
         let mut possibly_unsatisfied_predicates = Vec::new();
         let mut unstable_candidates = Vec::new();
@@ -1241,7 +1289,7 @@ fn pick_method(&mut self, self_ty: Ty<'tcx>) -> Option<PickResult<'tcx>> {
                         //
                         // We suppress warning if we're picking the method only because it is a
                         // suggestion.
-                        self.emit_unstable_name_collision_hint(p, &unstable_candidates, self_ty);
+                        self.emit_unstable_name_collision_hint(p, &unstable_candidates);
                     }
                 }
                 return Some(pick);
@@ -1251,7 +1299,7 @@ fn pick_method(&mut self, self_ty: Ty<'tcx>) -> Option<PickResult<'tcx>> {
         debug!("searching unstable candidates");
         let res = self.consider_candidates(
             self_ty,
-            unstable_candidates.into_iter().map(|(c, _)| c),
+            unstable_candidates.iter().map(|(c, _)| c),
             &mut possibly_unsatisfied_predicates,
             None,
         );
@@ -1261,6 +1309,42 @@ fn pick_method(&mut self, self_ty: Ty<'tcx>) -> Option<PickResult<'tcx>> {
         res
     }
 
+    fn pick_method(
+        &mut self,
+        self_ty: Ty<'tcx>,
+        mut unstable_candidates: Option<&mut Vec<(Candidate<'tcx>, Symbol)>>,
+    ) -> Option<PickResult<'tcx>> {
+        if !self.tcx.sess.opts.debugging_opts.pick_stable_methods_before_any_unstable {
+            return self.pick_method_with_unstable(self_ty);
+        }
+
+        debug!("pick_method(self_ty={})", self.ty_to_string(self_ty));
+
+        let mut possibly_unsatisfied_predicates = Vec::new();
+
+        for (kind, candidates) in
+            &[("inherent", &self.inherent_candidates), ("extension", &self.extension_candidates)]
+        {
+            debug!("searching {} candidates", kind);
+            let res = self.consider_candidates(
+                self_ty,
+                candidates.iter(),
+                &mut possibly_unsatisfied_predicates,
+                unstable_candidates.as_deref_mut(),
+            );
+            if let Some(pick) = res {
+                return Some(pick);
+            }
+        }
+
+        // `pick_method` may be called twice for the same self_ty if no stable methods
+        // match. Only extend once.
+        if unstable_candidates.is_some() {
+            self.unsatisfied_predicates.extend(possibly_unsatisfied_predicates);
+        }
+        None
+    }
+
     fn consider_candidates<'b, ProbesIter>(
         &self,
         self_ty: Ty<'tcx>,
@@ -1268,11 +1352,13 @@ fn consider_candidates<'b, ProbesIter>(
         possibly_unsatisfied_predicates: &mut Vec<(
             ty::Predicate<'tcx>,
             Option<ty::Predicate<'tcx>>,
+            Option<ObligationCause<'tcx>>,
         )>,
-        unstable_candidates: Option<&mut Vec<(&'b Candidate<'tcx>, Symbol)>>,
+        unstable_candidates: Option<&mut Vec<(Candidate<'tcx>, Symbol)>>,
     ) -> Option<PickResult<'tcx>>
     where
         ProbesIter: Iterator<Item = &'b Candidate<'tcx>> + Clone,
+        'tcx: 'b,
     {
         let mut applicable_candidates: Vec<_> = probes
             .clone()
@@ -1285,7 +1371,9 @@ fn consider_candidates<'b, ProbesIter>(
         debug!("applicable_candidates: {:?}", applicable_candidates);
 
         if applicable_candidates.len() > 1 {
-            if let Some(pick) = self.collapse_candidates_to_trait_pick(&applicable_candidates[..]) {
+            if let Some(pick) =
+                self.collapse_candidates_to_trait_pick(self_ty, &applicable_candidates[..])
+            {
                 return Some(Ok(pick));
             }
         }
@@ -1295,7 +1383,7 @@ fn consider_candidates<'b, ProbesIter>(
                 if let stability::EvalResult::Deny { feature, .. } =
                     self.tcx.eval_stability(p.item.def_id, None, self.span, None)
                 {
-                    uc.push((p, feature));
+                    uc.push((p.clone(), feature));
                     return false;
                 }
                 true
@@ -1309,7 +1397,7 @@ fn consider_candidates<'b, ProbesIter>(
 
         applicable_candidates.pop().map(|(probe, status)| {
             if status == ProbeResult::Match {
-                Ok(probe.to_unadjusted_pick())
+                Ok(probe.to_unadjusted_pick(self_ty))
             } else {
                 Err(MethodError::BadReturnType)
             }
@@ -1319,8 +1407,7 @@ fn consider_candidates<'b, ProbesIter>(
     fn emit_unstable_name_collision_hint(
         &self,
         stable_pick: &Pick<'_>,
-        unstable_candidates: &[(&Candidate<'tcx>, Symbol)],
-        self_ty: Ty<'tcx>,
+        unstable_candidates: &[(Candidate<'tcx>, Symbol)],
     ) {
         self.tcx.struct_span_lint_hir(
             lint::builtin::UNSTABLE_NAME_COLLISIONS,
@@ -1351,7 +1438,7 @@ fn emit_unstable_name_collision_hint(
                             "use the fully qualified path to the associated const",
                             format!(
                                 "<{} as {}>::{}",
-                                self_ty,
+                                stable_pick.self_ty,
                                 self.tcx.def_path_str(def_id),
                                 stable_pick.item.ident
                             ),
@@ -1412,6 +1499,7 @@ fn consider_probe(
         possibly_unsatisfied_predicates: &mut Vec<(
             ty::Predicate<'tcx>,
             Option<ty::Predicate<'tcx>>,
+            Option<ObligationCause<'tcx>>,
         )>,
     ) -> ProbeResult {
         debug!("consider_probe: self_ty={:?} probe={:?}", self_ty, probe);
@@ -1423,8 +1511,8 @@ fn consider_probe(
                 .sup(probe.xform_self_ty, self_ty)
             {
                 Ok(InferOk { obligations, value: () }) => obligations,
-                Err(_) => {
-                    debug!("--> cannot relate self-types");
+                Err(err) => {
+                    debug!("--> cannot relate self-types {:?}", err);
                     return ProbeResult::NoMatch;
                 }
             };
@@ -1473,7 +1561,11 @@ fn consider_probe(
                         let o = self.resolve_vars_if_possible(o);
                         if !self.predicate_may_hold(&o) {
                             result = ProbeResult::NoMatch;
-                            possibly_unsatisfied_predicates.push((o.predicate, None));
+                            possibly_unsatisfied_predicates.push((
+                                o.predicate,
+                                None,
+                                Some(o.cause),
+                            ));
                         }
                     }
                 }
@@ -1519,8 +1611,11 @@ fn consider_probe(
                                             } else {
                                                 Some(predicate)
                                             };
-                                            possibly_unsatisfied_predicates
-                                                .push((nested_predicate, p));
+                                            possibly_unsatisfied_predicates.push((
+                                                nested_predicate,
+                                                p,
+                                                Some(obligation.cause.clone()),
+                                            ));
                                         }
                                     }
                                 }
@@ -1528,7 +1623,7 @@ fn consider_probe(
                                     // Some nested subobligation of this predicate
                                     // failed.
                                     let predicate = self.resolve_vars_if_possible(predicate);
-                                    possibly_unsatisfied_predicates.push((predicate, None));
+                                    possibly_unsatisfied_predicates.push((predicate, None, None));
                                 }
                             }
                             false
@@ -1547,7 +1642,7 @@ fn consider_probe(
                 let o = self.resolve_vars_if_possible(o);
                 if !self.predicate_may_hold(&o) {
                     result = ProbeResult::NoMatch;
-                    possibly_unsatisfied_predicates.push((o.predicate, None));
+                    possibly_unsatisfied_predicates.push((o.predicate, None, Some(o.cause)));
                 }
             }
 
@@ -1591,6 +1686,7 @@ fn consider_probe(
     /// use, so it's ok to just commit to "using the method from the trait Foo".
     fn collapse_candidates_to_trait_pick(
         &self,
+        self_ty: Ty<'tcx>,
         probes: &[(&Candidate<'tcx>, ProbeResult)],
     ) -> Option<Pick<'tcx>> {
         // Do all probes correspond to the same trait?
@@ -1610,6 +1706,7 @@ fn collapse_candidates_to_trait_pick(
             import_ids: probes[0].0.import_ids.clone(),
             autoderefs: 0,
             autoref_or_ptr_adjustment: None,
+            self_ty,
         })
     }
 
@@ -1828,7 +1925,7 @@ fn erase_late_bound_regions<T>(&self, value: ty::Binder<'tcx, T>) -> T
 }
 
 impl<'tcx> Candidate<'tcx> {
-    fn to_unadjusted_pick(&self) -> Pick<'tcx> {
+    fn to_unadjusted_pick(&self, self_ty: Ty<'tcx>) -> Pick<'tcx> {
         Pick {
             item: self.item,
             kind: match self.kind {
@@ -1852,6 +1949,7 @@ fn to_unadjusted_pick(&self) -> Pick<'tcx> {
             import_ids: self.import_ids.clone(),
             autoderefs: 0,
             autoref_or_ptr_adjustment: None,
+            self_ty,
         }
     }
 }
index 661ced952c7362c0798f34c2ec630427fbb2f594..ca174ed5e84972cb3950e301e6bd3c7a107be699 100644 (file)
@@ -17,7 +17,9 @@
 use rustc_span::symbol::{kw, sym, Ident};
 use rustc_span::{source_map, FileName, MultiSpan, Span, Symbol};
 use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
-use rustc_trait_selection::traits::{FulfillmentError, Obligation};
+use rustc_trait_selection::traits::{
+    FulfillmentError, Obligation, ObligationCause, ObligationCauseCode,
+};
 
 use std::cmp::Ordering;
 use std::iter;
@@ -317,6 +319,10 @@ pub fn report_method_error(
                                     .span_to_snippet(lit.span)
                                     .unwrap_or_else(|_| "<numeric literal>".to_owned());
 
+                                // If this is a floating point literal that ends with '.',
+                                // get rid of it to stop this from becoming a member access.
+                                let snippet = snippet.strip_suffix('.').unwrap_or(&snippet);
+
                                 err.span_suggestion(
                                     lit.span,
                                     &format!(
@@ -324,7 +330,7 @@ pub fn report_method_error(
                                          like `{}`",
                                         concrete_type
                                     ),
-                                    format!("{}_{}", snippet, concrete_type),
+                                    format!("{snippet}_{concrete_type}"),
                                     Applicability::MaybeIncorrect,
                                 );
                             }
@@ -698,27 +704,39 @@ fn report_function<T: std::fmt::Display>(
                             if let (ty::Param(_), ty::PredicateKind::Trait(p)) =
                                 (self_ty.kind(), parent_pred.kind().skip_binder())
                             {
-                                if let ty::Adt(def, _) = p.trait_ref.self_ty().kind() {
-                                    let node = def.did.as_local().map(|def_id| {
+                                let node = match p.trait_ref.self_ty().kind() {
+                                    ty::Param(_) => {
+                                        // Account for `fn` items like in `issue-35677.rs` to
+                                        // suggest restricting its type params.
+                                        let did = self.tcx.hir().body_owner_def_id(hir::BodyId {
+                                            hir_id: self.body_id,
+                                        });
+                                        Some(
+                                            self.tcx
+                                                .hir()
+                                                .get(self.tcx.hir().local_def_id_to_hir_id(did)),
+                                        )
+                                    }
+                                    ty::Adt(def, _) => def.did.as_local().map(|def_id| {
                                         self.tcx
                                             .hir()
                                             .get(self.tcx.hir().local_def_id_to_hir_id(def_id))
-                                    });
-                                    if let Some(hir::Node::Item(hir::Item { kind, .. })) = node {
-                                        if let Some(g) = kind.generics() {
-                                            let key = match g.where_clause.predicates {
-                                                [.., pred] => (pred.span().shrink_to_hi(), false),
-                                                [] => (
-                                                    g.where_clause
-                                                        .span_for_predicates_or_empty_place(),
-                                                    true,
-                                                ),
-                                            };
-                                            type_params
-                                                .entry(key)
-                                                .or_insert_with(FxHashSet::default)
-                                                .insert(obligation.to_owned());
-                                        }
+                                    }),
+                                    _ => None,
+                                };
+                                if let Some(hir::Node::Item(hir::Item { kind, .. })) = node {
+                                    if let Some(g) = kind.generics() {
+                                        let key = match g.where_clause.predicates {
+                                            [.., pred] => (pred.span().shrink_to_hi(), false),
+                                            [] => (
+                                                g.where_clause.span_for_predicates_or_empty_place(),
+                                                true,
+                                            ),
+                                        };
+                                        type_params
+                                            .entry(key)
+                                            .or_insert_with(FxHashSet::default)
+                                            .insert(obligation.to_owned());
                                     }
                                 }
                             }
@@ -787,22 +805,109 @@ fn report_function<T: std::fmt::Display>(
                             _ => None,
                         }
                     };
+
+                    // Find all the requirements that come from a local `impl` block.
+                    let mut skip_list: FxHashSet<_> = Default::default();
+                    let mut spanned_predicates: FxHashMap<MultiSpan, _> = Default::default();
+                    for (data, p, parent_p) in unsatisfied_predicates
+                        .iter()
+                        .filter_map(|(p, parent, c)| c.as_ref().map(|c| (p, parent, c)))
+                        .filter_map(|(p, parent, c)| match c.code {
+                            ObligationCauseCode::ImplDerivedObligation(ref data) => {
+                                Some((data, p, parent))
+                            }
+                            _ => None,
+                        })
+                    {
+                        let parent_trait_ref = data.parent_trait_ref;
+                        let parent_def_id = parent_trait_ref.def_id();
+                        let path = parent_trait_ref.print_only_trait_path();
+                        let tr_self_ty = parent_trait_ref.skip_binder().self_ty();
+                        let mut candidates = vec![];
+                        self.tcx.for_each_relevant_impl(
+                            parent_def_id,
+                            parent_trait_ref.self_ty().skip_binder(),
+                            |impl_def_id| match self.tcx.hir().get_if_local(impl_def_id) {
+                                Some(Node::Item(hir::Item {
+                                    kind: hir::ItemKind::Impl(hir::Impl { .. }),
+                                    ..
+                                })) => {
+                                    candidates.push(impl_def_id);
+                                }
+                                _ => {}
+                            },
+                        );
+                        if let [def_id] = &candidates[..] {
+                            match self.tcx.hir().get_if_local(*def_id) {
+                                Some(Node::Item(hir::Item {
+                                    kind: hir::ItemKind::Impl(hir::Impl { of_trait, self_ty, .. }),
+                                    ..
+                                })) => {
+                                    if let Some(pred) = parent_p {
+                                        // Done to add the "doesn't satisfy" `span_label`.
+                                        let _ = format_pred(*pred);
+                                    }
+                                    skip_list.insert(p);
+                                    let mut spans = Vec::with_capacity(2);
+                                    if let Some(trait_ref) = of_trait {
+                                        spans.push(trait_ref.path.span);
+                                    }
+                                    spans.push(self_ty.span);
+                                    let entry = spanned_predicates.entry(spans.into());
+                                    entry
+                                        .or_insert_with(|| (path, tr_self_ty, Vec::new()))
+                                        .2
+                                        .push(p);
+                                }
+                                _ => {}
+                            }
+                        }
+                    }
+                    for (span, (path, self_ty, preds)) in spanned_predicates {
+                        err.span_note(
+                            span,
+                            &format!(
+                                "the following trait bounds were not satisfied because of the \
+                                 requirements of the implementation of `{}` for `{}`:\n{}",
+                                path,
+                                self_ty,
+                                preds
+                                    .into_iter()
+                                    // .map(|pred| format!("{:?}", pred))
+                                    .filter_map(|pred| format_pred(*pred))
+                                    .map(|(p, _)| format!("`{}`", p))
+                                    .collect::<Vec<_>>()
+                                    .join("\n"),
+                            ),
+                        );
+                    }
+
+                    // The requirements that didn't have an `impl` span to show.
                     let mut bound_list = unsatisfied_predicates
                         .iter()
-                        .filter_map(|(pred, parent_pred)| {
-                            format_pred(*pred).map(|(p, self_ty)| match parent_pred {
-                                None => format!("`{}`", &p),
-                                Some(parent_pred) => match format_pred(*parent_pred) {
+                        .filter(|(pred, _, _parent_pred)| !skip_list.contains(&pred))
+                        .filter_map(|(pred, parent_pred, _cause)| {
+                            format_pred(*pred).map(|(p, self_ty)| {
+                                collect_type_param_suggestions(self_ty, pred, &p);
+                                match parent_pred {
                                     None => format!("`{}`", &p),
-                                    Some((parent_p, _)) => {
-                                        collect_type_param_suggestions(self_ty, parent_pred, &p);
-                                        format!("`{}`\nwhich is required by `{}`", p, parent_p)
-                                    }
-                                },
+                                    Some(parent_pred) => match format_pred(*parent_pred) {
+                                        None => format!("`{}`", &p),
+                                        Some((parent_p, _)) => {
+                                            collect_type_param_suggestions(
+                                                self_ty,
+                                                parent_pred,
+                                                &p,
+                                            );
+                                            format!("`{}`\nwhich is required by `{}`", p, parent_p)
+                                        }
+                                    },
+                                }
                             })
                         })
                         .enumerate()
                         .collect::<Vec<(usize, String)>>();
+
                     for ((span, empty_where), obligations) in type_params.into_iter() {
                         restrict_type_params = true;
                         // #74886: Sort here so that the output is always the same.
@@ -832,7 +937,7 @@ trait bound{s}",
                     for (span, msg) in bound_spans.into_iter() {
                         err.span_label(span, &msg);
                     }
-                    if !bound_list.is_empty() {
+                    if !bound_list.is_empty() || !skip_list.is_empty() {
                         let bound_list = bound_list
                             .into_iter()
                             .map(|(_, path)| path)
@@ -842,9 +947,11 @@ trait bound{s}",
                         err.set_primary_message(&format!(
                             "the {item_kind} `{item_name}` exists for {actual_prefix} `{ty_str}`, but its trait bounds were not satisfied"
                         ));
-                        err.note(&format!(
-                            "the following trait bounds were not satisfied:\n{bound_list}"
-                        ));
+                        if !bound_list.is_empty() {
+                            err.note(&format!(
+                                "the following trait bounds were not satisfied:\n{bound_list}"
+                            ));
+                        }
                         self.suggest_derive(&mut err, &unsatisfied_predicates);
 
                         unsatisfied_bounds = true;
@@ -1058,18 +1165,25 @@ trait bound{s}",
             err.span_note(spans, &msg);
         }
 
-        let preds: Vec<_> = errors.iter().map(|e| (e.obligation.predicate, None)).collect();
+        let preds: Vec<_> = errors
+            .iter()
+            .map(|e| (e.obligation.predicate, None, Some(e.obligation.cause.clone())))
+            .collect();
         self.suggest_derive(err, &preds);
     }
 
     fn suggest_derive(
         &self,
         err: &mut DiagnosticBuilder<'_>,
-        unsatisfied_predicates: &Vec<(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)>,
+        unsatisfied_predicates: &Vec<(
+            ty::Predicate<'tcx>,
+            Option<ty::Predicate<'tcx>>,
+            Option<ObligationCause<'tcx>>,
+        )>,
     ) {
         let mut derives = Vec::<(String, Span, String)>::new();
         let mut traits = Vec::<Span>::new();
-        for (pred, _) in unsatisfied_predicates {
+        for (pred, _, _) in unsatisfied_predicates {
             let trait_pred = match pred.kind().skip_binder() {
                 ty::PredicateKind::Trait(trait_pred) => trait_pred,
                 _ => continue,
@@ -1260,7 +1374,11 @@ fn suggest_traits_to_import(
         item_name: Ident,
         source: SelfSource<'tcx>,
         valid_out_of_scope_traits: Vec<DefId>,
-        unsatisfied_predicates: &[(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)],
+        unsatisfied_predicates: &[(
+            ty::Predicate<'tcx>,
+            Option<ty::Predicate<'tcx>>,
+            Option<ObligationCause<'tcx>>,
+        )],
         unsatisfied_bounds: bool,
     ) {
         let mut alt_rcvr_sugg = false;
@@ -1376,7 +1494,7 @@ fn suggest_traits_to_import(
                 // this isn't perfect (that is, there are cases when
                 // implementing a trait would be legal but is rejected
                 // here).
-                unsatisfied_predicates.iter().all(|(p, _)| {
+                unsatisfied_predicates.iter().all(|(p, _, _)| {
                     match p.kind().skip_binder() {
                         // Hide traits if they are present in predicates as they can be fixed without
                         // having to implement them.
@@ -1490,7 +1608,7 @@ fn suggest_traits_to_import(
                         Node::GenericParam(param) => {
                             let mut impl_trait = false;
                             let has_bounds =
-                                if let hir::GenericParamKind::Type { synthetic: Some(_), .. } =
+                                if let hir::GenericParamKind::Type { synthetic: true, .. } =
                                     &param.kind
                                 {
                                     // We've found `fn foo(x: impl Trait)` instead of
index 2f427305782c5806918db038dddf419c76a263ce..b9db8a6be5916bbc7b000970e6921b7e6e64c393 100644 (file)
@@ -1543,7 +1543,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
                         kind: ty::GenericParamDefKind::Type {
                             has_default: false,
                             object_lifetime_default: rl::Set1::Empty,
-                            synthetic: None,
+                            synthetic: false,
                         },
                     });
 
@@ -1673,7 +1673,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
             kind: ty::GenericParamDefKind::Type {
                 has_default: false,
                 object_lifetime_default: rl::Set1::Empty,
-                synthetic: None,
+                synthetic: false,
             },
         }));
     }
@@ -1690,7 +1690,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
                 kind: ty::GenericParamDefKind::Type {
                     has_default: false,
                     object_lifetime_default: rl::Set1::Empty,
-                    synthetic: None,
+                    synthetic: false,
                 },
             });
         }
@@ -1990,16 +1990,12 @@ fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
         // prove that the trait applies to the types that were
         // used, and adding the predicate into this list ensures
         // that this is done.
-        let mut span = tcx.def_span(def_id);
-        if tcx.sess.source_map().is_local_span(span) {
-            // `guess_head_span` reads the actual source file from
-            // disk to try to determine the 'head' snippet of the span.
-            // Don't do this for a span that comes from a file outside
-            // of our crate, since this would make our query output
-            // (and overall crate metadata) dependent on the
-            // *current* state of an external file.
-            span = tcx.sess.source_map().guess_head_span(span);
-        }
+        //
+        // We use a DUMMY_SP here as a way to signal trait bounds that come
+        // from the trait itself that *shouldn't* be shown as the source of
+        // an obligation and instead be skipped. Otherwise we'd use
+        // `tcx.def_span(def_id);`
+        let span = rustc_span::DUMMY_SP;
         result.predicates =
             tcx.arena.alloc_from_iter(result.predicates.iter().copied().chain(std::iter::once((
                 ty::TraitRef::identity(tcx, def_id).without_const().to_predicate(tcx),
@@ -2865,14 +2861,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
         } else if attr.has_name(sym::link_name) {
             codegen_fn_attrs.link_name = attr.value_str();
         } else if attr.has_name(sym::link_ordinal) {
-            if link_ordinal_span.is_some() {
-                tcx.sess
-                    .struct_span_err(
-                        attr.span,
-                        "multiple `link_ordinal` attributes on a single definition",
-                    )
-                    .emit();
-            }
             link_ordinal_span = Some(attr.span);
             if let ordinal @ Some(_) = check_link_ordinal(tcx, attr) {
                 codegen_fn_attrs.link_ordinal = ordinal;
index 03e33a1ff2bc3b77f1223b8056497f8e40763b29..c4e5e44fec0b2df34fd417e65acebdcab582b15d 100644 (file)
@@ -341,12 +341,12 @@ fn inner(&self) -> &RcBox<T> {
         unsafe { self.ptr.as_ref() }
     }
 
-    fn from_inner(ptr: NonNull<RcBox<T>>) -> Self {
+    unsafe fn from_inner(ptr: NonNull<RcBox<T>>) -> Self {
         Self { ptr, phantom: PhantomData }
     }
 
     unsafe fn from_ptr(ptr: *mut RcBox<T>) -> Self {
-        Self::from_inner(unsafe { NonNull::new_unchecked(ptr) })
+        unsafe { Self::from_inner(NonNull::new_unchecked(ptr)) }
     }
 }
 
@@ -367,9 +367,11 @@ pub fn new(value: T) -> Rc<T> {
         // pointers, which ensures that the weak destructor never frees
         // the allocation while the strong destructor is running, even
         // if the weak pointer is stored inside the strong one.
-        Self::from_inner(
-            Box::leak(box RcBox { strong: Cell::new(1), weak: Cell::new(1), value }).into(),
-        )
+        unsafe {
+            Self::from_inner(
+                Box::leak(box RcBox { strong: Cell::new(1), weak: Cell::new(1), value }).into(),
+            )
+        }
     }
 
     /// Constructs a new `Rc<T>` using a weak reference to itself. Attempting
@@ -420,16 +422,16 @@ pub fn new_cyclic(data_fn: impl FnOnce(&Weak<T>) -> T) -> Rc<T> {
         // otherwise.
         let data = data_fn(&weak);
 
-        unsafe {
+        let strong = unsafe {
             let inner = init_ptr.as_ptr();
             ptr::write(ptr::addr_of_mut!((*inner).value), data);
 
             let prev_value = (*inner).strong.get();
             debug_assert_eq!(prev_value, 0, "No prior strong references should exist");
             (*inner).strong.set(1);
-        }
 
-        let strong = Rc::from_inner(init_ptr);
+            Rc::from_inner(init_ptr)
+        };
 
         // Strong references should collectively own a shared weak reference,
         // so don't run the destructor for our old weak reference.
@@ -521,10 +523,12 @@ pub fn try_new(value: T) -> Result<Rc<T>, AllocError> {
         // pointers, which ensures that the weak destructor never frees
         // the allocation while the strong destructor is running, even
         // if the weak pointer is stored inside the strong one.
-        Ok(Self::from_inner(
-            Box::leak(Box::try_new(RcBox { strong: Cell::new(1), weak: Cell::new(1), value })?)
-                .into(),
-        ))
+        unsafe {
+            Ok(Self::from_inner(
+                Box::leak(Box::try_new(RcBox { strong: Cell::new(1), weak: Cell::new(1), value })?)
+                    .into(),
+            ))
+        }
     }
 
     /// Constructs a new `Rc` with uninitialized contents, returning an error if the allocation fails
@@ -746,7 +750,7 @@ impl<T> Rc<mem::MaybeUninit<T>> {
     #[unstable(feature = "new_uninit", issue = "63291")]
     #[inline]
     pub unsafe fn assume_init(self) -> Rc<T> {
-        Rc::from_inner(mem::ManuallyDrop::new(self).ptr.cast())
+        unsafe { Rc::from_inner(mem::ManuallyDrop::new(self).ptr.cast()) }
     }
 }
 
@@ -1214,9 +1218,11 @@ impl Rc<dyn Any> {
     /// ```
     pub fn downcast<T: Any>(self) -> Result<Rc<T>, Rc<dyn Any>> {
         if (*self).is::<T>() {
-            let ptr = self.ptr.cast::<RcBox<T>>();
-            forget(self);
-            Ok(Rc::from_inner(ptr))
+            unsafe {
+                let ptr = self.ptr.cast::<RcBox<T>>();
+                forget(self);
+                Ok(Rc::from_inner(ptr))
+            }
         } else {
             Err(self)
         }
@@ -1489,8 +1495,10 @@ impl<T: ?Sized> Clone for Rc<T> {
     /// ```
     #[inline]
     fn clone(&self) -> Rc<T> {
-        self.inner().inc_strong();
-        Self::from_inner(self.ptr)
+        unsafe {
+            self.inner().inc_strong();
+            Self::from_inner(self.ptr)
+        }
     }
 }
 
@@ -2245,11 +2253,14 @@ pub unsafe fn from_raw(ptr: *const T) -> Self {
     #[stable(feature = "rc_weak", since = "1.4.0")]
     pub fn upgrade(&self) -> Option<Rc<T>> {
         let inner = self.inner()?;
+
         if inner.strong() == 0 {
             None
         } else {
-            inner.inc_strong();
-            Some(Rc::from_inner(self.ptr))
+            unsafe {
+                inner.inc_strong();
+                Some(Rc::from_inner(self.ptr))
+            }
         }
     }
 
index b738337a2ddd19805fc0d623f6570077f6991a22..733a898b285ac54c205547197d6ec0c9a1a577a2 100644 (file)
@@ -252,7 +252,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Arc<U>> for Arc<T> {}
 
 impl<T: ?Sized> Arc<T> {
-    fn from_inner(ptr: NonNull<ArcInner<T>>) -> Self {
+    unsafe fn from_inner(ptr: NonNull<ArcInner<T>>) -> Self {
         Self { ptr, phantom: PhantomData }
     }
 
@@ -348,7 +348,7 @@ pub fn new(data: T) -> Arc<T> {
             weak: atomic::AtomicUsize::new(1),
             data,
         };
-        Self::from_inner(Box::leak(x).into())
+        unsafe { Self::from_inner(Box::leak(x).into()) }
     }
 
     /// Constructs a new `Arc<T>` using a weak reference to itself. Attempting
@@ -397,7 +397,7 @@ pub fn new_cyclic(data_fn: impl FnOnce(&Weak<T>) -> T) -> Arc<T> {
 
         // Now we can properly initialize the inner value and turn our weak
         // reference into a strong reference.
-        unsafe {
+        let strong = unsafe {
             let inner = init_ptr.as_ptr();
             ptr::write(ptr::addr_of_mut!((*inner).data), data);
 
@@ -415,9 +415,9 @@ pub fn new_cyclic(data_fn: impl FnOnce(&Weak<T>) -> T) -> Arc<T> {
             // possible with safe code alone.
             let prev_value = (*inner).strong.fetch_add(1, Release);
             debug_assert_eq!(prev_value, 0, "No prior strong references should exist");
-        }
 
-        let strong = Arc::from_inner(init_ptr);
+            Arc::from_inner(init_ptr)
+        };
 
         // Strong references should collectively own a shared weak reference,
         // so don't run the destructor for our old weak reference.
@@ -529,7 +529,7 @@ pub fn try_new(data: T) -> Result<Arc<T>, AllocError> {
             weak: atomic::AtomicUsize::new(1),
             data,
         })?;
-        Ok(Self::from_inner(Box::leak(x).into()))
+        unsafe { Ok(Self::from_inner(Box::leak(x).into())) }
     }
 
     /// Constructs a new `Arc` with uninitialized contents, returning an error
@@ -743,7 +743,7 @@ impl<T> Arc<mem::MaybeUninit<T>> {
     #[must_use = "`self` will be dropped if the result is not used"]
     #[inline]
     pub unsafe fn assume_init(self) -> Arc<T> {
-        Arc::from_inner(mem::ManuallyDrop::new(self).ptr.cast())
+        unsafe { Arc::from_inner(mem::ManuallyDrop::new(self).ptr.cast()) }
     }
 }
 
@@ -1341,7 +1341,7 @@ fn clone(&self) -> Arc<T> {
             abort();
         }
 
-        Self::from_inner(self.ptr)
+        unsafe { Self::from_inner(self.ptr) }
     }
 }
 
@@ -1668,9 +1668,11 @@ pub fn downcast<T>(self) -> Result<Arc<T>, Self>
         T: Any + Send + Sync + 'static,
     {
         if (*self).is::<T>() {
-            let ptr = self.ptr.cast::<ArcInner<T>>();
-            mem::forget(self);
-            Ok(Arc::from_inner(ptr))
+            unsafe {
+                let ptr = self.ptr.cast::<ArcInner<T>>();
+                mem::forget(self);
+                Ok(Arc::from_inner(ptr))
+            }
         } else {
             Err(self)
         }
@@ -1899,7 +1901,7 @@ pub fn upgrade(&self) -> Option<Arc<T>> {
             // value can be initialized after `Weak` references have already been created. In that case, we
             // expect to observe the fully initialized value.
             match inner.strong.compare_exchange_weak(n, n + 1, Acquire, Relaxed) {
-                Ok(_) => return Some(Arc::from_inner(self.ptr)), // null checked above
+                Ok(_) => return Some(unsafe { Arc::from_inner(self.ptr) }), // null checked above
                 Err(old) => n = old,
             }
         }
index 4989244b50e27e4638631fa36d2d80092023f95f..85759917765fa6e3d91afa9fd468956c83afdc70 100644 (file)
@@ -1272,6 +1272,9 @@ pub unsafe fn set_len(&mut self, new_len: usize) {
     /// The removed element is replaced by the last element of the vector.
     ///
     /// This does not preserve ordering, but is *O*(1).
+    /// If you need to preserve the element order, use [`remove`] instead.
+    ///
+    /// [`remove`]: Vec::remove
     ///
     /// # Panics
     ///
@@ -1368,7 +1371,7 @@ fn assert_failed(index: usize, len: usize) -> ! {
     /// shifting all elements after it to the left.
     ///
     /// Note: Because this shifts over the remaining elements, it has a
-    /// worst-case performance of O(n). If you don't need the order of elements
+    /// worst-case performance of *O*(*n*). If you don't need the order of elements
     /// to be preserved, use [`swap_remove`] instead.
     ///
     /// [`swap_remove`]: Vec::swap_remove
index 8c57c804ad2dc149e160344cb55d6f1f525ab5c0..68e48348b076e18e5489c3f9560b6fdcbe070931 100644 (file)
@@ -25,6 +25,7 @@
 #![feature(const_btree_new)]
 #![feature(const_default_impls)]
 #![feature(const_trait_impl)]
+#![feature(const_str_from_utf8)]
 
 use std::collections::hash_map::DefaultHasher;
 use std::hash::{Hash, Hasher};
index dc7d0bff9a404ba8ec417b4ecfd17c3445e4c92d..1b741f174fb12f605b01984196f60d85a3c7e132 100644 (file)
@@ -1,3 +1,4 @@
+use std::assert_matches::assert_matches;
 use std::borrow::Cow;
 use std::cmp::Ordering::{Equal, Greater, Less};
 use std::str::{from_utf8, from_utf8_unchecked};
@@ -883,6 +884,33 @@ fn test_is_utf8() {
     assert!(from_utf8(&[0xF4, 0x8F, 0xBF, 0xBF]).is_ok());
 }
 
+#[test]
+fn test_const_is_utf8() {
+    const _: () = {
+        // deny overlong encodings
+        assert!(from_utf8(&[0xc0, 0x80]).is_err());
+        assert!(from_utf8(&[0xc0, 0xae]).is_err());
+        assert!(from_utf8(&[0xe0, 0x80, 0x80]).is_err());
+        assert!(from_utf8(&[0xe0, 0x80, 0xaf]).is_err());
+        assert!(from_utf8(&[0xe0, 0x81, 0x81]).is_err());
+        assert!(from_utf8(&[0xf0, 0x82, 0x82, 0xac]).is_err());
+        assert!(from_utf8(&[0xf4, 0x90, 0x80, 0x80]).is_err());
+
+        // deny surrogates
+        assert!(from_utf8(&[0xED, 0xA0, 0x80]).is_err());
+        assert!(from_utf8(&[0xED, 0xBF, 0xBF]).is_err());
+
+        assert!(from_utf8(&[0xC2, 0x80]).is_ok());
+        assert!(from_utf8(&[0xDF, 0xBF]).is_ok());
+        assert!(from_utf8(&[0xE0, 0xA0, 0x80]).is_ok());
+        assert!(from_utf8(&[0xED, 0x9F, 0xBF]).is_ok());
+        assert!(from_utf8(&[0xEE, 0x80, 0x80]).is_ok());
+        assert!(from_utf8(&[0xEF, 0xBF, 0xBF]).is_ok());
+        assert!(from_utf8(&[0xF0, 0x90, 0x80, 0x80]).is_ok());
+        assert!(from_utf8(&[0xF4, 0x8F, 0xBF, 0xBF]).is_ok());
+    };
+}
+
 #[test]
 fn from_utf8_mostly_ascii() {
     // deny invalid bytes embedded in long stretches of ascii
@@ -895,13 +923,43 @@ fn from_utf8_mostly_ascii() {
     }
 }
 
+#[test]
+fn const_from_utf8_mostly_ascii() {
+    const _: () = {
+        // deny invalid bytes embedded in long stretches of ascii
+        let mut i = 32;
+        while i < 64 {
+            let mut data = [0; 128];
+            data[i] = 0xC0;
+            assert!(from_utf8(&data).is_err());
+            data[i] = 0xC2;
+            assert!(from_utf8(&data).is_err());
+
+            i = i + 1;
+        }
+    };
+}
+
 #[test]
 fn from_utf8_error() {
     macro_rules! test {
-        ($input: expr, $expected_valid_up_to: expr, $expected_error_len: expr) => {
+        ($input: expr, $expected_valid_up_to:pat, $expected_error_len:pat) => {
             let error = from_utf8($input).unwrap_err();
-            assert_eq!(error.valid_up_to(), $expected_valid_up_to);
-            assert_eq!(error.error_len(), $expected_error_len);
+            assert_matches!(error.valid_up_to(), $expected_valid_up_to);
+            assert_matches!(error.error_len(), $expected_error_len);
+
+            const _: () = {
+                match from_utf8($input) {
+                    Err(error) => {
+                        let valid_up_to = error.valid_up_to();
+                        let error_len = error.error_len();
+
+                        assert!(matches!(valid_up_to, $expected_valid_up_to));
+                        assert!(matches!(error_len, $expected_error_len));
+                    }
+                    Ok(_) => unreachable!(),
+                }
+            };
         };
     }
     test!(b"A\xC3\xA9 \xFF ", 4, Some(1));
index 8fc6b1af92452919824a518383133eee11a30876..c4046d7496f71b3238a1f83a2a7f879e734ecd6d 100644 (file)
 #[must_use]
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn from_u32(i: u32) -> Option<char> {
-    char::try_from(i).ok()
+#[rustc_const_unstable(feature = "const_char_convert", issue = "89259")]
+pub const fn from_u32(i: u32) -> Option<char> {
+    // FIXME: once Result::ok is const fn, use it here
+    match char_try_from_u32(i) {
+        Ok(c) => Some(c),
+        Err(_) => None,
+    }
 }
 
 /// Converts a `u32` to a `char`, ignoring validity.
@@ -91,7 +96,8 @@ pub fn from_u32(i: u32) -> Option<char> {
 #[inline]
 #[must_use]
 #[stable(feature = "char_from_unchecked", since = "1.5.0")]
-pub unsafe fn from_u32_unchecked(i: u32) -> char {
+#[rustc_const_unstable(feature = "const_char_convert", issue = "89259")]
+pub const unsafe fn from_u32_unchecked(i: u32) -> char {
     // SAFETY: the caller must guarantee that `i` is a valid char value.
     if cfg!(debug_assertions) { char::from_u32(i).unwrap() } else { unsafe { transmute(i) } }
 }
@@ -248,18 +254,23 @@ fn from_str(s: &str) -> Result<Self, Self::Err> {
     }
 }
 
+#[inline]
+const fn char_try_from_u32(i: u32) -> Result<char, CharTryFromError> {
+    if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
+        Err(CharTryFromError(()))
+    } else {
+        // SAFETY: checked that it's a legal unicode value
+        Ok(unsafe { transmute(i) })
+    }
+}
+
 #[stable(feature = "try_from", since = "1.34.0")]
 impl TryFrom<u32> for char {
     type Error = CharTryFromError;
 
     #[inline]
     fn try_from(i: u32) -> Result<Self, Self::Error> {
-        if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
-            Err(CharTryFromError(()))
-        } else {
-            // SAFETY: checked that it's a legal unicode value
-            Ok(unsafe { transmute(i) })
-        }
+        char_try_from_u32(i)
     }
 }
 
@@ -327,7 +338,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 #[inline]
 #[must_use]
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn from_digit(num: u32, radix: u32) -> Option<char> {
+#[rustc_const_unstable(feature = "const_char_convert", issue = "89259")]
+pub const fn from_digit(num: u32, radix: u32) -> Option<char> {
     if radix > 36 {
         panic!("from_digit: radix is too high (maximum 36)");
     }
index 3c4972bd3c9a47f74046c7022098021104200fc4..7250dca2adfe45bd1d55b7e27105b6a00c0a6283 100644 (file)
@@ -136,9 +136,10 @@ pub fn decode_utf16<I: IntoIterator<Item = u16>>(iter: I) -> DecodeUtf16<I::Into
     /// assert_eq!(None, c);
     /// ```
     #[stable(feature = "assoc_char_funcs", since = "1.52.0")]
+    #[rustc_const_unstable(feature = "const_char_convert", issue = "89259")]
     #[must_use]
     #[inline]
-    pub fn from_u32(i: u32) -> Option<char> {
+    pub const fn from_u32(i: u32) -> Option<char> {
         super::convert::from_u32(i)
     }
 
@@ -178,9 +179,10 @@ pub fn from_u32(i: u32) -> Option<char> {
     /// assert_eq!('❤', c);
     /// ```
     #[stable(feature = "assoc_char_funcs", since = "1.52.0")]
+    #[rustc_const_unstable(feature = "const_char_convert", issue = "89259")]
     #[must_use]
     #[inline]
-    pub unsafe fn from_u32_unchecked(i: u32) -> char {
+    pub const unsafe fn from_u32_unchecked(i: u32) -> char {
         // SAFETY: the safety contract must be upheld by the caller.
         unsafe { super::convert::from_u32_unchecked(i) }
     }
@@ -235,9 +237,10 @@ pub unsafe fn from_u32_unchecked(i: u32) -> char {
     /// let _c = char::from_digit(1, 37);
     /// ```
     #[stable(feature = "assoc_char_funcs", since = "1.52.0")]
+    #[rustc_const_unstable(feature = "const_char_convert", issue = "89259")]
     #[must_use]
     #[inline]
-    pub fn from_digit(num: u32, radix: u32) -> Option<char> {
+    pub const fn from_digit(num: u32, radix: u32) -> Option<char> {
         super::convert::from_digit(num, radix)
     }
 
@@ -331,10 +334,11 @@ pub fn is_digit(self, radix: u32) -> bool {
     /// let _ = '1'.to_digit(37);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[rustc_const_unstable(feature = "const_char_convert", issue = "89259")]
     #[must_use = "this returns the result of the operation, \
                   without modifying the original"]
     #[inline]
-    pub fn to_digit(self, radix: u32) -> Option<u32> {
+    pub const fn to_digit(self, radix: u32) -> Option<u32> {
         assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
         // If not a digit, a number greater than radix will be created.
         let mut digit = (self as u32).wrapping_sub('0' as u32);
@@ -345,7 +349,8 @@ pub fn to_digit(self, radix: u32) -> Option<u32> {
             // Force the 6th bit to be set to ensure ascii is lower case.
             digit = (self as u32 | 0b10_0000).wrapping_sub('a' as u32).saturating_add(10);
         }
-        (digit < radix).then_some(digit)
+        // FIXME: once then_some is const fn, use it here
+        if digit < radix { Some(digit) } else { None }
     }
 
     /// Returns an iterator that yields the hexadecimal Unicode escape of a
@@ -1245,7 +1250,7 @@ pub fn make_ascii_lowercase(&mut self) {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_alphabetic());
     /// assert!(uppercase_g.is_ascii_alphabetic());
@@ -1279,7 +1284,7 @@ pub const fn is_ascii_alphabetic(&self) -> bool {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_uppercase());
     /// assert!(uppercase_g.is_ascii_uppercase());
@@ -1313,7 +1318,7 @@ pub const fn is_ascii_uppercase(&self) -> bool {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_lowercase());
     /// assert!(!uppercase_g.is_ascii_lowercase());
@@ -1350,7 +1355,7 @@ pub const fn is_ascii_lowercase(&self) -> bool {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_alphanumeric());
     /// assert!(uppercase_g.is_ascii_alphanumeric());
@@ -1384,7 +1389,7 @@ pub const fn is_ascii_alphanumeric(&self) -> bool {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_digit());
     /// assert!(!uppercase_g.is_ascii_digit());
@@ -1421,7 +1426,7 @@ pub const fn is_ascii_digit(&self) -> bool {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_hexdigit());
     /// assert!(!uppercase_g.is_ascii_hexdigit());
@@ -1459,7 +1464,7 @@ pub const fn is_ascii_hexdigit(&self) -> bool {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_punctuation());
     /// assert!(!uppercase_g.is_ascii_punctuation());
@@ -1493,7 +1498,7 @@ pub const fn is_ascii_punctuation(&self) -> bool {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_graphic());
     /// assert!(uppercase_g.is_ascii_graphic());
@@ -1544,7 +1549,7 @@ pub const fn is_ascii_graphic(&self) -> bool {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_whitespace());
     /// assert!(!uppercase_g.is_ascii_whitespace());
@@ -1580,7 +1585,7 @@ pub const fn is_ascii_whitespace(&self) -> bool {
     /// let percent = '%';
     /// let space = ' ';
     /// let lf = '\n';
-    /// let esc: char = 0x1b_u8.into();
+    /// let esc = '\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_control());
     /// assert!(!uppercase_g.is_ascii_control());
index e4a566f589582aa40fff4c84cae3b3c046e3cdfc..2486999ffb5c1188ca50dd64c3f4c2a0bf1cb09a 100644 (file)
@@ -97,6 +97,7 @@
 #![allow(explicit_outlives_requirements)]
 //
 // Library features for const fns:
+#![feature(const_align_offset)]
 #![feature(const_align_of_val)]
 #![feature(const_alloc_layout)]
 #![feature(const_arguments_as_str)]
 #![feature(const_bigint_helper_methods)]
 #![feature(const_caller_location)]
 #![feature(const_cell_into_inner)]
+#![feature(const_char_convert)]
 #![feature(const_discriminant)]
 #![feature(const_eval_select)]
 #![feature(const_float_bits_conv)]
 #![feature(const_size_of_val)]
 #![feature(const_slice_from_raw_parts)]
 #![feature(const_slice_ptr_len)]
+#![feature(const_str_from_utf8_unchecked_mut)]
 #![feature(const_swap)]
 #![feature(const_trait_impl)]
 #![feature(const_type_id)]
 #![feature(duration_consts_2)]
 #![feature(ptr_metadata)]
 #![feature(slice_ptr_get)]
+#![feature(str_internals)]
 #![feature(variant_count)]
 #![feature(const_array_from_ref)]
 #![feature(const_slice_from_ref)]
 #![cfg_attr(bootstrap, feature(const_raw_ptr_deref))]
 #![feature(const_refs_to_cell)]
 #![feature(decl_macro)]
+#![feature(derive_default_enum)]
 #![feature(doc_cfg)]
 #![feature(doc_notable_trait)]
 #![feature(doc_primitive)]
index 905b0c4245801e87c4be00d2684ab3f51cf34564..c4a232ef36c615c5010557afefa93358552a8adf 100644 (file)
@@ -673,6 +673,9 @@ pub fn to_radians(self) -> f32 {
 
     /// Returns the maximum of the two numbers.
     ///
+    /// Follows the IEEE-754 2008 semantics for maxNum, except for handling of signaling NaNs.
+    /// This matches the behavior of libm’s fmin.
+    ///
     /// ```
     /// let x = 1.0f32;
     /// let y = 2.0f32;
@@ -689,6 +692,9 @@ pub fn max(self, other: f32) -> f32 {
 
     /// Returns the minimum of the two numbers.
     ///
+    /// Follows the IEEE-754 2008 semantics for minNum, except for handling of signaling NaNs.
+    /// This matches the behavior of libm’s fmin.
+    ///
     /// ```
     /// let x = 1.0f32;
     /// let y = 2.0f32;
@@ -703,6 +709,68 @@ pub fn min(self, other: f32) -> f32 {
         intrinsics::minnumf32(self, other)
     }
 
+    /// Returns the maximum of the two numbers, propagating NaNs.
+    ///
+    /// This returns NaN when *either* argument is NaN, as opposed to
+    /// [`f32::max`] which only returns NaN when *both* arguments are NaN.
+    ///
+    /// ```
+    /// #![feature(float_minimum_maximum)]
+    /// let x = 1.0f32;
+    /// let y = 2.0f32;
+    ///
+    /// assert_eq!(x.maximum(y), y);
+    /// assert!(x.maximum(f32::NAN).is_nan());
+    /// ```
+    ///
+    /// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater
+    /// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
+    /// Note that this follows the semantics specified in IEEE 754-2019.
+    #[unstable(feature = "float_minimum_maximum", issue = "91079")]
+    #[inline]
+    pub fn maximum(self, other: f32) -> f32 {
+        if self > other {
+            self
+        } else if other > self {
+            other
+        } else if self == other {
+            if self.is_sign_positive() && other.is_sign_negative() { self } else { other }
+        } else {
+            self + other
+        }
+    }
+
+    /// Returns the minimum of the two numbers, propagating NaNs.
+    ///
+    /// This returns NaN when *either* argument is NaN, as opposed to
+    /// [`f32::min`] which only returns NaN when *both* arguments are NaN.
+    ///
+    /// ```
+    /// #![feature(float_minimum_maximum)]
+    /// let x = 1.0f32;
+    /// let y = 2.0f32;
+    ///
+    /// assert_eq!(x.minimum(y), x);
+    /// assert!(x.minimum(f32::NAN).is_nan());
+    /// ```
+    ///
+    /// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
+    /// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
+    /// Note that this follows the semantics specified in IEEE 754-2019.
+    #[unstable(feature = "float_minimum_maximum", issue = "91079")]
+    #[inline]
+    pub fn minimum(self, other: f32) -> f32 {
+        if self < other {
+            self
+        } else if other < self {
+            other
+        } else if self == other {
+            if self.is_sign_negative() && other.is_sign_positive() { self } else { other }
+        } else {
+            self + other
+        }
+    }
+
     /// Rounds toward zero and converts to any primitive integer type,
     /// assuming that the value is finite and fits in that type.
     ///
index 112a239a145f6ea374c8c2365157364b512dc3a0..85ee6aa2cb8c3399f6bd2787ad9696d72fbe5b82 100644 (file)
@@ -689,6 +689,9 @@ pub fn to_radians(self) -> f64 {
 
     /// Returns the maximum of the two numbers.
     ///
+    /// Follows the IEEE-754 2008 semantics for maxNum, except for handling of signaling NaNs.
+    /// This matches the behavior of libm’s fmin.
+    ///
     /// ```
     /// let x = 1.0_f64;
     /// let y = 2.0_f64;
@@ -705,6 +708,9 @@ pub fn max(self, other: f64) -> f64 {
 
     /// Returns the minimum of the two numbers.
     ///
+    /// Follows the IEEE-754 2008 semantics for minNum, except for handling of signaling NaNs.
+    /// This matches the behavior of libm’s fmin.
+    ///
     /// ```
     /// let x = 1.0_f64;
     /// let y = 2.0_f64;
@@ -719,6 +725,68 @@ pub fn min(self, other: f64) -> f64 {
         intrinsics::minnumf64(self, other)
     }
 
+    /// Returns the maximum of the two numbers, propagating NaNs.
+    ///
+    /// This returns NaN when *either* argument is NaN, as opposed to
+    /// [`f64::max`] which only returns NaN when *both* arguments are NaN.
+    ///
+    /// ```
+    /// #![feature(float_minimum_maximum)]
+    /// let x = 1.0_f64;
+    /// let y = 2.0_f64;
+    ///
+    /// assert_eq!(x.maximum(y), y);
+    /// assert!(x.maximum(f64::NAN).is_nan());
+    /// ```
+    ///
+    /// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater
+    /// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
+    /// Note that this follows the semantics specified in IEEE 754-2019.
+    #[unstable(feature = "float_minimum_maximum", issue = "91079")]
+    #[inline]
+    pub fn maximum(self, other: f64) -> f64 {
+        if self > other {
+            self
+        } else if other > self {
+            other
+        } else if self == other {
+            if self.is_sign_positive() && other.is_sign_negative() { self } else { other }
+        } else {
+            self + other
+        }
+    }
+
+    /// Returns the minimum of the two numbers, propagating NaNs.
+    ///
+    /// This returns NaN when *either* argument is NaN, as opposed to
+    /// [`f64::min`] which only returns NaN when *both* arguments are NaN.
+    ///
+    /// ```
+    /// #![feature(float_minimum_maximum)]
+    /// let x = 1.0_f64;
+    /// let y = 2.0_f64;
+    ///
+    /// assert_eq!(x.minimum(y), x);
+    /// assert!(x.minimum(f64::NAN).is_nan());
+    /// ```
+    ///
+    /// If one of the arguments is NaN, then NaN is returned. Otherwise this returns the lesser
+    /// of the two numbers. For this operation, -0.0 is considered to be less than +0.0.
+    /// Note that this follows the semantics specified in IEEE 754-2019.
+    #[unstable(feature = "float_minimum_maximum", issue = "91079")]
+    #[inline]
+    pub fn minimum(self, other: f64) -> f64 {
+        if self < other {
+            self
+        } else if other < self {
+            other
+        } else if self == other {
+            if self.is_sign_negative() && other.is_sign_positive() { self } else { other }
+        } else {
+            self + other
+        }
+    }
+
     /// Rounds toward zero and converts to any primitive integer type,
     /// assuming that the value is finite and fits in that type.
     ///
index a8f2ded46594ebb8560b54354c396fe39575ecd4..e3eab07b9df6d7e63ee64cbad51a79c36acd4f3e 100644 (file)
@@ -428,7 +428,7 @@ pub fn make_ascii_lowercase(&mut self) {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_alphabetic());
     /// assert!(uppercase_g.is_ascii_alphabetic());
@@ -462,7 +462,7 @@ pub const fn is_ascii_alphabetic(&self) -> bool {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_uppercase());
     /// assert!(uppercase_g.is_ascii_uppercase());
@@ -496,7 +496,7 @@ pub const fn is_ascii_uppercase(&self) -> bool {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_lowercase());
     /// assert!(!uppercase_g.is_ascii_lowercase());
@@ -533,7 +533,7 @@ pub const fn is_ascii_lowercase(&self) -> bool {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_alphanumeric());
     /// assert!(uppercase_g.is_ascii_alphanumeric());
@@ -567,7 +567,7 @@ pub const fn is_ascii_alphanumeric(&self) -> bool {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_digit());
     /// assert!(!uppercase_g.is_ascii_digit());
@@ -604,7 +604,7 @@ pub const fn is_ascii_digit(&self) -> bool {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_hexdigit());
     /// assert!(!uppercase_g.is_ascii_hexdigit());
@@ -642,7 +642,7 @@ pub const fn is_ascii_hexdigit(&self) -> bool {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_punctuation());
     /// assert!(!uppercase_g.is_ascii_punctuation());
@@ -676,7 +676,7 @@ pub const fn is_ascii_punctuation(&self) -> bool {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(uppercase_a.is_ascii_graphic());
     /// assert!(uppercase_g.is_ascii_graphic());
@@ -727,7 +727,7 @@ pub const fn is_ascii_graphic(&self) -> bool {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_whitespace());
     /// assert!(!uppercase_g.is_ascii_whitespace());
@@ -763,7 +763,7 @@ pub const fn is_ascii_whitespace(&self) -> bool {
     /// let percent = b'%';
     /// let space = b' ';
     /// let lf = b'\n';
-    /// let esc = 0x1b_u8;
+    /// let esc = b'\x1b';
     ///
     /// assert!(!uppercase_a.is_ascii_control());
     /// assert!(!uppercase_g.is_ascii_control());
index 0de9126dab2fe5679ea2390903a0c1e3293e59a4..f47a30c9b5d7dc109b4d402f1c918378615aa373 100644 (file)
@@ -1104,11 +1104,10 @@ mod prim_usize {}
 /// * [`Clone`] \(Note that this will not defer to `T`'s `Clone` implementation if it exists!)
 /// * [`Deref`]
 /// * [`Borrow`]
-/// * [`Pointer`]
+/// * [`fmt::Pointer`]
 ///
 /// [`Deref`]: ops::Deref
 /// [`Borrow`]: borrow::Borrow
-/// [`Pointer`]: fmt::Pointer
 ///
 /// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating
 /// multiple simultaneous mutable borrows), plus the following, regardless of the type of its
@@ -1124,7 +1123,7 @@ mod prim_usize {}
 /// The following traits are implemented on `&T` references if the underlying `T` also implements
 /// that trait:
 ///
-/// * All the traits in [`std::fmt`] except [`Pointer`] and [`fmt::Write`]
+/// * All the traits in [`std::fmt`] except [`fmt::Pointer`] (which is implemented regardless of the type of its referent) and [`fmt::Write`]
 /// * [`PartialOrd`]
 /// * [`Ord`]
 /// * [`PartialEq`]
@@ -1133,9 +1132,9 @@ mod prim_usize {}
 /// * [`Fn`] \(in addition, `&T` references get [`FnMut`] and [`FnOnce`] if `T: Fn`)
 /// * [`Hash`]
 /// * [`ToSocketAddrs`]
+/// * [`Send`] \(`&T` references also require <code>T: [Sync]</code>)
 ///
 /// [`std::fmt`]: fmt
-/// ['Pointer`]: fmt::Pointer
 /// [`Hash`]: hash::Hash
 #[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))]
 ///
@@ -1150,7 +1149,6 @@ mod prim_usize {}
 /// * [`ExactSizeIterator`]
 /// * [`FusedIterator`]
 /// * [`TrustedLen`]
-/// * [`Send`] \(note that `&T` references only get `Send` if <code>T: [Sync]</code>)
 /// * [`io::Write`]
 /// * [`Read`]
 /// * [`Seek`]
index ed9f49f159611f19702787f29161a3423e5ae731..ef26cbfb640bfea89ee4aa8ea0e566b4578ffea9 100644 (file)
 /// assert_eq!("💖", sparkle_heart);
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
-    run_utf8_validation(v)?;
-    // SAFETY: Just ran validation.
-    Ok(unsafe { from_utf8_unchecked(v) })
+#[rustc_const_unstable(feature = "const_str_from_utf8", issue = "91006")]
+pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
+    // This should use `?` again, once it's `const`
+    match run_utf8_validation(v) {
+        Ok(_) => {
+            // SAFETY: validation succeeded.
+            Ok(unsafe { from_utf8_unchecked(v) })
+        }
+        Err(err) => Err(err),
+    }
 }
 
 /// Converts a mutable slice of bytes to a mutable string slice.
@@ -119,10 +125,16 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
 /// See the docs for [`Utf8Error`] for more details on the kinds of
 /// errors that can be returned.
 #[stable(feature = "str_mut_extras", since = "1.20.0")]
-pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
-    run_utf8_validation(v)?;
-    // SAFETY: Just ran validation.
-    Ok(unsafe { from_utf8_unchecked_mut(v) })
+#[rustc_const_unstable(feature = "const_str_from_utf8", issue = "91006")]
+pub const fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
+    // This should use `?` again, once it's `const`
+    match run_utf8_validation(v) {
+        Ok(_) => {
+            // SAFETY: validation succeeded.
+            Ok(unsafe { from_utf8_unchecked_mut(v) })
+        }
+        Err(err) => Err(err),
+    }
 }
 
 /// Converts a slice of bytes to a string slice without checking
@@ -184,7 +196,8 @@ pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
 #[inline]
 #[must_use]
 #[stable(feature = "str_mut_extras", since = "1.20.0")]
-pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
+#[rustc_const_unstable(feature = "const_str_from_utf8_unchecked_mut", issue = "91005")]
+pub const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
     // SAFETY: the caller must guarantee that the bytes `v`
     // are valid UTF-8, thus the cast to `*mut str` is safe.
     // Also, the pointer dereference is safe because that pointer
index b6460d72fef32abc13f70a7a74581411131aaeaf..a127dd57eee0e22d972cd656560d8a8673169162 100644 (file)
@@ -72,9 +72,10 @@ impl Utf8Error {
     /// assert_eq!(1, error.valid_up_to());
     /// ```
     #[stable(feature = "utf8_error", since = "1.5.0")]
+    #[rustc_const_unstable(feature = "const_str_from_utf8", issue = "91006")]
     #[must_use]
     #[inline]
-    pub fn valid_up_to(&self) -> usize {
+    pub const fn valid_up_to(&self) -> usize {
         self.valid_up_to
     }
 
@@ -94,10 +95,15 @@ pub fn valid_up_to(&self) -> usize {
     ///
     /// [U+FFFD]: ../../std/char/constant.REPLACEMENT_CHARACTER.html
     #[stable(feature = "utf8_error_error_len", since = "1.20.0")]
+    #[rustc_const_unstable(feature = "const_str_from_utf8", issue = "91006")]
     #[must_use]
     #[inline]
-    pub fn error_len(&self) -> Option<usize> {
-        self.error_len.map(|len| len as usize)
+    pub const fn error_len(&self) -> Option<usize> {
+        // This should become `map` again, once it's `const`
+        match self.error_len {
+            Some(len) => Some(len as usize),
+            None => None,
+        }
     }
 }
 
index 94a534c6e797e8a65357c4d50dadffe7b2848513..4841044671659add949d8ead7bb65d9ade087318 100644 (file)
@@ -39,10 +39,9 @@ impl<'a> Iterator for Chars<'a> {
 
     #[inline]
     fn next(&mut self) -> Option<char> {
-        next_code_point(&mut self.iter).map(|ch| {
-            // SAFETY: `str` invariant says `ch` is a valid Unicode Scalar Value.
-            unsafe { char::from_u32_unchecked(ch) }
-        })
+        // SAFETY: `str` invariant says `self.iter` is a valid UTF-8 string and
+        // the resulting `ch` is a valid Unicode Scalar Value.
+        unsafe { next_code_point(&mut self.iter).map(|ch| char::from_u32_unchecked(ch)) }
     }
 
     #[inline]
@@ -81,10 +80,9 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 impl<'a> DoubleEndedIterator for Chars<'a> {
     #[inline]
     fn next_back(&mut self) -> Option<char> {
-        next_code_point_reverse(&mut self.iter).map(|ch| {
-            // SAFETY: `str` invariant says `ch` is a valid Unicode Scalar Value.
-            unsafe { char::from_u32_unchecked(ch) }
-        })
+        // SAFETY: `str` invariant says `self.iter` is a valid UTF-8 string and
+        // the resulting `ch` is a valid Unicode Scalar Value.
+        unsafe { next_code_point_reverse(&mut self.iter).map(|ch| char::from_u32_unchecked(ch)) }
     }
 }
 
index 9a1cf905e3b025c9aed55a9d56804da08d2482e3..be9c41a491b8e8f68b33e24c6b3a3fdc480185e7 100644 (file)
@@ -8,36 +8,32 @@
 /// The first byte is special, only want bottom 5 bits for width 2, 4 bits
 /// for width 3, and 3 bits for width 4.
 #[inline]
-fn utf8_first_byte(byte: u8, width: u32) -> u32 {
+const fn utf8_first_byte(byte: u8, width: u32) -> u32 {
     (byte & (0x7F >> width)) as u32
 }
 
 /// Returns the value of `ch` updated with continuation byte `byte`.
 #[inline]
-fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 {
+const fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 {
     (ch << 6) | (byte & CONT_MASK) as u32
 }
 
 /// Checks whether the byte is a UTF-8 continuation byte (i.e., starts with the
 /// bits `10`).
 #[inline]
-pub(super) fn utf8_is_cont_byte(byte: u8) -> bool {
+pub(super) const fn utf8_is_cont_byte(byte: u8) -> bool {
     (byte as i8) < -64
 }
 
-#[inline]
-fn unwrap_or_0(opt: Option<&u8>) -> u8 {
-    match opt {
-        Some(&byte) => byte,
-        None => 0,
-    }
-}
-
 /// Reads the next code point out of a byte iterator (assuming a
 /// UTF-8-like encoding).
+///
+/// # Safety
+///
+/// `bytes` must produce a valid UTF-8-like (UTF-8 or WTF-8) string
 #[unstable(feature = "str_internals", issue = "none")]
 #[inline]
-pub fn next_code_point<'a, I: Iterator<Item = &'a u8>>(bytes: &mut I) -> Option<u32> {
+pub unsafe fn next_code_point<'a, I: Iterator<Item = &'a u8>>(bytes: &mut I) -> Option<u32> {
     // Decode UTF-8
     let x = *bytes.next()?;
     if x < 128 {
@@ -48,18 +44,24 @@ pub fn next_code_point<'a, I: Iterator<Item = &'a u8>>(bytes: &mut I) -> Option<
     // Decode from a byte combination out of: [[[x y] z] w]
     // NOTE: Performance is sensitive to the exact formulation here
     let init = utf8_first_byte(x, 2);
-    let y = unwrap_or_0(bytes.next());
+    // SAFETY: `bytes` produces an UTF-8-like string,
+    // so the iterator must produce a value here.
+    let y = unsafe { *bytes.next().unwrap_unchecked() };
     let mut ch = utf8_acc_cont_byte(init, y);
     if x >= 0xE0 {
         // [[x y z] w] case
         // 5th bit in 0xE0 .. 0xEF is always clear, so `init` is still valid
-        let z = unwrap_or_0(bytes.next());
+        // SAFETY: `bytes` produces an UTF-8-like string,
+        // so the iterator must produce a value here.
+        let z = unsafe { *bytes.next().unwrap_unchecked() };
         let y_z = utf8_acc_cont_byte((y & CONT_MASK) as u32, z);
         ch = init << 12 | y_z;
         if x >= 0xF0 {
             // [x y z w] case
             // use only the lower 3 bits of `init`
-            let w = unwrap_or_0(bytes.next());
+            // SAFETY: `bytes` produces an UTF-8-like string,
+            // so the iterator must produce a value here.
+            let w = unsafe { *bytes.next().unwrap_unchecked() };
             ch = (init & 7) << 18 | utf8_acc_cont_byte(y_z, w);
         }
     }
@@ -69,8 +71,12 @@ pub fn next_code_point<'a, I: Iterator<Item = &'a u8>>(bytes: &mut I) -> Option<
 
 /// Reads the last code point out of a byte iterator (assuming a
 /// UTF-8-like encoding).
+///
+/// # Safety
+///
+/// `bytes` must produce a valid UTF-8-like (UTF-8 or WTF-8) string
 #[inline]
-pub(super) fn next_code_point_reverse<'a, I>(bytes: &mut I) -> Option<u32>
+pub(super) unsafe fn next_code_point_reverse<'a, I>(bytes: &mut I) -> Option<u32>
 where
     I: DoubleEndedIterator<Item = &'a u8>,
 {
@@ -83,13 +89,19 @@ pub(super) fn next_code_point_reverse<'a, I>(bytes: &mut I) -> Option<u32>
     // Multibyte case follows
     // Decode from a byte combination out of: [x [y [z w]]]
     let mut ch;
-    let z = unwrap_or_0(bytes.next_back());
+    // SAFETY: `bytes` produces an UTF-8-like string,
+    // so the iterator must produce a value here.
+    let z = unsafe { *bytes.next_back().unwrap_unchecked() };
     ch = utf8_first_byte(z, 2);
     if utf8_is_cont_byte(z) {
-        let y = unwrap_or_0(bytes.next_back());
+        // SAFETY: `bytes` produces an UTF-8-like string,
+        // so the iterator must produce a value here.
+        let y = unsafe { *bytes.next_back().unwrap_unchecked() };
         ch = utf8_first_byte(y, 3);
         if utf8_is_cont_byte(y) {
-            let x = unwrap_or_0(bytes.next_back());
+            // SAFETY: `bytes` produces an UTF-8-like string,
+            // so the iterator must produce a value here.
+            let x = unsafe { *bytes.next_back().unwrap_unchecked() };
             ch = utf8_first_byte(x, 4);
             ch = utf8_acc_cont_byte(ch, y);
         }
@@ -105,14 +117,15 @@ pub(super) fn next_code_point_reverse<'a, I>(bytes: &mut I) -> Option<u32>
 
 /// Returns `true` if any byte in the word `x` is nonascii (>= 128).
 #[inline]
-fn contains_nonascii(x: usize) -> bool {
+const fn contains_nonascii(x: usize) -> bool {
     (x & NONASCII_MASK) != 0
 }
 
 /// Walks through `v` checking that it's a valid UTF-8 sequence,
 /// returning `Ok(())` in that case, or, if it is invalid, `Err(err)`.
 #[inline(always)]
-pub(super) fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> {
+#[rustc_const_unstable(feature = "str_internals", issue = "none")]
+pub(super) const fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> {
     let mut index = 0;
     let len = v.len();
 
@@ -142,7 +155,7 @@ macro_rules! next {
 
         let first = v[index];
         if first >= 128 {
-            let w = UTF8_CHAR_WIDTH[first as usize];
+            let w = utf8_char_width(first);
             // 2-byte encoding is for codepoints  \u{0080} to  \u{07ff}
             //        first  C2 80        last DF BF
             // 3-byte encoding is for codepoints  \u{0800} to  \u{ffff}
@@ -230,7 +243,7 @@ macro_rules! next {
 }
 
 // https://tools.ietf.org/html/rfc3629
-static UTF8_CHAR_WIDTH: [u8; 256] = [
+const UTF8_CHAR_WIDTH: &[u8; 256] = &[
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     1, // 0x1F
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -253,7 +266,7 @@ macro_rules! next {
 #[unstable(feature = "str_internals", issue = "none")]
 #[must_use]
 #[inline]
-pub fn utf8_char_width(b: u8) -> usize {
+pub const fn utf8_char_width(b: u8) -> usize {
     UTF8_CHAR_WIDTH[b as usize] as usize
 }
 
index b9acd0d29903d6d14c50c19167b8a2d80d3d9cb5..a56a1dbd17ae01df0cb35ed8e597c23f407be92e 100644 (file)
@@ -27,6 +27,7 @@
 #![feature(extern_types)]
 #![feature(flt2dec)]
 #![feature(fmt_internals)]
+#![feature(float_minimum_maximum)]
 #![feature(array_from_fn)]
 #![feature(hashmap_internals)]
 #![feature(try_find)]
index 37b5e9127d5b0b0645e4a5dde48f80fc7d6ee515..4f773a824efd29a4aaa36d33a068675ca9324d61 100644 (file)
@@ -715,6 +715,67 @@ fn max() {
                 assert!(($nan as $fty).max($nan).is_nan());
             }
             #[test]
+            fn minimum() {
+                assert_eq!((0.0 as $fty).minimum(0.0), 0.0);
+                assert!((0.0 as $fty).minimum(0.0).is_sign_positive());
+                assert_eq!((-0.0 as $fty).minimum(0.0), -0.0);
+                assert!((-0.0 as $fty).minimum(0.0).is_sign_negative());
+                assert_eq!((-0.0 as $fty).minimum(-0.0), -0.0);
+                assert!((-0.0 as $fty).minimum(-0.0).is_sign_negative());
+                assert_eq!((9.0 as $fty).minimum(9.0), 9.0);
+                assert_eq!((-9.0 as $fty).minimum(0.0), -9.0);
+                assert_eq!((0.0 as $fty).minimum(9.0), 0.0);
+                assert!((0.0 as $fty).minimum(9.0).is_sign_positive());
+                assert_eq!((-0.0 as $fty).minimum(9.0), -0.0);
+                assert!((-0.0 as $fty).minimum(9.0).is_sign_negative());
+                assert_eq!((-0.0 as $fty).minimum(-9.0), -9.0);
+                assert_eq!(($inf as $fty).minimum(9.0), 9.0);
+                assert_eq!((9.0 as $fty).minimum($inf), 9.0);
+                assert_eq!(($inf as $fty).minimum(-9.0), -9.0);
+                assert_eq!((-9.0 as $fty).minimum($inf), -9.0);
+                assert_eq!(($neginf as $fty).minimum(9.0), $neginf);
+                assert_eq!((9.0 as $fty).minimum($neginf), $neginf);
+                assert_eq!(($neginf as $fty).minimum(-9.0), $neginf);
+                assert_eq!((-9.0 as $fty).minimum($neginf), $neginf);
+                assert!(($nan as $fty).minimum(9.0).is_nan());
+                assert!(($nan as $fty).minimum(-9.0).is_nan());
+                assert!((9.0 as $fty).minimum($nan).is_nan());
+                assert!((-9.0 as $fty).minimum($nan).is_nan());
+                assert!(($nan as $fty).minimum($nan).is_nan());
+            }
+            #[test]
+            fn maximum() {
+                assert_eq!((0.0 as $fty).maximum(0.0), 0.0);
+                assert!((0.0 as $fty).maximum(0.0).is_sign_positive());
+                assert_eq!((-0.0 as $fty).maximum(0.0), 0.0);
+                assert!((-0.0 as $fty).maximum(0.0).is_sign_positive());
+                assert_eq!((-0.0 as $fty).maximum(-0.0), -0.0);
+                assert!((-0.0 as $fty).maximum(-0.0).is_sign_negative());
+                assert_eq!((9.0 as $fty).maximum(9.0), 9.0);
+                assert_eq!((-9.0 as $fty).maximum(0.0), 0.0);
+                assert!((-9.0 as $fty).maximum(0.0).is_sign_positive());
+                assert_eq!((-9.0 as $fty).maximum(-0.0), -0.0);
+                assert!((-9.0 as $fty).maximum(-0.0).is_sign_negative());
+                assert_eq!((0.0 as $fty).maximum(9.0), 9.0);
+                assert_eq!((0.0 as $fty).maximum(-9.0), 0.0);
+                assert!((0.0 as $fty).maximum(-9.0).is_sign_positive());
+                assert_eq!((-0.0 as $fty).maximum(-9.0), -0.0);
+                assert!((-0.0 as $fty).maximum(-9.0).is_sign_negative());
+                assert_eq!(($inf as $fty).maximum(9.0), $inf);
+                assert_eq!((9.0 as $fty).maximum($inf), $inf);
+                assert_eq!(($inf as $fty).maximum(-9.0), $inf);
+                assert_eq!((-9.0 as $fty).maximum($inf), $inf);
+                assert_eq!(($neginf as $fty).maximum(9.0), 9.0);
+                assert_eq!((9.0 as $fty).maximum($neginf), 9.0);
+                assert_eq!(($neginf as $fty).maximum(-9.0), -9.0);
+                assert_eq!((-9.0 as $fty).maximum($neginf), -9.0);
+                assert!(($nan as $fty).maximum(9.0).is_nan());
+                assert!(($nan as $fty).maximum(-9.0).is_nan());
+                assert!((9.0 as $fty).maximum($nan).is_nan());
+                assert!((-9.0 as $fty).maximum($nan).is_nan());
+                assert!(($nan as $fty).maximum($nan).is_nan());
+            }
+            #[test]
             fn rem_euclid() {
                 let a: $fty = 42.0;
                 assert!($inf.rem_euclid(a).is_nan());
index 0d4b865f3392a66304e13e47e9fa652099428534..69fa203ff4e70bb03c9f0a15615348345670a625 100644 (file)
@@ -19,6 +19,18 @@ fn test_max_nan() {
     assert_eq!(2.0f32.max(f32::NAN), 2.0);
 }
 
+#[test]
+fn test_minimum() {
+    assert!(f32::NAN.minimum(2.0).is_nan());
+    assert!(2.0f32.minimum(f32::NAN).is_nan());
+}
+
+#[test]
+fn test_maximum() {
+    assert!(f32::NAN.maximum(2.0).is_nan());
+    assert!(2.0f32.maximum(f32::NAN).is_nan());
+}
+
 #[test]
 fn test_nan() {
     let nan: f32 = f32::NAN;
index 1417d860c47f580a68afdd740ff9f98ee765ea2f..9a8f1e44f1f1cc3b04928d84b4c13361b44117ed 100644 (file)
@@ -1430,4 +1430,8 @@ fn create_dir_long_paths() {
     // This will fail if the path isn't converted to verbatim.
     path.push("a");
     fs::create_dir(&path).unwrap();
+
+    // #90940: Ensure an empty path returns the "Not Found" error.
+    let path = Path::new("");
+    assert_eq!(path.canonicalize().unwrap_err().kind(), crate::io::ErrorKind::NotFound);
 }
index 3da28695b34bd951e9e3b84a1e5e28a3c99fbe8e..d93c6172cfcf6e1e451d97faec6c45ff80f62272 100644 (file)
@@ -392,6 +392,9 @@ impl Error {
     /// originate from the OS itself. The `error` argument is an arbitrary
     /// payload which will be contained in this [`Error`].
     ///
+    /// If no extra payload is required, use the `From` conversion from
+    /// `ErrorKind`.
+    ///
     /// # Examples
     ///
     /// ```
@@ -402,6 +405,9 @@ impl Error {
     ///
     /// // errors can also be created from other errors
     /// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
+    ///
+    /// // creating an error without payload
+    /// let eof_error = Error::from(ErrorKind::UnexpectedEof);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn new<E>(kind: ErrorKind, error: E) -> Error
index a8365071d61eb5085ae3d497d0f7a5dc13d8e37c..a370485102e35a85cafaf6cd6b0f505016a2d072 100644 (file)
@@ -549,13 +549,10 @@ mod fn_keyword {}
 /// {
 ///     let result = match IntoIterator::into_iter(iterator) {
 ///         mut iter => loop {
-///             let next;
 ///             match iter.next() {
-///                 Some(val) => next = val,
 ///                 None => break,
+///                 Some(loop_variable) => { code(); },
 ///             };
-///             let loop_variable = next;
-///             let () = { code(); };
 ///         },
 ///     };
 ///     result
index f2490a77ce0f8aa72a86d9e3c22cb70d413fdaf6..afd8d8edaa169f8b41d1bed27fdb56f7a4eb6ad8 100644 (file)
 #![feature(exhaustive_patterns)]
 #![feature(extend_one)]
 #![feature(fn_traits)]
+#![feature(float_minimum_maximum)]
 #![feature(format_args_nl)]
 #![feature(gen_future)]
 #![feature(generator_trait)]
index 0de9126dab2fe5679ea2390903a0c1e3293e59a4..f47a30c9b5d7dc109b4d402f1c918378615aa373 100644 (file)
@@ -1104,11 +1104,10 @@ mod prim_usize {}
 /// * [`Clone`] \(Note that this will not defer to `T`'s `Clone` implementation if it exists!)
 /// * [`Deref`]
 /// * [`Borrow`]
-/// * [`Pointer`]
+/// * [`fmt::Pointer`]
 ///
 /// [`Deref`]: ops::Deref
 /// [`Borrow`]: borrow::Borrow
-/// [`Pointer`]: fmt::Pointer
 ///
 /// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating
 /// multiple simultaneous mutable borrows), plus the following, regardless of the type of its
@@ -1124,7 +1123,7 @@ mod prim_usize {}
 /// The following traits are implemented on `&T` references if the underlying `T` also implements
 /// that trait:
 ///
-/// * All the traits in [`std::fmt`] except [`Pointer`] and [`fmt::Write`]
+/// * All the traits in [`std::fmt`] except [`fmt::Pointer`] (which is implemented regardless of the type of its referent) and [`fmt::Write`]
 /// * [`PartialOrd`]
 /// * [`Ord`]
 /// * [`PartialEq`]
@@ -1133,9 +1132,9 @@ mod prim_usize {}
 /// * [`Fn`] \(in addition, `&T` references get [`FnMut`] and [`FnOnce`] if `T: Fn`)
 /// * [`Hash`]
 /// * [`ToSocketAddrs`]
+/// * [`Send`] \(`&T` references also require <code>T: [Sync]</code>)
 ///
 /// [`std::fmt`]: fmt
-/// ['Pointer`]: fmt::Pointer
 /// [`Hash`]: hash::Hash
 #[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))]
 ///
@@ -1150,7 +1149,6 @@ mod prim_usize {}
 /// * [`ExactSizeIterator`]
 /// * [`FusedIterator`]
 /// * [`TrustedLen`]
-/// * [`Send`] \(note that `&T` references only get `Send` if <code>T: [Sync]</code>)
 /// * [`io::Write`]
 /// * [`Read`]
 /// * [`Seek`]
index bc71c150550a4080a0ad6f51e945a7cef6698460..094d2efbdd5095c0f8be42ce7d870d93d170f553 100644 (file)
@@ -297,7 +297,7 @@ fn test_interior_nul_in_progname_is_error() {
 
 #[test]
 fn test_interior_nul_in_arg_is_error() {
-    match Command::new("echo").arg("has-some-\0\0s-inside").spawn() {
+    match Command::new("rustc").arg("has-some-\0\0s-inside").spawn() {
         Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
         Ok(_) => panic!(),
     }
@@ -305,7 +305,7 @@ fn test_interior_nul_in_arg_is_error() {
 
 #[test]
 fn test_interior_nul_in_args_is_error() {
-    match Command::new("echo").args(&["has-some-\0\0s-inside"]).spawn() {
+    match Command::new("rustc").args(&["has-some-\0\0s-inside"]).spawn() {
         Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
         Ok(_) => panic!(),
     }
@@ -313,7 +313,7 @@ fn test_interior_nul_in_args_is_error() {
 
 #[test]
 fn test_interior_nul_in_current_dir_is_error() {
-    match Command::new("echo").current_dir("has-some-\0\0s-inside").spawn() {
+    match Command::new("rustc").current_dir("has-some-\0\0s-inside").spawn() {
         Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput),
         Ok(_) => panic!(),
     }
index a6b43229ba6b7dd4b0aa7e3b40fb985a3c1f4901..f3155fbc0620f1ad8dbd634fb24d3be328d4cbb1 100644 (file)
@@ -576,7 +576,7 @@ fn copy_file_range(
                 return match err.raw_os_error() {
                     // when file offset + max_length > u64::MAX
                     Some(EOVERFLOW) => CopyResult::Fallback(written),
-                    Some(ENOSYS | EXDEV | EINVAL | EPERM | EOPNOTSUPP | EBADF) => {
+                    Some(ENOSYS | EXDEV | EINVAL | EPERM | EOPNOTSUPP | EBADF) if written == 0 => {
                         // Try fallback io::copy if either:
                         // - Kernel version is < 4.5 (ENOSYS¹)
                         // - Files are mounted on different fs (EXDEV)
@@ -584,12 +584,14 @@ fn copy_file_range(
                         // - copy_file_range file is immutable or syscall is blocked by seccomp¹ (EPERM)
                         // - copy_file_range cannot be used with pipes or device nodes (EINVAL)
                         // - the writer fd was opened with O_APPEND (EBADF²)
+                        // and no bytes were written successfully yet.  (All these errnos should
+                        // not be returned if something was already written, but they happen in
+                        // the wild, see #91152.)
                         //
                         // ¹ these cases should be detected by the initial probe but we handle them here
                         //   anyway in case syscall interception changes during runtime
                         // ² actually invalid file descriptors would cause this too, but in that case
                         //   the fallback code path is expected to encounter the same error again
-                        assert_eq!(written, 0);
                         CopyResult::Fallback(0)
                     }
                     _ => CopyResult::Error(err, written),
index 9dfc8114eb596e29ad2079d4efd9d7586bee24f6..50c4547de85f69e46f7ff43276367d153e0128f1 100644 (file)
@@ -734,6 +734,7 @@ pub fn CreateHardLinkW(
             lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
         ) -> BOOL;
         pub fn SetThreadStackGuarantee(_size: *mut c_ulong) -> BOOL;
+        pub fn GetWindowsDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT;
     }
 }
 }
@@ -773,6 +774,7 @@ pub fn GetFileInformationByHandleEx(
     pub fn LeaveCriticalSection(CriticalSection: *mut CRITICAL_SECTION);
     pub fn DeleteCriticalSection(CriticalSection: *mut CRITICAL_SECTION);
 
+    pub fn GetSystemDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT;
     pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
     pub fn SetFileAttributesW(lpFileName: LPCWSTR, dwFileAttributes: DWORD) -> BOOL;
     pub fn SetLastError(dwErrCode: DWORD);
index 460c1eff7788d1cfd105002a9c3ab91f004bc6b0..79e0eaf6c34c6e813a80eba3c1d3491745030e48 100644 (file)
@@ -1,9 +1,8 @@
 use super::{c, fill_utf16_buf, to_u16s};
-use crate::ffi::OsStr;
+use crate::ffi::{OsStr, OsString};
 use crate::io;
 use crate::mem;
-use crate::path::Path;
-use crate::path::Prefix;
+use crate::path::{Path, PathBuf, Prefix};
 use crate::ptr;
 
 #[cfg(test)]
@@ -32,6 +31,25 @@ pub fn is_verbatim_sep(b: u8) -> bool {
     b == b'\\'
 }
 
+/// Returns true if `path` looks like a lone filename.
+pub(crate) fn is_file_name(path: &OsStr) -> bool {
+    !path.bytes().iter().copied().any(is_sep_byte)
+}
+pub(crate) fn has_trailing_slash(path: &OsStr) -> bool {
+    let is_verbatim = path.bytes().starts_with(br"\\?\");
+    let is_separator = if is_verbatim { is_verbatim_sep } else { is_sep_byte };
+    if let Some(&c) = path.bytes().last() { is_separator(c) } else { false }
+}
+
+/// Appends a suffix to a path.
+///
+/// Can be used to append an extension without removing an existing extension.
+pub(crate) fn append_suffix(path: PathBuf, suffix: &OsStr) -> PathBuf {
+    let mut path = OsString::from(path);
+    path.push(suffix);
+    path.into()
+}
+
 pub fn parse_prefix(path: &OsStr) -> Option<Prefix<'_>> {
     use Prefix::{DeviceNS, Disk, Verbatim, VerbatimDisk, VerbatimUNC, UNC};
 
@@ -174,8 +192,8 @@ pub(crate) fn maybe_verbatim(path: &Path) -> io::Result<Vec<u16>> {
     const UNC_PREFIX: &[u16] = &[SEP, SEP, QUERY, SEP, U, N, C, SEP];
 
     let mut path = to_u16s(path)?;
-    if path.starts_with(VERBATIM_PREFIX) || path.starts_with(NT_PREFIX) {
-        // Early return for paths that are already verbatim.
+    if path.starts_with(VERBATIM_PREFIX) || path.starts_with(NT_PREFIX) || path == &[0] {
+        // Early return for paths that are already verbatim or empty.
         return Ok(path);
     } else if path.len() < LEGACY_MAX_PATH {
         // Early return if an absolute path is less < 260 UTF-16 code units.
index c6c84519f419cbe750582153d96e906d59e7de69..425c2011b32390bdf4c3900cc873880e597e019c 100644 (file)
@@ -91,7 +91,6 @@ fn check(path: &str, expected: &str) {
     // Make sure opening a drive will work.
     check("Z:", "Z:");
 
-    // An empty path or a path that contains null are not valid paths.
-    assert!(maybe_verbatim(Path::new("")).is_err());
+    // A path that contains null is not a valid path.
     assert!(maybe_verbatim(Path::new("\0")).is_err());
 }
index ccff90629a37144598de7bbbda40812f41f01c9d..66b210ce1bfb3ebcfadc052330fd05cfe2fe8c3c 100644 (file)
@@ -7,24 +7,24 @@
 use crate::collections::BTreeMap;
 use crate::convert::{TryFrom, TryInto};
 use crate::env;
-use crate::env::split_paths;
+use crate::env::consts::{EXE_EXTENSION, EXE_SUFFIX};
 use crate::ffi::{OsStr, OsString};
 use crate::fmt;
-use crate::fs;
 use crate::io::{self, Error, ErrorKind};
 use crate::mem;
 use crate::num::NonZeroI32;
-use crate::os::windows::ffi::OsStrExt;
+use crate::os::windows::ffi::{OsStrExt, OsStringExt};
 use crate::os::windows::io::{AsRawHandle, FromRawHandle, IntoRawHandle};
-use crate::path::Path;
+use crate::path::{Path, PathBuf};
 use crate::ptr;
 use crate::sys::c;
 use crate::sys::c::NonZeroDWORD;
-use crate::sys::cvt;
 use crate::sys::fs::{File, OpenOptions};
 use crate::sys::handle::Handle;
+use crate::sys::path;
 use crate::sys::pipe::{self, AnonPipe};
 use crate::sys::stdio;
+use crate::sys::{cvt, to_u16s};
 use crate::sys_common::mutex::StaticMutex;
 use crate::sys_common::process::{CommandEnv, CommandEnvs};
 use crate::sys_common::{AsInner, IntoInner};
@@ -258,31 +258,19 @@ pub fn spawn(
         needs_stdin: bool,
     ) -> io::Result<(Process, StdioPipes)> {
         let maybe_env = self.env.capture_if_changed();
-        // To have the spawning semantics of unix/windows stay the same, we need
-        // to read the *child's* PATH if one is provided. See #15149 for more
-        // details.
-        let program = maybe_env.as_ref().and_then(|env| {
-            if let Some(v) = env.get(&EnvKey::new("PATH")) {
-                // Split the value and test each path to see if the
-                // program exists.
-                for path in split_paths(&v) {
-                    let path = path
-                        .join(self.program.to_str().unwrap())
-                        .with_extension(env::consts::EXE_EXTENSION);
-                    if fs::metadata(&path).is_ok() {
-                        return Some(path.into_os_string());
-                    }
-                }
-            }
-            None
-        });
 
         let mut si = zeroed_startupinfo();
         si.cb = mem::size_of::<c::STARTUPINFO>() as c::DWORD;
         si.dwFlags = c::STARTF_USESTDHANDLES;
 
-        let program = program.as_ref().unwrap_or(&self.program);
-        let mut cmd_str = make_command_line(program, &self.args, self.force_quotes_enabled)?;
+        let child_paths = if let Some(env) = maybe_env.as_ref() {
+            env.get(&EnvKey::new("PATH")).map(|s| s.as_os_str())
+        } else {
+            None
+        };
+        let program = resolve_exe(&self.program, child_paths)?;
+        let mut cmd_str =
+            make_command_line(program.as_os_str(), &self.args, self.force_quotes_enabled)?;
         cmd_str.push(0); // add null terminator
 
         // stolen from the libuv code.
@@ -321,9 +309,10 @@ pub fn spawn(
         si.hStdOutput = stdout.as_raw_handle();
         si.hStdError = stderr.as_raw_handle();
 
+        let program = to_u16s(&program)?;
         unsafe {
             cvt(c::CreateProcessW(
-                ptr::null(),
+                program.as_ptr(),
                 cmd_str.as_mut_ptr(),
                 ptr::null_mut(),
                 ptr::null_mut(),
@@ -361,6 +350,132 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     }
 }
 
+// Resolve `exe_path` to the executable name.
+//
+// * If the path is simply a file name then use the paths given by `search_paths` to find the executable.
+// * Otherwise use the `exe_path` as given.
+//
+// This function may also append `.exe` to the name. The rationale for doing so is as follows:
+//
+// It is a very strong convention that Windows executables have the `exe` extension.
+// In Rust, it is common to omit this extension.
+// Therefore this functions first assumes `.exe` was intended.
+// It falls back to the plain file name if a full path is given and the extension is omitted
+// or if only a file name is given and it already contains an extension.
+fn resolve_exe<'a>(exe_path: &'a OsStr, child_paths: Option<&OsStr>) -> io::Result<PathBuf> {
+    // Early return if there is no filename.
+    if exe_path.is_empty() || path::has_trailing_slash(exe_path) {
+        return Err(io::Error::new_const(
+            io::ErrorKind::InvalidInput,
+            &"program path has no file name",
+        ));
+    }
+    // Test if the file name has the `exe` extension.
+    // This does a case-insensitive `ends_with`.
+    let has_exe_suffix = if exe_path.len() >= EXE_SUFFIX.len() {
+        exe_path.bytes()[exe_path.len() - EXE_SUFFIX.len()..]
+            .eq_ignore_ascii_case(EXE_SUFFIX.as_bytes())
+    } else {
+        false
+    };
+
+    // If `exe_path` is an absolute path or a sub-path then don't search `PATH` for it.
+    if !path::is_file_name(exe_path) {
+        if has_exe_suffix {
+            // The application name is a path to a `.exe` file.
+            // Let `CreateProcessW` figure out if it exists or not.
+            return Ok(exe_path.into());
+        }
+        let mut path = PathBuf::from(exe_path);
+
+        // Append `.exe` if not already there.
+        path = path::append_suffix(path, EXE_SUFFIX.as_ref());
+        if path.try_exists().unwrap_or(false) {
+            return Ok(path);
+        } else {
+            // It's ok to use `set_extension` here because the intent is to
+            // remove the extension that was just added.
+            path.set_extension("");
+            return Ok(path);
+        }
+    } else {
+        ensure_no_nuls(exe_path)?;
+        // From the `CreateProcessW` docs:
+        // > If the file name does not contain an extension, .exe is appended.
+        // Note that this rule only applies when searching paths.
+        let has_extension = exe_path.bytes().contains(&b'.');
+
+        // Search the directories given by `search_paths`.
+        let result = search_paths(child_paths, |mut path| {
+            path.push(&exe_path);
+            if !has_extension {
+                path.set_extension(EXE_EXTENSION);
+            }
+            if let Ok(true) = path.try_exists() { Some(path) } else { None }
+        });
+        if let Some(path) = result {
+            return Ok(path);
+        }
+    }
+    // If we get here then the executable cannot be found.
+    Err(io::Error::new_const(io::ErrorKind::NotFound, &"program not found"))
+}
+
+// Calls `f` for every path that should be used to find an executable.
+// Returns once `f` returns the path to an executable or all paths have been searched.
+fn search_paths<F>(child_paths: Option<&OsStr>, mut f: F) -> Option<PathBuf>
+where
+    F: FnMut(PathBuf) -> Option<PathBuf>,
+{
+    // 1. Child paths
+    // This is for consistency with Rust's historic behaviour.
+    if let Some(paths) = child_paths {
+        for path in env::split_paths(paths).filter(|p| !p.as_os_str().is_empty()) {
+            if let Some(path) = f(path) {
+                return Some(path);
+            }
+        }
+    }
+
+    // 2. Application path
+    if let Ok(mut app_path) = env::current_exe() {
+        app_path.pop();
+        if let Some(path) = f(app_path) {
+            return Some(path);
+        }
+    }
+
+    // 3 & 4. System paths
+    // SAFETY: This uses `fill_utf16_buf` to safely call the OS functions.
+    unsafe {
+        if let Ok(Some(path)) = super::fill_utf16_buf(
+            |buf, size| c::GetSystemDirectoryW(buf, size),
+            |buf| f(PathBuf::from(OsString::from_wide(buf))),
+        ) {
+            return Some(path);
+        }
+        #[cfg(not(target_vendor = "uwp"))]
+        {
+            if let Ok(Some(path)) = super::fill_utf16_buf(
+                |buf, size| c::GetWindowsDirectoryW(buf, size),
+                |buf| f(PathBuf::from(OsString::from_wide(buf))),
+            ) {
+                return Some(path);
+            }
+        }
+    }
+
+    // 5. Parent paths
+    if let Some(parent_paths) = env::var_os("PATH") {
+        for path in env::split_paths(&parent_paths).filter(|p| !p.as_os_str().is_empty()) {
+            if let Some(path) = f(path) {
+                return Some(path);
+            }
+        }
+    }
+    None
+}
+
 impl Stdio {
     fn to_handle(&self, stdio_id: c::DWORD, pipe: &mut Option<AnonPipe>) -> io::Result<Handle> {
         match *self {
index 3b65856dcaca6d4f3e017a2ba97fccf2cf8f339c..6c862edc2370ace2a74a21780a7e6e61f51e99ec 100644 (file)
@@ -128,3 +128,55 @@ fn windows_env_unicode_case() {
         }
     }
 }
+
+// UWP applications run in a restricted environment which means this test may not work.
+#[cfg(not(target_vendor = "uwp"))]
+#[test]
+fn windows_exe_resolver() {
+    use super::resolve_exe;
+    use crate::io;
+
+    // Test a full path, with and without the `exe` extension.
+    let mut current_exe = env::current_exe().unwrap();
+    assert!(resolve_exe(current_exe.as_ref(), None).is_ok());
+    current_exe.set_extension("");
+    assert!(resolve_exe(current_exe.as_ref(), None).is_ok());
+
+    // Test lone file names.
+    assert!(resolve_exe(OsStr::new("cmd"), None).is_ok());
+    assert!(resolve_exe(OsStr::new("cmd.exe"), None).is_ok());
+    assert!(resolve_exe(OsStr::new("cmd.EXE"), None).is_ok());
+    assert!(resolve_exe(OsStr::new("fc"), None).is_ok());
+
+    // Invalid file names should return InvalidInput.
+    assert_eq!(resolve_exe(OsStr::new(""), None).unwrap_err().kind(), io::ErrorKind::InvalidInput);
+    assert_eq!(
+        resolve_exe(OsStr::new("\0"), None).unwrap_err().kind(),
+        io::ErrorKind::InvalidInput
+    );
+    // Trailing slash, therefore there's no file name component.
+    assert_eq!(
+        resolve_exe(OsStr::new(r"C:\Path\to\"), None).unwrap_err().kind(),
+        io::ErrorKind::InvalidInput
+    );
+
+    /*
+    Some of the following tests may need to be changed if you are deliberately
+    changing the behaviour of `resolve_exe`.
+    */
+
+    let paths = env::var_os("PATH").unwrap();
+    env::set_var("PATH", "");
+
+    assert_eq!(resolve_exe(OsStr::new("rustc"), None).unwrap_err().kind(), io::ErrorKind::NotFound);
+
+    let child_paths = Some(paths.as_os_str());
+    assert!(resolve_exe(OsStr::new("rustc"), child_paths).is_ok());
+
+    // The resolver looks in system directories even when `PATH` is empty.
+    assert!(resolve_exe(OsStr::new("cmd.exe"), None).is_ok());
+
+    // The application's directory is also searched.
+    let current_exe = env::current_exe().unwrap();
+    assert!(resolve_exe(current_exe.file_name().unwrap().as_ref(), None).is_ok());
+}
index 0629859bd9dcc15bc232b502366bf21512500ff7..6e29bc61454c85076260a5f6412702a790506f04 100644 (file)
@@ -809,7 +809,8 @@ impl<'a> Iterator for Wtf8CodePoints<'a> {
 
     #[inline]
     fn next(&mut self) -> Option<CodePoint> {
-        next_code_point(&mut self.bytes).map(|c| CodePoint { value: c })
+        // SAFETY: `self.bytes` has been created from a WTF-8 string
+        unsafe { next_code_point(&mut self.bytes).map(|c| CodePoint { value: c }) }
     }
 
     #[inline]
index f6898d283fc16ed7226d4958daffd3a6917bdd8e..4da59577d78a19cfb61ba24c47c1b54e7cc37cc9 100644 (file)
@@ -165,6 +165,7 @@ macro_rules! __thread_local_inner {
         #[cfg_attr(not(windows), inline)] // see comments below
         unsafe fn __getit() -> $crate::option::Option<&'static $t> {
             const _REQUIRE_UNSTABLE: () = $crate::thread::require_unstable_const_init_thread_local();
+            const INIT_EXPR: $t = $init;
 
             // wasm without atomics maps directly to `static mut`, and dtors
             // aren't implemented because thread dtors aren't really a thing
@@ -174,7 +175,7 @@ unsafe fn __getit() -> $crate::option::Option<&'static $t> {
             // block.
             #[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
             {
-                static mut VAL: $t = $init;
+                static mut VAL: $t = INIT_EXPR;
                 Some(&VAL)
             }
 
@@ -184,18 +185,17 @@ unsafe fn __getit() -> $crate::option::Option<&'static $t> {
                 not(all(target_family = "wasm", not(target_feature = "atomics"))),
             ))]
             {
+                #[thread_local]
+                static mut VAL: $t = INIT_EXPR;
+
                 // If a dtor isn't needed we can do something "very raw" and
                 // just get going.
                 if !$crate::mem::needs_drop::<$t>() {
-                    #[thread_local]
-                    static mut VAL: $t = $init;
                     unsafe {
                         return Some(&VAL)
                     }
                 }
 
-                #[thread_local]
-                static mut VAL: $t = $init;
                 // 0 == dtor not registered
                 // 1 == dtor registered, dtor not run
                 // 2 == dtor registered and is running or has run
@@ -242,7 +242,7 @@ unsafe fn __getit() -> $crate::option::Option<&'static $t> {
             ))]
             {
                 #[inline]
-                const fn __init() -> $t { $init }
+                const fn __init() -> $t { INIT_EXPR }
                 static __KEY: $crate::thread::__OsLocalKeyInner<$t> =
                     $crate::thread::__OsLocalKeyInner::new();
                 #[allow(unused_unsafe)]
index 815d55c610dab39e92e7c83bf5fd4b7a020b4d46..cfba59fccd90b3b52a614120834320f764ab08d1 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 815d55c610dab39e92e7c83bf5fd4b7a020b4d46
+Subproject commit cfba59fccd90b3b52a614120834320f764ab08d1
index 38d3c7aec4941f5bfe12c1c7957a9eb93f9d5044..22f2e405a1e88d29356539b74453b4e71b16c793 100644 (file)
@@ -1119,17 +1119,22 @@ class RustBuild(object):
                     raise Exception("{} not found".format(vendor_dir))
 
         if self.use_vendored_sources:
+            config = ("[source.crates-io]\n"
+                      "replace-with = 'vendored-sources'\n"
+                      "registry = 'https://example.com'\n"
+                      "\n"
+                      "[source.vendored-sources]\n"
+                      "directory = '{}/vendor'\n"
+                      .format(self.rust_root))
             if not os.path.exists('.cargo'):
                 os.makedirs('.cargo')
-            with output('.cargo/config') as cargo_config:
-                cargo_config.write(
-                    "[source.crates-io]\n"
-                    "replace-with = 'vendored-sources'\n"
-                    "registry = 'https://example.com'\n"
-                    "\n"
-                    "[source.vendored-sources]\n"
-                    "directory = '{}/vendor'\n"
-                    .format(self.rust_root))
+                with output('.cargo/config') as cargo_config:
+                    cargo_config.write(config)
+            else:
+                print('info: using vendored source, but .cargo/config is already present.')
+                print('      Reusing the current configuration file. But you may want to '
+                      'configure vendoring like this:')
+                print(config)
         else:
             if os.path.exists('.cargo'):
                 shutil.rmtree('.cargo')
index 5c5dbc5b196c9564422b3193264f3288d2a051ce..a5e0c5b2c5f9054be3b961aea2c7edfeea591de8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 5c5dbc5b196c9564422b3193264f3288d2a051ce
+Subproject commit a5e0c5b2c5f9054be3b961aea2c7edfeea591de8
index 27f4a84d3852e9416cae5861254fa53a825c56bd..8e0ec8c77d8b28b86159fdee9d33a758225ecf9c 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 27f4a84d3852e9416cae5861254fa53a825c56bd
+Subproject commit 8e0ec8c77d8b28b86159fdee9d33a758225ecf9c
index 51739471276b1776dea27cf562b974ef07e24685..8c395bdd8073deb20ca67e1ed4b14a3a7e315a37 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 51739471276b1776dea27cf562b974ef07e24685
+Subproject commit 8c395bdd8073deb20ca67e1ed4b14a3a7e315a37
index a01d151a7250a540a9cb7ccce5956f020c677c21..c0f222da23568477155991d391c9ce918e381351 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a01d151a7250a540a9cb7ccce5956f020c677c21
+Subproject commit c0f222da23568477155991d391c9ce918e381351
index e9d45342d7a6c1def4731f1782d87ea317ba30c3..43f82530210b83cf888282b207ed13d5893da9b2 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e9d45342d7a6c1def4731f1782d87ea317ba30c3
+Subproject commit 43f82530210b83cf888282b207ed13d5893da9b2
index 196ef69aa68f2cef44f37566ee7db37daf00301b..a2fc9635029c04e692474965a6606f8e286d539a 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 196ef69aa68f2cef44f37566ee7db37daf00301b
+Subproject commit a2fc9635029c04e692474965a6606f8e286d539a
index b3b6422afab427cc26f749ca5d8b142c711518c7..8da1d22a4d172d3f6a2c5830bcc10cc138d6df1d 100644 (file)
@@ -348,6 +348,18 @@ Using this flag looks like this:
 $ rustdoc src/lib.rs -Z unstable-options --show-coverage
 ```
 
+It generates something like this:
+
+```bash
++-------------------------------------+------------+------------+------------+------------+
+| File                                | Documented | Percentage |   Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| lib.rs                              |          4 |     100.0% |          1 |      25.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total                               |          4 |     100.0% |          1 |      25.0% |
++-------------------------------------+------------+------------+------------+------------+
+```
+
 If you want to determine how many items in your crate are documented, pass this flag to rustdoc.
 When it receives this flag, it will count the public items in your crate that have documentation,
 and print out the counts and a percentage instead of generating docs.
@@ -367,12 +379,21 @@ Some methodology notes about what rustdoc counts in this metric:
 Public items that are not documented can be seen with the built-in `missing_docs` lint. Private
 items that are not documented can be seen with Clippy's `missing_docs_in_private_items` lint.
 
-### `-w`/`--output-format`: output format
+Calculating code examples follows these rules:
 
-When using
-[`--show-coverage`](https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#--show-coverage-get-statistics-about-code-documentation-coverage),
-passing `--output-format json` will display the coverage information in JSON format. For example,
-here is the JSON for a file with one documented item and one undocumented item:
+1. These items aren't accounted by default:
+  * struct/union field
+  * enum variant
+  * constant
+  * static
+  * typedef
+2. If one of the previously listed items has a code example, then it'll be counted.
+
+#### JSON output
+
+When using `--output-format json` with this option, it will display the coverage information in
+JSON format. For example, here is the JSON for a file with one documented item and one
+undocumented item:
 
 ```rust
 /// This item has documentation
@@ -387,10 +408,16 @@ pub fn no_documentation() {}
 
 Note that the third item is the crate root, which in this case is undocumented.
 
-When not using `--show-coverage`, `--output-format json` emits documentation in the experimental
+### `-w`/`--output-format`: output format
+
+`--output-format json` emits documentation in the experimental
 [JSON format](https://github.com/rust-lang/rfcs/pull/2963). `--output-format html` has no effect,
 and is also accepted on stable toolchains.
 
+It can also be used with `--show-coverage`. Take a look at its
+[documentation](#--show-coverage-get-statistics-about-code-documentation-coverage) for more
+information.
+
 ### `--enable-per-target-ignores`: allow `ignore-foo` style filters for doctests
 
 Using this flag looks like this:
@@ -441,39 +468,6 @@ $ rustdoc src/lib.rs -Z unstable-options --runtool valgrind
 
 Another use case would be to run a test inside an emulator, or through a Virtual Machine.
 
-### `--show-coverage`: get statistics about code documentation coverage
-
-This option allows you to get a nice overview over your code documentation coverage, including both
-doc-comments and code examples in the doc-comments. Example:
-
-```bash
-$ rustdoc src/lib.rs -Z unstable-options --show-coverage
-+-------------------------------------+------------+------------+------------+------------+
-| File                                | Documented | Percentage |   Examples | Percentage |
-+-------------------------------------+------------+------------+------------+------------+
-| lib.rs                              |          4 |     100.0% |          1 |      25.0% |
-+-------------------------------------+------------+------------+------------+------------+
-| Total                               |          4 |     100.0% |          1 |      25.0% |
-+-------------------------------------+------------+------------+------------+------------+
-```
-
-You can also use this option with the `--output-format` one:
-
-```bash
-$ rustdoc src/lib.rs -Z unstable-options --show-coverage --output-format json
-{"lib.rs":{"total":4,"with_docs":4,"total_examples":4,"with_examples":1}}
-```
-
-Calculating code examples follows these rules:
-
-1. These items aren't accounted by default:
-  * struct/union field
-  * enum variant
-  * constant
-  * static
-  * typedef
-2. If one of the previously listed items has a code example, then it'll be counted.
-
 ### `--with-examples`: include examples of uses of items as documentation
 
 This option, combined with `--scrape-examples-target-crate` and
diff --git a/src/doc/unstable-book/src/language-features/inline-const-pat.md b/src/doc/unstable-book/src/language-features/inline-const-pat.md
new file mode 100644 (file)
index 0000000..5f0f754
--- /dev/null
@@ -0,0 +1,24 @@
+# `inline_const_pat`
+
+The tracking issue for this feature is: [#76001]
+
+See also [`inline_const`](inline-const.md)
+
+------
+
+This feature allows you to use inline constant expressions in pattern position:
+
+```rust
+#![feature(inline_const_pat)]
+
+const fn one() -> i32 { 1 }
+
+let some_int = 3;
+match some_int {
+    const { 1 + 2 } => println!("Matched 1 + 2"),
+    const { one() } => println!("Matched const fn returning 1"),
+    _ => println!("Didn't match anything :("),
+}
+```
+
+[#76001]: https://github.com/rust-lang/rust/issues/76001
index 00e1c79ca3ff39bf7de34f33a4d0f0e0f25215b3..7be70eed6cedc534144e360fe86db86693011d0d 100644 (file)
@@ -2,6 +2,8 @@
 
 The tracking issue for this feature is: [#76001]
 
+See also [`inline_const_pat`](inline-const-pat.md)
+
 ------
 
 This feature allows you to use inline constant expressions. For example, you can
@@ -27,19 +29,4 @@ fn main() {
 }
 ```
 
-You can also use inline constant expressions in patterns:
-
-```rust
-#![feature(inline_const)]
-
-const fn one() -> i32 { 1 }
-
-let some_int = 3;
-match some_int {
-    const { 1 + 2 } => println!("Matched 1 + 2"),
-    const { one() } => println!("Matched const fn returning 1"),
-    _ => println!("Didn't match anything :("),
-}
-```
-
 [#76001]: https://github.com/rust-lang/rust/issues/76001
index 4a8a316037961fcd056d0aa7b91e876bb24471b0..d4bf93bb40931178d5236796ed61fdefefa3d316 100644 (file)
@@ -229,6 +229,7 @@ fn build_external_function(cx: &mut DocContext<'_>, did: DefId) -> clean::Functi
     let asyncness = cx.tcx.asyncness(did);
     let predicates = cx.tcx.predicates_of(did);
     let (generics, decl) = clean::enter_impl_trait(cx, |cx| {
+        // NOTE: generics need to be cleaned before the decl!
         ((cx.tcx.generics_of(did), predicates).clean(cx), (did, sig).clean(cx))
     });
     clean::Function {
@@ -592,14 +593,9 @@ fn build_macro(
     match CStore::from_tcx(cx.tcx).load_macro_untracked(def_id, cx.sess()) {
         LoadedMacro::MacroDef(item_def, _) => {
             if let ast::ItemKind::MacroDef(ref def) = item_def.kind {
+                let vis = cx.tcx.visibility(import_def_id.unwrap_or(def_id)).clean(cx);
                 clean::MacroItem(clean::Macro {
-                    source: utils::display_macro_source(
-                        cx,
-                        name,
-                        def,
-                        def_id,
-                        cx.tcx.visibility(import_def_id.unwrap_or(def_id)),
-                    ),
+                    source: utils::display_macro_source(cx, name, def, def_id, vis),
                 })
             } else {
                 unreachable!()
index 70401065689834baff8bce7b4e0aedd31c47ec68..de1293cd96dfc0160a4c419ae380627bb8a500ff 100644 (file)
@@ -109,7 +109,10 @@ fn clean(&self, cx: &mut DocContext<'_>) -> GenericBound {
                 };
 
                 GenericBound::TraitBound(
-                    PolyTrait { trait_: (trait_ref, &*bindings).clean(cx), generic_params: vec![] },
+                    PolyTrait {
+                        trait_: (trait_ref, &bindings[..]).clean(cx),
+                        generic_params: vec![],
+                    },
                     hir::TraitBoundModifier::None,
                 )
             }
@@ -456,9 +459,7 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Generics {
         // scans them first.
         fn is_impl_trait(param: &hir::GenericParam<'_>) -> bool {
             match param.kind {
-                hir::GenericParamKind::Type { synthetic, .. } => {
-                    synthetic == Some(hir::SyntheticTyParamKind::ImplTrait)
-                }
+                hir::GenericParamKind::Type { synthetic, .. } => synthetic,
                 _ => false,
             }
         }
@@ -557,7 +558,7 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Generics {
                         assert_eq!(param.index, 0);
                         return None;
                     }
-                    if synthetic == Some(hir::SyntheticTyParamKind::ImplTrait) {
+                    if synthetic {
                         impl_trait.insert(param.index.into(), vec![]);
                         return None;
                     }
@@ -761,8 +762,13 @@ fn clean_fn_or_proc_macro(
 
 impl<'a> Clean<Function> for (&'a hir::FnSig<'a>, &'a hir::Generics<'a>, hir::BodyId) {
     fn clean(&self, cx: &mut DocContext<'_>) -> Function {
-        let (generics, decl) =
-            enter_impl_trait(cx, |cx| (self.1.clean(cx), (&*self.0.decl, self.2).clean(cx)));
+        let (generics, decl) = enter_impl_trait(cx, |cx| {
+            // NOTE: generics must be cleaned before args
+            let generics = self.1.clean(cx);
+            let args = (self.0.decl.inputs, self.2).clean(cx);
+            let decl = clean_fn_decl_with_args(cx, self.0.decl, args);
+            (generics, decl)
+        });
         Function { decl, generics, header: self.0.header }
     }
 }
@@ -804,17 +810,12 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Arguments {
     }
 }
 
-impl<'a, A: Copy> Clean<FnDecl> for (&'a hir::FnDecl<'a>, A)
-where
-    (&'a [hir::Ty<'a>], A): Clean<Arguments>,
-{
-    fn clean(&self, cx: &mut DocContext<'_>) -> FnDecl {
-        FnDecl {
-            inputs: (self.0.inputs, self.1).clean(cx),
-            output: self.0.output.clean(cx),
-            c_variadic: self.0.c_variadic,
-        }
-    }
+fn clean_fn_decl_with_args(
+    cx: &mut DocContext<'_>,
+    decl: &hir::FnDecl<'_>,
+    args: Arguments,
+) -> FnDecl {
+    FnDecl { inputs: args, output: decl.output.clean(cx), c_variadic: decl.c_variadic }
 }
 
 impl<'tcx> Clean<FnDecl> for (DefId, ty::PolyFnSig<'tcx>) {
@@ -894,7 +895,11 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Item {
                 }
                 hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Required(names)) => {
                     let (generics, decl) = enter_impl_trait(cx, |cx| {
-                        (self.generics.clean(cx), (sig.decl, names).clean(cx))
+                        // NOTE: generics must be cleaned before args
+                        let generics = self.generics.clean(cx);
+                        let args = (sig.decl.inputs, names).clean(cx);
+                        let decl = clean_fn_decl_with_args(cx, sig.decl, args);
+                        (generics, decl)
                     });
                     let mut t = Function { header: sig.header, decl, generics };
                     if t.header.constness == hir::Constness::Const
@@ -1560,45 +1565,37 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Constant {
 
 impl Clean<Item> for hir::FieldDef<'_> {
     fn clean(&self, cx: &mut DocContext<'_>) -> Item {
-        let what_rustc_thinks = Item::from_hir_id_and_parts(
-            self.hir_id,
-            Some(self.ident.name),
-            StructFieldItem(self.ty.clean(cx)),
-            cx,
-        );
-        // Don't show `pub` for fields on enum variants; they are always public
-        Item { visibility: self.vis.clean(cx), ..what_rustc_thinks }
+        let def_id = cx.tcx.hir().local_def_id(self.hir_id).to_def_id();
+        clean_field(def_id, self.ident.name, self.ty.clean(cx), cx)
     }
 }
 
 impl Clean<Item> for ty::FieldDef {
     fn clean(&self, cx: &mut DocContext<'_>) -> Item {
-        let what_rustc_thinks = Item::from_def_id_and_parts(
-            self.did,
-            Some(self.ident.name),
-            StructFieldItem(cx.tcx.type_of(self.did).clean(cx)),
-            cx,
-        );
-        // Don't show `pub` for fields on enum variants; they are always public
-        Item { visibility: self.vis.clean(cx), ..what_rustc_thinks }
+        clean_field(self.did, self.ident.name, cx.tcx.type_of(self.did).clean(cx), cx)
     }
 }
 
-impl Clean<Visibility> for hir::Visibility<'_> {
-    fn clean(&self, cx: &mut DocContext<'_>) -> Visibility {
-        match self.node {
-            hir::VisibilityKind::Public => Visibility::Public,
-            hir::VisibilityKind::Inherited => Visibility::Inherited,
-            hir::VisibilityKind::Crate(_) => {
-                let krate = DefId::local(CRATE_DEF_INDEX);
-                Visibility::Restricted(krate)
-            }
-            hir::VisibilityKind::Restricted { ref path, .. } => {
-                let path = path.clean(cx);
-                let did = register_res(cx, path.res);
-                Visibility::Restricted(did)
-            }
-        }
+fn clean_field(def_id: DefId, name: Symbol, ty: Type, cx: &mut DocContext<'_>) -> Item {
+    let what_rustc_thinks =
+        Item::from_def_id_and_parts(def_id, Some(name), StructFieldItem(ty), cx);
+    if is_field_vis_inherited(cx.tcx, def_id) {
+        // Variant fields inherit their enum's visibility.
+        Item { visibility: Visibility::Inherited, ..what_rustc_thinks }
+    } else {
+        what_rustc_thinks
+    }
+}
+
+fn is_field_vis_inherited(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
+    let parent = tcx
+        .parent(def_id)
+        .expect("is_field_vis_inherited can only be called on struct or variant fields");
+    match tcx.def_kind(parent) {
+        DefKind::Struct | DefKind::Union => false,
+        DefKind::Variant => true,
+        // FIXME: what about DefKind::Ctor?
+        parent_kind => panic!("unexpected parent kind: {:?}", parent_kind),
     }
 }
 
@@ -1609,8 +1606,7 @@ fn clean(&self, _cx: &mut DocContext<'_>) -> Visibility {
             // NOTE: this is not quite right: `ty` uses `Invisible` to mean 'private',
             // while rustdoc really does mean inherited. That means that for enum variants, such as
             // `pub enum E { V }`, `V` will be marked as `Public` by `ty`, but as `Inherited` by rustdoc.
-            // This is the main reason `impl Clean for hir::Visibility` still exists; various parts of clean
-            // override `tcx.visibility` explicitly to make sure this distinction is captured.
+            // Various parts of clean override `tcx.visibility` explicitly to make sure this distinction is captured.
             ty::Visibility::Invisible => Visibility::Inherited,
             ty::Visibility::Restricted(module) => Visibility::Restricted(module),
         }
@@ -1637,39 +1633,18 @@ impl Clean<Item> for ty::VariantDef {
     fn clean(&self, cx: &mut DocContext<'_>) -> Item {
         let kind = match self.ctor_kind {
             CtorKind::Const => Variant::CLike,
-            CtorKind::Fn => Variant::Tuple(
-                self.fields
-                    .iter()
-                    .map(|field| {
-                        let name = Some(field.ident.name);
-                        let kind = StructFieldItem(cx.tcx.type_of(field.did).clean(cx));
-                        let what_rustc_thinks =
-                            Item::from_def_id_and_parts(field.did, name, kind, cx);
-                        // don't show `pub` for fields, which are always public
-                        Item { visibility: Visibility::Inherited, ..what_rustc_thinks }
-                    })
-                    .collect(),
-            ),
+            CtorKind::Fn => {
+                Variant::Tuple(self.fields.iter().map(|field| field.clean(cx)).collect())
+            }
             CtorKind::Fictive => Variant::Struct(VariantStruct {
                 struct_type: CtorKind::Fictive,
                 fields_stripped: false,
-                fields: self
-                    .fields
-                    .iter()
-                    .map(|field| {
-                        let name = Some(field.ident.name);
-                        let kind = StructFieldItem(cx.tcx.type_of(field.did).clean(cx));
-                        let what_rustc_thinks =
-                            Item::from_def_id_and_parts(field.did, name, kind, cx);
-                        // don't show `pub` for fields, which are always public
-                        Item { visibility: Visibility::Inherited, ..what_rustc_thinks }
-                    })
-                    .collect(),
+                fields: self.fields.iter().map(|field| field.clean(cx)).collect(),
             }),
         };
         let what_rustc_thinks =
             Item::from_def_id_and_parts(self.def_id, Some(self.ident.name), VariantItem(kind), cx);
-        // don't show `pub` for fields, which are always public
+        // don't show `pub` for variants, which always inherit visibility
         Item { visibility: Inherited, ..what_rustc_thinks }
     }
 }
@@ -1727,8 +1702,10 @@ fn clean(&self, cx: &mut DocContext<'_>) -> PathSegment {
 impl Clean<BareFunctionDecl> for hir::BareFnTy<'_> {
     fn clean(&self, cx: &mut DocContext<'_>) -> BareFunctionDecl {
         let (generic_params, decl) = enter_impl_trait(cx, |cx| {
+            // NOTE: generics must be cleaned before args
             let generic_params = self.generic_params.iter().map(|x| x.clean(cx)).collect();
-            let decl = (self.decl, self.param_names).clean(cx);
+            let args = (self.decl.inputs, self.param_names).clean(cx);
+            let decl = clean_fn_decl_with_args(cx, self.decl, args);
             (generic_params, decl)
         });
         BareFunctionDecl { unsafety: self.unsafety, abi: self.abi, decl, generic_params }
@@ -1792,9 +1769,12 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Vec<Item> {
                 ItemKind::Fn(ref sig, ref generics, body_id) => {
                     clean_fn_or_proc_macro(item, sig, generics, body_id, &mut name, cx)
                 }
-                ItemKind::Macro(ref macro_def) => MacroItem(Macro {
-                    source: display_macro_source(cx, name, macro_def, def_id, item.vis),
-                }),
+                ItemKind::Macro(ref macro_def) => {
+                    let ty_vis = cx.tcx.visibility(def_id).clean(cx);
+                    MacroItem(Macro {
+                        source: display_macro_source(cx, name, macro_def, def_id, ty_vis),
+                    })
+                }
                 ItemKind::Trait(is_auto, unsafety, ref generics, bounds, item_ids) => {
                     let items = item_ids
                         .iter()
@@ -1881,7 +1861,8 @@ fn clean_extern_crate(
     // this is the ID of the crate itself
     let crate_def_id = DefId { krate: cnum, index: CRATE_DEF_INDEX };
     let attrs = cx.tcx.hir().attrs(krate.hir_id());
-    let please_inline = cx.tcx.visibility(krate.def_id).is_public()
+    let ty_vis = cx.tcx.visibility(krate.def_id);
+    let please_inline = ty_vis.is_public()
         && attrs.iter().any(|a| {
             a.has_name(sym::doc)
                 && match a.meta_item_list() {
@@ -1913,7 +1894,7 @@ fn clean_extern_crate(
         name: Some(name),
         attrs: box attrs.clean(cx),
         def_id: crate_def_id.into(),
-        visibility: krate.vis.clean(cx),
+        visibility: ty_vis.clean(cx),
         kind: box ExternCrateItem { src: orig_name },
         cfg: attrs.cfg(cx.tcx, &cx.cache.hidden_cfg),
     }]
@@ -1938,8 +1919,20 @@ fn clean_use_statement(
     let inline_attr = attrs.lists(sym::doc).get_word_attr(sym::inline);
     let pub_underscore = visibility.is_public() && name == kw::Underscore;
     let current_mod = cx.tcx.parent_module_from_def_id(import.def_id);
+
+    // The parent of the module in which this import resides. This
+    // is the same as `current_mod` if that's already the top
+    // level module.
     let parent_mod = cx.tcx.parent_module_from_def_id(current_mod);
 
+    // This checks if the import can be seen from a higher level module.
+    // In other words, it checks if the visibility is the equivalent of
+    // `pub(super)` or higher. If the current module is the top level
+    // module, there isn't really a parent module, which makes the results
+    // meaningless. In this case, we make sure the answer is `false`.
+    let is_visible_from_parent_mod = visibility.is_accessible_from(parent_mod.to_def_id(), cx.tcx)
+        && !current_mod.is_top_level_module();
+
     if pub_underscore {
         if let Some(ref inline) = inline_attr {
             rustc_errors::struct_span_err!(
@@ -1958,8 +1951,7 @@ fn clean_use_statement(
     // #[doc(no_inline)] attribute is present.
     // Don't inline doc(hidden) imports so they can be stripped at a later stage.
     let mut denied = !(visibility.is_public()
-        || (cx.render_options.document_private
-            && visibility.is_accessible_from(parent_mod.to_def_id(), cx.tcx)))
+        || (cx.render_options.document_private && is_visible_from_parent_mod))
         || pub_underscore
         || attrs.iter().any(|a| {
             a.has_name(sym::doc)
@@ -2029,8 +2021,13 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Item {
             let kind = match item.kind {
                 hir::ForeignItemKind::Fn(decl, names, ref generics) => {
                     let abi = cx.tcx.hir().get_foreign_abi(item.hir_id());
-                    let (generics, decl) =
-                        enter_impl_trait(cx, |cx| (generics.clean(cx), (decl, names).clean(cx)));
+                    let (generics, decl) = enter_impl_trait(cx, |cx| {
+                        // NOTE: generics must be cleaned before args
+                        let generics = generics.clean(cx);
+                        let args = (decl.inputs, names).clean(cx);
+                        let decl = clean_fn_decl_with_args(cx, decl, args);
+                        (generics, decl)
+                    });
                     ForeignFunctionItem(Function {
                         decl,
                         generics,
index 2dba52afcd9cd847203c001024e4cb157dc7aafa..d28f3ce87785bb9f1bd30f403fb3dda91dc5e25b 100644 (file)
@@ -117,7 +117,6 @@ fn from(id: DefId) -> Self {
 #[derive(Clone, Debug)]
 crate struct Crate {
     crate module: Item,
-    crate externs: Vec<ExternalCrate>,
     crate primitives: ThinVec<(DefId, PrimitiveType)>,
     /// Only here so that they can be filtered through the rustdoc passes.
     crate external_traits: Rc<RefCell<FxHashMap<DefId, TraitWithExtraInfo>>>,
@@ -126,7 +125,7 @@ fn from(id: DefId) -> Self {
 
 // `Crate` is frequently moved by-value. Make sure it doesn't unintentionally get bigger.
 #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-rustc_data_structures::static_assert_size!(Crate, 104);
+rustc_data_structures::static_assert_size!(Crate, 80);
 
 impl Crate {
     crate fn name(&self, tcx: TyCtxt<'_>) -> Symbol {
@@ -906,7 +905,6 @@ fn get_word_attr(mut self, word: Symbol) -> Option<ast::NestedMetaItem> {
 /// kept separate because of issue #42760.
 #[derive(Clone, PartialEq, Eq, Debug, Hash)]
 crate struct DocFragment {
-    crate line: usize,
     crate span: rustc_span::Span,
     /// The module this doc-comment came from.
     ///
@@ -919,6 +917,10 @@ fn get_word_attr(mut self, word: Symbol) -> Option<ast::NestedMetaItem> {
     crate indent: usize,
 }
 
+// `DocFragment` is used a lot. Make sure it doesn't unintentionally get bigger.
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
+rustc_data_structures::static_assert_size!(DocFragment, 32);
+
 #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
 crate enum DocFragmentKind {
     /// A doc fragment created from a `///` or `//!` doc comment.
@@ -1027,7 +1029,6 @@ impl Attributes {
         additional_attrs: Option<(&[ast::Attribute], DefId)>,
     ) -> Attributes {
         let mut doc_strings: Vec<DocFragment> = vec![];
-        let mut doc_line = 0;
 
         fn update_need_backline(doc_strings: &mut Vec<DocFragment>) {
             if let Some(prev) = doc_strings.last_mut() {
@@ -1045,10 +1046,7 @@ fn update_need_backline(doc_strings: &mut Vec<DocFragment>) {
                     DocFragmentKind::RawDoc
                 };
 
-                let line = doc_line;
-                doc_line += value.as_str().lines().count();
                 let frag = DocFragment {
-                    line,
                     span: attr.span,
                     doc: value,
                     kind,
@@ -1115,7 +1113,7 @@ fn update_need_backline(doc_strings: &mut Vec<DocFragment>) {
         if self.doc_strings.is_empty() { None } else { Some(self.doc_strings.iter().collect()) }
     }
 
-    crate fn get_doc_aliases(&self) -> Box<[String]> {
+    crate fn get_doc_aliases(&self) -> Box<[Symbol]> {
         let mut aliases = FxHashSet::default();
 
         for attr in self.other_attrs.lists(sym::doc).filter(|a| a.has_name(sym::alias)) {
@@ -1123,16 +1121,16 @@ fn update_need_backline(doc_strings: &mut Vec<DocFragment>) {
                 for l in values {
                     match l.literal().unwrap().kind {
                         ast::LitKind::Str(s, _) => {
-                            aliases.insert(s.as_str().to_string());
+                            aliases.insert(s);
                         }
                         _ => unreachable!(),
                     }
                 }
             } else {
-                aliases.insert(attr.value_str().map(|s| s.to_string()).unwrap());
+                aliases.insert(attr.value_str().unwrap());
             }
         }
-        aliases.into_iter().collect::<Vec<String>>().into()
+        aliases.into_iter().collect::<Vec<_>>().into()
     }
 }
 
@@ -1238,20 +1236,9 @@ impl WherePredicate {
 
 #[derive(Clone, PartialEq, Eq, Debug, Hash)]
 crate enum GenericParamDefKind {
-    Lifetime {
-        outlives: Vec<Lifetime>,
-    },
-    Type {
-        did: DefId,
-        bounds: Vec<GenericBound>,
-        default: Option<Box<Type>>,
-        synthetic: Option<hir::SyntheticTyParamKind>,
-    },
-    Const {
-        did: DefId,
-        ty: Box<Type>,
-        default: Option<Box<String>>,
-    },
+    Lifetime { outlives: Vec<Lifetime> },
+    Type { did: DefId, bounds: Vec<GenericBound>, default: Option<Box<Type>>, synthetic: bool },
+    Const { did: DefId, ty: Box<Type>, default: Option<Box<String>> },
 }
 
 impl GenericParamDefKind {
@@ -1285,7 +1272,7 @@ impl GenericParamDef {
     crate fn is_synthetic_type_param(&self) -> bool {
         match self.kind {
             GenericParamDefKind::Lifetime { .. } | GenericParamDefKind::Const { .. } => false,
-            GenericParamDefKind::Type { ref synthetic, .. } => synthetic.is_some(),
+            GenericParamDefKind::Type { synthetic, .. } => synthetic,
         }
     }
 
index 2fa7efcc6509b143e69b5192d06cf4bf8d507669..110322112364c15f0668d66a80cf90296de91014 100644 (file)
@@ -7,6 +7,7 @@
 };
 use crate::core::DocContext;
 use crate::formats::item_type::ItemType;
+use crate::visit_lib::LibEmbargoVisitor;
 
 use rustc_ast as ast;
 use rustc_ast::tokenstream::TokenTree;
 mod tests;
 
 crate fn krate(cx: &mut DocContext<'_>) -> Crate {
-    use crate::visit_lib::LibEmbargoVisitor;
-
     let module = crate::visit_ast::RustdocVisitor::new(cx).visit();
 
-    let mut externs = Vec::new();
     for &cnum in cx.tcx.crates(()) {
-        externs.push(ExternalCrate { crate_num: cnum });
         // Analyze doc-reachability for extern items
         LibEmbargoVisitor::new(cx).visit_lib(cnum);
     }
         }));
     }
 
-    Crate {
-        module,
-        externs,
-        primitives,
-        external_traits: cx.external_traits.clone(),
-        collapsed: false,
-    }
+    Crate { module, primitives, external_traits: cx.external_traits.clone(), collapsed: false }
 }
 
 fn external_generic_args(
@@ -529,7 +520,7 @@ pub(super) fn display_macro_source(
     name: Symbol,
     def: &ast::MacroDef,
     def_id: DefId,
-    vis: impl Clean<Visibility>,
+    vis: Visibility,
 ) -> String {
     let tts: Vec<_> = def.body.inner_tokens().into_trees().collect();
     // Extract the spans of all matchers. They represent the "interface" of the macro.
@@ -538,8 +529,6 @@ pub(super) fn display_macro_source(
     if def.macro_rules {
         format!("macro_rules! {} {{\n{}}}", name, render_macro_arms(matchers, ";"))
     } else {
-        let vis = vis.clean(cx);
-
         if matchers.len() <= 1 {
             format!(
                 "{}macro {}{} {{\n    ...\n}}",
index a331f4cf3e6e7c6e48e015ad67409019d07a6b65..c58310947d2825e934acdbb9148a10c41f968482 100644 (file)
@@ -508,14 +508,12 @@ fn report_deprecated_attr(name: &str, diag: &rustc_errors::Handler, sp: Span) {
         rustc_errors::FatalError.raise();
     }
 
-    let render_options = ctxt.render_options;
-    let mut cache = ctxt.cache;
-    krate = tcx.sess.time("create_format_cache", || cache.populate(krate, tcx, &render_options));
+    krate = tcx.sess.time("create_format_cache", || Cache::populate(&mut ctxt, krate));
 
     // The main crate doc comments are always collapsed.
     krate.collapsed = true;
 
-    (krate, render_options, cache)
+    (krate, ctxt.render_options, ctxt.cache)
 }
 
 /// Due to <https://github.com/rust-lang/rust/pull/73566>,
index 302fc5a677771ffe6b7957cdc512cbcf31815f18..6ed911b8d24099ff4cf3e1dc2079a734df6a08e8 100644 (file)
@@ -8,13 +8,13 @@
 
 #[derive(Clone, Debug, Serialize)]
 crate struct ExternalHtml {
-    /// Content that will be included inline in the <head> section of a
+    /// Content that will be included inline in the `<head>` section of a
     /// rendered Markdown file or generated documentation
     crate in_header: String,
-    /// Content that will be included inline between <body> and the content of
+    /// Content that will be included inline between `<body>` and the content of
     /// a rendered Markdown file or generated documentation
     crate before_content: String,
-    /// Content that will be included inline between the content and </body> of
+    /// Content that will be included inline between the content and `</body>` of
     /// a rendered Markdown file or generated documentation
     crate after_content: String,
 }
index 05d8b643f502b5e6fa2ecd3d9d37420838ba0c42..db2b836de86e459b8b318425e5bb952418304094 100644 (file)
@@ -6,8 +6,8 @@
 use rustc_middle::ty::TyCtxt;
 use rustc_span::symbol::sym;
 
-use crate::clean::{self, ItemId, PrimitiveType};
-use crate::config::RenderOptions;
+use crate::clean::{self, ExternalCrate, ItemId, PrimitiveType};
+use crate::core::DocContext;
 use crate::fold::DocFolder;
 use crate::formats::item_type::ItemType;
 use crate::formats::Impl;
@@ -136,46 +136,47 @@ impl Cache {
 
     /// Populates the `Cache` with more data. The returned `Crate` will be missing some data that was
     /// in `krate` due to the data being moved into the `Cache`.
-    crate fn populate(
-        &mut self,
-        mut krate: clean::Crate,
-        tcx: TyCtxt<'_>,
-        render_options: &RenderOptions,
-    ) -> clean::Crate {
+    crate fn populate(cx: &mut DocContext<'_>, mut krate: clean::Crate) -> clean::Crate {
+        let tcx = cx.tcx;
+
         // Crawl the crate to build various caches used for the output
-        debug!(?self.crate_version);
-        self.traits = krate.external_traits.take();
-        let RenderOptions { extern_html_root_takes_precedence, output: dst, .. } = render_options;
+        debug!(?cx.cache.crate_version);
+        cx.cache.traits = krate.external_traits.take();
 
         // Cache where all our extern crates are located
         // FIXME: this part is specific to HTML so it'd be nice to remove it from the common code
-        for &e in &krate.externs {
+        for &crate_num in cx.tcx.crates(()) {
+            let e = ExternalCrate { crate_num };
+
             let name = e.name(tcx);
+            let render_options = &cx.render_options;
             let extern_url =
                 render_options.extern_html_root_urls.get(&*name.as_str()).map(|u| &**u);
-            let location = e.location(extern_url, *extern_html_root_takes_precedence, dst, tcx);
-            self.extern_locations.insert(e.crate_num, location);
-            self.external_paths.insert(e.def_id(), (vec![name.to_string()], ItemType::Module));
+            let extern_url_takes_precedence = render_options.extern_html_root_takes_precedence;
+            let dst = &render_options.output;
+            let location = e.location(extern_url, extern_url_takes_precedence, dst, tcx);
+            cx.cache.extern_locations.insert(e.crate_num, location);
+            cx.cache.external_paths.insert(e.def_id(), (vec![name.to_string()], ItemType::Module));
         }
 
         // FIXME: avoid this clone (requires implementing Default manually)
-        self.primitive_locations = PrimitiveType::primitive_locations(tcx).clone();
-        for (prim, &def_id) in &self.primitive_locations {
+        cx.cache.primitive_locations = PrimitiveType::primitive_locations(tcx).clone();
+        for (prim, &def_id) in &cx.cache.primitive_locations {
             let crate_name = tcx.crate_name(def_id.krate);
             // Recall that we only allow primitive modules to be at the root-level of the crate.
             // If that restriction is ever lifted, this will have to include the relative paths instead.
-            self.external_paths.insert(
+            cx.cache.external_paths.insert(
                 def_id,
                 (vec![crate_name.to_string(), prim.as_sym().to_string()], ItemType::Primitive),
             );
         }
 
-        krate = CacheBuilder { tcx, cache: self }.fold_crate(krate);
+        krate = CacheBuilder { tcx, cache: &mut cx.cache }.fold_crate(krate);
 
-        for (trait_did, dids, impl_) in self.orphan_trait_impls.drain(..) {
-            if self.traits.contains_key(&trait_did) {
+        for (trait_did, dids, impl_) in cx.cache.orphan_trait_impls.drain(..) {
+            if cx.cache.traits.contains_key(&trait_did) {
                 for did in dids {
-                    self.impls.entry(did).or_default().push(impl_.clone());
+                    cx.cache.impls.entry(did).or_default().push(impl_.clone());
                 }
             }
         }
index 47772651bf9b9e92defd25a9ea1d0b8e32504228..d811c85ea58d1df2ac9ba658241d0431d1f9c3b5 100644 (file)
@@ -656,7 +656,7 @@ fn new(iter: I) -> Self {
     }
 
     fn get_entry(&mut self, key: &str) -> &mut (Vec<Event<'a>>, u16) {
-        let new_id = self.footnotes.keys().count() + 1;
+        let new_id = self.footnotes.len() + 1;
         let key = key.to_owned();
         self.footnotes.entry(key).or_insert((Vec::new(), new_id as u16))
     }
index 0286d2a4c8128599e1f72b8a9c89897fa03c0350..9aa69d94215ded7281c96f0fb1a33c3dbade33eb 100644 (file)
@@ -70,7 +70,7 @@
     // Set up alias indexes.
     for (i, item) in search_index.iter().enumerate() {
         for alias in &item.aliases[..] {
-            aliases.entry(alias.to_lowercase()).or_insert_with(Vec::new).push(i);
+            aliases.entry(alias.as_str().to_lowercase()).or_default().push(i);
         }
     }
 
index dd592de41bd6c142c98f40828f001f3d239ea483..ffd09663f8240700efe2c005ecf64a815700c283 100644 (file)
     crate parent: Option<DefId>,
     crate parent_idx: Option<usize>,
     crate search_type: Option<IndexItemFunctionType>,
-    crate aliases: Box<[String]>,
+    crate aliases: Box<[Symbol]>,
 }
 
 /// A type used for the search index.
index 7ef773fe5ff29dde2338ef963426cb4d5b2b419f..049d17a4b477af36e53639465ab24202beebbd9e 100644 (file)
@@ -1080,7 +1080,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
                 cx.derive_id(format!("{}.{}", ItemType::Variant, variant.name.as_ref().unwrap()));
             write!(
                 w,
-                "<div id=\"{id}\" class=\"variant small-section-header\">\
+                "<h3 id=\"{id}\" class=\"variant small-section-header\">\
                     <a href=\"#{id}\" class=\"anchor field\"></a>\
                     <code>{name}",
                 id = id,
@@ -1093,9 +1093,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
             }
             w.write_str("</code>");
             render_stability_since(w, variant, it, cx.tcx());
-            w.write_str("</div>");
-            document(w, cx, variant, Some(it), HeadingOffset::H3);
-            document_non_exhaustive(w, variant);
+            w.write_str("</h3>");
 
             use crate::clean::Variant;
             if let Some((extra, fields)) = match *variant.kind {
@@ -1109,12 +1107,8 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
                     variant.name.as_ref().unwrap()
                 ));
                 write!(w, "<div class=\"sub-variant\" id=\"{id}\">", id = variant_id);
-                write!(
-                    w,
-                    "<h3>{extra}Fields of <b>{name}</b></h3><div>",
-                    extra = extra,
-                    name = variant.name.as_ref().unwrap(),
-                );
+                write!(w, "<h4>{extra}Fields</h4>", extra = extra,);
+                document_non_exhaustive(w, variant);
                 for field in fields {
                     match *field.kind {
                         clean::StrippedItem(box clean::StructFieldItem(_)) => {}
@@ -1126,7 +1120,8 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
                             ));
                             write!(
                                 w,
-                                "<span id=\"{id}\" class=\"variant small-section-header\">\
+                                "<div class=\"sub-variant-field\">\
+                                 <span id=\"{id}\" class=\"variant small-section-header\">\
                                     <a href=\"#{id}\" class=\"anchor field\"></a>\
                                     <code>{f}:&nbsp;{t}</code>\
                                 </span>",
@@ -1134,13 +1129,16 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
                                 f = field.name.as_ref().unwrap(),
                                 t = ty.print(cx)
                             );
-                            document(w, cx, field, Some(variant), HeadingOffset::H4);
+                            document(w, cx, field, Some(variant), HeadingOffset::H5);
+                            write!(w, "</div>");
                         }
                         _ => unreachable!(),
                     }
                 }
-                w.write_str("</div></div>");
+                w.write_str("</div>");
             }
+
+            document(w, cx, variant, Some(it), HeadingOffset::H4);
         }
     }
     let def_id = it.def_id.expect_def_id();
index 89a763ef6d707fbf79a7117e261c4f4102230e74..27f9c183b8e6fee701faf538e17eb7a341986f82 100644 (file)
@@ -199,7 +199,6 @@ h1, h2, h3, h4, h5, h6,
 div.item-list .out-of-band, span.since,
 #source-sidebar, #sidebar-toggle,
 details.rustdoc-toggle > summary::before,
-details.undocumented > summary::before,
 div.impl-items > div:not(.docblock):not(.item-info),
 .content ul.crate a.crate, a.srclink,
 /* This selector is for the items listed in the "all items" page. */
@@ -303,7 +302,7 @@ nav.sub {
        left: 0;
        top: 0;
        bottom: 0;
-       overflow: auto;
+       overflow-y: scroll;
 }
 
 /* Improve the scrollbar display on firefox */
@@ -1079,10 +1078,6 @@ a.test-arrow:hover{
        text-decoration: none;
 }
 
-.section-header a {
-       color: inherit;
-}
-
 .code-attribute {
        font-weight: 300;
 }
@@ -1102,25 +1097,28 @@ a.test-arrow:hover{
        margin-right: 5px;
 }
 
-.sub-variant, .sub-variant > h3 {
-       margin-top: 0px !important;
-       padding-top: 1px;
+h3.variant {
+       font-weight: 600;
+       font-size: 1.1em;
+       margin-bottom: 10px;
+       border-bottom: none;
 }
 
-#main .sub-variant > h3 {
-       font-size: 15px;
-       margin-left: 25px;
-       margin-bottom: 5px;
+.sub-variant h4 {
+       font-size: 1em;
+       font-weight: 400;
+       border-bottom: none;
+       margin-top: 0;
+       margin-bottom: 0;
 }
 
-.sub-variant > div {
-       margin-left: 20px;
-       margin-bottom: 10px;
+.sub-variant {
+       margin-left: 24px;
+       margin-bottom: 40px;
 }
 
-.sub-variant > div > span {
-       display: block;
-       position: relative;
+.sub-variant > .sub-variant-field {
+       margin-left: 24px;
 }
 
 .toggle-label {
@@ -1520,13 +1518,11 @@ details.rustdoc-toggle > summary.hideme {
        cursor: pointer;
 }
 
-details.rustdoc-toggle > summary, details.undocumented > summary {
+details.rustdoc-toggle > summary {
        list-style: none;
 }
 details.rustdoc-toggle > summary::-webkit-details-marker,
-details.rustdoc-toggle > summary::marker,
-details.undocumented > summary::-webkit-details-marker,
-details.undocumented > summary::marker {
+details.rustdoc-toggle > summary::marker {
        display: none;
 }
 
@@ -1588,8 +1584,7 @@ details.rustdoc-toggle > summary:not(.hideme)::before {
        top: 3px;
 }
 
-.impl-items > details.rustdoc-toggle > summary:not(.hideme)::before,
-.undocumented > details.rustdoc-toggle > summary:not(.hideme)::before {
+.impl-items > details.rustdoc-toggle > summary:not(.hideme)::before {
        position: absolute;
        left: -24px;
 }
@@ -1603,7 +1598,7 @@ details.rustdoc-toggle[open] > summary.hideme {
        position: absolute;
 }
 
-details.rustdoc-toggle, details.undocumented {
+details.rustdoc-toggle {
        position: relative;
 }
 
@@ -1626,31 +1621,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
        content: "Collapse";
 }
 
-details.undocumented > summary::before {
-       padding-left: 17px;
-       height: max(17px, 1.1em);
-       background-repeat: no-repeat;
-       background-position: top left;
-       content: "Show hidden undocumented items";
-       cursor: pointer;
-       font-size: 16px;
-       font-weight: 300;
-       opacity: .5;
-}
-
-details.undocumented > summary:focus::before,
-details.undocumented > summary:hover::before {
-       opacity: 1;
-}
-
-details.undocumented[open] > summary::before {
-       padding-left: 17px;
-       height: max(17px, 1.1em);
-       background-repeat: no-repeat
-       background-position: top left;
-       content: "Hide undocumented items";
-}
-
 /* Media Queries */
 
 @media (min-width: 701px) {
index ba7fb3b5456a55425d76939bab0e56775f9da13e..85fb34b39595cfade58fc7e04caf26dd092d48b6 100644 (file)
@@ -70,11 +70,11 @@ pre, .rustdoc.source .example-wrap {
 
 /* Improve the scrollbar display on firefox */
 * {
-       scrollbar-color: #5c6773 transparent;
+       scrollbar-color: #5c6773 #24292f;
 }
 
 .sidebar {
-       scrollbar-color: #5c6773 transparent;
+       scrollbar-color: #5c6773 #24292f;
 }
 
 /* Improve the scrollbar display on webkit-based browsers */
@@ -214,18 +214,23 @@ nav.main .separator {
        border: 1px solid #5c6773;
 }
 a {
+       color: #39AFD7;
+}
+a.srclink,
+a#toggle-all-docs,
+#source-sidebar a,
+pre.rust a,
+.sidebar a,
+.in-band a {
        color: #c5c5c5;
 }
+.search-results a {
+       color: #0096cf;
+}
 body.source .example-wrap pre.rust a {
        background: #333;
 }
 
-.docblock:not(.item-decl) a:not(.srclink):not(.test-arrow),
-.docblock-short a:not(.srclink):not(.test-arrow), .item-info a,
-#help a {
-       color: #39AFD7;
-}
-
 details.rustdoc-toggle > summary.hideme > span,
 details.rustdoc-toggle > summary::before,
 details.undocumented > summary::before {
index 77ac217e6f41dd9f76efc9b9c298ab4bc38d2889..5a6c08bafd24062939ae1cc4507ef89d9a901796 100644 (file)
@@ -44,7 +44,7 @@ pre, .rustdoc.source .example-wrap {
        scrollbar-color: rgb(64, 65, 67) #717171;
 }
 .sidebar {
-       scrollbar-color: rgba(32,34,37,.6) transparent;
+       scrollbar-color: rgba(32,34,37,.6) #5a5a5a;
 }
 
 /* Improve the scrollbar display on webkit-based browsers */
@@ -174,22 +174,27 @@ nav.main .current {
 nav.main .separator {
        border-color: #eee;
 }
+
 a {
-       color: #ddd;
+       color: #D2991D;
 }
-body.source .example-wrap pre.rust a {
-       background: #333;
+a.srclink,
+a#toggle-all-docs,
+#source-sidebar a,
+pre.rust a,
+.sidebar a,
+.in-band a {
+       color: #ddd;
 }
-
-.docblock:not(.item-decl) a:not(.srclink):not(.test-arrow),
-.docblock-short a:not(.srclink):not(.test-arrow), .item-info a,
-#help a {
-       color: #D2991D;
+.search-results a {
+       color: #ddd;
 }
-
 a.test-arrow {
        color: #dedede;
 }
+body.source .example-wrap pre.rust a {
+       background: #333;
+}
 
 details.rustdoc-toggle > summary.hideme > span,
 details.rustdoc-toggle > summary::before,
index 6df137e39141508a88674a94a53c516efc79d9f1..05f12fc365d74855adaf7e3b60d8b7956a57e306 100644 (file)
@@ -169,22 +169,27 @@ nav.main .current {
 nav.main .separator {
        border: 1px solid #000;
 }
+
 a {
-       color: #000;
+       color: #3873AD;
 }
-body.source .example-wrap pre.rust a {
-       background: #eee;
+a.srclink,
+a#toggle-all-docs,
+#source-sidebar a,
+pre.rust a,
+.sidebar a,
+.in-band a {
+       color: #000;
 }
-
-.docblock:not(.item-decl) a:not(.srclink):not(.test-arrow),
-.docblock-short a:not(.srclink):not(.test-arrow), .item-info a,
-#help a {
-       color: #3873AD;
+.search-results a {
+       color: initial;
 }
-
 a.test-arrow {
        color: #f5f5f5;
 }
+body.source .example-wrap pre.rust a {
+       background: #eee;
+}
 
 details.rustdoc-toggle > summary.hideme > span,
 details.rustdoc-toggle > summary::before,
index 4b55a0a69b66358c2987337484c50e9e76cfd338..32aa82195a962013c7567543e8b5645cb2fada57 100644 (file)
@@ -886,6 +886,14 @@ function hideThemeButtonState() {
         }
     });
 
+    onEachLazy(document.querySelectorAll(".rustdoc-toggle > summary:not(.hideme)"), function(el) {
+        el.addEventListener("click", function(e) {
+            if (e.target.tagName != "SUMMARY") {
+                e.preventDefault();
+            }
+        });
+    });
+
     onEachLazy(document.getElementsByClassName("notable-traits"), function(e) {
         e.onclick = function() {
             this.getElementsByClassName('notable-traits-tooltiptext')[0]
index 9fafea6914524ad3f8cb6ab503f179a5fbf797d6..cf57d4cf3aa43929ef937bfe1d9c7801af699e56 100644 (file)
     ></script> {#- -#}
     <script src="{{static_root_path | safe}}storage{{page.resource_suffix}}.js"></script> {#- -#}
     <script src="{{page.root_path | safe}}crates{{page.resource_suffix}}.js"></script> {#- -#}
+    <script defer src="{{static_root_path | safe}}main{{page.resource_suffix}}.js"></script> {#- -#}
+    {%- for script in page.static_extra_scripts -%}
+    <script defer src="{{static_root_path | safe}}{{script}}.js"></script> {#- -#}
+    {% endfor %}
+    {%- if layout.scrape_examples_extension -%}
+    <script defer src="{{page.root_path | safe}}scrape-examples{{page.resource_suffix}}.js"></script> {#- -#}
+    {%- endif -%}
+    {%- for script in page.extra_scripts -%}
+    <script defer src="{{page.root_path | safe}}{{script}}.js"></script> {#- -#}
+    {% endfor %}
     <noscript> {#- -#}
         <link rel="stylesheet" {# -#}
            href="{{static_root_path | safe}}noscript{{page.resource_suffix}}.css"> {#- -#}
          data-search-index-js="{{page.root_path | safe}}search-index{{page.resource_suffix}}.js" {# -#}
          data-search-js="{{static_root_path | safe}}search{{page.resource_suffix}}.js"> {#- -#}
     </div>
-    <script src="{{static_root_path | safe}}main{{page.resource_suffix}}.js"></script> {#- -#}
-    {%- for script in page.static_extra_scripts -%}
-    <script src="{{static_root_path | safe}}{{script}}.js"></script> {#- -#}
-    {% endfor %}
-    {%- if layout.scrape_examples_extension -%}
-    <script src="{{page.root_path | safe}}scrape-examples{{page.resource_suffix}}.js"></script> {#- -#}
-    {%- endif -%}
-    {%- for script in page.extra_scripts -%}
-    <script src="{{page.root_path | safe}}{{script}}.js"></script> {#- -#}
-    {% endfor %}
 </body> {#- -#}
 </html> {#- -#}
index da2eda73641228e737f6f70cab177bbc48511940..97f4f941e06861ac095f7e82ba6cc69c5ccbf148 100644 (file)
@@ -1,5 +1,7 @@
 use std::cmp;
 
+use rustc_span::symbol::kw;
+
 use crate::clean::{self, DocFragment, DocFragmentKind, Item};
 use crate::core::DocContext;
 use crate::fold::{self, DocFolder};
@@ -87,7 +89,7 @@ fn unindent_fragments(docs: &mut Vec<DocFragment>) {
     };
 
     for fragment in docs {
-        if fragment.doc.as_str().lines().count() == 0 {
+        if fragment.doc == kw::Empty {
             continue;
         }
 
index 82d1afac5eceb96fd48f1088917c991ef1fc0106..daec04e11cd180b409308c9c7325944049c38f2d 100644 (file)
@@ -5,7 +5,6 @@
 
 fn create_doc_fragment(s: &str) -> Vec<DocFragment> {
     vec![DocFragment {
-        line: 0,
         span: DUMMY_SP,
         parent_module: None,
         doc: Symbol::intern(s),
diff --git a/src/test/assembly/stack-protector/stack-protector-heuristics-effect.rs b/src/test/assembly/stack-protector/stack-protector-heuristics-effect.rs
new file mode 100644 (file)
index 0000000..530326a
--- /dev/null
@@ -0,0 +1,396 @@
+// revisions: all strong basic none missing
+// assembly-output: emit-asm
+// ignore-macos slightly different policy on stack protection of arrays
+// ignore-windows stack check code uses different function names
+// ignore-nvptx64 stack protector is not supported
+// [all] compile-flags: -Z stack-protector=all
+// [strong] compile-flags: -Z stack-protector=strong
+// [basic] compile-flags: -Z stack-protector=basic
+// [none] compile-flags: -Z stack-protector=none
+// compile-flags: -C opt-level=2 -Z merge-functions=disabled
+
+#![crate_type = "lib"]
+
+#![allow(incomplete_features)]
+
+#![feature(unsized_locals, unsized_fn_params)]
+
+
+// CHECK-LABEL: emptyfn:
+#[no_mangle]
+pub fn emptyfn() {
+    // all: __stack_chk_fail
+    // strong-NOT: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+// CHECK-LABEL: array_char
+#[no_mangle]
+pub fn array_char(f: fn(*const char)) {
+    let a = ['c'; 1];
+    let b = ['d'; 3];
+    let c = ['e'; 15];
+
+    f(&a as *const _);
+    f(&b as *const _);
+    f(&c as *const _);
+
+    // Any type of local array variable leads to stack protection with the
+    // "strong" heuristic. The 'basic' heuristic only adds stack protection to
+    // functions with local array variables of a byte-sized type, however. Since
+    // 'char' is 4 bytes in Rust, this function is not protected by the 'basic'
+    // heuristic
+    //
+    // (This test *also* takes the address of the local stack variables. We
+    // cannot know that this isn't what triggers the `strong` heuristic.
+    // However, the test strategy of passing the address of a stack array to an
+    // external function is sufficient to trigger the `basic` heuristic (see
+    // test `array_u8_large()`). Since the `basic` heuristic only checks for the
+    // presence of stack-local array variables, we can be confident that this
+    // test also captures this part of the `strong` heuristic specification.)
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+// CHECK-LABEL: array_u8_1
+#[no_mangle]
+pub fn array_u8_1(f: fn(*const u8)) {
+    let a = [0u8; 1];
+    f(&a as *const _);
+
+    // The 'strong' heuristic adds stack protection to functions with local
+    // array variables regardless of their size.
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+// CHECK-LABEL: array_u8_small:
+#[no_mangle]
+pub fn array_u8_small(f: fn(*const u8)) {
+    let a = [0u8; 2];
+    let b = [0u8; 8];
+    f(&a as *const _);
+    f(&b as *const _);
+
+    // Small arrays do not lead to stack protection by the 'basic' heuristic.
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+// CHECK-LABEL: array_u8_large:
+#[no_mangle]
+pub fn array_u8_large(f: fn(*const u8)) {
+    let a = [0u8; 9];
+    f(&a as *const _);
+
+    // Since `a` is a byte array with size greater than 8, the basic heuristic
+    // will also protect this function.
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+#[derive(Copy, Clone)]
+pub struct ByteSizedNewtype(u8);
+
+// CHECK-LABEL: array_bytesizednewtype_9:
+#[no_mangle]
+pub fn array_bytesizednewtype_9(f: fn(*const ByteSizedNewtype)) {
+    let a = [ByteSizedNewtype(0); 9];
+    f(&a as *const _);
+
+    // Since `a` is a byte array in the LLVM output, the basic heuristic will
+    // also protect this function.
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+// CHECK-LABEL: local_var_addr_used_indirectly
+#[no_mangle]
+pub fn local_var_addr_used_indirectly(f: fn(bool)) {
+    let a = 5;
+    let a_addr = &a as *const _ as usize;
+    f(a_addr & 0x10 == 0);
+
+    // This function takes the address of a local variable taken. Although this
+    // address is never used as a way to refer to stack memory, the `strong`
+    // heuristic adds stack smash protection. This is also the case in C++:
+    // ```
+    // cat << EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
+    // #include <cstdint>
+    // void f(void (*g)(bool)) {
+    //     int32_t x;
+    //     g((reinterpret_cast<uintptr_t>(&x) & 0x10U) == 0);
+    // }
+    // EOF
+    // ```
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+
+// CHECK-LABEL: local_string_addr_taken
+#[no_mangle]
+pub fn local_string_addr_taken(f: fn(&String)) {
+    let x = String::new();
+    f(&x);
+
+    // Taking the address of the local variable `x` leads to stack smash
+    // protection with the `strong` heuristic, but not with the `basic`
+    // heuristic. It does not matter that the reference is not mut.
+    //
+    // An interesting note is that a similar function in C++ *would* be
+    // protected by the `basic` heuristic, because `std::string` has a char
+    // array internally as a small object optimization:
+    // ```
+    // cat <<EOF | clang++ -O2 -fstack-protector -S -x c++ - -o - | grep stack_chk
+    // #include <string>
+    // void f(void (*g)(const std::string&)) {
+    //     std::string x;
+    //     g(x);
+    // }
+    // EOF
+    // ```
+    //
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+pub trait SelfByRef {
+    fn f(&self) -> i32;
+}
+
+impl SelfByRef for i32 {
+    fn f(&self) -> i32 {
+        return self + 1;
+    }
+}
+
+// CHECK-LABEL: local_var_addr_taken_used_locally_only
+#[no_mangle]
+pub fn local_var_addr_taken_used_locally_only(factory: fn() -> i32, sink: fn(i32)) {
+    let x = factory();
+    let g = x.f();
+    sink(g);
+
+    // Even though the local variable conceptually has its address taken, as
+    // it's passed by reference to the trait function, the use of the reference
+    // is easily inlined. There is therefore no stack smash protection even with
+    // the `strong` heuristic.
+
+    // all: __stack_chk_fail
+    // strong-NOT: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+pub struct Gigastruct {
+    does: u64,
+    not: u64,
+    have: u64,
+    array: u64,
+    members: u64
+}
+
+// CHECK-LABEL: local_large_var_moved
+#[no_mangle]
+pub fn local_large_var_moved(f: fn(Gigastruct)) {
+    let x = Gigastruct { does: 0, not: 1, have: 2, array: 3, members: 4 };
+    f(x);
+
+    // Even though the local variable conceptually doesn't have its address
+    // taken, it's so large that the "move" is implemented with a reference to a
+    // stack-local variable in the ABI. Consequently, this function *is*
+    // protected by the `strong` heuristic. This is also the case for
+    // rvalue-references in C++, regardless of struct size:
+    // ```
+    // cat <<EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
+    // #include <cstdint>
+    // #include <utility>
+    // void f(void (*g)(uint64_t&&)) {
+    //     uint64_t x;
+    //     g(std::move(x));
+    // }
+    // EOF
+    // ```
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+// CHECK-LABEL: local_large_var_cloned
+#[no_mangle]
+pub fn local_large_var_cloned(f: fn(Gigastruct)) {
+    f(Gigastruct { does: 0, not: 1, have: 2, array: 3, members: 4 });
+
+    // A new instance of `Gigastruct` is passed to `f()`, without any apparent
+    // connection to this stack frame. Still, since instances of `Gigastruct`
+    // are sufficiently large, it is allocated in the caller stack frame and
+    // passed as a pointer. As such, this function is *also* protected by the
+    // `strong` heuristic, just like `local_large_var_moved`. This is also the
+    // case for pass-by-value of sufficiently large structs in C++:
+    // ```
+    // cat <<EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
+    // #include <cstdint>
+    // #include <utility>
+    // struct Gigastruct { uint64_t a, b, c, d, e; };
+    // void f(void (*g)(Gigastruct)) {
+    //     g(Gigastruct{});
+    // }
+    // EOF
+    // ```
+
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+
+extern "C" {
+    // A call to an external `alloca` function is *not* recognized as an
+    // `alloca(3)` operation. This function is a compiler built-in, as the
+    // man page explains. Clang translates it to an LLVM `alloca`
+    // instruction with a count argument, which is also what the LLVM stack
+    // protector heuristics looks for. The man page for `alloca(3)` details
+    // a way to avoid using the compiler built-in: pass a -std=c11
+    // argument, *and* don't include <alloca.h>. Though this leads to an
+    // external alloca() function being called, it doesn't lead to stack
+    // protection being included. It even fails with a linker error
+    // "undefined reference to `alloca'". Example:
+    // ```
+    // cat<<EOF | clang -fstack-protector-strong -x c -std=c11 - -o /dev/null
+    // #include <stdlib.h>
+    // void * alloca(size_t);
+    // void f(void (*g)(void*)) {
+    //     void * p = alloca(10);
+    //     g(p);
+    // }
+    // int main() { return 0; }
+    // EOF
+    // ```
+    // The following tests demonstrate that calls to an external `alloca`
+    // function in Rust also doesn't trigger stack protection.
+
+    fn alloca(size: usize) -> *mut ();
+}
+
+// CHECK-LABEL: alloca_small_compile_time_constant_arg
+#[no_mangle]
+pub fn alloca_small_compile_time_constant_arg(f: fn(*mut ())) {
+    f(unsafe { alloca(8) });
+
+    // all: __stack_chk_fail
+    // strong-NOT: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+// CHECK-LABEL: alloca_large_compile_time_constant_arg
+#[no_mangle]
+pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {
+    f(unsafe { alloca(9) });
+
+    // all: __stack_chk_fail
+    // strong-NOT: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+
+// CHECK-LABEL: alloca_dynamic_arg
+#[no_mangle]
+pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
+    f(unsafe { alloca(n) });
+
+    // all: __stack_chk_fail
+    // strong-NOT: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+// The question then is: in what ways can Rust code generate array-`alloca`
+// LLVM instructions? This appears to only be generated by
+// rustc_codegen_ssa::traits::Builder::array_alloca() through
+// rustc_codegen_ssa::mir::operand::OperandValue::store_unsized(). FWICT
+// this is support for the "unsized locals" unstable feature:
+// https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html.
+
+
+// CHECK-LABEL: unsized_fn_param
+#[no_mangle]
+pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
+    let n = if l { 1 } else { 2 };
+    f(*Box::<[u8]>::from(&s[0..n])); // slice-copy with Box::from
+
+    // Even though slices are conceptually passed by-value both into this
+    // function and into `f()`, this is implemented with pass-by-reference
+    // using a suitably constructed fat-pointer (as if the functions
+    // accepted &[u8]). This function therefore doesn't need dynamic array
+    // alloca, and is therefore not protected by the `strong` or `basic`
+    // heuristics.
+
+
+    // all: __stack_chk_fail
+    // strong-NOT: __stack_chk_fail
+    // basic-NOT: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
+
+// CHECK-LABEL: unsized_local
+#[no_mangle]
+pub fn unsized_local(s: &[u8], l: bool, f: fn(&mut [u8])) {
+    let n = if l { 1 } else { 2 };
+    let mut a: [u8] = *Box::<[u8]>::from(&s[0..n]); // slice-copy with Box::from
+    f(&mut a);
+
+    // This function allocates a slice as a local variable in its stack
+    // frame. Since the size is not a compile-time constant, an array
+    // alloca is required, and the function is protected by both the
+    // `strong` and `basic` heuristic.
+
+    // all: __stack_chk_fail
+    // strong: __stack_chk_fail
+    // basic: __stack_chk_fail
+    // none-NOT: __stack_chk_fail
+    // missing-NOT: __stack_chk_fail
+}
diff --git a/src/test/assembly/stack-protector/stack-protector-target-support.rs b/src/test/assembly/stack-protector/stack-protector-target-support.rs
new file mode 100644 (file)
index 0000000..5ba46d0
--- /dev/null
@@ -0,0 +1,286 @@
+// Test that stack smash protection code is emitted for all tier1 and tier2
+// targets, with the exception of nvptx64-nvidia-cuda
+//
+// revisions: r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23
+// revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r34 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44
+// revisions: r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57 r58 r59 r60 r61 r62 r63 r64 r65
+// revisions: r66 r67 r68 r69 r70 r71 r72 r73 r74 r75 r76 r77 r78 r79 r80 r81 r82 r83 r84
+// assembly-output: emit-asm
+// [r1] compile-flags: --target aarch64-unknown-linux-gnu
+// [r1] needs-llvm-components: aarch64
+// [r2] compile-flags: --target i686-pc-windows-gnu
+// [r2] needs-llvm-components: x86
+// [r3] compile-flags: --target i686-pc-windows-msvc
+// [r3] needs-llvm-components: x86
+// [r4] compile-flags: --target i686-unknown-linux-gnu
+// [r4] needs-llvm-components: x86
+// [r5] compile-flags: --target x86_64-apple-darwin
+// [r5] needs-llvm-components: x86
+// [r6] compile-flags: --target x86_64-pc-windows-gnu
+// [r6] needs-llvm-components: x86
+// [r7] compile-flags: --target x86_64-pc-windows-msvc
+// [r7] needs-llvm-components: x86
+// [r8] compile-flags: --target x86_64-unknown-linux-gnu
+// [r8] needs-llvm-components: x86
+// [r9] compile-flags: --target aarch64-apple-darwin
+// [r9] needs-llvm-components: aarch64
+// [r10] compile-flags: --target aarch64-apple-ios
+// [r10] needs-llvm-components: aarch64
+// [r11] compile-flags: --target aarch64-fuchsia
+// [r11] needs-llvm-components: aarch64
+// [r12] compile-flags: --target aarch64-linux-android
+// [r12] needs-llvm-components: aarch64
+// [r13] compile-flags: --target aarch64-pc-windows-msvc
+// [r13] needs-llvm-components: aarch64
+// [r14] compile-flags: --target aarch64-unknown-linux-musl
+// [r14] needs-llvm-components: aarch64
+// [r15] compile-flags: --target aarch64-unknown-none
+// [r15] needs-llvm-components: aarch64
+// [r16] compile-flags: --target aarch64-unknown-none-softfloat
+// [r16] needs-llvm-components: aarch64
+// [r17] compile-flags: --target arm-linux-androideabi
+// [r17] needs-llvm-components: arm
+// [r18] compile-flags: --target arm-unknown-linux-gnueabi
+// [r18] needs-llvm-components: arm
+// [r19] compile-flags: --target arm-unknown-linux-gnueabihf
+// [r19] needs-llvm-components: arm
+// [r20] compile-flags: --target arm-unknown-linux-musleabi
+// [r20] needs-llvm-components: arm
+// [r21] compile-flags: --target arm-unknown-linux-musleabihf
+// [r21] needs-llvm-components: arm
+// [r22] compile-flags: --target armebv7r-none-eabi
+// [r22] needs-llvm-components: arm
+// [r23] compile-flags: --target armebv7r-none-eabihf
+// [r23] needs-llvm-components: arm
+// [r24] compile-flags: --target armv5te-unknown-linux-gnueabi
+// [r24] needs-llvm-components: arm
+// [r25] compile-flags: --target armv5te-unknown-linux-musleabi
+// [r25] needs-llvm-components: arm
+// [r26] compile-flags: --target armv7-linux-androideabi
+// [r26] needs-llvm-components: arm
+// [r27] compile-flags: --target armv7a-none-eabi
+// [r27] needs-llvm-components: arm
+// [r28] compile-flags: --target armv7r-none-eabi
+// [r28] needs-llvm-components: arm
+// [r29] compile-flags: --target armv7r-none-eabihf
+// [r29] needs-llvm-components: arm
+// [r30] compile-flags: --target armv7-unknown-linux-gnueabi
+// [r30] needs-llvm-components: arm
+// [r31] compile-flags: --target armv7-unknown-linux-gnueabihf
+// [r31] needs-llvm-components: arm
+// [r32] compile-flags: --target armv7-unknown-linux-musleabi
+// [r32] needs-llvm-components: arm
+// [r33] compile-flags: --target armv7-unknown-linux-musleabihf
+// [r33] needs-llvm-components: arm
+// [r34] compile-flags: --target asmjs-unknown-emscripten
+// [r34] needs-llvm-components: webassembly
+// [r35] compile-flags: --target i586-pc-windows-msvc
+// [r35] needs-llvm-components: x86
+// [r36] compile-flags: --target i586-unknown-linux-gnu
+// [r36] needs-llvm-components: x86
+// [r37] compile-flags: --target i586-unknown-linux-musl
+// [r37] needs-llvm-components: x86
+// [r38] compile-flags: --target i686-linux-android
+// [r38] needs-llvm-components: x86
+// [r39] compile-flags: --target i686-unknown-freebsd
+// [r39] needs-llvm-components: x86
+// [r40] compile-flags: --target i686-unknown-linux-musl
+// [r40] needs-llvm-components: x86
+// [r41] compile-flags: --target mips-unknown-linux-gnu
+// [r41] needs-llvm-components: mips
+// [r42] compile-flags: --target mips-unknown-linux-musl
+// [r42] needs-llvm-components: mips
+// [r43] compile-flags: --target mips64-unknown-linux-gnuabi64
+// [r43] needs-llvm-components: mips
+// [r44] compile-flags: --target mips64-unknown-linux-muslabi64
+// [r44] needs-llvm-components: mips
+// [r45] compile-flags: --target mips64el-unknown-linux-gnuabi64
+// [r45] needs-llvm-components: mips
+// [r46] compile-flags: --target mips64el-unknown-linux-muslabi64
+// [r46] needs-llvm-components: mips
+// [r47] compile-flags: --target mipsel-unknown-linux-gnu
+// [r47] needs-llvm-components: mips
+// [r48] compile-flags: --target mipsel-unknown-linux-musl
+// [r48] needs-llvm-components: mips
+// [r49] compile-flags: --target nvptx64-nvidia-cuda
+// [r49] needs-llvm-components: nvptx
+// [r50] compile-flags: --target powerpc-unknown-linux-gnu
+// [r50] needs-llvm-components: powerpc
+// [r51] compile-flags: --target powerpc64-unknown-linux-gnu
+// [r51] needs-llvm-components: powerpc
+// [r52] compile-flags: --target powerpc64le-unknown-linux-gnu
+// [r52] needs-llvm-components: powerpc
+// [r53] compile-flags: --target riscv32i-unknown-none-elf
+// [r53] needs-llvm-components: riscv
+// [r54] compile-flags: --target riscv32imac-unknown-none-elf
+// [r54] needs-llvm-components: riscv
+// [r55] compile-flags:--target riscv32imc-unknown-none-elf
+// [r55] needs-llvm-components: riscv
+// [r56] compile-flags:--target riscv64gc-unknown-linux-gnu
+// [r56] needs-llvm-components: riscv
+// [r57] compile-flags:--target riscv64gc-unknown-none-elf
+// [r57] needs-llvm-components: riscv
+// [r58] compile-flags:--target riscv64imac-unknown-none-elf
+// [r58] needs-llvm-components: riscv
+// [r59] compile-flags:--target s390x-unknown-linux-gnu
+// [r59] needs-llvm-components: systemz
+// [r60] compile-flags:--target sparc64-unknown-linux-gnu
+// [r60] needs-llvm-components: sparc
+// [r61] compile-flags:--target sparcv9-sun-solaris
+// [r61] needs-llvm-components: sparc
+// [r62] compile-flags:--target thumbv6m-none-eabi
+// [r62] needs-llvm-components: arm
+// [r63] compile-flags:--target thumbv7em-none-eabi
+// [r63] needs-llvm-components: arm
+// [r64] compile-flags:--target thumbv7em-none-eabihf
+// [r64] needs-llvm-components: arm
+// [r65] compile-flags:--target thumbv7m-none-eabi
+// [r65] needs-llvm-components: arm
+// [r66] compile-flags:--target thumbv7neon-linux-androideabi
+// [r66] needs-llvm-components: arm
+// [r67] compile-flags:--target thumbv7neon-unknown-linux-gnueabihf
+// [r67] needs-llvm-components: arm
+// [r68] compile-flags:--target thumbv8m.base-none-eabi
+// [r68] needs-llvm-components: arm
+// [r69] compile-flags:--target thumbv8m.main-none-eabi
+// [r69] needs-llvm-components: arm
+// [r70] compile-flags:--target thumbv8m.main-none-eabihf
+// [r70] needs-llvm-components: arm
+// [r71] compile-flags:--target wasm32-unknown-emscripten
+// [r71] needs-llvm-components: webassembly
+// [r72] compile-flags:--target wasm32-unknown-unknown
+// [r72] needs-llvm-components: webassembly
+// [r73] compile-flags:--target wasm32-wasi
+// [r73] needs-llvm-components: webassembly
+// [r74] compile-flags:--target x86_64-apple-ios
+// [r74] needs-llvm-components: x86
+// [r75] compile-flags:--target x86_64-fortanix-unknown-sgx
+// [r75] needs-llvm-components: x86
+// [r75] min-llvm-version: 11.0.0
+// [r76] compile-flags:--target x86_64-fuchsia
+// [r76] needs-llvm-components: x86
+// [r77] compile-flags:--target x86_64-linux-android
+// [r77] needs-llvm-components: x86
+// [r78] compile-flags:--target x86_64-sun-solaris
+// [r78] needs-llvm-components: x86
+// [r79] compile-flags:--target x86_64-unknown-freebsd
+// [r79] needs-llvm-components: x86
+// [r80] compile-flags:--target x86_64-unknown-illumos
+// [r80] needs-llvm-components: x86
+// [r81] compile-flags:--target x86_64-unknown-linux-gnux32
+// [r81] needs-llvm-components: x86
+// [r82] compile-flags:--target x86_64-unknown-linux-musl
+// [r82] needs-llvm-components: x86
+// [r83] compile-flags:--target x86_64-unknown-netbsd
+// [r83] needs-llvm-components: x86
+// [r84] compile-flags: --target x86_64-unknown-redox
+// [r84] needs-llvm-components: x86
+// compile-flags: -Z stack-protector=all
+// compile-flags: -C opt-level=2
+
+#![crate_type = "lib"]
+
+#![feature(no_core, lang_items)]
+#![crate_type = "lib"]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+
+#[no_mangle]
+pub fn foo() {
+    // CHECK: foo{{:|()}}
+
+    // MSVC does the stack checking within a stack-check function:
+    // r3: calll @__security_check_cookie
+    // r7: callq __security_check_cookie
+    // r13: bl __security_check_cookie
+    // r35: calll @__security_check_cookie
+
+    // cuda doesn't support stack-smash protection
+    // r49-NOT: __security_check_cookie
+    // r49-NOT: __stack_chk_fail
+
+    // Other targets do stack checking within the function, and call a failure function on error
+    // r1: __stack_chk_fail
+    // r2: __stack_chk_fail
+    // r4: __stack_chk_fail
+    // r5: __stack_chk_fail
+    // r6: __stack_chk_fail
+    // r8: __stack_chk_fail
+    // r9: __stack_chk_fail
+    // r10: __stack_chk_fail
+    // r11: __stack_chk_fail
+    // r12: __stack_chk_fail
+    // r14: __stack_chk_fail
+    // r15: __stack_chk_fail
+    // r16: __stack_chk_fail
+    // r17: __stack_chk_fail
+    // r18: __stack_chk_fail
+    // r19: __stack_chk_fail
+    // r20: __stack_chk_fail
+    // r21: __stack_chk_fail
+    // r22: __stack_chk_fail
+    // r23: __stack_chk_fail
+    // r24: __stack_chk_fail
+    // r25: __stack_chk_fail
+    // r26: __stack_chk_fail
+    // r27: __stack_chk_fail
+    // r28: __stack_chk_fail
+    // r29: __stack_chk_fail
+    // r30: __stack_chk_fail
+    // r31: __stack_chk_fail
+    // r32: __stack_chk_fail
+    // r33: __stack_chk_fail
+    // r34: __stack_chk_fail
+    // r36: __stack_chk_fail
+    // r37: __stack_chk_fail
+    // r38: __stack_chk_fail
+    // r39: __stack_chk_fail
+    // r40: __stack_chk_fail
+    // r41: __stack_chk_fail
+    // r42: __stack_chk_fail
+    // r43: __stack_chk_fail
+    // r44: __stack_chk_fail
+    // r45: __stack_chk_fail
+    // r46: __stack_chk_fail
+    // r47: __stack_chk_fail
+    // r48: __stack_chk_fail
+    // r50: __stack_chk_fail
+    // r51: __stack_chk_fail
+    // r52: __stack_chk_fail
+    // r53: __stack_chk_fail
+    // r54: __stack_chk_fail
+    // r55: __stack_chk_fail
+    // r56: __stack_chk_fail
+    // r57: __stack_chk_fail
+    // r58: __stack_chk_fail
+    // r59: __stack_chk_fail
+    // r60: __stack_chk_fail
+    // r61: __stack_chk_fail
+    // r62: __stack_chk_fail
+    // r63: __stack_chk_fail
+    // r64: __stack_chk_fail
+    // r65: __stack_chk_fail
+    // r66: __stack_chk_fail
+    // r67: __stack_chk_fail
+    // r68: __stack_chk_fail
+    // r69: __stack_chk_fail
+    // r70: __stack_chk_fail
+    // r71: __stack_chk_fail
+    // r72: __stack_chk_fail
+    // r73: __stack_chk_fail
+    // r74: __stack_chk_fail
+    // r75: __stack_chk_fail
+    // r76: __stack_chk_fail
+    // r77: __stack_chk_fail
+    // r78: __stack_chk_fail
+    // r79: __stack_chk_fail
+    // r80: __stack_chk_fail
+    // r81: __stack_chk_fail
+    // r82: __stack_chk_fail
+    // r83: __stack_chk_fail
+    // r84: __stack_chk_fail
+}
diff --git a/src/test/codegen/stack-protector.rs b/src/test/codegen/stack-protector.rs
new file mode 100644 (file)
index 0000000..a24e6f1
--- /dev/null
@@ -0,0 +1,34 @@
+// revisions: all strong basic none
+// ignore-nvptx64 stack protector not supported
+// [all] compile-flags: -Z stack-protector=all
+// [strong] compile-flags: -Z stack-protector=strong
+// [basic] compile-flags: -Z stack-protector=basic
+
+#![crate_type = "lib"]
+
+#[no_mangle]
+pub fn foo() {
+    // CHECK: @foo() unnamed_addr #0
+
+    // all-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
+    // all-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
+    // all: attributes #0 = { {{.*}} sspreq {{.*}} }
+    // all-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
+    // all-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
+
+    // strong-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
+    // strong-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
+    // strong: attributes #0 = { {{.*}} sspstrong {{.*}} }
+    // strong-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
+    // strong-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
+
+    // basic-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
+    // basic-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
+    // basic: attributes #0 = { {{.*}} ssp {{.*}} }
+    // basic-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
+    // basic-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
+
+    // none-NOT: attributes #0 = { {{.*}} sspreq {{.*}} }
+    // none-NOT: attributes #0 = { {{.*}} sspstrong {{.*}} }
+    // none-NOT: attributes #0 = { {{.*}} ssp {{.*}} }
+}
index 1b96cd54c3ed01b4baf623f9a0ab0c506de9f9c3..d3687d5b9081ea28b01063a37a41f565b9257b04 100644 (file)
@@ -183,7 +183,7 @@ pub fn add_loop_label_to_break() {
 #[cfg(not(any(cfail1,cfail4)))]
 #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
 #[rustc_clean(cfg="cfail3")]
-#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
 #[rustc_clean(cfg="cfail6")]
 pub fn add_loop_label_to_break() {
     let mut _x = 0;
index 9cbd110d68aab76aafc5a413534330f5c15f2475..b72ec404f672a575900678e11c1ea535e211e825 100644 (file)
@@ -33,7 +33,7 @@ trait TraitVisibility { }
 #[cfg(not(any(cfail1,cfail4)))]
 #[rustc_clean(except="hir_owner", cfg="cfail2")]
 #[rustc_clean(cfg="cfail3")]
-#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(except="hir_owner", cfg="cfail5")]
 #[rustc_clean(cfg="cfail6")]
 pub trait TraitVisibility { }
 
@@ -46,7 +46,7 @@ trait TraitUnsafety { }
 #[cfg(not(any(cfail1,cfail4)))]
 #[rustc_clean(except="hir_owner", cfg="cfail2")]
 #[rustc_clean(cfg="cfail3")]
-#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(except="hir_owner", cfg="cfail5")]
 #[rustc_clean(cfg="cfail6")]
 unsafe trait TraitUnsafety { }
 
@@ -60,7 +60,7 @@ trait TraitAddMethod {
 #[cfg(not(any(cfail1,cfail4)))]
 #[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
 #[rustc_clean(cfg="cfail3")]
-#[rustc_clean(except="hir_owner,associated_item_def_ids,predicates_of", cfg="cfail5")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
 #[rustc_clean(cfg="cfail6")]
 pub trait TraitAddMethod {
     fn method();
index 57cde5f7c6e48609c0d9e1cc4621e151e8b3eb84..1e7d823050c3dbb4e3f7ce313ef39c3504866a8e 100644 (file)
@@ -1,3 +1,3 @@
 // no-prefer-dynamic
-//[cfail1] compile-flags: -lbar -lfoo --crate-type lib
-//[cfail2] compile-flags: -lfoo -lbar --crate-type lib
+//[cfail1] compile-flags: -lbar -lfoo --crate-type lib -Zassert-incr-state=not-loaded
+//[cfail2] compile-flags: -lfoo -lbar --crate-type lib -Zassert-incr-state=not-loaded
index 7498d0305e0b11667a0a9829e78fc531ef50bf64..a7c79e9d751e0e8af468e20ced0b543882f3e018 100644 (file)
@@ -3,6 +3,7 @@
 
 // revisions:rpass1 cfail2
 // compile-flags: -Z query-dep-graph
+// [cfail2] compile-flags: -Z query-dep-graph -Z assert-incr-state=loaded
 
 #![feature(rustc_attrs)]
 
index 02f6e55a9a8b6b56e098eaa3c01eaf22ebfbee56..2dfc94f21868e149049e70df81fd68b84b875663 100644 (file)
@@ -7,39 +7,29 @@
       let mut _2: std::ops::Range<i32>;    // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
       let mut _3: std::ops::Range<i32>;    // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
       let mut _5: ();                      // in scope 0 at $DIR/remove_storage_markers.rs:6:1: 11:2
-      let _7: ();                          // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
-      let mut _8: std::option::Option<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+      let _6: ();                          // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+      let mut _7: std::option::Option<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
+      let mut _8: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
       let mut _9: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
-      let mut _10: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
-      let mut _11: isize;                  // in scope 0 at $DIR/remove_storage_markers.rs:8:9: 8:10
-      let mut _13: i32;                    // in scope 0 at $DIR/remove_storage_markers.rs:8:9: 8:10
-      let mut _14: !;                      // in scope 0 at $DIR/remove_storage_markers.rs:8:5: 10:6
-      let _16: ();                         // in scope 0 at $DIR/remove_storage_markers.rs:8:20: 10:6
-      let mut _17: i32;                    // in scope 0 at $DIR/remove_storage_markers.rs:9:16: 9:17
+      let mut _10: isize;                  // in scope 0 at $DIR/remove_storage_markers.rs:8:5: 10:6
+      let mut _11: !;                      // in scope 0 at $DIR/remove_storage_markers.rs:8:5: 10:6
+      let mut _13: i32;                    // in scope 0 at $DIR/remove_storage_markers.rs:9:16: 9:17
       scope 1 {
           debug sum => _1;                 // in scope 1 at $DIR/remove_storage_markers.rs:7:9: 7:16
           let mut _4: std::ops::Range<i32>; // in scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
           scope 2 {
               debug iter => _4;            // in scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
-              let mut _6: i32;             // in scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+              let _12: i32;                // in scope 2 at $DIR/remove_storage_markers.rs:8:9: 8:10
               scope 3 {
-                  debug __next => _6;      // in scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
-                  let _12: i32;            // in scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
-                  let _15: i32;            // in scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
-                  scope 4 {
-                      debug val => _12;    // in scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
-                  }
-                  scope 5 {
-                      debug i => _15;      // in scope 5 at $DIR/remove_storage_markers.rs:8:9: 8:10
-                  }
-                  scope 7 (inlined iter::range::<impl Iterator for std::ops::Range<i32>>::next) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
-                      debug self => _9;    // in scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
-                      let mut _18: &mut std::ops::Range<i32>; // in scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
-                  }
+                  debug i => _12;          // in scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
+              }
+              scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<i32>>::next) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
+                  debug self => _8;        // in scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
+                  let mut _14: &mut std::ops::Range<i32>; // in scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
               }
           }
-          scope 6 (inlined <std::ops::Range<i32> as IntoIterator>::into_iter) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
-              debug self => _3;            // in scope 6 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          scope 4 (inlined <std::ops::Range<i32> as IntoIterator>::into_iter) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
+              debug self => _3;            // in scope 4 at $DIR/remove_storage_markers.rs:8:14: 8:19
           }
       }
   
@@ -50,7 +40,7 @@
 -         StorageLive(_3);                 // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
           (_3.0: i32) = const 0_i32;       // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
           (_3.1: i32) = const 10_i32;      // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _2 = move _3;                    // scope 6 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _2 = move _3;                    // scope 4 at $DIR/remove_storage_markers.rs:8:14: 8:19
 -         StorageDead(_3);                 // scope 1 at $DIR/remove_storage_markers.rs:8:18: 8:19
 -         StorageLive(_4);                 // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
           _4 = move _2;                    // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
   
       bb1: {
 -         StorageLive(_6);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_7);                 // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_8);                 // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_9);                 // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_10);                // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _10 = &mut _4;                   // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _9 = &mut (*_10);                // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_18);                // scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _18 = &mut (*_9);                // scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          _8 = <std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next(move _18) -> bb4; // scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageLive(_7);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageLive(_8);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageLive(_9);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _9 = &mut _4;                    // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _8 = &mut (*_9);                 // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageLive(_14);                // scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _14 = &mut (*_8);                // scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          _7 = <std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next(move _14) -> bb4; // scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
                                            // mir::Constant
                                            // + span: $DIR/remove_storage_markers.rs:8:14: 8:19
                                            // + literal: Const { ty: for<'r> fn(&'r mut std::ops::Range<i32>) -> std::option::Option<<std::ops::Range<i32> as std::iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<i32> as std::iter::range::RangeIteratorImpl>::spec_next}, val: Value(Scalar(<ZST>)) }
       }
   
       bb2: {
-          _0 = const ();                   // scope 3 at $DIR/remove_storage_markers.rs:8:5: 10:6
--         StorageDead(_10);                // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageDead(_8);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageDead(_7);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
+-         StorageLive(_12);                // scope 2 at $DIR/remove_storage_markers.rs:8:9: 8:10
+          _12 = ((_7 as Some).0: i32);     // scope 2 at $DIR/remove_storage_markers.rs:8:9: 8:10
+-         StorageLive(_13);                // scope 3 at $DIR/remove_storage_markers.rs:9:16: 9:17
+          _13 = _12;                       // scope 3 at $DIR/remove_storage_markers.rs:9:16: 9:17
+          _1 = Add(_1, move _13);          // scope 3 at $DIR/remove_storage_markers.rs:9:9: 9:17
+-         StorageDead(_13);                // scope 3 at $DIR/remove_storage_markers.rs:9:16: 9:17
+          _6 = const ();                   // scope 3 at $DIR/remove_storage_markers.rs:8:20: 10:6
+-         StorageDead(_12);                // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_9);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_7);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
 -         StorageDead(_6);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
--         StorageDead(_4);                 // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
--         StorageDead(_2);                 // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
--         StorageDead(_1);                 // scope 0 at $DIR/remove_storage_markers.rs:11:1: 11:2
-          return;                          // scope 0 at $DIR/remove_storage_markers.rs:11:2: 11:2
+          _5 = const ();                   // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
+          goto -> bb1;                     // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
       }
   
       bb3: {
--         StorageLive(_12);                // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _12 = ((_8 as Some).0: i32);     // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
--         StorageLive(_13);                // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _13 = _12;                       // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _6 = move _13;                   // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _7 = const ();                   // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
--         StorageDead(_13);                // scope 4 at $DIR/remove_storage_markers.rs:8:9: 8:10
--         StorageDead(_12);                // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
--         StorageDead(_10);                // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageDead(_8);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageDead(_7);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
--         StorageLive(_15);                // scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
-          _15 = _6;                        // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageLive(_16);                // scope 5 at $DIR/remove_storage_markers.rs:8:20: 10:6
--         StorageLive(_17);                // scope 5 at $DIR/remove_storage_markers.rs:9:16: 9:17
-          _17 = _15;                       // scope 5 at $DIR/remove_storage_markers.rs:9:16: 9:17
-          _1 = Add(_1, move _17);          // scope 5 at $DIR/remove_storage_markers.rs:9:9: 9:17
--         StorageDead(_17);                // scope 5 at $DIR/remove_storage_markers.rs:9:16: 9:17
-          _16 = const ();                  // scope 5 at $DIR/remove_storage_markers.rs:8:20: 10:6
--         StorageDead(_16);                // scope 5 at $DIR/remove_storage_markers.rs:10:5: 10:6
-          _5 = const ();                   // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
--         StorageDead(_15);                // scope 3 at $DIR/remove_storage_markers.rs:10:5: 10:6
+          _0 = const ();                   // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
+-         StorageDead(_9);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_7);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
 -         StorageDead(_6);                 // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
-          goto -> bb1;                     // scope 2 at $DIR/remove_storage_markers.rs:8:5: 10:6
+-         StorageDead(_4);                 // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_2);                 // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
+-         StorageDead(_1);                 // scope 0 at $DIR/remove_storage_markers.rs:11:1: 11:2
+          return;                          // scope 0 at $DIR/remove_storage_markers.rs:11:2: 11:2
       }
   
       bb4: {
--         StorageDead(_18);                // scope 7 at $DIR/remove_storage_markers.rs:8:14: 8:19
--         StorageDead(_9);                 // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
-          _11 = discriminant(_8);          // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
-          switchInt(move _11) -> [0_isize: bb2, otherwise: bb3]; // scope 3 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageDead(_14);                // scope 5 at $DIR/remove_storage_markers.rs:8:14: 8:19
+-         StorageDead(_8);                 // scope 2 at $DIR/remove_storage_markers.rs:8:18: 8:19
+          _10 = discriminant(_7);          // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
+          switchInt(move _10) -> [0_isize: bb3, otherwise: bb2]; // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
       }
   }
   
index 28e0f1953e0499ac762619f1a084ccc42ea2b72b..1c64ead9f2674e37fb967968434ad7b4a0bcf9d4 100644 (file)
@@ -5,7 +5,6 @@
     5|      1|
     6|      1|    let mut x = 0;
     7|     11|    for _ in 0..10 {
-                      ^10
     8|     10|        match is_true {
     9|       |            true => {
    10|     10|                continue;
@@ -17,7 +16,6 @@
    16|      0|        x = 3;
    17|       |    }
    18|     11|    for _ in 0..10 {
-                      ^10
    19|     10|        match is_true {
    20|      0|            false => {
    21|      0|                x = 1;
@@ -29,7 +27,6 @@
    27|      0|        x = 3;
    28|       |    }
    29|     11|    for _ in 0..10 {
-                      ^10
    30|     10|        match is_true {
    31|     10|            true => {
    32|     10|                x = 1;
    38|     10|        x = 3;
    39|       |    }
    40|     11|    for _ in 0..10 {
-                      ^10
    41|     10|        if is_true {
    42|     10|            continue;
    43|      0|        }
    44|      0|        x = 3;
    45|       |    }
    46|     11|    for _ in 0..10 {
-                      ^10
    47|     10|        match is_true {
    48|      0|            false => {
    49|      0|                x = 1;
index 31d3ddea8d95a7d7131a1f80e5ff8d1b212cbd89..6f5d1544fa0349c9ada9952fc61de41e064fed63 100644 (file)
@@ -40,7 +40,8 @@
    39|     30|}
    40|       |
    41|      6|fn display<T: Display>(xs: &[T]) {
-   42|     18|    for x in xs {
+   42|     24|    for x in xs {
+                      ^18
    43|     18|        print!("{}", x);
    44|     18|    }
    45|      6|    println!();
index 5d572db7cc60da3b6b90c2a9dd799c7eda9143ed..b7ad79a24844c665ddfe7d59eae60c97cb89278e 100644 (file)
@@ -17,7 +17,8 @@
    16|      0|        } else {
    17|      0|        }
    18|       |
-   19|     10|        for i in 0..10 {
+   19|     11|        for i in 0..10 {
+                          ^10
    20|     10|            if true {
    21|     10|                if false {
    22|      0|                    while true {}
@@ -43,7 +44,8 @@
    41|      1|            write!(f, "cool")?;
                                            ^0
    42|       |        }
-   43|     10|        for i in 0..10 {
+   43|     11|        for i in 0..10 {
+                          ^10
    44|     10|            if false {
    45|      0|            } else {
    46|     10|                if false {
index 81b4c090a46c0e7bfd18d2910f02699831b43d7c..b9298213111c028739af4468b03f4bca26eb815e 100644 (file)
@@ -13,7 +13,7 @@
                    ^0
    13|       |
    14|       |    for
-   15|      2|        _
+   15|       |        _
    16|       |    in
    17|      3|        0..2
    18|       |    {
index 9fca52451ed57fbcbb03fe1ea16df0384fc7ed71..0ad0180b76149852c16287ebc32740191359020c 100644 (file)
@@ -14,7 +14,7 @@
    14|      1|        countdown = 10
    15|       |    ;
    16|       |    for
-   17|      6|        _
+   17|       |        _
    18|       |    in
    19|      6|        0..10
    20|       |    {
@@ -64,7 +64,7 @@
    63|      1|        countdown = 10
    64|       |    ;
    65|       |    for
-   66|      6|        _
+   66|       |        _
    67|       |    in
    68|      6|        0..10
    69|       |    {
diff --git a/src/test/rustdoc-gui/anchors.goml b/src/test/rustdoc-gui/anchors.goml
new file mode 100644 (file)
index 0000000..6953009
--- /dev/null
@@ -0,0 +1,17 @@
+goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
+
+// Set the theme to light.
+local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: ("#toggle-all-docs", {"color": "rgba(0, 0, 0, 0)"})
+assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgba(0, 0, 0, 0)"})
+assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgba(0, 0, 0, 0)"})
+assert-css: (".srclink", {"color": "rgba(0, 0, 0, 0)"})
+assert-css: (".srclink", {"color": "rgba(0, 0, 0, 0)"})
+
+assert-css: ("#top-doc-prose-title", {"color": "rgba(0, 0, 0, 0)"})
+
+assert-css: (".sidebar a", {"color": "rgba(0, 0, 0, 0)"})
+assert-css: (".in-band a", {"color": "rgba(0, 0, 0, 0)"})
index bdf17ec45705780952ccc74d6068e8e8161fafb0..87c512468e05fd9a1dcfd0fdc5a91028c8933c2a 100644 (file)
@@ -1,4 +1,4 @@
-// This test check that headers (a) have the correct heading level, (b) are the right size,
+// This test checks that headers (a) have the correct heading level, (b) are the right size,
 // and (c) have the correct underlining (or absence of underlining).
 // The sizes may change as design changes, but try to make sure a lower header is never bigger than
 // its parent headers. Also make sure lower headers don't have underlines when their parents lack
@@ -67,25 +67,25 @@ assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"})
 assert-css: ("h2#variants", {"font-size": "22.4px"})
 assert-css: ("h2#variants", {"border-bottom-width": "1px"})
 
-assert-css: ("h3#none-prose-title", {"font-size": "20.8px"})
-assert-css: ("h3#none-prose-title", {"border-bottom-width": "0px"})
-assert-css: ("h4#none-prose-sub-heading", {"font-size": "16px"})
-assert-css: ("h4#none-prose-sub-heading", {"border-bottom-width": "0px"})
-
-assert-css: ("h3#wrapped-prose-title", {"font-size": "20.8px"})
-assert-css: ("h3#wrapped-prose-title", {"border-bottom-width": "0px"})
-assert-css: ("h4#wrapped-prose-sub-heading", {"font-size": "16px"})
-assert-css: ("h4#wrapped-prose-sub-heading", {"border-bottom-width": "0px"})
-
-assert-css: ("h4#wrapped0-prose-title", {"font-size": "16px"})
-assert-css: ("h4#wrapped0-prose-title", {"border-bottom-width": "0px"})
-assert-css: ("h5#wrapped0-prose-sub-heading", {"font-size": "16px"})
-assert-css: ("h5#wrapped0-prose-sub-heading", {"border-bottom-width": "0px"})
-
-assert-css: ("h4#structy-prose-title", {"font-size": "16px"})
-assert-css: ("h4#structy-prose-title", {"border-bottom-width": "0px"})
-assert-css: ("h5#structy-prose-sub-heading", {"font-size": "16px"})
-assert-css: ("h5#structy-prose-sub-heading", {"border-bottom-width": "0px"})
+assert-css: ("h4#none-prose-title", {"font-size": "16px"})
+assert-css: ("h4#none-prose-title", {"border-bottom-width": "0px"})
+assert-css: ("h5#none-prose-sub-heading", {"font-size": "16px"})
+assert-css: ("h5#none-prose-sub-heading", {"border-bottom-width": "0px"})
+
+assert-css: ("h4#wrapped-prose-title", {"font-size": "16px"})
+assert-css: ("h4#wrapped-prose-title", {"border-bottom-width": "0px"})
+assert-css: ("h5#wrapped-prose-sub-heading", {"font-size": "16px"})
+assert-css: ("h5#wrapped-prose-sub-heading", {"border-bottom-width": "0px"})
+
+assert-css: ("h5#wrapped0-prose-title", {"font-size": "16px"})
+assert-css: ("h5#wrapped0-prose-title", {"border-bottom-width": "0px"})
+assert-css: ("h6#wrapped0-prose-sub-heading", {"font-size": "15.2px"})
+assert-css: ("h6#wrapped0-prose-sub-heading", {"border-bottom-width": "0px"})
+
+assert-css: ("h5#structy-prose-title", {"font-size": "16px"})
+assert-css: ("h5#structy-prose-title", {"border-bottom-width": "0px"})
+assert-css: ("h6#structy-prose-sub-heading", {"font-size": "15.2px"})
+assert-css: ("h6#structy-prose-sub-heading", {"border-bottom-width": "0px"})
 
 assert-css: ("h2#implementations", {"font-size": "22.4px"})
 assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
index f2e76b546c4affb1afc342703af74856b0f8111e..79354ec8745073b229e330607b2709b71c2631f4 100644 (file)
@@ -22,6 +22,8 @@ pub struct Foo {
 }
 
 impl Foo {
+    /// Some documentation
+    /// # A Heading
     pub fn a_method(&self) {}
 }
 
diff --git a/src/test/rustdoc-gui/toggle-click-deadspace.goml b/src/test/rustdoc-gui/toggle-click-deadspace.goml
new file mode 100644 (file)
index 0000000..4d08927
--- /dev/null
@@ -0,0 +1,8 @@
+// This test ensures that clicking on a method summary, but not on the "[-]",
+// doesn't toggle the <details>.
+goto: file://|DOC_PATH|/test_docs/struct.Foo.html
+assert-attribute: (".impl-items .rustdoc-toggle", {"open": ""})
+click: "h4.code-header" // This is the position of "pub" in "pub fn a_method"
+assert-attribute: (".impl-items .rustdoc-toggle", {"open": ""})
+click: ".impl-items .rustdoc-toggle summary::before" // This is the position of "[-]" next to that pub fn.
+assert-attribute-false: (".impl-items .rustdoc-toggle", {"open": ""})
index e04b786a864a1b63ed8ceda82dfbbcd9ecf6ef2f..4336993a36eb1ccdeef6ba1dc612f903dd60f5a9 100644 (file)
@@ -4,39 +4,63 @@
     &raw const $place
 }
 
+pub macro addr_of_crate($place:expr) {
+    &raw const $place
+}
+
+pub macro addr_of_super($place:expr) {
+    &raw const $place
+}
+
 pub macro addr_of_self($place:expr) {
     &raw const $place
 }
 
-pub macro addr_of_crate($place:expr) {
+pub macro addr_of_local($place:expr) {
     &raw const $place
 }
 
 pub struct Foo;
-pub struct FooSelf;
 pub struct FooCrate;
+pub struct FooSuper;
+pub struct FooSelf;
+pub struct FooLocal;
 
 pub enum Bar { Foo, }
-pub enum BarSelf { Foo, }
 pub enum BarCrate { Foo, }
+pub enum BarSuper { Foo, }
+pub enum BarSelf { Foo, }
+pub enum BarLocal { Foo, }
 
 pub fn foo() {}
-pub fn foo_self() {}
 pub fn foo_crate() {}
+pub fn foo_super() {}
+pub fn foo_self() {}
+pub fn foo_local() {}
 
 pub type Type = i32;
-pub type TypeSelf = i32;
 pub type TypeCrate = i32;
+pub type TypeSuper = i32;
+pub type TypeSelf = i32;
+pub type TypeLocal = i32;
 
 pub union Union {
     a: i8,
     b: i8,
 }
+pub union UnionCrate {
+    a: i8,
+    b: i8,
+}
+pub union UnionSuper {
+    a: i8,
+    b: i8,
+}
 pub union UnionSelf {
     a: i8,
     b: i8,
 }
-pub union UnionCrate {
+pub union UnionLocal {
     a: i8,
     b: i8,
 }
diff --git a/src/test/rustdoc/enum-headings.rs b/src/test/rustdoc/enum-headings.rs
new file mode 100644 (file)
index 0000000..2e5c343
--- /dev/null
@@ -0,0 +1,40 @@
+#![crate_name = "foo"]
+// @has foo/enum.Token.html
+/// A token!
+/// # First
+/// Some following text...
+// @has - '//h2[@id="first"]' "First"
+pub enum Token {
+    /// A declaration!
+    /// # Variant-First
+    /// Some following text...
+    // @has - '//h4[@id="variant-first"]' "Variant-First"
+    Declaration {
+        /// A version!
+        /// # Variant-Field-First
+        /// Some following text...
+        // @has - '//h5[@id="variant-field-first"]' "Variant-Field-First"
+        version: String,
+    },
+    /// A Zoople!
+    /// # Variant-First
+    Zoople(
+        // @has - '//h5[@id="variant-tuple-field-first"]' "Variant-Tuple-Field-First"
+        /// Zoople's first variant!
+        /// # Variant-Tuple-Field-First
+        /// Some following text...
+        usize,
+    ),
+    /// Unfinished business!
+    /// # Non-Exhaustive-First
+    /// Some following text...
+    // @has - '//h4[@id="non-exhaustive-first"]' "Non-Exhaustive-First"
+    #[non_exhaustive]
+    Unfinished {
+        /// This is x.
+        /// # X-First
+        /// Some following text...
+        // @has - '//h5[@id="x-first"]' "X-First"
+        x: usize,
+    },
+}
index 509457f6c9649610b4200fb4cf69886ac0a7bed8..95f741807494cf8e8ba7b780ab2fb7d0783ecbd4 100644 (file)
 
 // @has 'foo/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place : expr) {'
 pub use reexports::addr_of;
-// @has 'foo/macro.addr_of_crate.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_crate($place : expr) {'
+// @!has 'foo/macro.addr_of_crate.html'
 pub(crate) use reexports::addr_of_crate;
-// @has 'foo/macro.addr_of_self.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_self($place : expr) {'
+// @!has 'foo/macro.addr_of_self.html'
 pub(self) use reexports::addr_of_self;
+// @!has 'foo/macro.addr_of_local.html'
+use reexports::addr_of_local;
 
 // @has 'foo/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;'
 pub use reexports::Foo;
-// @has 'foo/struct.FooCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooCrate;'
+// @!has 'foo/struct.FooCrate.html'
 pub(crate) use reexports::FooCrate;
-// @has 'foo/struct.FooSelf.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooSelf;'
+// @!has 'foo/struct.FooSelf.html'
 pub(self) use reexports::FooSelf;
+// @!has 'foo/struct.FooLocal.html'
+use reexports::FooLocal;
 
 // @has 'foo/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {'
 pub use reexports::Bar;
-// @has 'foo/enum.BarCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarCrate {'
+// @!has 'foo/enum.BarCrate.html'
 pub(crate) use reexports::BarCrate;
-// @has 'foo/enum.BarSelf.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarSelf {'
+// @!has 'foo/enum.BarSelf.html'
 pub(self) use reexports::BarSelf;
+// @!has 'foo/enum.BarLocal.html'
+use reexports::BarLocal;
 
 // @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()'
 pub use reexports::foo;
-// @has 'foo/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()'
+// @!has 'foo/fn.foo_crate.html'
 pub(crate) use reexports::foo_crate;
-// @has 'foo/fn.foo_self.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_self()'
+// @!has 'foo/fn.foo_self.html'
 pub(self) use reexports::foo_self;
+// @!has 'foo/fn.foo_local.html'
+use reexports::foo_local;
 
 // @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type ='
 pub use reexports::Type;
-// @has 'foo/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate ='
+// @!has 'foo/type.TypeCrate.html'
 pub(crate) use reexports::TypeCrate;
-// @has 'foo/type.TypeSelf.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeSelf ='
+// @!has 'foo/type.TypeSelf.html'
 pub(self) use reexports::TypeSelf;
+// @!has 'foo/type.TypeLocal.html'
+use reexports::TypeLocal;
 
 // @has 'foo/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {'
 pub use reexports::Union;
-// @has 'foo/union.UnionCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionCrate {'
+// @!has 'foo/union.UnionCrate.html'
 pub(crate) use reexports::UnionCrate;
-// @has 'foo/union.UnionSelf.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionSelf {'
+// @!has 'foo/union.UnionSelf.html'
 pub(self) use reexports::UnionSelf;
+// @!has 'foo/union.UnionLocal.html'
+use reexports::UnionLocal;
 
-pub mod foo {
-    // @!has 'foo/foo/union.Union.html'
-    use crate::reexports::Union;
+pub mod outer {
+    pub mod inner {
+        // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place : expr) {'
+        pub use reexports::addr_of;
+        // @has 'foo/outer/inner/macro.addr_of_crate.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_crate($place : expr) {'
+        pub(crate) use reexports::addr_of_crate;
+        // @has 'foo/outer/inner/macro.addr_of_super.html' '//*[@class="docblock item-decl"]' 'pub(in outer) macro addr_of_super($place : expr) {'
+        pub(super) use reexports::addr_of_super;
+        // @!has 'foo/outer/inner/macro.addr_of_self.html'
+        pub(self) use reexports::addr_of_self;
+        // @!has 'foo/outer/inner/macro.addr_of_local.html'
+        use reexports::addr_of_local;
+
+        // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;'
+        pub use reexports::Foo;
+        // @has 'foo/outer/inner/struct.FooCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooCrate;'
+        pub(crate) use reexports::FooCrate;
+        // @has 'foo/outer/inner/struct.FooSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) struct FooSuper;'
+        pub(super) use reexports::FooSuper;
+        // @!has 'foo/outer/inner/struct.FooSelf.html'
+        pub(self) use reexports::FooSelf;
+        // @!has 'foo/outer/inner/struct.FooLocal.html'
+        use reexports::FooLocal;
+
+        // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {'
+        pub use reexports::Bar;
+        // @has 'foo/outer/inner/enum.BarCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarCrate {'
+        pub(crate) use reexports::BarCrate;
+        // @has 'foo/outer/inner/enum.BarSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) enum BarSuper {'
+        pub(super) use reexports::BarSuper;
+        // @!has 'foo/outer/inner/enum.BarSelf.html'
+        pub(self) use reexports::BarSelf;
+        // @!has 'foo/outer/inner/enum.BarLocal.html'
+        use reexports::BarLocal;
+
+        // @has 'foo/outer/inner/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()'
+        pub use reexports::foo;
+        // @has 'foo/outer/inner/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()'
+        pub(crate) use reexports::foo_crate;
+        // @has 'foo/outer/inner/fn.foo_super.html' '//*[@class="rust fn"]' 'pub(in outer) fn foo_super()'
+        pub(super) use::reexports::foo_super;
+        // @!has 'foo/outer/inner/fn.foo_self.html'
+        pub(self) use reexports::foo_self;
+        // @!has 'foo/outer/inner/fn.foo_local.html'
+        use reexports::foo_local;
+
+        // @has 'foo/outer/inner/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type ='
+        pub use reexports::Type;
+        // @has 'foo/outer/inner/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate ='
+        pub(crate) use reexports::TypeCrate;
+        // @has 'foo/outer/inner/type.TypeSuper.html' '//*[@class="rust typedef"]' 'pub(in outer) type TypeSuper ='
+        pub(super) use reexports::TypeSuper;
+        // @!has 'foo/outer/inner/type.TypeSelf.html'
+        pub(self) use reexports::TypeSelf;
+        // @!has 'foo/outer/inner/type.TypeLocal.html'
+        use reexports::TypeLocal;
+
+        // @has 'foo/outer/inner/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {'
+        pub use reexports::Union;
+        // @has 'foo/outer/inner/union.UnionCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionCrate {'
+        pub(crate) use reexports::UnionCrate;
+        // @has 'foo/outer/inner/union.UnionSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) union UnionSuper {'
+        pub(super) use reexports::UnionSuper;
+        // @!has 'foo/outer/inner/union.UnionSelf.html'
+        pub(self) use reexports::UnionSelf;
+        // @!has 'foo/outer/inner/union.UnionLocal.html'
+        use reexports::UnionLocal;
+    }
+}
+
+mod re_re_exports {
+        // @!has 'foo/re_re_exports/union.Union.html'
+        use crate::reexports::Union;
 }
index c308d0c2f05cf49db8f5fc2be4026ffa9a29b74b..3b315308470356e4eae661fd59da051143927ad3 100644 (file)
@@ -10,6 +10,8 @@
 pub(crate) use reexports::addr_of_crate;
 // @!has 'foo/macro.addr_of_self.html'
 pub(self) use reexports::addr_of_self;
+// @!has 'foo/macro.addr_of_local.html'
+use reexports::addr_of_local;
 
 // @has 'foo/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;'
 pub use reexports::Foo;
@@ -17,6 +19,8 @@
 pub(crate) use reexports::FooCrate;
 // @!has 'foo/struct.FooSelf.html'
 pub(self) use reexports::FooSelf;
+// @!has 'foo/struct.FooLocal.html'
+use reexports::FooLocal;
 
 // @has 'foo/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {'
 pub use reexports::Bar;
@@ -24,6 +28,8 @@
 pub(crate) use reexports::BarCrate;
 // @!has 'foo/enum.BarSelf.html'
 pub(self) use reexports::BarSelf;
+// @!has 'foo/enum.BarLocal.html'
+use reexports::BarLocal;
 
 // @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()'
 pub use reexports::foo;
@@ -31,6 +37,8 @@
 pub(crate) use reexports::foo_crate;
 // @!has 'foo/fn.foo_self.html'
 pub(self) use reexports::foo_self;
+// @!has 'foo/fn.foo_local.html'
+use reexports::foo_local;
 
 // @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type ='
 pub use reexports::Type;
@@ -38,6 +46,8 @@
 pub(crate) use reexports::TypeCrate;
 // @!has 'foo/type.TypeSelf.html'
 pub(self) use reexports::TypeSelf;
+// @!has 'foo/type.TypeLocal.html'
+use reexports::TypeLocal;
 
 // @has 'foo/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {'
 pub use reexports::Union;
 pub(crate) use reexports::UnionCrate;
 // @!has 'foo/union.UnionSelf.html'
 pub(self) use reexports::UnionSelf;
+// @!has 'foo/union.UnionLocal.html'
+use reexports::UnionLocal;
+
+pub mod outer {
+    pub mod inner {
+        // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place : expr) {'
+        pub use reexports::addr_of;
+        // @!has 'foo/outer/inner/macro.addr_of_crate.html'
+        pub(crate) use reexports::addr_of_crate;
+        // @!has 'foo/outer/inner/macro.addr_of_super.html'
+        pub(super) use reexports::addr_of_super;
+        // @!has 'foo/outer/inner/macro.addr_of_self.html'
+        pub(self) use reexports::addr_of_self;
+        // @!has 'foo/outer/inner/macro.addr_of_local.html'
+        use reexports::addr_of_local;
+
+        // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;'
+        pub use reexports::Foo;
+        // @!has 'foo/outer/inner/struct.FooCrate.html'
+        pub(crate) use reexports::FooCrate;
+        // @!has 'foo/outer/inner/struct.FooSuper.html'
+        pub(super) use reexports::FooSuper;
+        // @!has 'foo/outer/inner/struct.FooSelf.html'
+        pub(self) use reexports::FooSelf;
+        // @!has 'foo/outer/inner/struct.FooLocal.html'
+        use reexports::FooLocal;
+
+        // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {'
+        pub use reexports::Bar;
+        // @!has 'foo/outer/inner/enum.BarCrate.html'
+        pub(crate) use reexports::BarCrate;
+        // @!has 'foo/outer/inner/enum.BarSuper.html'
+        pub(super) use reexports::BarSuper;
+        // @!has 'foo/outer/inner/enum.BarSelf.html'
+        pub(self) use reexports::BarSelf;
+        // @!has 'foo/outer/inner/enum.BarLocal.html'
+        use reexports::BarLocal;
+
+        // @has 'foo/outer/inner/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()'
+        pub use reexports::foo;
+        // @!has 'foo/outer/inner/fn.foo_crate.html'
+        pub(crate) use reexports::foo_crate;
+        // @!has 'foo/outer/inner/fn.foo_super.html'
+        pub(super) use::reexports::foo_super;
+        // @!has 'foo/outer/inner/fn.foo_self.html'
+        pub(self) use reexports::foo_self;
+        // @!has 'foo/outer/inner/fn.foo_local.html'
+        use reexports::foo_local;
+
+        // @has 'foo/outer/inner/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type ='
+        pub use reexports::Type;
+        // @!has 'foo/outer/inner/type.TypeCrate.html'
+        pub(crate) use reexports::TypeCrate;
+        // @!has 'foo/outer/inner/type.TypeSuper.html'
+        pub(super) use reexports::TypeSuper;
+        // @!has 'foo/outer/inner/type.TypeSelf.html'
+        pub(self) use reexports::TypeSelf;
+        // @!has 'foo/outer/inner/type.TypeLocal.html'
+        use reexports::TypeLocal;
+
+        // @has 'foo/outer/inner/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {'
+        pub use reexports::Union;
+        // @!has 'foo/outer/inner/union.UnionCrate.html'
+        pub(crate) use reexports::UnionCrate;
+        // @!has 'foo/outer/inner/union.UnionSuper.html'
+        pub(super) use reexports::UnionSuper;
+        // @!has 'foo/outer/inner/union.UnionSelf.html'
+        pub(self) use reexports::UnionSelf;
+        // @!has 'foo/outer/inner/union.UnionLocal.html'
+        use reexports::UnionLocal;
+    }
+}
index f3d8e39ea2d266824e0695b2046d02926c383458..139c5b4391ab7261860d3eb2f6f84ef99fd187af 100644 (file)
@@ -20,10 +20,10 @@ pub struct Foo(
 
 // @has foo/enum.Bar.html
 // @has - '//pre[@class="rust enum"]' 'BarVariant(String),'
-// @matches - '//*[@id="variant.BarVariant.fields"]/h3' '^Tuple Fields of BarVariant$'
+// @matches - '//*[@id="variant.BarVariant.fields"]/h4' '^Tuple Fields$'
 // @has - '//*[@id="variant.BarVariant.field.0"]' '0: String'
 // @has - '//*[@id="variant.BarVariant.fields"]//*[@class="docblock"]' 'Hello docs'
-// @matches - '//*[@id="variant.FooVariant.fields"]/h3' '^Fields of FooVariant$'
+// @matches - '//*[@id="variant.FooVariant.fields"]/h4' '^Fields$'
 pub enum Bar {
     BarVariant(
         /// Hello docs
diff --git a/src/test/ui/abi/stack-protector.rs b/src/test/ui/abi/stack-protector.rs
new file mode 100644 (file)
index 0000000..24bd2e2
--- /dev/null
@@ -0,0 +1,99 @@
+// run-pass
+// only-x86_64-unknown-linux-gnu
+// revisions: ssp no-ssp
+// [ssp] compile-flags: -Z stack-protector=all
+// compile-flags: -C opt-level=2
+// compile-flags: -g
+
+use std::env;
+use std::process::{Command, ExitStatus};
+
+fn main() {
+    if env::args().len() == 1 {
+        // The test is initially run without arguments. Start the process again,
+        // this time *with* an argument; in this configuration, the test program
+        // will deliberately smash the stack.
+        let cur_argv0 = env::current_exe().unwrap();
+        let mut child = Command::new(&cur_argv0);
+        child.arg("stacksmash");
+
+        if cfg!(ssp) {
+            assert_stack_smash_prevented(&mut child);
+        } else {
+            assert_stack_smashed(&mut child);
+        }
+    } else {
+        vulnerable_function();
+        // If we return here the test is broken: it should either have called
+        // malicious_code() which terminates the process, or be caught by the
+        // stack check which also terminates the process.
+        panic!("TEST BUG: stack smash unsuccessful");
+    }
+}
+
+// Avoid inlining to make sure the return address is pushed to stack.
+#[inline(never)]
+fn vulnerable_function() {
+    let mut x = 5usize;
+    let stackaddr = &mut x as *mut usize;
+    let bad_code_ptr = malicious_code as usize;
+    // 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); }
+}
+
+// Use an uninlined function with its own stack frame to make sure that we don't
+// clobber e.g. the counter or address local variable.
+#[inline(never)]
+unsafe fn fill(addr: *mut usize, val: usize, count: usize) {
+    let mut addr = addr;
+    for _ in 0..count {
+        *addr = val;
+        addr = addr.add(1);
+    }
+}
+
+// We jump to malicious_code() having wreaked havoc with the previous stack
+// frame and not setting up a new one. This function is therefore constrained,
+// e.g. both println!() and std::process::exit() segfaults if called. We
+// therefore keep the amount of work to a minimum by calling POSIX functions
+// directly.
+// The function is un-inlined just to make it possible to set a breakpoint here.
+#[inline(never)]
+fn malicious_code() {
+    let msg = [112u8, 119u8, 110u8, 101u8, 100u8, 33u8, 0u8]; // "pwned!\0" ascii
+    unsafe {
+        write(1, &msg as *const u8, msg.len());
+        _exit(0);
+    }
+}
+extern "C" {
+    fn write(fd: i32, buf: *const u8, count: usize) -> isize;
+    fn _exit(status: i32) -> !;
+}
+
+
+fn assert_stack_smash_prevented(cmd: &mut Command) {
+    let (status, stdout, stderr) = run(cmd);
+    assert!(!status.success());
+    assert!(stdout.is_empty());
+    assert!(stderr.contains("stack smashing detected"));
+}
+
+fn assert_stack_smashed(cmd: &mut Command) {
+    let (status, stdout, stderr) = run(cmd);
+    assert!(status.success());
+    assert!(stdout.contains("pwned!"));
+    assert!(stderr.is_empty());
+}
+
+
+fn run(cmd: &mut Command) -> (ExitStatus, String, String) {
+    let output = cmd.output().unwrap();
+    let stdout = String::from_utf8_lossy(&output.stdout);
+    let stderr = String::from_utf8_lossy(&output.stderr);
+    println!("status: {}", output.status);
+    println!("stdout: {}", stdout);
+    println!("stderr: {}", stderr);
+    (output.status, stdout.to_string(), stderr.to_string())
+}
diff --git a/src/test/ui/absolute-paths-in-nested-use-groups.rs b/src/test/ui/absolute-paths-in-nested-use-groups.rs
deleted file mode 100644 (file)
index 96b5131..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#![allow(unused_imports)]
-
-mod foo {}
-
-use foo::{
-    ::bar,       //~ ERROR crate root in paths can only be used in start position
-    super::bar,  //~ ERROR `super` in paths can only be used in start position
-    self::bar,   //~ ERROR `self` in paths can only be used in start position
-};
-
-fn main() {}
diff --git a/src/test/ui/absolute-paths-in-nested-use-groups.stderr b/src/test/ui/absolute-paths-in-nested-use-groups.stderr
deleted file mode 100644 (file)
index e41590a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0433]: failed to resolve: crate root in paths can only be used in start position
-  --> $DIR/absolute-paths-in-nested-use-groups.rs:6:5
-   |
-LL |     ::bar,
-   |     ^ crate root in paths can only be used in start position
-
-error[E0433]: failed to resolve: `super` in paths can only be used in start position
-  --> $DIR/absolute-paths-in-nested-use-groups.rs:7:5
-   |
-LL |     super::bar,
-   |     ^^^^^ `super` in paths can only be used in start position
-
-error[E0433]: failed to resolve: `self` in paths can only be used in start position
-  --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5
-   |
-LL |     self::bar,
-   |     ^^^^ `self` in paths can only be used in start position
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/alignment-gep-tup-like-1.rs b/src/test/ui/alignment-gep-tup-like-1.rs
deleted file mode 100644 (file)
index eb503dc..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// run-pass
-
-#![allow(non_camel_case_types)]
-#![allow(dead_code)]
-
-struct pair<A,B> {
-    a: A, b: B
-}
-
-trait Invokable<A> {
-    fn f(&self) -> (A, u16);
-}
-
-struct Invoker<A> {
-    a: A,
-    b: u16,
-}
-
-impl<A:Clone> Invokable<A> for Invoker<A> {
-    fn f(&self) -> (A, u16) {
-        (self.a.clone(), self.b)
-    }
-}
-
-fn f<A:Clone + 'static>(a: A, b: u16) -> Box<dyn Invokable<A>+'static> {
-    Box::new(Invoker {
-        a: a,
-        b: b,
-    }) as Box<dyn Invokable<A>+'static>
-}
-
-pub fn main() {
-    let (a, b) = f(22_u64, 44u16).f();
-    println!("a={} b={}", a, b);
-    assert_eq!(a, 22u64);
-    assert_eq!(b, 44u16);
-}
index 628b48a45d76d6b19604f4a47537b4cbb7a4e2d6..e7a9ce94af4d9f52fc0c4c61e19f7097b2709c5d 100644 (file)
@@ -6,11 +6,6 @@ LL | #[global_allocator]
 LL | static A: usize = 0;
    | ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
    |
-note: required by `std::alloc::GlobalAlloc::alloc`
-  --> $SRC_DIR/core/src/alloc/global.rs:LL:COL
-   |
-LL |     unsafe fn alloc(&self, layout: Layout) -> *mut u8;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@@ -21,11 +16,6 @@ LL | #[global_allocator]
 LL | static A: usize = 0;
    | ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
    |
-note: required by `std::alloc::GlobalAlloc::dealloc`
-  --> $SRC_DIR/core/src/alloc/global.rs:LL:COL
-   |
-LL |     unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@@ -36,11 +26,6 @@ LL | #[global_allocator]
 LL | static A: usize = 0;
    | ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
    |
-note: required by `std::alloc::GlobalAlloc::realloc`
-  --> $SRC_DIR/core/src/alloc/global.rs:LL:COL
-   |
-LL |     unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@@ -51,11 +36,6 @@ LL | #[global_allocator]
 LL | static A: usize = 0;
    | ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
    |
-note: required by `std::alloc::GlobalAlloc::alloc_zeroed`
-  --> $SRC_DIR/core/src/alloc/global.rs:LL:COL
-   |
-LL |     unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 4 previous errors
diff --git a/src/test/ui/array-slice-vec/byte-literals.rs b/src/test/ui/array-slice-vec/byte-literals.rs
new file mode 100644 (file)
index 0000000..2649c2e
--- /dev/null
@@ -0,0 +1,67 @@
+// run-pass
+//
+
+
+static FOO: u8 = b'\xF0';
+static BAR: &'static [u8] = b"a\xF0\t";
+static BAR_FIXED: &'static [u8; 3] = b"a\xF0\t";
+static BAZ: &'static [u8] = br"a\n";
+
+pub fn main() {
+    let bar: &'static [u8] = b"a\xF0\t";
+    let bar_fixed: &'static [u8; 3] = b"a\xF0\t";
+
+    assert_eq!(b'a', 97u8);
+    assert_eq!(b'\n', 10u8);
+    assert_eq!(b'\r', 13u8);
+    assert_eq!(b'\t', 9u8);
+    assert_eq!(b'\\', 92u8);
+    assert_eq!(b'\'', 39u8);
+    assert_eq!(b'\"', 34u8);
+    assert_eq!(b'\0', 0u8);
+    assert_eq!(b'\xF0', 240u8);
+    assert_eq!(FOO, 240u8);
+
+    match 42 {
+        b'*' => {},
+        _ => panic!()
+    }
+
+    match 100 {
+        b'a' ..= b'z' => {},
+        _ => panic!()
+    }
+
+    let expected: &[_] = &[97u8, 10u8, 13u8, 9u8, 92u8, 39u8, 34u8, 0u8, 240u8];
+    assert_eq!(b"a\n\r\t\\\'\"\0\xF0", expected);
+    let expected: &[_] = &[97u8, 98u8];
+    assert_eq!(b"a\
+                 b", expected);
+    let expected: &[_] = &[97u8, 240u8, 9u8];
+    assert_eq!(BAR, expected);
+    assert_eq!(BAR_FIXED, expected);
+    assert_eq!(bar, expected);
+    assert_eq!(bar_fixed, expected);
+
+    let val = &[97u8, 10u8];
+    match val {
+        b"a\n" => {},
+        _ => panic!(),
+    }
+
+    let buf = vec![97u8, 98, 99, 100];
+    assert_eq!(match &buf[0..3] {
+         b"def" => 1,
+         b"abc" => 2,
+         _ => 3
+    }, 2);
+
+    let expected: &[_] = &[97u8, 92u8, 110u8];
+    assert_eq!(BAZ, expected);
+    let expected: &[_] = &[97u8, 92u8, 110u8];
+    assert_eq!(br"a\n", expected);
+    assert_eq!(br"a\n", b"a\\n");
+    let expected: &[_] = &[97u8, 34u8, 35u8, 35u8, 98u8];
+    assert_eq!(br###"a"##b"###, expected);
+    assert_eq!(br###"a"##b"###, b"a\"##b");
+}
diff --git a/src/test/ui/assignment-operator-unimplemented.rs b/src/test/ui/assignment-operator-unimplemented.rs
deleted file mode 100644 (file)
index 21df464..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-struct Foo;
-
-fn main() {
-  let mut a = Foo;
-  let ref b = Foo;
-  a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo`
-}
diff --git a/src/test/ui/assignment-operator-unimplemented.stderr b/src/test/ui/assignment-operator-unimplemented.stderr
deleted file mode 100644 (file)
index 73c9f86..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0368]: binary assignment operation `+=` cannot be applied to type `Foo`
-  --> $DIR/assignment-operator-unimplemented.rs:6:3
-   |
-LL |   a += *b;
-   |   -^^^^^^
-   |   |
-   |   cannot use `+=` on type `Foo`
-   |
-note: an implementation of `AddAssign<_>` might be missing for `Foo`
-  --> $DIR/assignment-operator-unimplemented.rs:1:1
-   |
-LL | struct Foo;
-   | ^^^^^^^^^^^ must implement `AddAssign<_>`
-note: the following trait must be implemented
-  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
-   |
-LL | / pub trait AddAssign<Rhs = Self> {
-LL | |     /// Performs the `+=` operation.
-LL | |     ///
-LL | |     /// # Example
-...  |
-LL | |     fn add_assign(&mut self, rhs: Rhs);
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0368`.
index ff56d112c8184254fd9645f52a097180504f37b9..86c62e7b7f12fe0a61b08cb88c8ee2230b253ba4 100644 (file)
@@ -3,12 +3,6 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
    |
 LL | const X: [i32; <i32 as Foo>::ID] = [0, 1, 2];
    |                ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
-   |
-note: required by `Foo::ID`
-  --> $DIR/associated-const-array-len.rs:2:5
-   |
-LL |     const ID: usize;
-   |     ^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index cea56cd5946c969ddbd9fb6d6d1a87c61b0f14cc..db39fd762c307c056ce5339d32377e95771a8198 100644 (file)
@@ -9,11 +9,6 @@ LL |     fn f() -> ([u8; A::C], [u8; A::C]);
    |
    = note: cannot satisfy `_: A`
    = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl`
-note: required by `A::C`
-  --> $DIR/issue-63496.rs:2:5
-   |
-LL |     const C: usize;
-   |     ^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/issue-63496.rs:4:33
@@ -26,11 +21,6 @@ LL |     fn f() -> ([u8; A::C], [u8; A::C]);
    |
    = note: cannot satisfy `_: A`
    = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl`
-note: required by `A::C`
-  --> $DIR/issue-63496.rs:2:5
-   |
-LL |     const C: usize;
-   |     ^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index 7b158f1d754740ad1500dbaf5f7146e48085e045..9ae25a8c222206e27c305920f72a90c580232933 100644 (file)
@@ -9,11 +9,6 @@ LL |     fn return_n(&self) -> [u8; Bar::X];
    |
    = note: cannot satisfy `_: Bar`
    = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl`
-note: required by `Bar::X`
-  --> $DIR/issue-48027.rs:2:5
-   |
-LL |     const X: usize;
-   |     ^^^^^^^^^^^^^^^
 
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/issue-48027.rs:6:6
index 57aacf67e05fd8919da971f76449af18101c69f4..4ecae471ec2da3909602ebca1931fec9685c623a 100644 (file)
@@ -5,13 +5,6 @@ LL |     type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8
    |                                    ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be sent between threads safely
    |
    = help: the trait `Send` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
-note: required by a bound in `Send`
-  --> $SRC_DIR/core/src/marker.rs:LL:COL
-   |
-LL | / pub unsafe auto trait Send {
-LL | |     // empty.
-LL | | }
-   | |_^ required by this bound in `Send`
 help: consider further restricting the associated type
    |
 LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Send {
@@ -24,17 +17,6 @@ LL |     type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<<Self as Case1>::C as Iterator>::Item` is not an iterator
    |
    = help: the trait `Iterator` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
-note: required by a bound in `Iterator`
-  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-   |
-LL | / pub trait Iterator {
-LL | |     /// The type of the elements being iterated over.
-LL | |     #[stable(feature = "rust1", since = "1.0.0")]
-LL | |     type Item;
-...  |
-LL | |     }
-LL | | }
-   | |_^ required by this bound in `Iterator`
 help: consider further restricting the associated type
    |
 LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Iterator {
@@ -47,17 +29,6 @@ LL |     type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8
    |                                                                                             ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be shared between threads safely
    |
    = help: the trait `Sync` is not implemented for `<<Self as Case1>::C as Iterator>::Item`
-note: required by a bound in `Sync`
-  --> $SRC_DIR/core/src/marker.rs:LL:COL
-   |
-LL | / pub unsafe auto trait Sync {
-LL | |     // FIXME(estebank): once support to add notes in `rustc_on_unimplemented`
-LL | |     // lands in beta, and it has been extended to check whether a closure is
-LL | |     // anywhere in the requirement chain, extend it as such (#48534):
-...  |
-LL | |     // Empty
-LL | | }
-   | |_^ required by this bound in `Sync`
 help: consider further restricting the associated type
    |
 LL | trait Case1 where <<Self as Case1>::C as Iterator>::Item: Sync {
index 4da5a2cbd41a6b588bc35a07ef146de7a68b874a..4e2313bd4e4a90709aabcdc0101a2e2cd1fe28db 100644 (file)
@@ -5,17 +5,6 @@ LL |     type A: Iterator<Item: Debug>;
    |                            ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
    = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item`
-note: required by a bound in `Debug`
-  --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
-   |
-LL | / pub trait Debug {
-LL | |     /// Formats the value using the given formatter.
-LL | |     ///
-LL | |     /// # Examples
-...  |
-LL | |     fn fmt(&self, f: &mut Formatter<'_>) -> Result;
-LL | | }
-   | |_^ required by this bound in `Debug`
 help: consider further restricting the associated type
    |
 LL | trait Case1 where <<Self as Case1>::A as Iterator>::Item: Debug {
@@ -27,17 +16,6 @@ error[E0277]: the trait bound `<<Self as Foo>::Out as Baz>::Assoc: Default` is n
 LL | pub trait Foo { type Out: Baz<Assoc: Default>; }
    |                                      ^^^^^^^ the trait `Default` is not implemented for `<<Self as Foo>::Out as Baz>::Assoc`
    |
-note: required by a bound in `Default`
-  --> $SRC_DIR/core/src/default.rs:LL:COL
-   |
-LL | / pub trait Default: Sized {
-LL | |     /// Returns the "default value" for a type.
-LL | |     ///
-LL | |     /// Default values are often some kind of initial value, identity value, or anything else that
-...  |
-LL | |     fn default() -> Self;
-LL | | }
-   | |_^ required by this bound in `Default`
 help: consider further restricting the associated type
    |
 LL | pub trait Foo where <<Self as Foo>::Out as Baz>::Assoc: Default { type Out: Baz<Assoc: Default>; }
index e66c6b35ca1eed0749a494c4f95d889d19c8fea6..3eda22796e099aeb4bdf39a5c9ac395f81fa11ae 100644 (file)
@@ -6,11 +6,6 @@ LL |     ToInt::to_int(&g.get())
    |     |
    |     required by a bound introduced by this call
    |
-note: required by `ToInt::to_int`
-  --> $DIR/associated-types-bound-failure.rs:6:5
-   |
-LL |     fn to_int(&self) -> isize;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider further restricting the associated type
    |
 LL |     where G : GetToInt, <G as GetToInt>::R: ToInt
index 92c963a9ef9f2360c4fa9588e5121e6dcc0872ac..6552c8be7808926e1b4acb7cd25536ed2c708795 100644 (file)
@@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied
 LL |     fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
    |                                        ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
    |
-note: required by a bound in `Get`
-  --> $DIR/associated-types-for-unimpl-trait.rs:4:1
-   |
-LL | trait Get {
-   | ^^^^^^^^^ required by this bound in `Get`
 help: consider further restricting `Self`
    |
 LL |     fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
index 509d548c69df0b27ac0bcb214808cb1d36fd3725..b2ee1b5e6d04527fb56eb6eddb0b65ce4e8d8381 100644 (file)
@@ -4,11 +4,6 @@ error[E0277]: the trait bound `T: Get` is not satisfied
 LL |     fn uhoh<T>(foo: <T as Get>::Value) {}
    |                     ^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T`
    |
-note: required by a bound in `Get`
-  --> $DIR/associated-types-no-suitable-bound.rs:1:1
-   |
-LL | trait Get {
-   | ^^^^^^^^^ required by this bound in `Get`
 help: consider restricting type parameter `T`
    |
 LL |     fn uhoh<T: Get>(foo: <T as Get>::Value) {}
index 1cb9ac8fdefc1d111244473d85301fd38dbe0204..2e40dbd065d3ef5579d5495b95590646d5e086a0 100644 (file)
@@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied
 LL |     fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
    |                                        ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
    |
-note: required by a bound in `Get`
-  --> $DIR/associated-types-no-suitable-supertrait-2.rs:12:1
-   |
-LL | trait Get {
-   | ^^^^^^^^^ required by this bound in `Get`
 help: consider further restricting `Self`
    |
 LL |     fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
index e3185fbe9392e648a88332c84bf5688cf6fa6914..da79c7ac77f9d1bf5e64b63a8ad154ef56bde2d3 100644 (file)
@@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied
 LL |     fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
    |                                        ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
    |
-note: required by a bound in `Get`
-  --> $DIR/associated-types-no-suitable-supertrait.rs:12:1
-   |
-LL | trait Get {
-   | ^^^^^^^^^ required by this bound in `Get`
 help: consider further restricting `Self`
    |
 LL |     fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
@@ -19,12 +14,6 @@ error[E0277]: the trait bound `(T, U): Get` is not satisfied
    |
 LL |     fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
    |                                        ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)`
-   |
-note: required by a bound in `Get`
-  --> $DIR/associated-types-no-suitable-supertrait.rs:12:1
-   |
-LL | trait Get {
-   | ^^^^^^^^^ required by this bound in `Get`
 
 error: aborting due to 2 previous errors
 
index 09ec0e116175db9462eeb812b13546d9f679c61b..2e67c21940fc712c05aebfd3170128e287c54434 100644 (file)
@@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Get` is not satisfied
 LL |     fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value);
    |                                        ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
    |
-note: required by a bound in `Get`
-  --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:5:1
-   |
-LL | trait Get {
-   | ^^^^^^^^^ required by this bound in `Get`
 help: consider further restricting `Self`
    |
 LL |     fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get;
index 5f4b65bd131ee4129757a80d6a85ff776f03d80d..60ec23cf655ab162e80d3a1b6045cc4424fddab3 100644 (file)
@@ -5,11 +5,6 @@ LL |     let x: isize = Foo::bar();
    |                    ^^^^^^^^ cannot infer type
    |
    = note: cannot satisfy `_: Foo`
-note: required by `Foo::bar`
-  --> $DIR/associated-types-unconstrained.rs:5:5
-   |
-LL |     fn bar() -> isize;
-   |     ^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 7bf36d5e91515dbff90e8c892258273262f9ccc7..54f6556c083fd8b55e849b3e336716f9cc6828ae 100644 (file)
@@ -9,11 +9,6 @@ note: required because of the requirements on the impl of `Visit` for `()`
    |
 LL | impl<'a> Visit for () where
    |          ^^^^^     ^^
-note: required by `Visit::visit`
-  --> $DIR/issue-44153.rs:6:5
-   |
-LL |     fn visit() {}
-   |     ^^^^^^^^^^
 
 error: aborting due to previous error
 
index a70f771e4826f14c33b4900ecbb8a76765e0df21..384561f8ccd7e0496ef3c867ff4e015f8955a958 100644 (file)
@@ -83,17 +83,17 @@ fn main() {
     //~^ ERROR type mismatch resolving `<impl DerivedTrait as Trait>::Associated == ()`
 
     accepts_trait(returns_opaque_foo());
-    //~^ ERROR type mismatch resolving `<impl Trait+Foo as Trait>::Associated == ()`
+    //~^ ERROR type mismatch resolving `<impl Trait + Foo as Trait>::Associated == ()`
 
     accepts_trait(returns_opaque_derived_foo());
-    //~^ ERROR type mismatch resolving `<impl DerivedTrait+Foo as Trait>::Associated == ()`
+    //~^ ERROR type mismatch resolving `<impl DerivedTrait + Foo as Trait>::Associated == ()`
 
     accepts_generic_trait(returns_opaque_generic());
     //~^ ERROR type mismatch resolving `<impl GenericTrait<()> as GenericTrait<()>>::Associated == ()`
 
     accepts_generic_trait(returns_opaque_generic_foo());
-    //~^ ERROR type mismatch resolving `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated == ()`
+    //~^ ERROR type mismatch resolving `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated == ()`
 
     accepts_generic_trait(returns_opaque_generic_duplicate());
-    //~^ ERROR type mismatch resolving `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
+    //~^ ERROR type mismatch resolving `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
 }
index b85d64b86ae667c0c902e673065b315ff24b11f4..8db4a49da3c96e4f7790d038e62ac3ad0062a3d4 100644 (file)
@@ -160,7 +160,7 @@ help: consider constraining the associated type `<impl DerivedTrait as Trait>::A
 LL | fn returns_opaque_derived() -> impl DerivedTrait<Associated = ()> + 'static {
    |                                                 +++++++++++++++++
 
-error[E0271]: type mismatch resolving `<impl Trait+Foo as Trait>::Associated == ()`
+error[E0271]: type mismatch resolving `<impl Trait + Foo as Trait>::Associated == ()`
   --> $DIR/issue-87261.rs:85:5
    |
 LL | fn returns_opaque_foo() -> impl Trait + Foo {
@@ -170,18 +170,18 @@ LL |     accepts_trait(returns_opaque_foo());
    |     ^^^^^^^^^^^^^ expected `()`, found associated type
    |
    = note:    expected unit type `()`
-           found associated type `<impl Trait+Foo as Trait>::Associated`
+           found associated type `<impl Trait + Foo as Trait>::Associated`
 note: required by a bound in `accepts_trait`
   --> $DIR/issue-87261.rs:43:27
    |
 LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {}
    |                           ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait`
-help: consider constraining the associated type `<impl Trait+Foo as Trait>::Associated` to `()`
+help: consider constraining the associated type `<impl Trait + Foo as Trait>::Associated` to `()`
    |
 LL | fn returns_opaque_foo() -> impl Trait<Associated = ()> + Foo {
    |                                      +++++++++++++++++
 
-error[E0271]: type mismatch resolving `<impl DerivedTrait+Foo as Trait>::Associated == ()`
+error[E0271]: type mismatch resolving `<impl DerivedTrait + Foo as Trait>::Associated == ()`
   --> $DIR/issue-87261.rs:88:5
    |
 LL | fn returns_opaque_derived_foo() -> impl DerivedTrait + Foo {
@@ -191,8 +191,8 @@ LL |     accepts_trait(returns_opaque_derived_foo());
    |     ^^^^^^^^^^^^^ expected `()`, found associated type
    |
    = note:    expected unit type `()`
-           found associated type `<impl DerivedTrait+Foo as Trait>::Associated`
-   = help: consider constraining the associated type `<impl DerivedTrait+Foo as Trait>::Associated` to `()`
+           found associated type `<impl DerivedTrait + Foo as Trait>::Associated`
+   = help: consider constraining the associated type `<impl DerivedTrait + Foo as Trait>::Associated` to `()`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
 note: required by a bound in `accepts_trait`
   --> $DIR/issue-87261.rs:43:27
@@ -221,7 +221,7 @@ help: consider constraining the associated type `<impl GenericTrait<()> as Gener
 LL | fn returns_opaque_generic() -> impl GenericTrait<(), Associated = ()> + 'static {
    |                                                    +++++++++++++++++
 
-error[E0271]: type mismatch resolving `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated == ()`
+error[E0271]: type mismatch resolving `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated == ()`
   --> $DIR/issue-87261.rs:94:5
    |
 LL | fn returns_opaque_generic_foo() -> impl GenericTrait<()> + Foo {
@@ -231,18 +231,18 @@ LL |     accepts_generic_trait(returns_opaque_generic_foo());
    |     ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
    |
    = note:    expected unit type `()`
-           found associated type `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated`
+           found associated type `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated`
 note: required by a bound in `accepts_generic_trait`
   --> $DIR/issue-87261.rs:44:46
    |
 LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {}
    |                                              ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait`
-help: consider constraining the associated type `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated` to `()`
+help: consider constraining the associated type `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated` to `()`
    |
 LL | fn returns_opaque_generic_foo() -> impl GenericTrait<(), Associated = ()> + Foo {
    |                                                        +++++++++++++++++
 
-error[E0271]: type mismatch resolving `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
+error[E0271]: type mismatch resolving `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
   --> $DIR/issue-87261.rs:97:5
    |
 LL | fn returns_opaque_generic_duplicate() -> impl GenericTrait<()> + GenericTrait<u8> {
@@ -252,8 +252,8 @@ LL |     accepts_generic_trait(returns_opaque_generic_duplicate());
    |     ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
    |
    = note:    expected unit type `()`
-           found associated type `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated`
-   = help: consider constraining the associated type `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated` to `()`
+           found associated type `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated`
+   = help: consider constraining the associated type `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated` to `()`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
 note: required by a bound in `accepts_generic_trait`
   --> $DIR/issue-87261.rs:44:46
diff --git a/src/test/ui/associated-types/substs-ppaux.normal.stderr b/src/test/ui/associated-types/substs-ppaux.normal.stderr
new file mode 100644 (file)
index 0000000..085c568
--- /dev/null
@@ -0,0 +1,89 @@
+error[E0308]: mismatched types
+  --> $DIR/substs-ppaux.rs:16:17
+   |
+LL |     fn bar<'a, T>() where T: 'a {}
+   |     --------------------------- fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>} defined here
+...
+LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>;
+   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
+   |            |
+   |            expected due to this
+   |
+   = note: expected unit type `()`
+                found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
+help: use parentheses to call this function
+   |
+LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>();
+   |                                                                         ++
+
+error[E0308]: mismatched types
+  --> $DIR/substs-ppaux.rs:25:17
+   |
+LL |     fn bar<'a, T>() where T: 'a {}
+   |     --------------------------- fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>} defined here
+...
+LL |     let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>;
+   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
+   |            |
+   |            expected due to this
+   |
+   = note: expected unit type `()`
+                found fn item `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
+help: use parentheses to call this function
+   |
+LL |     let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>();
+   |                                                                          ++
+
+error[E0308]: mismatched types
+  --> $DIR/substs-ppaux.rs:33:17
+   |
+LL |     fn baz() {}
+   |     -------- fn() {<i8 as Foo<'static, 'static, u8>>::baz} defined here
+...
+LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::baz;
+   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
+   |            |
+   |            expected due to this
+   |
+   = note: expected unit type `()`
+                found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
+help: use parentheses to call this function
+   |
+LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::baz();
+   |                                                        ++
+
+error[E0308]: mismatched types
+  --> $DIR/substs-ppaux.rs:41:17
+   |
+LL | fn foo<'z>() where &'z (): Sized {
+   | -------------------------------- fn() {foo::<'static>} defined here
+...
+LL |     let x: () = foo::<'static>;
+   |            --   ^^^^^^^^^^^^^^ expected `()`, found fn item
+   |            |
+   |            expected due to this
+   |
+   = note: expected unit type `()`
+                found fn item `fn() {foo::<'static>}`
+help: use parentheses to call this function
+   |
+LL |     let x: () = foo::<'static>();
+   |                               ++
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+  --> $DIR/substs-ppaux.rs:49:5
+   |
+LL |     <str as Foo<u8>>::bar;
+   |     ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+   |
+   = help: the trait `Sized` is not implemented for `str`
+note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for `str`
+  --> $DIR/substs-ppaux.rs:11:17
+   |
+LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
+   |                 ^^^^^^^^^^^^^^     ^
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/associated-types/substs-ppaux.rs b/src/test/ui/associated-types/substs-ppaux.rs
new file mode 100644 (file)
index 0000000..66cd94d
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// revisions: verbose normal
+//
+//[verbose] compile-flags: -Z verbose
+
+trait Foo<'b, 'c, S=u32> {
+    fn bar<'a, T>() where T: 'a {}
+    fn baz() {}
+}
+
+impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
+
+fn main() {}
+
+fn foo<'z>() where &'z (): Sized {
+    let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>;
+    //[verbose]~^ ERROR mismatched types
+    //[verbose]~| expected unit type `()`
+    //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
+    //[normal]~^^^^ ERROR mismatched types
+    //[normal]~| expected unit type `()`
+    //[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
+
+
+    let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>;
+    //[verbose]~^ ERROR mismatched types
+    //[verbose]~| expected unit type `()`
+    //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}`
+    //[normal]~^^^^ ERROR mismatched types
+    //[normal]~| expected unit type `()`
+    //[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
+
+    let x: () = <i8 as Foo<'static, 'static,  u8>>::baz;
+    //[verbose]~^ ERROR mismatched types
+    //[verbose]~| expected unit type `()`
+    //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
+    //[normal]~^^^^ ERROR mismatched types
+    //[normal]~| expected unit type `()`
+    //[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
+
+    let x: () = foo::<'static>;
+    //[verbose]~^ ERROR mismatched types
+    //[verbose]~| expected unit type `()`
+    //[verbose]~| found fn item `fn() {foo::<ReStatic>}`
+    //[normal]~^^^^ ERROR mismatched types
+    //[normal]~| expected unit type `()`
+    //[normal]~| found fn item `fn() {foo::<'static>}`
+
+    <str as Foo<u8>>::bar;
+    //[verbose]~^ ERROR the size for values of type
+    //[normal]~^^ ERROR the size for values of type
+}
diff --git a/src/test/ui/associated-types/substs-ppaux.verbose.stderr b/src/test/ui/associated-types/substs-ppaux.verbose.stderr
new file mode 100644 (file)
index 0000000..b831f3b
--- /dev/null
@@ -0,0 +1,89 @@
+error[E0308]: mismatched types
+  --> $DIR/substs-ppaux.rs:16:17
+   |
+LL |     fn bar<'a, T>() where T: 'a {}
+   |     --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>} defined here
+...
+LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>;
+   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
+   |            |
+   |            expected due to this
+   |
+   = note: expected unit type `()`
+                found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
+help: use parentheses to call this function
+   |
+LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>();
+   |                                                                         ++
+
+error[E0308]: mismatched types
+  --> $DIR/substs-ppaux.rs:25:17
+   |
+LL |     fn bar<'a, T>() where T: 'a {}
+   |     --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>} defined here
+...
+LL |     let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>;
+   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
+   |            |
+   |            expected due to this
+   |
+   = note: expected unit type `()`
+                found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}`
+help: use parentheses to call this function
+   |
+LL |     let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>();
+   |                                                                          ++
+
+error[E0308]: mismatched types
+  --> $DIR/substs-ppaux.rs:33:17
+   |
+LL |     fn baz() {}
+   |     -------- fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz} defined here
+...
+LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::baz;
+   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
+   |            |
+   |            expected due to this
+   |
+   = note: expected unit type `()`
+                found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
+help: use parentheses to call this function
+   |
+LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::baz();
+   |                                                        ++
+
+error[E0308]: mismatched types
+  --> $DIR/substs-ppaux.rs:41:17
+   |
+LL | fn foo<'z>() where &'z (): Sized {
+   | -------------------------------- fn() {foo::<ReStatic>} defined here
+...
+LL |     let x: () = foo::<'static>;
+   |            --   ^^^^^^^^^^^^^^ expected `()`, found fn item
+   |            |
+   |            expected due to this
+   |
+   = note: expected unit type `()`
+                found fn item `fn() {foo::<ReStatic>}`
+help: use parentheses to call this function
+   |
+LL |     let x: () = foo::<'static>();
+   |                               ++
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+  --> $DIR/substs-ppaux.rs:49:5
+   |
+LL |     <str as Foo<u8>>::bar;
+   |     ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+   |
+   = help: the trait `Sized` is not implemented for `str`
+note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8>` for `str`
+  --> $DIR/substs-ppaux.rs:11:17
+   |
+LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
+   |                 ^^^^^^^^^^^^^^     ^
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
index baaab7fee679dcdfed20ed7419e2adb25dd4e27c..bf7ab148e23df0a8ad0a5727e410ab53b47d3d93 100644 (file)
@@ -4,7 +4,7 @@ error: future cannot be sent between threads safely
 LL |     assert_send(local_dropped_before_await());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
    |
-   = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>`
+   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
 note: future is not `Send` as this value is used across an await
   --> $DIR/async-fn-nonsend.rs:24:5
    |
@@ -27,7 +27,7 @@ error: future cannot be sent between threads safely
 LL |     assert_send(non_send_temporary_in_match());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
    |
-   = help: within `impl Future`, the trait `Send` is not implemented for `Rc<()>`
+   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
 note: future is not `Send` as this value is used across an await
   --> $DIR/async-fn-nonsend.rs:33:20
    |
index 76bbad26c8026443e6d869ea5fa8994c0d8a7831..289a567209c4958ea5c50ca1b82c336d478eb423 100644 (file)
@@ -10,7 +10,7 @@ note: while checking the return type of the `async fn`
 LL | async fn make_u32() -> u32 {
    |                        ^^^ checked the `Output` of this `async fn`, found opaque type
    = note:     expected type `u32`
-           found opaque type `impl Future`
+           found opaque type `impl Future<Output = u32>`
 help: consider `await`ing on the `Future`
    |
 LL |         take_u32(x.await)
index d75e927696e106c369966d7d632d2e031b55cbbf..79834ed7ec1a8fb08d64c5cbdbba08c9a13536ad 100644 (file)
@@ -25,8 +25,8 @@ note: while checking the return type of the `async fn`
    |
 LL | async fn two() {}
    |                ^ checked the `Output` of this `async fn`, found opaque type
-   = note: expected opaque type `impl Future` (opaque type at <$DIR/generator-desc.rs:5:16>)
-              found opaque type `impl Future` (opaque type at <$DIR/generator-desc.rs:6:16>)
+   = note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:5:16>)
+              found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:6:16>)
    = help: consider `await`ing on both `Future`s
    = note: distinct uses of `impl Trait` result in different opaque types
 
index 220f0774e2d54281eeead56b5ba7ba1933bfc7f7..a94136cfea1fc44f162f9246256c1fd9c3e29db3 100644 (file)
@@ -40,14 +40,12 @@ async fn foo() -> Result<(), ()> {
 
 async fn bar() -> Result<(), ()> {
     foo()?; //~ ERROR the `?` operator can only be applied to values that implement `Try`
-    //~^ NOTE the `?` operator cannot be applied to type `impl Future`
-    //~| HELP the trait `Try` is not implemented for `impl Future`
-    //~| NOTE required by `branch`
+    //~^ NOTE the `?` operator cannot be applied to type `impl Future<Output = Result<(), ()>>`
+    //~| HELP the trait `Try` is not implemented for `impl Future<Output = Result<(), ()>>`
     //~| HELP consider `await`ing on the `Future`
     //~| NOTE in this expansion of desugaring of operator `?`
     //~| NOTE in this expansion of desugaring of operator `?`
     //~| NOTE in this expansion of desugaring of operator `?`
-    //~| NOTE in this expansion of desugaring of operator `?`
     Ok(())
 }
 
@@ -67,12 +65,10 @@ async fn baz() -> Result<(), ()> {
     t?; //~ ERROR the `?` operator can only be applied to values that implement `Try`
     //~^ NOTE the `?` operator cannot be applied to type `T`
     //~| HELP the trait `Try` is not implemented for `T`
-    //~| NOTE required by `branch`
     //~| HELP consider `await`ing on the `Future`
     //~| NOTE in this expansion of desugaring of operator `?`
     //~| NOTE in this expansion of desugaring of operator `?`
     //~| NOTE in this expansion of desugaring of operator `?`
-    //~| NOTE in this expansion of desugaring of operator `?`
 
 
     let _: i32 = tuple().0; //~ ERROR no field `0`
@@ -84,7 +80,7 @@ async fn baz() -> Result<(), ()> {
     //~| NOTE field not available in `impl Future`
 
     struct_().method(); //~ ERROR no method named
-    //~^ NOTE method not found in `impl Future`
+    //~^ NOTE method not found in `impl Future<Output = Struct>`
     //~| HELP consider `await`ing on the `Future`
     Ok(())
 }
@@ -93,7 +89,7 @@ async fn match_() {
     match tuple() { //~ HELP consider `await`ing on the `Future`
         Tuple(_) => {} //~ ERROR mismatched types
         //~^ NOTE expected opaque type, found struct `Tuple`
-        //~| NOTE expected opaque type `impl Future`
+        //~| NOTE expected opaque type `impl Future<Output = Tuple>`
     }
 }
 
index 60b5bfa53d77fb07cc425ff4e1e59cb8379a869d..65c0bc695bfbc12732750ce08004c4027d6e705f 100644 (file)
@@ -2,38 +2,28 @@ error[E0277]: the `?` operator can only be applied to values that implement `Try
   --> $DIR/issue-61076.rs:42:5
    |
 LL |     foo()?;
-   |     ^^^^^^ the `?` operator cannot be applied to type `impl Future`
+   |     ^^^^^^ the `?` operator cannot be applied to type `impl Future<Output = Result<(), ()>>`
    |
-   = help: the trait `Try` is not implemented for `impl Future`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = help: the trait `Try` is not implemented for `impl Future<Output = Result<(), ()>>`
 help: consider `await`ing on the `Future`
    |
 LL |     foo().await?;
    |          ++++++
 
 error[E0277]: the `?` operator can only be applied to values that implement `Try`
-  --> $DIR/issue-61076.rs:67:5
+  --> $DIR/issue-61076.rs:65:5
    |
 LL |     t?;
    |     ^^ the `?` operator cannot be applied to type `T`
    |
    = help: the trait `Try` is not implemented for `T`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider `await`ing on the `Future`
    |
 LL |     t.await?;
    |      ++++++
 
-error[E0609]: no field `0` on type `impl Future`
-  --> $DIR/issue-61076.rs:78:26
+error[E0609]: no field `0` on type `impl Future<Output = Tuple>`
+  --> $DIR/issue-61076.rs:74:26
    |
 LL |     let _: i32 = tuple().0;
    |                          ^ field not available in `impl Future`, but it is available in its `Output`
@@ -43,8 +33,8 @@ help: consider `await`ing on the `Future` and access the field of its `Output`
 LL |     let _: i32 = tuple().await.0;
    |                         ++++++
 
-error[E0609]: no field `a` on type `impl Future`
-  --> $DIR/issue-61076.rs:82:28
+error[E0609]: no field `a` on type `impl Future<Output = Struct>`
+  --> $DIR/issue-61076.rs:78:28
    |
 LL |     let _: i32 = struct_().a;
    |                            ^ field not available in `impl Future`, but it is available in its `Output`
@@ -54,11 +44,11 @@ help: consider `await`ing on the `Future` and access the field of its `Output`
 LL |     let _: i32 = struct_().await.a;
    |                           ++++++
 
-error[E0599]: no method named `method` found for opaque type `impl Future` in the current scope
-  --> $DIR/issue-61076.rs:86:15
+error[E0599]: no method named `method` found for opaque type `impl Future<Output = Struct>` in the current scope
+  --> $DIR/issue-61076.rs:82:15
    |
 LL |     struct_().method();
-   |               ^^^^^^ method not found in `impl Future`
+   |               ^^^^^^ method not found in `impl Future<Output = Struct>`
    |
 help: consider `await`ing on the `Future` and calling the method on its `Output`
    |
@@ -66,17 +56,17 @@ LL |     struct_().await.method();
    |               ++++++
 
 error[E0308]: mismatched types
-  --> $DIR/issue-61076.rs:94:9
+  --> $DIR/issue-61076.rs:90:9
    |
 LL |         Tuple(_) => {}
    |         ^^^^^^^^ expected opaque type, found struct `Tuple`
    |
 note: while checking the return type of the `async fn`
-  --> $DIR/issue-61076.rs:58:21
+  --> $DIR/issue-61076.rs:56:21
    |
 LL | async fn tuple() -> Tuple {
    |                     ^^^^^ checked the `Output` of this `async fn`, expected opaque type
-   = note: expected opaque type `impl Future`
+   = note: expected opaque type `impl Future<Output = Tuple>`
                    found struct `Tuple`
 help: consider `await`ing on the `Future`
    |
index 12e4bfc3d48b66b05fb91b238270a5e4dd429b81..010611fae438142f9173817ac4c8e3ae099d941e 100644 (file)
@@ -4,7 +4,7 @@ error: future cannot be shared between threads safely
 LL |     is_sync(bar());
    |             ^^^^^ future returned by `bar` is not `Sync`
    |
-   = help: within `impl Future`, the trait `Sync` is not implemented for `Foo`
+   = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
 note: future is not `Sync` as this value is used across an await
   --> $DIR/issue-64130-1-sync.rs:15:5
    |
index 9c94b8da8929ab48b764fbd8ec11aa6a31158e94..bb598b53594e9991f72c34fdcd271ad3a66adb9c 100644 (file)
@@ -4,7 +4,7 @@ error: future cannot be sent between threads safely
 LL |     is_send(bar());
    |             ^^^^^ future returned by `bar` is not `Send`
    |
-   = help: within `impl Future`, the trait `Send` is not implemented for `Foo`
+   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
 note: future is not `Send` as this value is used across an await
   --> $DIR/issue-64130-2-send.rs:15:5
    |
index 7f2e3db6d60f20914a9d37112b6fd6ae9415d632..52801c35ba3d34794f968efc74119fa6f30aeba8 100644 (file)
@@ -5,22 +5,22 @@
 // This tests the the unspecialized async-await-specific error when futures don't implement an
 // auto trait (which is not Send or Sync) due to some type that was captured.
 
-auto trait Qux { }
+auto trait Qux {}
 
 struct Foo;
 
 impl !Qux for Foo {}
 
-fn is_qux<T: Qux>(t: T) { }
+fn is_qux<T: Qux>(t: T) {}
 
 async fn bar() {
     let x = Foo;
     baz().await;
 }
 
-async fn baz() { }
+async fn baz() {}
 
 fn main() {
     is_qux(bar());
-    //~^ ERROR the trait bound `Foo: Qux` is not satisfied in `impl Future`
+    //~^ ERROR the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
 }
index 3dd1239e23dbeefff5a5b81af8346c02ed6b690e..4de7929e1814969fcdc03127327e1899f53ec614 100644 (file)
@@ -1,11 +1,11 @@
-error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future`
+error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
   --> $DIR/issue-64130-3-other.rs:24:12
    |
 LL | async fn bar() {
-   |                - within this `impl Future`
+   |                - within this `impl Future<Output = ()>`
 ...
 LL |     is_qux(bar());
-   |            ^^^^^ within `impl Future`, the trait `Qux` is not implemented for `Foo`
+   |            ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
    |
 note: future does not implement `Qux` as this value is used across an await
   --> $DIR/issue-64130-3-other.rs:18:5
@@ -19,7 +19,7 @@ LL | }
 note: required by a bound in `is_qux`
   --> $DIR/issue-64130-3-other.rs:14:14
    |
-LL | fn is_qux<T: Qux>(t: T) { }
+LL | fn is_qux<T: Qux>(t: T) {}
    |              ^^^ required by this bound in `is_qux`
 
 error: aborting due to previous error
index a373ba6aa71361ea74b4bb90880874cd70cdfe4e..8eedb3597330e0ff8676586333b5bc05e72a7cba 100644 (file)
@@ -4,7 +4,7 @@ error: future cannot be sent between threads safely
 LL |     is_send(foo());
    |             ^^^^^ future returned by `foo` is not `Send`
    |
-   = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, u32>`
+   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, u32>`
 note: future is not `Send` as this value is used across an await
   --> $DIR/issue-64130-non-send-future-diags.rs:17:5
    |
index 6b8e49a21a67068103c383af70f9b835a1751d21..9682a7055e93c4fd16fdd7748c7e87d1853553ea 100644 (file)
@@ -9,7 +9,7 @@ note: future is not `Send` as it awaits another future which is not `Send`
   --> $DIR/issue-68112.rs:31:17
    |
 LL |         let _ = non_send_fut.await;
-   |                 ^^^^^^^^^^^^ await occurs here on type `impl Future`, which is not `Send`
+   |                 ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
 note: required by a bound in `require_send`
   --> $DIR/issue-68112.rs:11:25
    |
@@ -27,7 +27,7 @@ note: future is not `Send` as it awaits another future which is not `Send`
   --> $DIR/issue-68112.rs:40:17
    |
 LL |         let _ = make_non_send_future1().await;
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future`, which is not `Send`
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
 note: required by a bound in `require_send`
   --> $DIR/issue-68112.rs:11:25
    |
@@ -45,9 +45,9 @@ LL |     require_send(send_fut);
    = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:47:31: 47:36]`
    = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:47:31: 47:36]>`
    = note: required because it appears within the type `impl Future`
-   = note: required because it appears within the type `impl Future`
-   = note: required because it appears within the type `impl Future`
-   = note: required because it appears within the type `{ResumeTy, impl Future, (), i32, Ready<i32>}`
+   = note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
+   = note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
+   = note: required because it appears within the type `{ResumeTy, impl Future<Output = Arc<RefCell<i32>>>, (), i32, Ready<i32>}`
    = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:55:26: 59:6]`
    = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:55:26: 59:6]>`
    = note: required because it appears within the type `impl Future`
index e20e2e8f6ba3848bc327b112c2f449d88b8548c3..eb24040404b90db8c60434af98708c8b523d84f7 100644 (file)
@@ -25,11 +25,6 @@ LL |     [1; ().await];
    |         ^^^^^^^^ `()` is not a future
    |
    = help: the trait `Future` is not implemented for `()`
-note: required by `poll`
-  --> $SRC_DIR/core/src/future/future.rs:LL:COL
-   |
-LL |     fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 4 previous errors
 
index 3cc800f96c20d0ed983779fc88362c13f5bf7aa2..dddea12162a0be604b3f88e744c00135e0408605 100644 (file)
@@ -4,7 +4,7 @@ error: future cannot be sent between threads safely
 LL |   fake_spawn(wrong_mutex());
    |              ^^^^^^^^^^^^^ future returned by `wrong_mutex` is not `Send`
    |
-   = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, i32>`
+   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, i32>`
 note: future is not `Send` as this value is used across an await
   --> $DIR/issue-71137.rs:14:5
    |
index 89fe1abb3656b5c3e2eda9076c53b0528993fd65..4427014ae3bf93c406d669f372f6bb7195a3c712 100644 (file)
@@ -4,7 +4,7 @@ error: lifetime may not live long enough
 LL |     let _ = foo(|x| bar(x));
    |                  -- ^^^^^^ returning this value requires that `'1` must outlive `'2`
    |                  ||
-   |                  |return type of closure `impl Future` contains a lifetime `'2`
+   |                  |return type of closure `impl Future<Output = ()>` contains a lifetime `'2`
    |                  has type `&'1 u8`
 
 error: aborting due to previous error
index e28ba74eb6339dd8ed00b71df6c07a21528b0af6..1e22373ba6ea10c7105ab0a90dbfa8143ffedfb5 100644 (file)
@@ -2,14 +2,9 @@ error[E0277]: the `?` operator can only be applied to values that implement `Try
   --> $DIR/issue-84841.rs:9:5
    |
 LL |     test()?;
-   |     ^^^^^^^ the `?` operator cannot be applied to type `impl Future`
+   |     ^^^^^^^ the `?` operator cannot be applied to type `impl Future<Output = ()>`
    |
-   = help: the trait `Try` is not implemented for `impl Future`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = help: the trait `Try` is not implemented for `impl Future<Output = ()>`
 
 error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/issue-84841.rs:9:11
@@ -25,11 +20,6 @@ LL | | }
    | |_- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<_>` is not implemented for `()`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index 946b8d19e6936a11e162723db023fbe1694f0c04..e2ea72a1e617890583230fbc734040c272f528c6 100644 (file)
@@ -34,11 +34,6 @@ LL |     (|_| 2333).await;
    |     ^^^^^^^^^^^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future
    |
    = help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]`
-note: required by `poll`
-  --> $SRC_DIR/core/src/future/future.rs:LL:COL
-   |
-LL |     fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 4 previous errors
 
index ee32a1a9e4fbb4a17b22ada678d38262a0058e53..0aa0d5d7ccdde9c30840aaf7f6239a26d456412b 100644 (file)
@@ -4,7 +4,7 @@ error: generator cannot be sent between threads safely
 LL |     g(issue_67893::run())
    |       ^^^^^^^^^^^^^^^^^^ generator is not `Send`
    |
-   = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
+   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
 note: required by a bound in `g`
   --> $DIR/issue-67893.rs:6:14
    |
index b63ea106d90262ae8a0a09e7d970d40bf9db994f..83d1a02c876b19e3ca71523aba19fdc147b0005d 100644 (file)
@@ -12,11 +12,11 @@ note: required because it appears within the type `Sleep`
    |
 LL | struct Sleep(std::marker::PhantomPinned);
    |        ^^^^^
-note: required by `Pin::<P>::new`
+note: required by a bound in `Pin::<P>::new`
   --> $SRC_DIR/core/src/pin.rs:LL:COL
    |
-LL |     pub const fn new(pointer: P) -> Pin<P> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | impl<P: Deref<Target: Unpin>> Pin<P> {
+   |                       ^^^^^ required by this bound in `Pin::<P>::new`
 
 error: aborting due to previous error
 
index 630ae4b539f99c73e1bb2b1bd96fe6b41cf95dde..d951c8ed094e703dd42041e9903a17a50fe2b580 100644 (file)
@@ -10,7 +10,7 @@ note: while checking the return type of the `async fn`
 LL | async fn make_u32() -> u32 {
    |                        ^^^ checked the `Output` of this `async fn`, found opaque type
    = note:     expected type `u32`
-           found opaque type `impl Future`
+           found opaque type `impl Future<Output = u32>`
 help: consider `await`ing on the `Future`
    |
 LL |         take_u32(x.await)
index df74df79d9f47a0eda39ae622fad1490d0db252d..c7c5b51e7334b87b27e40534c5541d9e7044b960 100644 (file)
@@ -54,4 +54,21 @@ async fn suggest_await_on_match_expr() {
     };
 }
 
+async fn dummy_result() -> Result<(), ()> {
+    Ok(())
+}
+
+#[allow(unused)]
+async fn suggest_await_in_generic_pattern() {
+    match dummy_result() {
+        //~^ HELP consider `await`ing on the `Future`
+        //~| HELP consider `await`ing on the `Future`
+        //~| SUGGESTION .await
+        Ok(_) => {}
+        //~^ ERROR mismatched types [E0308]
+        Err(_) => {}
+        //~^ ERROR mismatched types [E0308]
+    }
+}
+
 fn main() {}
index aefe3096fd9b20a0b7d465da9545130fc2091dcb..3cca9616a358a34d7489d0efbd75aca2c185c2ba 100644 (file)
@@ -10,7 +10,7 @@ note: while checking the return type of the `async fn`
 LL | async fn make_u32() -> u32 {
    |                        ^^^ checked the `Output` of this `async fn`, found opaque type
    = note:     expected type `u32`
-           found opaque type `impl Future`
+           found opaque type `impl Future<Output = u32>`
 help: consider `await`ing on the `Future`
    |
 LL |     take_u32(x.await)
@@ -28,7 +28,7 @@ note: while checking the return type of the `async fn`
 LL | async fn dummy() {}
    |                  ^ checked the `Output` of this `async fn`, found opaque type
    = note: expected unit type `()`
-            found opaque type `impl Future`
+            found opaque type `impl Future<Output = ()>`
 help: consider `await`ing on the `Future`
    |
 LL |     dummy().await
@@ -53,7 +53,7 @@ LL | |
 LL | |     };
    | |_____- `if` and `else` have incompatible types
    |
-   = note:   expected type `impl Future`
+   = note:   expected type `impl Future<Output = ()>`
            found unit type `()`
 help: consider `await`ing on the `Future`
    |
@@ -66,9 +66,9 @@ error[E0308]: `match` arms have incompatible types
 LL |       let _x = match 0usize {
    |  ______________-
 LL | |         0 => dummy(),
-   | |              ------- this is found to be of type `impl Future`
+   | |              ------- this is found to be of type `impl Future<Output = ()>`
 LL | |         1 => dummy(),
-   | |              ------- this is found to be of type `impl Future`
+   | |              ------- this is found to be of type `impl Future<Output = ()>`
 LL | |         2 => dummy().await,
    | |              ^^^^^^^^^^^^^ expected opaque type, found `()`
 LL | |
@@ -80,7 +80,7 @@ note: while checking the return type of the `async fn`
    |
 LL | async fn dummy() {}
    |                  ^ checked the `Output` of this `async fn`, expected opaque type
-   = note: expected opaque type `impl Future`
+   = note: expected opaque type `impl Future<Output = ()>`
                 found unit type `()`
 help: consider `await`ing on the `Future`
    |
@@ -99,13 +99,49 @@ note: while checking the return type of the `async fn`
    |
 LL | async fn dummy() {}
    |                  ^ checked the `Output` of this `async fn`, expected opaque type
-   = note: expected opaque type `impl Future`
+   = note: expected opaque type `impl Future<Output = ()>`
                 found unit type `()`
 help: consider `await`ing on the `Future`
    |
 LL |     let _x = match dummy().await {
    |                           ++++++
 
-error: aborting due to 5 previous errors
+error[E0308]: mismatched types
+  --> $DIR/suggest-missing-await.rs:67:9
+   |
+LL |         Ok(_) => {}
+   |         ^^^^^ expected opaque type, found enum `Result`
+   |
+note: while checking the return type of the `async fn`
+  --> $DIR/suggest-missing-await.rs:57:28
+   |
+LL | async fn dummy_result() -> Result<(), ()> {
+   |                            ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type
+   = note: expected opaque type `impl Future<Output = Result<(), ()>>`
+                     found enum `Result<_, _>`
+help: consider `await`ing on the `Future`
+   |
+LL |     match dummy_result().await {
+   |                         ++++++
+
+error[E0308]: mismatched types
+  --> $DIR/suggest-missing-await.rs:69:9
+   |
+LL |         Err(_) => {}
+   |         ^^^^^^ expected opaque type, found enum `Result`
+   |
+note: while checking the return type of the `async fn`
+  --> $DIR/suggest-missing-await.rs:57:28
+   |
+LL | async fn dummy_result() -> Result<(), ()> {
+   |                            ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type
+   = note: expected opaque type `impl Future<Output = Result<(), ()>>`
+                     found enum `Result<_, _>`
+help: consider `await`ing on the `Future`
+   |
+LL |     match dummy_result().await {
+   |                         ++++++
+
+error: aborting due to 7 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
index e8bb4aca9a9c9d5b92174d6cd4eb8cdb1228eb54..a55850d76c3d8c2e2b5818baad2cffd9b46cb1a0 100644 (file)
@@ -11,11 +11,6 @@ LL | |     }
    | |_____- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `{integer}`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in an async closure that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/try-on-option-in-async.rs:17:10
@@ -30,11 +25,6 @@ LL | |     };
    | |_____- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/try-on-option-in-async.rs:26:6
@@ -49,11 +39,6 @@ LL | | }
    | |_- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/atomic-print.rs b/src/test/ui/atomic-print.rs
deleted file mode 100644 (file)
index fe57910..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// run-pass
-
-#![allow(unused_must_use)]
-#![allow(deprecated)]
-// ignore-emscripten no threads support
-// ignore-sgx no processes
-
-use std::{env, fmt, process, sync, thread};
-
-struct SlowFmt(u32);
-impl fmt::Debug for SlowFmt {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        thread::sleep_ms(3);
-        self.0.fmt(f)
-    }
-}
-
-fn do_print(x: u32) {
-    let x = SlowFmt(x);
-    println!("{:?}{:?}{:?}{:?}{:?}", x, x, x, x, x);
-}
-
-fn main(){
-    if env::args().count() == 2 {
-        let barrier = sync::Arc::new(sync::Barrier::new(2));
-        let tbarrier = barrier.clone();
-        let t = thread::spawn(move || {
-            tbarrier.wait();
-            do_print(1);
-        });
-        barrier.wait();
-        do_print(2);
-        t.join();
-    } else {
-        let this = env::args().next().unwrap();
-        let output = process::Command::new(this).arg("-").output().unwrap();
-        for line in String::from_utf8(output.stdout).unwrap().lines() {
-            match line.chars().next().unwrap() {
-                '1' => assert_eq!(line, "11111"),
-                '2' => assert_eq!(line, "22222"),
-                chr => panic!("unexpected character {:?}", chr)
-            }
-        }
-    }
-}
diff --git a/src/test/ui/attribute-with-no-generics-in-parameter-list.rs b/src/test/ui/attribute-with-no-generics-in-parameter-list.rs
deleted file mode 100644 (file)
index c2cc91d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-fn foo<#[attr]>() {} //~ ERROR attribute without generic parameters
-
-fn main() {}
diff --git a/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr b/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr
deleted file mode 100644 (file)
index 4c59647..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: attribute without generic parameters
-  --> $DIR/attribute-with-no-generics-in-parameter-list.rs:1:8
-   |
-LL | fn foo<#[attr]>() {}
-   |        ^^^^^^^ attributes are only permitted when preceding parameters
-
-error: aborting due to previous error
-
index e59216fe902704879d0eed6b815942532b9ed004..878afb39214adaf4f5a50da71b1bc4a6b2848c8a 100644 (file)
@@ -16,15 +16,15 @@ LL | bug!();
    = note: this error originates in the macro `bug` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: unexpected token: `{
-    let res =
-        ::alloc::fmt::format(::core::fmt::Arguments::new_v1(&[""],
-                                                            &match (&"u8",) {
-                                                                 _args =>
-                                                                 [::core::fmt::ArgumentV1::new(_args.0,
-                                                                                               ::core::fmt::Display::fmt)],
-                                                             }));
-    res
-}.as_str()`
+           let res =
+               ::alloc::fmt::format(::core::fmt::Arguments::new_v1(&[""],
+                                                                   &match (&"u8",) {
+                                                                        _args =>
+                                                                        [::core::fmt::ArgumentV1::new(_args.0,
+                                                                                                      ::core::fmt::Display::fmt)],
+                                                                    }));
+           res
+       }.as_str()`
   --> $DIR/key-value-expansion.rs:48:23
    |
 LL |         doc_comment! {format!("{coor}", coor = stringify!($t1)).as_str()}
diff --git a/src/test/ui/attributes/suffixed-literal-meta.rs b/src/test/ui/attributes/suffixed-literal-meta.rs
new file mode 100644 (file)
index 0000000..a653149
--- /dev/null
@@ -0,0 +1,15 @@
+#![feature(rustc_attrs)]
+
+#[rustc_dummy = 1usize] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1u8] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1u16] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1u32] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1u64] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1isize] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1i8] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1i16] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1i32] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1i64] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes
+#[rustc_dummy = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes
+fn main() {}
diff --git a/src/test/ui/attributes/suffixed-literal-meta.stderr b/src/test/ui/attributes/suffixed-literal-meta.stderr
new file mode 100644 (file)
index 0000000..5245ffe
--- /dev/null
@@ -0,0 +1,98 @@
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:3:17
+   |
+LL | #[rustc_dummy = 1usize]
+   |                 ^^^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:4:17
+   |
+LL | #[rustc_dummy = 1u8]
+   |                 ^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:5:17
+   |
+LL | #[rustc_dummy = 1u16]
+   |                 ^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:6:17
+   |
+LL | #[rustc_dummy = 1u32]
+   |                 ^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:7:17
+   |
+LL | #[rustc_dummy = 1u64]
+   |                 ^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:8:17
+   |
+LL | #[rustc_dummy = 1isize]
+   |                 ^^^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:9:17
+   |
+LL | #[rustc_dummy = 1i8]
+   |                 ^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:10:17
+   |
+LL | #[rustc_dummy = 1i16]
+   |                 ^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:11:17
+   |
+LL | #[rustc_dummy = 1i32]
+   |                 ^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:12:17
+   |
+LL | #[rustc_dummy = 1i64]
+   |                 ^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:13:17
+   |
+LL | #[rustc_dummy = 1.0f32]
+   |                 ^^^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: suffixed literals are not allowed in attributes
+  --> $DIR/suffixed-literal-meta.rs:14:17
+   |
+LL | #[rustc_dummy = 1.0f64]
+   |                 ^^^^^^
+   |
+   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo.rs b/src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo.rs
deleted file mode 100644 (file)
index cf769f3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#![crate_type="lib"]
-
-pub const X: () = ();
diff --git a/src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo2.rs b/src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo2.rs
deleted file mode 100644 (file)
index 81c16ed..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#![crate_type="lib"]
-
-pub const Y: () = ();
diff --git a/src/test/ui/auxiliary/extern-statics.rs b/src/test/ui/auxiliary/extern-statics.rs
deleted file mode 100644 (file)
index c090bc7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-extern "C" {
-    pub static XA: u8;
-    pub static mut XB: u8;
-}
diff --git a/src/test/ui/auxiliary/impl_privacy_xc_2.rs b/src/test/ui/auxiliary/impl_privacy_xc_2.rs
deleted file mode 100644 (file)
index 5f9c226..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#![crate_type = "lib"]
-
-pub struct Fish {
-    pub x: isize
-}
-
-mod unexported {
-    use super::Fish;
-    impl PartialEq for Fish {
-        fn eq(&self, _: &Fish) -> bool { true }
-        fn ne(&self, _: &Fish) -> bool { false }
-    }
-}
diff --git a/src/test/ui/auxiliary/link-cfg-works-transitive-dylib.rs b/src/test/ui/auxiliary/link-cfg-works-transitive-dylib.rs
deleted file mode 100644 (file)
index 0d92711..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#![feature(link_cfg)]
-
-#[link(name = "foo", cfg(foo))]
-extern "C" {}
diff --git a/src/test/ui/auxiliary/link-cfg-works-transitive-rlib.rs b/src/test/ui/auxiliary/link-cfg-works-transitive-rlib.rs
deleted file mode 100644 (file)
index 0a296f0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// no-prefer-dynamic
-
-#![feature(link_cfg)]
-#![crate_type = "rlib"]
-
-#[link(name = "foo", cfg(foo))]
-extern "C" {}
diff --git a/src/test/ui/auxiliary/llvm_pr32379.rs b/src/test/ui/auxiliary/llvm_pr32379.rs
deleted file mode 100644 (file)
index 8e42976..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-pub fn pr32379(mut data: u64, f1: bool, f2: bool) -> u64 {
-    if f1 { data &= !2; }
-    if f2 { data |= 2; }
-    data
-}
diff --git a/src/test/ui/auxiliary/no-mangle-associated-fn.rs b/src/test/ui/auxiliary/no-mangle-associated-fn.rs
deleted file mode 100644 (file)
index 7fc73c7..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#![crate_type = "lib"]
-
-struct Bar;
-
-impl Bar {
-    #[no_mangle]
-    fn bar() -> u8 {
-        2
-    }
-}
-
-trait Foo {
-    fn baz() -> u8;
-}
-
-impl Foo for Bar {
-    #[no_mangle]
-    fn baz() -> u8 {
-        3
-    }
-}
diff --git a/src/test/ui/auxiliary/reachable-unnameable-items.rs b/src/test/ui/auxiliary/reachable-unnameable-items.rs
deleted file mode 100644 (file)
index 20f110b..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-use inner_private_module::*;
-
-mod inner_private_module {
-    pub struct Unnameable1;
-    pub struct Unnameable2;
-    #[derive(Clone, Copy)]
-    pub struct Unnameable3;
-    pub struct Unnameable4;
-    pub struct Unnameable5;
-    pub struct Unnameable6;
-    pub struct Unnameable7;
-    #[derive(Default)]
-    pub struct Unnameable8;
-    pub enum UnnameableEnum {
-        NameableVariant
-    }
-    pub trait UnnameableTrait {
-        type Alias: Default;
-    }
-
-    impl Unnameable1 {
-        pub fn method_of_unnameable_type1(&self) -> &'static str {
-            "Hello1"
-        }
-    }
-    impl Unnameable2 {
-        pub fn method_of_unnameable_type2(&self) -> &'static str {
-            "Hello2"
-        }
-    }
-    impl Unnameable3 {
-        pub fn method_of_unnameable_type3(&self) -> &'static str {
-            "Hello3"
-        }
-    }
-    impl Unnameable4 {
-        pub fn method_of_unnameable_type4(&self) -> &'static str {
-            "Hello4"
-        }
-    }
-    impl Unnameable5 {
-        pub fn method_of_unnameable_type5(&self) -> &'static str {
-            "Hello5"
-        }
-    }
-    impl Unnameable6 {
-        pub fn method_of_unnameable_type6(&self) -> &'static str {
-            "Hello6"
-        }
-    }
-    impl Unnameable7 {
-        pub fn method_of_unnameable_type7(&self) -> &'static str {
-            "Hello7"
-        }
-    }
-    impl Unnameable8 {
-        pub fn method_of_unnameable_type8(&self) -> &'static str {
-            "Hello8"
-        }
-    }
-    impl UnnameableEnum {
-        pub fn method_of_unnameable_enum(&self) -> &'static str {
-            "HelloEnum"
-        }
-    }
-}
-
-pub fn function_returning_unnameable_type() -> Unnameable1 {
-    Unnameable1
-}
-
-pub const CONSTANT_OF_UNNAMEABLE_TYPE: Unnameable2 =
-                                            Unnameable2;
-
-pub fn function_accepting_unnameable_type(_: Option<Unnameable3>) {}
-
-pub type AliasOfUnnameableType = Unnameable4;
-
-impl Unnameable1 {
-    pub fn inherent_method_returning_unnameable_type(&self) -> Unnameable5 {
-        Unnameable5
-    }
-}
-
-pub trait Tr {
-    fn trait_method_returning_unnameable_type(&self) -> Unnameable6 {
-        Unnameable6
-    }
-}
-impl Tr for Unnameable1 {}
-
-pub use inner_private_module::UnnameableEnum::NameableVariant;
-
-pub struct Struct {
-    pub field_of_unnameable_type: Unnameable7
-}
-
-pub static STATIC: Struct = Struct { field_of_unnameable_type: Unnameable7 } ;
-
-impl UnnameableTrait for AliasOfUnnameableType {
-    type Alias = Unnameable8;
-}
-
-pub fn generic_function<T: UnnameableTrait>() -> T::Alias {
-    Default::default()
-}
diff --git a/src/test/ui/backtrace-debuginfo-aux.rs b/src/test/ui/backtrace-debuginfo-aux.rs
deleted file mode 100644 (file)
index 1411bcf..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-pass
-// ignore-test: not a test, used by backtrace-debuginfo.rs to test file!()
-
-#[inline(never)]
-pub fn callback<F>(f: F) where F: FnOnce((&'static str, u32)) {
-    f((file!(), line!()))
-}
-
-// We emit the wrong location for the caller here when inlined on MSVC
-#[cfg_attr(not(target_env = "msvc"), inline(always))]
-#[cfg_attr(target_env = "msvc", inline(never))]
-pub fn callback_inlined<F>(f: F) where F: FnOnce((&'static str, u32)) {
-    f((file!(), line!()))
-}
diff --git a/src/test/ui/backtrace-debuginfo.rs b/src/test/ui/backtrace-debuginfo.rs
deleted file mode 100644 (file)
index b976c3a..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-// run-pass
-// We disable tail merging here because it can't preserve debuginfo and thus
-// potentially breaks the backtraces. Also, subtle changes can decide whether
-// tail merging succeeds, so the test might work today but fail tomorrow due to a
-// seemingly completely unrelated change.
-// Unfortunately, LLVM has no "disable" option for this, so we have to set
-// "enable" to 0 instead.
-
-// compile-flags:-g -Copt-level=0 -Cllvm-args=-enable-tail-merge=0
-// compile-flags:-Cforce-frame-pointers=yes
-// ignore-pretty issue #37195
-// ignore-emscripten spawning processes is not supported
-// ignore-sgx no processes
-
-use std::env;
-
-#[path = "backtrace-debuginfo-aux.rs"] mod aux;
-
-macro_rules! pos {
-    () => ((file!(), line!()))
-}
-
-macro_rules! dump_and_die {
-    ($($pos:expr),*) => ({
-        // FIXME(#18285): we cannot include the current position because
-        // the macro span takes over the last frame's file/line.
-        //
-        // You might also be wondering why a major platform,
-        // i686-pc-windows-msvc, is located in here. Some of the saga can be
-        // found on #62897, but the tl;dr; is that it appears that if the
-        // standard library doesn't have debug information or frame pointers,
-        // which it doesn't by default on the test builders, then the stack
-        // walking routines in dbghelp will randomly terminate the stack trace
-        // in libstd without going further. Presumably the addition of frame
-        // pointers and/or debuginfo fixes this since tests always work with
-        // nightly compilers (which have debuginfo). In general though this test
-        // is replicated in rust-lang/backtrace-rs and has extensive coverage
-        // there, even on i686-pc-windows-msvc. We do the best we can in
-        // rust-lang/rust to test it as well, but sometimes we just gotta keep
-        // landing PRs.
-        if cfg!(any(target_os = "android",
-                    all(target_os = "linux", target_arch = "arm"),
-                    all(target_env = "msvc", target_arch = "x86"),
-                    target_os = "freebsd",
-                    target_os = "dragonfly",
-                    target_os = "openbsd")) {
-            // skip these platforms as this support isn't implemented yet.
-        } else {
-            dump_filelines(&[$($pos),*]);
-            panic!();
-        }
-    })
-}
-
-// we can't use a function as it will alter the backtrace
-macro_rules! check {
-    ($counter:expr; $($pos:expr),*) => ({
-        if *$counter == 0 {
-            dump_and_die!($($pos),*)
-        } else {
-            *$counter -= 1;
-        }
-    })
-}
-
-type Pos = (&'static str, u32);
-
-// this goes to stdout and each line has to be occurred
-// in the following backtrace to stderr with a correct order.
-fn dump_filelines(filelines: &[Pos]) {
-    for &(file, line) in filelines.iter().rev() {
-        // extract a basename
-        let basename = file.split(&['/', '\\'][..]).last().unwrap();
-        println!("{}:{}", basename, line);
-    }
-}
-
-#[inline(never)]
-fn inner(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
-    check!(counter; main_pos, outer_pos);
-    check!(counter; main_pos, outer_pos);
-    let inner_pos = pos!(); aux::callback(|aux_pos| {
-        check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
-    });
-    let inner_pos = pos!(); aux::callback_inlined(|aux_pos| {
-        check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
-    });
-}
-
-// We emit the wrong location for the caller here when inlined on MSVC
-#[cfg_attr(not(target_env = "msvc"), inline(always))]
-#[cfg_attr(target_env = "msvc", inline(never))]
-fn inner_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
-    check!(counter; main_pos, outer_pos);
-    check!(counter; main_pos, outer_pos);
-
-    // Again, disable inlining for MSVC.
-    #[cfg_attr(not(target_env = "msvc"), inline(always))]
-    #[cfg_attr(target_env = "msvc", inline(never))]
-    fn inner_further_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos, inner_pos: Pos) {
-        check!(counter; main_pos, outer_pos, inner_pos);
-    }
-    inner_further_inlined(counter, main_pos, outer_pos, pos!());
-
-    let inner_pos = pos!(); aux::callback(|aux_pos| {
-        check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
-    });
-    let inner_pos = pos!(); aux::callback_inlined(|aux_pos| {
-        check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
-    });
-
-    // this tests a distinction between two independent calls to the inlined function.
-    // (un)fortunately, LLVM somehow merges two consecutive such calls into one node.
-    inner_further_inlined(counter, main_pos, outer_pos, pos!());
-}
-
-#[inline(never)]
-fn outer(mut counter: i32, main_pos: Pos) {
-    inner(&mut counter, main_pos, pos!());
-    inner_inlined(&mut counter, main_pos, pos!());
-}
-
-fn check_trace(output: &str, error: &str) -> Result<(), String> {
-    // reverse the position list so we can start with the last item (which was the first line)
-    let mut remaining: Vec<&str> = output.lines().map(|s| s.trim()).rev().collect();
-
-    if !error.contains("stack backtrace") {
-        return Err(format!("no backtrace found in stderr:\n{}", error))
-    }
-    for line in error.lines() {
-        if !remaining.is_empty() && line.contains(remaining.last().unwrap()) {
-            remaining.pop();
-        }
-    }
-    if !remaining.is_empty() {
-        return Err(format!("trace does not match position list\n\
-            still need to find {:?}\n\n\
-            --- stdout\n{}\n\
-            --- stderr\n{}",
-            remaining, output, error))
-    }
-    Ok(())
-}
-
-fn run_test(me: &str) {
-    use std::str;
-    use std::process::Command;
-
-    let mut i = 0;
-    let mut errors = Vec::new();
-    loop {
-        let out = Command::new(me)
-                          .env("RUST_BACKTRACE", "full")
-                          .arg(i.to_string()).output().unwrap();
-        let output = str::from_utf8(&out.stdout).unwrap();
-        let error = str::from_utf8(&out.stderr).unwrap();
-        if out.status.success() {
-            assert!(output.contains("done."), "bad output for successful run: {}", output);
-            break;
-        } else {
-            if let Err(e) = check_trace(output, error) {
-                errors.push(e);
-            }
-        }
-        i += 1;
-    }
-    if errors.len() > 0 {
-        for error in errors {
-            println!("---------------------------------------");
-            println!("{}", error);
-        }
-
-        panic!("found some errors");
-    }
-}
-
-#[inline(never)]
-fn main() {
-    let args: Vec<String> = env::args().collect();
-    if args.len() >= 2 {
-        let case = args[1].parse().unwrap();
-        eprintln!("test case {}", case);
-        outer(case, pos!());
-        println!("done.");
-    } else {
-        run_test(&args[0]);
-    }
-}
diff --git a/src/test/ui/binop/operator-multidispatch.rs b/src/test/ui/binop/operator-multidispatch.rs
new file mode 100644 (file)
index 0000000..0d1dcfd
--- /dev/null
@@ -0,0 +1,36 @@
+// run-pass
+// Test that we can overload the `+` operator for points so that two
+// points can be added, and a point can be added to an integer.
+
+use std::ops;
+
+#[derive(Debug,PartialEq,Eq)]
+struct Point {
+    x: isize,
+    y: isize
+}
+
+impl ops::Add for Point {
+    type Output = Point;
+
+    fn add(self, other: Point) -> Point {
+        Point {x: self.x + other.x, y: self.y + other.y}
+    }
+}
+
+impl ops::Add<isize> for Point {
+    type Output = Point;
+
+    fn add(self, other: isize) -> Point {
+        Point {x: self.x + other,
+               y: self.y + other}
+    }
+}
+
+pub fn main() {
+    let mut p = Point {x: 10, y: 20};
+    p = p + Point {x: 101, y: 102};
+    assert_eq!(p, Point {x: 111, y: 122});
+    p = p + 1;
+    assert_eq!(p, Point {x: 112, y: 123});
+}
diff --git a/src/test/ui/binop/operator-overloading.rs b/src/test/ui/binop/operator-overloading.rs
new file mode 100644 (file)
index 0000000..6b3abcb
--- /dev/null
@@ -0,0 +1,81 @@
+// run-pass
+
+#![allow(unused_variables)]
+use std::cmp;
+use std::ops;
+
+#[derive(Copy, Clone, Debug)]
+struct Point {
+    x: isize,
+    y: isize
+}
+
+impl ops::Add for Point {
+    type Output = Point;
+
+    fn add(self, other: Point) -> Point {
+        Point {x: self.x + other.x, y: self.y + other.y}
+    }
+}
+
+impl ops::Sub for Point {
+    type Output = Point;
+
+    fn sub(self, other: Point) -> Point {
+        Point {x: self.x - other.x, y: self.y - other.y}
+    }
+}
+
+impl ops::Neg for Point {
+    type Output = Point;
+
+    fn neg(self) -> Point {
+        Point {x: -self.x, y: -self.y}
+    }
+}
+
+impl ops::Not for Point {
+    type Output = Point;
+
+    fn not(self) -> Point {
+        Point {x: !self.x, y: !self.y }
+    }
+}
+
+impl ops::Index<bool> for Point {
+    type Output = isize;
+
+    fn index(&self, x: bool) -> &isize {
+        if x {
+            &self.x
+        } else {
+            &self.y
+        }
+    }
+}
+
+impl cmp::PartialEq for Point {
+    fn eq(&self, other: &Point) -> bool {
+        (*self).x == (*other).x && (*self).y == (*other).y
+    }
+    fn ne(&self, other: &Point) -> bool { !(*self).eq(other) }
+}
+
+pub fn main() {
+    let mut p = Point {x: 10, y: 20};
+    p = p + Point {x: 101, y: 102};
+    p = p - Point {x: 100, y: 100};
+    assert_eq!(p + Point {x: 5, y: 5}, Point {x: 16, y: 27});
+    assert_eq!(-p, Point {x: -11, y: -22});
+    assert_eq!(p[true], 11);
+    assert_eq!(p[false], 22);
+
+    let q = !p;
+    assert_eq!(q.x, !(p.x));
+    assert_eq!(q.y, !(p.y));
+
+    // Issue #1733
+    result(p[true]);
+}
+
+fn result(i: isize) { }
diff --git a/src/test/ui/binop/placement-syntax.rs b/src/test/ui/binop/placement-syntax.rs
new file mode 100644 (file)
index 0000000..4df96de
--- /dev/null
@@ -0,0 +1,6 @@
+fn main() {
+    let x = -5;
+    if x<-1 { //~ ERROR unexpected token: `<-`
+        println!("ok");
+    }
+}
diff --git a/src/test/ui/binop/placement-syntax.stderr b/src/test/ui/binop/placement-syntax.stderr
new file mode 100644 (file)
index 0000000..3fdaf4c
--- /dev/null
@@ -0,0 +1,13 @@
+error: unexpected token: `<-`
+  --> $DIR/placement-syntax.rs:3:9
+   |
+LL |     if x<-1 {
+   |         ^^
+   |
+help: if you meant to write a comparison against a negative value, add a space in between `<` and `-`
+   |
+LL |     if x< -1 {
+   |         ~~~
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/blind-item-mixed-crate-use-item.rs b/src/test/ui/blind-item-mixed-crate-use-item.rs
deleted file mode 100644 (file)
index 36d8ab1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// run-pass
-// aux-build:blind-item-mixed-crate-use-item-foo.rs
-// aux-build:blind-item-mixed-crate-use-item-foo2.rs
-
-// pretty-expanded FIXME #23616
-
-mod m {
-    pub fn f<T>(_: T, _: (), _: ()) { }
-    pub fn g<T>(_: T, _: (), _: ()) { }
-}
-
-const BAR: () = ();
-struct Data;
-use m::f;
-extern crate blind_item_mixed_crate_use_item_foo as foo;
-
-fn main() {
-    const BAR2: () = ();
-    struct Data2;
-    use m::g;
-
-    extern crate blind_item_mixed_crate_use_item_foo2 as foo2;
-
-    f(Data, BAR, foo::X);
-    g(Data2, BAR2, foo2::Y);
-}
diff --git a/src/test/ui/blind-item-mixed-use-item.rs b/src/test/ui/blind-item-mixed-use-item.rs
deleted file mode 100644 (file)
index 4a39054..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-
-mod m {
-    pub fn f<T>(_: T, _: ()) { }
-    pub fn g<T>(_: T, _: ()) { }
-}
-
-const BAR: () = ();
-struct Data;
-use m::f;
-
-fn main() {
-    const BAR2: () = ();
-    struct Data2;
-    use m::g;
-
-    f(Data, BAR);
-    g(Data2, BAR2);
-}
diff --git a/src/test/ui/borrowck/immut-function-arguments.rs b/src/test/ui/borrowck/immut-function-arguments.rs
new file mode 100644 (file)
index 0000000..242a33e
--- /dev/null
@@ -0,0 +1,9 @@
+fn f(y: Box<isize>) {
+    *y = 5; //~ ERROR cannot assign
+}
+
+fn g() {
+    let _frob = |q: Box<isize>| { *q = 2; }; //~ ERROR cannot assign
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/immut-function-arguments.stderr b/src/test/ui/borrowck/immut-function-arguments.stderr
new file mode 100644 (file)
index 0000000..7238dd1
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable
+  --> $DIR/immut-function-arguments.rs:2:5
+   |
+LL | fn f(y: Box<isize>) {
+   |      - help: consider changing this to be mutable: `mut y`
+LL |     *y = 5;
+   |     ^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable
+  --> $DIR/immut-function-arguments.rs:6:35
+   |
+LL |     let _frob = |q: Box<isize>| { *q = 2; };
+   |                  -                ^^^^^^ cannot assign
+   |                  |
+   |                  help: consider changing this to be mutable: `mut q`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/kindck-implicit-close-over-mut-var.rs b/src/test/ui/borrowck/kindck-implicit-close-over-mut-var.rs
new file mode 100644 (file)
index 0000000..5b5d86e
--- /dev/null
@@ -0,0 +1,49 @@
+// run-pass
+
+#![allow(unused_must_use)]
+#![allow(dead_code)]
+use std::thread;
+
+fn user(_i: isize) {}
+
+fn foo() {
+    // Here, i is *copied* into the proc (heap closure).
+    // Requires allocation.  The proc's copy is not mutable.
+    let mut i = 0;
+    let t = thread::spawn(move|| {
+        user(i);
+        println!("spawned {}", i)
+    });
+    i += 1;
+    println!("original {}", i);
+    t.join();
+}
+
+fn bar() {
+    // Here, the original i has not been moved, only copied, so is still
+    // mutable outside of the proc.
+    let mut i = 0;
+    while i < 10 {
+        let t = thread::spawn(move|| {
+            user(i);
+        });
+        i += 1;
+        t.join();
+    }
+}
+
+fn car() {
+    // Here, i must be shadowed in the proc to be mutable.
+    let mut i = 0;
+    while i < 10 {
+        let t = thread::spawn(move|| {
+            let mut i = i;
+            i += 1;
+            user(i);
+        });
+        i += 1;
+        t.join();
+    }
+}
+
+pub fn main() {}
index 536fd43ef75e83fa14fd64cb52aaa7e1639a60df..1e3b071ef92927781fd4db9524547ab77016648e 100644 (file)
@@ -64,13 +64,13 @@ LL |     fn wrong_bound2(self, b: Inv, c: Inv, d: Inv) {
    |                    ^ lifetimes do not match method in trait
 
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/regions-bound-missing-bound-in-impl.rs:49:5
+  --> $DIR/regions-bound-missing-bound-in-impl.rs:49:26
    |
 LL |     fn another_bound<'x: 'a>(self, x: Inv<'x>, y: Inv<'t>);
    |     ------------------------------------------------------- definition of `another_bound` from trait
 ...
 LL |     fn another_bound<'x: 't>(self, x: Inv<'x>, y: Inv<'t>) {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'x: 't`
+   |                          ^^ impl has extra requirement `'x: 't`
 
 error: aborting due to 6 previous errors
 
index b2dcd54ec2e900c097be7f68cff75a8a933b79d4..c6643edf5a9547f2f6393e4f3df30ccde3142b02 100644 (file)
@@ -27,7 +27,7 @@ fn group_by<I, F, T>(xs: &mut I, f: F) -> HashMap<T, Vec<&I::Item>>
         let key = f(x);
         result.entry(key).or_insert(Vec::new()).push(x);
     }
-    result //~ ERROR cannot return value referencing local binding
+    result //~ ERROR cannot return value referencing temporary value
 }
 
 fn main() {}
index 293dbe628131384525abb7445a0b33ddda807f03..9f952542e18b0348c5b1c7bc113afb00e1e5fac1 100644 (file)
@@ -1,8 +1,8 @@
-error[E0515]: cannot return value referencing local binding
+error[E0515]: cannot return value referencing temporary value
   --> $DIR/return-local-binding-from-desugaring.rs:30:5
    |
 LL |     for ref x in xs {
-   |                  -- local binding introduced here
+   |                  -- temporary value created here
 ...
 LL |     result
    |     ^^^^^^ returns a value referencing data owned by the current function
index 2f1dec9d2090c69f231e82a8cc6d9decf653f049..de654fdc1a4b5540125520e7825586a083a7f672 100644 (file)
@@ -7,11 +7,11 @@ LL |     let _ = Box::into_boxed_slice(boxed_slice);
    |             required by a bound introduced by this call
    |
    = help: the trait `Sized` is not implemented for `[u8]`
-note: required by `Box::<T, A>::into_boxed_slice`
+note: required by a bound in `Box::<T, A>::into_boxed_slice`
   --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
    |
-LL |     pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | impl<T, A: Allocator> Box<T, A> {
+   |      ^ required by this bound in `Box::<T, A>::into_boxed_slice`
 
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
   --> $DIR/into-boxed-slice-fail.rs:7:13
@@ -31,11 +31,11 @@ LL |     let _ = Box::into_boxed_slice(boxed_trait);
    |             required by a bound introduced by this call
    |
    = help: the trait `Sized` is not implemented for `dyn Debug`
-note: required by `Box::<T, A>::into_boxed_slice`
+note: required by a bound in `Box::<T, A>::into_boxed_slice`
   --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
    |
-LL |     pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | impl<T, A: Allocator> Box<T, A> {
+   |      ^ required by this bound in `Box::<T, A>::into_boxed_slice`
 
 error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time
   --> $DIR/into-boxed-slice-fail.rs:11:13
diff --git a/src/test/ui/break-outside-loop.rs b/src/test/ui/break-outside-loop.rs
deleted file mode 100644 (file)
index 26769b3..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-struct Foo {
-    t: String
-}
-
-fn cond() -> bool { true }
-
-fn foo<F>(_: F) where F: FnOnce() {}
-
-fn main() {
-    let pth = break; //~ ERROR: `break` outside of a loop
-    if cond() { continue } //~ ERROR: `continue` outside of a loop
-
-    while cond() {
-        if cond() { break }
-        if cond() { continue }
-        foo(|| {
-            if cond() { break } //~ ERROR: `break` inside of a closure
-            if cond() { continue } //~ ERROR: `continue` inside of a closure
-        })
-    }
-
-    let rs: Foo = Foo{t: pth};
-
-    let unconstrained = break; //~ ERROR: `break` outside of a loop
-
-    // This used to ICE because `target_id` passed to `check_expr_break` would be the closure and
-    // not the `loop`, which failed in the call to `find_breakable`. (#65383)
-    'lab: loop {
-        || {
-            break 'lab;
-            //~^ ERROR use of unreachable label `'lab`
-            //~| ERROR `break` inside of a closure
-        };
-    }
-}
diff --git a/src/test/ui/break-outside-loop.stderr b/src/test/ui/break-outside-loop.stderr
deleted file mode 100644 (file)
index 287bf9a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-error[E0767]: use of unreachable label `'lab`
-  --> $DIR/break-outside-loop.rs:30:19
-   |
-LL |     'lab: loop {
-   |     ---- unreachable label defined here
-LL |         || {
-LL |             break 'lab;
-   |                   ^^^^ unreachable label `'lab`
-   |
-   = note: labels are unreachable through functions, closures, async blocks and modules
-
-error[E0268]: `break` outside of a loop
-  --> $DIR/break-outside-loop.rs:10:15
-   |
-LL |     let pth = break;
-   |               ^^^^^ cannot `break` outside of a loop
-
-error[E0268]: `continue` outside of a loop
-  --> $DIR/break-outside-loop.rs:11:17
-   |
-LL |     if cond() { continue }
-   |                 ^^^^^^^^ cannot `continue` outside of a loop
-
-error[E0267]: `break` inside of a closure
-  --> $DIR/break-outside-loop.rs:17:25
-   |
-LL |         foo(|| {
-   |             -- enclosing closure
-LL |             if cond() { break }
-   |                         ^^^^^ cannot `break` inside of a closure
-
-error[E0267]: `continue` inside of a closure
-  --> $DIR/break-outside-loop.rs:18:25
-   |
-LL |         foo(|| {
-   |             -- enclosing closure
-LL |             if cond() { break }
-LL |             if cond() { continue }
-   |                         ^^^^^^^^ cannot `continue` inside of a closure
-
-error[E0268]: `break` outside of a loop
-  --> $DIR/break-outside-loop.rs:24:25
-   |
-LL |     let unconstrained = break;
-   |                         ^^^^^ cannot `break` outside of a loop
-
-error[E0267]: `break` inside of a closure
-  --> $DIR/break-outside-loop.rs:30:13
-   |
-LL |         || {
-   |         -- enclosing closure
-LL |             break 'lab;
-   |             ^^^^^^^^^^ cannot `break` inside of a closure
-
-error: aborting due to 7 previous errors
-
-Some errors have detailed explanations: E0267, E0268, E0767.
-For more information about an error, try `rustc --explain E0267`.
diff --git a/src/test/ui/break-while-condition.rs b/src/test/ui/break-while-condition.rs
deleted file mode 100644 (file)
index 6064e6a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#![feature(never_type)]
-
-fn main() {
-    // The `if false` expressions are simply to
-    // make sure we don't avoid checking everything
-    // simply because a few expressions are unreachable.
-
-    if false {
-        let _: ! = { //~ ERROR mismatched types
-            'a: while break 'a {};
-        };
-    }
-
-    if false {
-        let _: ! = {
-            while false { //~ ERROR mismatched types
-                break
-            }
-        };
-    }
-
-    if false {
-        let _: ! = {
-            while false { //~ ERROR mismatched types
-                return
-            }
-        };
-    }
-}
diff --git a/src/test/ui/break-while-condition.stderr b/src/test/ui/break-while-condition.stderr
deleted file mode 100644 (file)
index 6960c4f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/break-while-condition.rs:9:20
-   |
-LL |           let _: ! = {
-   |  ____________________^
-LL | |             'a: while break 'a {};
-LL | |         };
-   | |_________^ expected `!`, found `()`
-   |
-   = note:   expected type `!`
-           found unit type `()`
-
-error[E0308]: mismatched types
-  --> $DIR/break-while-condition.rs:16:13
-   |
-LL | /             while false {
-LL | |                 break
-LL | |             }
-   | |_____________^ expected `!`, found `()`
-   |
-   = note:   expected type `!`
-           found unit type `()`
-
-error[E0308]: mismatched types
-  --> $DIR/break-while-condition.rs:24:13
-   |
-LL | /             while false {
-LL | |                 return
-LL | |             }
-   | |_____________^ expected `!`, found `()`
-   |
-   = note:   expected type `!`
-           found unit type `()`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/byte-literals.rs b/src/test/ui/byte-literals.rs
deleted file mode 100644 (file)
index 2649c2e..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// run-pass
-//
-
-
-static FOO: u8 = b'\xF0';
-static BAR: &'static [u8] = b"a\xF0\t";
-static BAR_FIXED: &'static [u8; 3] = b"a\xF0\t";
-static BAZ: &'static [u8] = br"a\n";
-
-pub fn main() {
-    let bar: &'static [u8] = b"a\xF0\t";
-    let bar_fixed: &'static [u8; 3] = b"a\xF0\t";
-
-    assert_eq!(b'a', 97u8);
-    assert_eq!(b'\n', 10u8);
-    assert_eq!(b'\r', 13u8);
-    assert_eq!(b'\t', 9u8);
-    assert_eq!(b'\\', 92u8);
-    assert_eq!(b'\'', 39u8);
-    assert_eq!(b'\"', 34u8);
-    assert_eq!(b'\0', 0u8);
-    assert_eq!(b'\xF0', 240u8);
-    assert_eq!(FOO, 240u8);
-
-    match 42 {
-        b'*' => {},
-        _ => panic!()
-    }
-
-    match 100 {
-        b'a' ..= b'z' => {},
-        _ => panic!()
-    }
-
-    let expected: &[_] = &[97u8, 10u8, 13u8, 9u8, 92u8, 39u8, 34u8, 0u8, 240u8];
-    assert_eq!(b"a\n\r\t\\\'\"\0\xF0", expected);
-    let expected: &[_] = &[97u8, 98u8];
-    assert_eq!(b"a\
-                 b", expected);
-    let expected: &[_] = &[97u8, 240u8, 9u8];
-    assert_eq!(BAR, expected);
-    assert_eq!(BAR_FIXED, expected);
-    assert_eq!(bar, expected);
-    assert_eq!(bar_fixed, expected);
-
-    let val = &[97u8, 10u8];
-    match val {
-        b"a\n" => {},
-        _ => panic!(),
-    }
-
-    let buf = vec![97u8, 98, 99, 100];
-    assert_eq!(match &buf[0..3] {
-         b"def" => 1,
-         b"abc" => 2,
-         _ => 3
-    }, 2);
-
-    let expected: &[_] = &[97u8, 92u8, 110u8];
-    assert_eq!(BAZ, expected);
-    let expected: &[_] = &[97u8, 92u8, 110u8];
-    assert_eq!(br"a\n", expected);
-    assert_eq!(br"a\n", b"a\\n");
-    let expected: &[_] = &[97u8, 34u8, 35u8, 35u8, 98u8];
-    assert_eq!(br###"a"##b"###, expected);
-    assert_eq!(br###"a"##b"###, b"a\"##b");
-}
index a30e9b35f5cf68ac9a6fe07b2719e130e9fd1b9f..f9abfb5225f91c3f5b1fd693f14c6cb245887fed 100644 (file)
@@ -1,4 +1,4 @@
-error[E0606]: casting `*mut impl Debug+?Sized` as `*mut impl Debug+?Sized` is invalid
+error[E0606]: casting `*mut impl Debug + ?Sized` as `*mut impl Debug + ?Sized` is invalid
   --> $DIR/casts-differing-anon.rs:21:13
    |
 LL |     b_raw = f_raw as *mut _;
diff --git a/src/test/ui/cfg/crt-static-on-works.rs b/src/test/ui/cfg/crt-static-on-works.rs
new file mode 100644 (file)
index 0000000..f89d1ed
--- /dev/null
@@ -0,0 +1,6 @@
+// run-pass
+// compile-flags:-C target-feature=+crt-static
+// only-msvc
+
+#[cfg(target_feature = "crt-static")]
+fn main() {}
index ebd885a7d323f641baea3fd84a6abcd9602a1798..57902efa2015cb8de239e3d780c9806fd31ae613 100644 (file)
@@ -7,11 +7,11 @@ LL |     let s = S {
    = help: the following implementations were found:
              <Option<T> as Foo>
              <i32 as Foo>
-note: required by `S`
-  --> $DIR/type_wf.rs:6:1
+note: required by a bound in `S`
+  --> $DIR/type_wf.rs:6:13
    |
 LL | struct S<T: Foo> {
-   | ^^^^^^^^^^^^^^^^
+   |             ^^^ required by this bound in `S`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/cleanup-arm-conditional.rs b/src/test/ui/cleanup-arm-conditional.rs
deleted file mode 100644 (file)
index 38c7170..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// run-pass
-
-#![allow(stable_features)]
-#![allow(unused_imports)]
-// Test that cleanup scope for temporaries created in a match
-// arm is confined to the match arm itself.
-
-// pretty-expanded FIXME #23616
-
-#![feature(os)]
-
-use std::os;
-
-struct Test { x: isize }
-
-impl Test {
-    fn get_x(&self) -> Option<Box<isize>> {
-        Some(Box::new(self.x))
-    }
-}
-
-fn do_something(t: &Test) -> isize {
-
-    // The cleanup scope for the result of `t.get_x()` should be the
-    // arm itself and not the match, otherwise we'll (potentially) get
-    // a crash trying to free an uninitialized stack slot.
-
-    match t {
-        &Test { x: 2 } if t.get_x().is_some() => {
-            t.x * 2
-        }
-        _ => { 22 }
-    }
-}
-
-pub fn main() {
-    let t = Test { x: 1 };
-    do_something(&t);
-}
diff --git a/src/test/ui/clone-with-exterior.rs b/src/test/ui/clone-with-exterior.rs
deleted file mode 100644 (file)
index 9fc661b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-pass
-
-#![allow(unused_must_use)]
-// ignore-emscripten no threads support
-
-use std::thread;
-
-struct Pair {
-    a: isize,
-    b: isize
-}
-
-pub fn main() {
-    let z: Box<_> = Box::new(Pair { a : 10, b : 12});
-
-    thread::spawn(move|| {
-        assert_eq!(z.a, 10);
-        assert_eq!(z.b, 12);
-    }).join();
-}
index d4f230780436ea5c80e632223774bfb2dcbc5c94..8b38d5ff4592cf9a28eede7f4b86a643ce66b7d5 100644 (file)
@@ -8,6 +8,11 @@ LL |     let y = x.or_else(4);
    |
    = help: the trait `FnOnce<()>` is not implemented for `{integer}`
    = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `Option::<T>::or_else`
+  --> $SRC_DIR/core/src/option.rs:LL:COL
+   |
+LL |     pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
+   |                       ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::or_else`
 
 error: aborting due to previous error
 
index 4a47e0549155f9508223981beefcbd89c32958f2..24db272534730a30c7b9ac40def0c09a48ab648e 100644 (file)
@@ -7,6 +7,11 @@ LL |     let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
    |                                        required by a bound introduced by this call
    |
    = help: the trait `FnOnce<(&str,)>` is not implemented for `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
+note: required by a bound in `Option::<T>::map`
+  --> $SRC_DIR/core/src/option.rs:LL:COL
+   |
+LL |     pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> {
+   |                      ^^^^^^^^^^^^^^ required by this bound in `Option::<T>::map`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closures/once-move-out-on-heap.rs b/src/test/ui/closures/once-move-out-on-heap.rs
new file mode 100644 (file)
index 0000000..4e2e400
--- /dev/null
@@ -0,0 +1,18 @@
+// run-pass
+// Testing guarantees provided by once functions.
+
+
+
+use std::sync::Arc;
+
+fn foo<F:FnOnce()>(blk: F) {
+    blk();
+}
+
+pub fn main() {
+    let x = Arc::new(true);
+    foo(move|| {
+        assert!(*x);
+        drop(x);
+    });
+}
index c90641840755dc9f628a688aad03dc340c967e27..37230078781ede152614b2e937b9861347e37bb4 100644 (file)
@@ -1,5 +1,4 @@
 error: <unknown>:0:0: in function test i32 (i32, i32, i32, i32, i32): call to non-secure function would require passing arguments on stack
 
-
 error: aborting due to previous error
 
index d9956acbe75771f03d1935fef27476e8482159d6..1054c26651270276c87c04fa8b93ab55696103aa 100644 (file)
@@ -1,5 +1,4 @@
 error: <unknown>:0:0: in function entry_function i32 (i32, i32, i32, i32, i32): secure entry function requires arguments on stack
 
-
 error: aborting due to previous error
 
diff --git a/src/test/ui/codegen/auxiliary/llvm_pr32379.rs b/src/test/ui/codegen/auxiliary/llvm_pr32379.rs
new file mode 100644 (file)
index 0000000..8e42976
--- /dev/null
@@ -0,0 +1,5 @@
+pub fn pr32379(mut data: u64, f1: bool, f2: bool) -> u64 {
+    if f1 { data &= !2; }
+    if f2 { data |= 2; }
+    data
+}
diff --git a/src/test/ui/codegen/init-large-type.rs b/src/test/ui/codegen/init-large-type.rs
new file mode 100644 (file)
index 0000000..ce90557
--- /dev/null
@@ -0,0 +1,23 @@
+// compile-flags: -O
+// run-pass
+
+#![allow(unused_must_use)]
+// Makes sure that zero-initializing large types is reasonably fast,
+// Doing it incorrectly causes massive slowdown in LLVM during
+// optimisation.
+
+// pretty-expanded FIXME #23616
+// ignore-emscripten no threads support
+
+#![feature(intrinsics)]
+
+use std::{mem, thread};
+
+const SIZE: usize = 1024 * 1024;
+
+fn main() {
+    // do the test in a new thread to avoid (spurious?) stack overflows
+    thread::spawn(|| {
+        let _memory: [u8; SIZE] = unsafe { mem::zeroed() };
+    }).join();
+}
diff --git a/src/test/ui/codegen/llvm-pr32379.rs b/src/test/ui/codegen/llvm-pr32379.rs
new file mode 100644 (file)
index 0000000..8a1f032
--- /dev/null
@@ -0,0 +1,14 @@
+// run-pass
+// aux-build:llvm_pr32379.rs
+
+// LLVM PR #32379 (https://bugs.llvm.org/show_bug.cgi?id=32379), which
+// applies to upstream LLVM 3.9.1, is known to cause rustc itself to be
+// miscompiled on ARM (Rust issue #40593). Because cross builds don't test
+// our *compiler* on ARM, have a test for the miscompilation directly.
+
+extern crate llvm_pr32379;
+
+pub fn main() {
+    let val = llvm_pr32379::pr32379(2, false, false);
+    assert_eq!(val, 2);
+}
diff --git a/src/test/ui/coercion/retslot-cast.rs b/src/test/ui/coercion/retslot-cast.rs
new file mode 100644 (file)
index 0000000..ae500cb
--- /dev/null
@@ -0,0 +1,22 @@
+#![allow(warnings)]
+
+pub fn fail(x: Option<&(Iterator<Item=()>+Send)>)
+            -> Option<&Iterator<Item=()>> {
+    // This call used to trigger an LLVM assertion because the return
+    // slot had type "Option<&Iterator>"* instead of
+    // "Option<&(Iterator+Send)>"* -- but this now yields a
+    // compilation error and I'm not sure how to create a comparable
+    // test. To ensure that this PARTICULAR failure doesn't occur
+    // again, though, I've left this test here, so if this ever starts
+    // to compile again, we can adjust the test appropriately (clearly
+    // it should never ICE...). -nmatsakis
+    inner(x) //~ ERROR mismatched types
+}
+
+pub fn inner(x: Option<&(Iterator<Item=()>+Send)>)
+             -> Option<&(Iterator<Item=()>+Send)> {
+    x
+}
+
+
+fn main() {}
diff --git a/src/test/ui/coercion/retslot-cast.stderr b/src/test/ui/coercion/retslot-cast.stderr
new file mode 100644 (file)
index 0000000..798ce11
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+  --> $DIR/retslot-cast.rs:13:5
+   |
+LL |             -> Option<&Iterator<Item=()>> {
+   |                -------------------------- expected `Option<&dyn Iterator<Item = ()>>` because of return type
+...
+LL |     inner(x)
+   |     ^^^^^^^^ expected trait `Iterator<Item = ()>`, found trait `Iterator<Item = ()> + Send`
+   |
+   = note: expected enum `Option<&dyn Iterator<Item = ()>>`
+              found enum `Option<&dyn Iterator<Item = ()> + Send>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
index affc58b84d46ded6d232956c3f530359c979c0c0..5b389f24bf15128e287bf32482b5de09ddb12089 100644 (file)
@@ -12,11 +12,6 @@ LL | impl<T: AB> C for T {}
 LL | #[rustc_strict_coherence]
 LL | impl C for u32 {}
    | ^^^^^^^^^^^^^^
-note: required by a bound in `C`
-  --> $DIR/coherence-overlap-trait-alias.rs:11:1
-   |
-LL | trait C {}
-   | ^^^^^^^ required by this bound in `C`
 
 error: aborting due to previous error
 
index e5f5c5ed20d55b37376a0b2e0eaca1accea16bf4..797a8167931f858331b196c5e330953cb86b429e 100644 (file)
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/proj-outlives-region.rs:9:5
+  --> $DIR/proj-outlives-region.rs:9:23
    |
 LL |     fn foo() where T: 'a;
    |     --------------------- definition of `foo` from trait
 ...
 LL |     fn foo() where U: 'a { }
-   |     ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
+   |                       ^^ impl has extra requirement `U: 'a`
 
 error: aborting due to previous error
 
index 420d99c15ec9994bb9787fafb289e9a2820a44fe..f01d7f4710c382d502ad33b9731b8c9147c4df9e 100644 (file)
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/region-extra-2.rs:9:5
+  --> $DIR/region-extra-2.rs:9:53
    |
 LL |     fn renew<'b: 'a>(self) -> &'b mut [T];
    |     -------------------------------------- definition of `renew` from trait
 ...
 LL |     fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
+   |                                                     ^^ impl has extra requirement `'a: 'b`
 
 error: aborting due to previous error
 
index 5a584c7d6ed9fbe60fd63caeaaf4606f4d82e72b..4a3af65e9042bc350bdd31865af17e458f767356 100644 (file)
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/region-extra.rs:9:5
+  --> $DIR/region-extra.rs:9:24
    |
 LL |     fn foo();
    |     --------- definition of `foo` from trait
 ...
 LL |     fn foo() where 'a: 'b { }
-   |     ^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
+   |                        ^^ impl has extra requirement `'a: 'b`
 
 error: aborting due to previous error
 
index fd3576ddcf1b58d0b10f40841d6e246ad70f868f..f7ae6f94438e2c161c21198560301da13dcb4dd6 100644 (file)
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/region-unrelated.rs:9:5
+  --> $DIR/region-unrelated.rs:9:23
    |
 LL |     fn foo() where T: 'a;
    |     --------------------- definition of `foo` from trait
 ...
 LL |     fn foo() where V: 'a { }
-   |     ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a`
+   |                       ^^ impl has extra requirement `V: 'a`
 
 error: aborting due to previous error
 
index 83a2ae6068109b97c8f8532165b30e91711b0385..ce6885c1541f70ddf3928fd6fc98163a3d3649b5 100644 (file)
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/trait-bound-on-type-parameter.rs:15:5
+  --> $DIR/trait-bound-on-type-parameter.rs:15:13
    |
 LL |   fn b<C,D>(&self, x: C) -> C;
    |   ---------------------------- definition of `b` from trait
 ...
 LL |     fn b<F: Sync, G>(&self, _x: F) -> F { panic!() }
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: Sync`
+   |             ^^^^ impl has extra requirement `F: Sync`
 
 error: aborting due to previous error
 
index da94fc658410a02a8537815e2e1cc58c7da0413d..805c04536cac7d74f51c6dfc3a28803a582f9d8f 100644 (file)
@@ -1,65 +1,65 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/traits-misc-mismatch-1.rs:27:5
+  --> $DIR/traits-misc-mismatch-1.rs:27:26
    |
 LL |     fn test_error1_fn<T: Eq>(&self);
    |     -------------------------------- definition of `test_error1_fn` from trait
 ...
 LL |     fn test_error1_fn<T: Ord>(&self) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Ord`
+   |                          ^^^ impl has extra requirement `T: Ord`
 
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/traits-misc-mismatch-1.rs:31:5
+  --> $DIR/traits-misc-mismatch-1.rs:31:31
    |
 LL |     fn test_error2_fn<T: Eq + Ord>(&self);
    |     -------------------------------------- definition of `test_error2_fn` from trait
 ...
 LL |     fn test_error2_fn<T: Eq + B>(&self) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B`
+   |                               ^ impl has extra requirement `T: B`
 
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/traits-misc-mismatch-1.rs:35:5
+  --> $DIR/traits-misc-mismatch-1.rs:35:26
    |
 LL |     fn test_error3_fn<T: Eq + Ord>(&self);
    |     -------------------------------------- definition of `test_error3_fn` from trait
 ...
 LL |     fn test_error3_fn<T: B + Eq>(&self) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B`
+   |                          ^ impl has extra requirement `T: B`
 
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/traits-misc-mismatch-1.rs:45:5
+  --> $DIR/traits-misc-mismatch-1.rs:45:26
    |
 LL |     fn test_error5_fn<T: A>(&self);
    |     ------------------------------- definition of `test_error5_fn` from trait
 ...
 LL |     fn test_error5_fn<T: B>(&self) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B`
+   |                          ^ impl has extra requirement `T: B`
 
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/traits-misc-mismatch-1.rs:51:5
+  --> $DIR/traits-misc-mismatch-1.rs:51:30
    |
 LL |     fn test_error7_fn<T: A>(&self);
    |     ------------------------------- definition of `test_error7_fn` from trait
 ...
 LL |     fn test_error7_fn<T: A + Eq>(&self) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Eq`
+   |                              ^^ impl has extra requirement `T: Eq`
 
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/traits-misc-mismatch-1.rs:54:5
+  --> $DIR/traits-misc-mismatch-1.rs:54:26
    |
 LL |     fn test_error8_fn<T: B>(&self);
    |     ------------------------------- definition of `test_error8_fn` from trait
 ...
 LL |     fn test_error8_fn<T: C>(&self) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: C`
+   |                          ^ impl has extra requirement `T: C`
 
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/traits-misc-mismatch-1.rs:67:5
+  --> $DIR/traits-misc-mismatch-1.rs:67:18
    |
 LL |     fn method<G:Getter<isize>>(&self);
    |     ---------------------------------- definition of `method` from trait
 ...
 LL |     fn method<G: Getter<usize>>(&self) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `G: Getter<usize>`
+   |                  ^^^^^^^^^^^^^ impl has extra requirement `G: Getter<usize>`
 
 error: aborting due to 7 previous errors
 
index acf94ad32b1dfb57f344a3f6936029539981da06..36bb764d40eb45fabdd141125b49800bc07f5be0 100644 (file)
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/traits-misc-mismatch-2.rs:13:5
+  --> $DIR/traits-misc-mismatch-2.rs:13:18
    |
 LL |     fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>;
    |     ------------------------------------------------------------------ definition of `zip` from trait
 ...
 LL |     fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: Iterator<B>`
+   |                  ^^^^^^^^^^^ impl has extra requirement `U: Iterator<B>`
 
 error: aborting due to previous error
 
index 9826af8802a27377ca326461dad1ddf409688d1a..2d400f9bbf5219024adacd9e7590d3cb4be7787c 100644 (file)
@@ -12,11 +12,6 @@ LL | struct WhereClause<const N: u8 = 2> where (): Trait<N>;
    |
    = help: the following implementations were found:
              <() as Trait<3_u8>>
-note: required by `WhereClause`
-  --> $DIR/wfness.rs:8:1
-   |
-LL | struct WhereClause<const N: u8 = 2> where (): Trait<N>;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `(): Trait<1_u8>` is not satisfied
   --> $DIR/wfness.rs:16:13
index 09986f623fc4b393b742aa9d60243a50d2d1fef8..68ce61bd4a374d3118ba39ab1672716dfa178189 100644 (file)
@@ -3,12 +3,6 @@ error[E0277]: the trait bound `[Adt; _]: Foo` is not satisfied
    |
 LL |         <[Adt; std::mem::size_of::<Self::Assoc>()] as Foo>::bar()
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[Adt; _]`
-   |
-note: required by `Foo::bar`
-  --> $DIR/dont-evaluate-array-len-on-err-1.rs:19:5
-   |
-LL |     fn bar() {}
-   |     ^^^^^^^^
 
 error: aborting due to previous error
 
index 0c6aced4bc22b3b0bc6de259770cbfecaac87637..1a8f4abf52aa3fe04891a0753f2fada263f1f79c 100644 (file)
@@ -10,11 +10,6 @@ LL |     <() as Foo<N>>::test()
              <() as Foo<101_u8>>
              <() as Foo<102_u8>>
            and 252 others
-note: required by `Foo::test`
-  --> $DIR/exhaustive-value.rs:2:5
-   |
-LL |     fn test() {}
-   |     ^^^^^^^^^
 
 error: aborting due to previous error
 
index 3c7a740e8434a6a6f969aff5e84241877bcf98c0..02dce4f7a97e829d1f886d0a8025a41a77d81e64 100644 (file)
@@ -41,11 +41,6 @@ LL |     IsLessOrEqual<I, 8>: True,
    |                          ^^^^ cannot infer type for struct `IsLessOrEqual<I, 8_u32>`
    |
    = note: cannot satisfy `IsLessOrEqual<I, 8_u32>: True`
-note: required by a bound in `True`
-  --> $DIR/issue-72787.rs:8:1
-   |
-LL | pub trait True {}
-   | ^^^^^^^^^^^^^^ required by this bound in `True`
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72787.rs:21:26
@@ -54,11 +49,6 @@ LL |     IsLessOrEqual<I, 8>: True,
    |                          ^^^^ cannot infer type for struct `IsLessOrEqual<I, 8_u32>`
    |
    = note: cannot satisfy `IsLessOrEqual<I, 8_u32>: True`
-note: required by a bound in `True`
-  --> $DIR/issue-72787.rs:8:1
-   |
-LL | pub trait True {}
-   | ^^^^^^^^^^^^^^ required by this bound in `True`
 
 error: aborting due to 6 previous errors
 
index ef785bf07ebbfce44fd8765d10bd1fdef2be76c4..0332e82fe0727eefc311ff62320d91826f5c82a2 100644 (file)
@@ -14,6 +14,11 @@ LL |         self.reference.size()
    |                        ^^^^
    |
    = help: try adding a `where` bound using this expression: `where [(); Self::DIM]:`
+note: required by a bound in `TensorSize::size`
+  --> $DIR/issue-83765.rs:9:31
+   |
+LL |     fn size(&self) -> [usize; Self::DIM];
+   |                               ^^^^^^^^^ required by this bound in `TensorSize::size`
 
 error[E0308]: mismatched types
   --> $DIR/issue-83765.rs:32:9
diff --git a/src/test/ui/const-generics/invariant.nll.stderr b/src/test/ui/const-generics/invariant.nll.stderr
new file mode 100644 (file)
index 0000000..ce0fad1
--- /dev/null
@@ -0,0 +1,26 @@
+warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())`
+  --> $DIR/invariant.rs:14:1
+   |
+LL | impl SadBee for for<'a> fn(&'a ()) {
+   | ---------------------------------- first implementation here
+...
+LL | impl SadBee for fn(&'static ()) {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a ())`
+   |
+   = note: `#[warn(coherence_leak_check)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
+   = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
+
+error[E0308]: mismatched types
+  --> $DIR/invariant.rs:27:5
+   |
+LL |     v
+   |     ^ one type is more general than the other
+   |
+   = note: expected reference `&Foo<fn(&())>`
+              found reference `&Foo<for<'a> fn(&'a ())>`
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/const-generics/invariant.rs b/src/test/ui/const-generics/invariant.rs
new file mode 100644 (file)
index 0000000..ee191b6
--- /dev/null
@@ -0,0 +1,33 @@
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+use std::marker::PhantomData;
+
+trait SadBee {
+    const ASSOC: usize;
+}
+// fn(&'static ())` is a supertype of `for<'a> fn(&'a ())` while
+// we allow two different impls for these types, leading
+// to different const eval results.
+impl SadBee for for<'a> fn(&'a ()) {
+    const ASSOC: usize = 0;
+}
+impl SadBee for fn(&'static ()) {
+    //~^ WARNING conflicting implementations of trait
+    //~| WARNING this was previously accepted
+    const ASSOC: usize = 100;
+}
+
+struct Foo<T: SadBee>([u8; <T as SadBee>::ASSOC], PhantomData<T>)
+where
+    [(); <T as SadBee>::ASSOC]: ;
+
+fn covariant(
+    v: &'static Foo<for<'a> fn(&'a ())>
+) -> &'static Foo<fn(&'static ())> {
+    v //~ ERROR mismatched types
+}
+
+fn main() {
+    let y = covariant(&Foo([], PhantomData));
+    println!("{:?}", y.0);
+}
diff --git a/src/test/ui/const-generics/invariant.stderr b/src/test/ui/const-generics/invariant.stderr
new file mode 100644 (file)
index 0000000..318c885
--- /dev/null
@@ -0,0 +1,26 @@
+warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())`
+  --> $DIR/invariant.rs:14:1
+   |
+LL | impl SadBee for for<'a> fn(&'a ()) {
+   | ---------------------------------- first implementation here
+...
+LL | impl SadBee for fn(&'static ()) {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a ())`
+   |
+   = note: `#[warn(coherence_leak_check)]` on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
+   = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
+
+error[E0308]: mismatched types
+  --> $DIR/invariant.rs:27:5
+   |
+LL |     v
+   |     ^ one type is more general than the other
+   |
+   = note: expected reference `&'static Foo<fn(&'static ())>`
+              found reference `&'static Foo<for<'a> fn(&'a ())>`
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0308`.
index 382dd0ee5a64eaa909cbc9b8fdb4d26a2427ed08..486a298a9ffe573510cd84273173c418c9751c51 100644 (file)
@@ -6,13 +6,11 @@ LL |     let _ = A;
    |
    = help: the following implementations were found:
              <A<7_usize> as Bar<N>>
-note: required by `A`
-  --> $DIR/unused-substs-1.rs:7:1
+note: required by a bound in `A`
+  --> $DIR/unused-substs-1.rs:9:11
    |
-LL | / struct A<const N: usize>
-LL | | where
-LL | |     A<N>: Bar<N>;
-   | |_________________^
+LL |     A<N>: Bar<N>;
+   |           ^^^^^^ required by this bound in `A`
 
 error: aborting due to previous error
 
index 7853ee41a90091c9991c942c5a09e0726ffd212b..1952ddb941e511db20bccf3446e0cb08de658154 100644 (file)
@@ -1,6 +1,5 @@
 // Regression test for issue 90013.
 // check-pass
-#![allow(incomplete_features)]
 #![feature(inline_const)]
 
 fn main() {
index 7936af75d84ac585af4af9a834b3da8ba0cbec90..20496f62712c284055bd034e9380ebd2e09c1c24 100644 (file)
@@ -1,7 +1,7 @@
 // run-pass
 
 #![feature(inline_const)]
-#![allow(unused, incomplete_features)]
+#![allow(unused)]
 
 // Some type that is not copyable.
 struct Bar;
index cae8fcf1068ad01b285477fd3db5298e8a68f436..a1d6c5e51b49896726271f4f207da931fdc1fe06 100644 (file)
@@ -7,7 +7,9 @@
 
 #[repr(simd)] struct i8x1(i8);
 #[repr(simd)] struct u16x2(u16, u16);
-#[repr(simd)] struct f32x4(f32, f32, f32, f32);
+// Make some of them array types to ensure those also work.
+#[repr(simd)] struct i8x1_arr([i8; 1]);
+#[repr(simd)] struct f32x4([f32; 4]);
 
 extern "platform-intrinsic" {
     #[rustc_const_stable(feature = "foo", since = "1.3.37")]
@@ -25,6 +27,14 @@ fn main() {
         assert_eq!(X0, 42);
         assert_eq!(Y0, 42);
     }
+    {
+        const U: i8x1_arr = i8x1_arr([13]);
+        const V: i8x1_arr = unsafe { simd_insert(U, 0_u32, 42_i8) };
+        const X0: i8 = V.0[0];
+        const Y0: i8 = unsafe { simd_extract(V, 0) };
+        assert_eq!(X0, 42);
+        assert_eq!(Y0, 42);
+    }
     {
         const U: u16x2 = u16x2(13, 14);
         const V: u16x2 = unsafe { simd_insert(U, 1_u32, 42_u16) };
@@ -38,12 +48,12 @@ fn main() {
         assert_eq!(Y1, 42);
     }
     {
-        const U: f32x4 = f32x4(13., 14., 15., 16.);
+        const U: f32x4 = f32x4([13., 14., 15., 16.]);
         const V: f32x4 = unsafe { simd_insert(U, 1_u32, 42_f32) };
-        const X0: f32 = V.0;
-        const X1: f32 = V.1;
-        const X2: f32 = V.2;
-        const X3: f32 = V.3;
+        const X0: f32 = V.0[0];
+        const X1: f32 = V.0[1];
+        const X2: f32 = V.0[2];
+        const X3: f32 = V.0[3];
         const Y0: f32 = unsafe { simd_extract(V, 0) };
         const Y1: f32 = unsafe { simd_extract(V, 1) };
         const Y2: f32 = unsafe { simd_extract(V, 2) };
diff --git a/src/test/ui/consts/issue-90878-2.rs b/src/test/ui/consts/issue-90878-2.rs
new file mode 100644 (file)
index 0000000..7e3f18c
--- /dev/null
@@ -0,0 +1,12 @@
+ #![l=|x|[b;x ]] //~ ERROR unexpected token: `|x| [b; x]`
+//~^ ERROR cannot find attribute `l` in this scope
+//~^^ ERROR attempt to use a non-constant value in a constant [E0435]
+//~^^^ ERROR cannot find value `b` in this scope [E0425]
+
+// notice the space at the start,
+// we can't attach any attributes to this file because it needs to be at the start
+
+// this example has been slightly modified (adding ]] at the end), so that it actually works here
+// it still produces the same issue though
+
+fn main() {}
diff --git a/src/test/ui/consts/issue-90878-2.stderr b/src/test/ui/consts/issue-90878-2.stderr
new file mode 100644 (file)
index 0000000..9e16742
--- /dev/null
@@ -0,0 +1,30 @@
+error: unexpected token: `|x| [b; x]`
+  --> $DIR/issue-90878-2.rs:1:7
+   |
+LL |  #![l=|x|[b;x ]]
+   |       ^^^^^^^^^
+
+error: cannot find attribute `l` in this scope
+  --> $DIR/issue-90878-2.rs:1:5
+   |
+LL |  #![l=|x|[b;x ]]
+   |     ^
+
+error[E0435]: attempt to use a non-constant value in a constant
+  --> $DIR/issue-90878-2.rs:1:13
+   |
+LL |  #![l=|x|[b;x ]]
+   |        -    ^
+   |        |
+   |        this would need to be a `const`
+
+error[E0425]: cannot find value `b` in this scope
+  --> $DIR/issue-90878-2.rs:1:11
+   |
+LL |  #![l=|x|[b;x ]]
+   |           ^ help: a local variable with a similar name exists: `x`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0425, E0435.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/ui/consts/issue-90878-3.rs b/src/test/ui/consts/issue-90878-3.rs
new file mode 100644 (file)
index 0000000..0e36646
--- /dev/null
@@ -0,0 +1,6 @@
+
+fn main() {
+    |x: usize| [0; x];  //~ ERROR attempt to use a non-constant value in a constant [E0435]
+    // (note the newline before "fn")
+}
+// ignore-tidy-leading-newlines
diff --git a/src/test/ui/consts/issue-90878-3.stderr b/src/test/ui/consts/issue-90878-3.stderr
new file mode 100644 (file)
index 0000000..1bcc0eb
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0435]: attempt to use a non-constant value in a constant
+  --> $DIR/issue-90878-3.rs:3:20
+   |
+LL |     |x: usize| [0; x];
+   |      -             ^
+   |      |
+   |      this would need to be a `const`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0435`.
diff --git a/src/test/ui/consts/issue-90878.rs b/src/test/ui/consts/issue-90878.rs
new file mode 100644 (file)
index 0000000..43f6fe5
--- /dev/null
@@ -0,0 +1,4 @@
+ fn main() {
+    |x: usize| [0; x];  //~ ERROR attempt to use a non-constant value in a constant [E0435]
+    // (note the space before "fn")
+}
diff --git a/src/test/ui/consts/issue-90878.stderr b/src/test/ui/consts/issue-90878.stderr
new file mode 100644 (file)
index 0000000..c038fc6
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0435]: attempt to use a non-constant value in a constant
+  --> $DIR/issue-90878.rs:2:20
+   |
+LL |     |x: usize| [0; x];
+   |      -             ^
+   |      |
+   |      this would need to be a `const`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0435`.
diff --git a/src/test/ui/consts/non-const-value-in-const.rs b/src/test/ui/consts/non-const-value-in-const.rs
new file mode 100644 (file)
index 0000000..1a20b1e
--- /dev/null
@@ -0,0 +1,7 @@
+fn main() {
+    let x = 5;
+    const Y: i32 = x; //~ ERROR attempt to use a non-constant value in a constant [E0435]
+
+    let x = 5;
+    let _ = [0; x]; //~ ERROR attempt to use a non-constant value in a constant [E0435]
+}
diff --git a/src/test/ui/consts/non-const-value-in-const.stderr b/src/test/ui/consts/non-const-value-in-const.stderr
new file mode 100644 (file)
index 0000000..0ce4b4b
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0435]: attempt to use a non-constant value in a constant
+  --> $DIR/non-const-value-in-const.rs:3:20
+   |
+LL |     const Y: i32 = x;
+   |     -------        ^ non-constant value
+   |     |
+   |     help: consider using `let` instead of `const`: `let Y`
+
+error[E0435]: attempt to use a non-constant value in a constant
+  --> $DIR/non-const-value-in-const.rs:6:17
+   |
+LL |     let x = 5;
+   |     ----- help: consider using `const` instead of `let`: `const x`
+...
+LL |     let _ = [0; x];
+   |                 ^ non-constant value
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0435`.
diff --git a/src/test/ui/core-run-destroy.rs b/src/test/ui/core-run-destroy.rs
deleted file mode 100644 (file)
index 5fd418e..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-// run-pass
-
-#![allow(unused_must_use)]
-#![allow(stable_features)]
-#![allow(deprecated)]
-#![allow(unused_imports)]
-// compile-flags:--test
-// ignore-emscripten no processes
-// ignore-sgx no processes
-// ignore-vxworks no 'cat' and 'sleep'
-
-// N.B., these tests kill child processes. Valgrind sees these children as leaking
-// memory, which makes for some *confusing* logs. That's why these are here
-// instead of in std.
-
-#![feature(rustc_private, duration)]
-
-extern crate libc;
-
-use std::process::{self, Command, Child, Output, Stdio};
-use std::str;
-use std::sync::mpsc::channel;
-use std::thread;
-use std::time::Duration;
-
-macro_rules! t {
-    ($e:expr) => (match $e { Ok(e) => e, Err(e) => panic!("error: {}", e) })
-}
-
-#[test]
-fn test_destroy_once() {
-    let mut p = sleeper();
-    t!(p.kill());
-}
-
-#[cfg(unix)]
-pub fn sleeper() -> Child {
-    t!(Command::new("sleep").arg("1000").spawn())
-}
-#[cfg(windows)]
-pub fn sleeper() -> Child {
-    // There's a `timeout` command on windows, but it doesn't like having
-    // its output piped, so instead just ping ourselves a few times with
-    // gaps in between so we're sure this process is alive for awhile
-    t!(Command::new("ping").arg("127.0.0.1").arg("-n").arg("1000").spawn())
-}
-
-#[test]
-fn test_destroy_twice() {
-    let mut p = sleeper();
-    t!(p.kill()); // this shouldn't crash...
-    let _ = p.kill(); // ...and nor should this (and nor should the destructor)
-}
-
-#[test]
-fn test_destroy_actually_kills() {
-    let cmd = if cfg!(windows) {
-        "cmd"
-    } else if cfg!(target_os = "android") {
-        "/system/bin/cat"
-    } else {
-        "cat"
-    };
-
-    // this process will stay alive indefinitely trying to read from stdin
-    let mut p = t!(Command::new(cmd)
-                           .stdin(Stdio::piped())
-                           .spawn());
-
-    t!(p.kill());
-
-    // Don't let this test time out, this should be quick
-    let (tx, rx) = channel();
-    thread::spawn(move|| {
-        thread::sleep_ms(1000);
-        if rx.try_recv().is_err() {
-            process::exit(1);
-        }
-    });
-    let code = t!(p.wait()).code();
-    if cfg!(windows) {
-        assert!(code.is_some());
-    } else {
-        assert!(code.is_none());
-    }
-    tx.send(());
-}
diff --git a/src/test/ui/crt-static-on-works.rs b/src/test/ui/crt-static-on-works.rs
deleted file mode 100644 (file)
index f89d1ed..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// run-pass
-// compile-flags:-C target-feature=+crt-static
-// only-msvc
-
-#[cfg(target_feature = "crt-static")]
-fn main() {}
diff --git a/src/test/ui/cycle-generic-bound.rs b/src/test/ui/cycle-generic-bound.rs
deleted file mode 100644 (file)
index 9241f37..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-pass
-// Regression test for #15477. This test just needs to compile.
-
-// pretty-expanded FIXME #23616
-
-trait Chromosome<X: Chromosome<i32>> {
-}
-
-impl Chromosome<i32> for i32 { }
-
-fn main() { }
index 1080f947732e4442c23d4720b6850292e9ad066c..45a906a39475bd863047bb54a6b3f264e54ba89e 100644 (file)
@@ -13,12 +13,16 @@ LL | struct NotClone;
 LL |     Bar::<NotClone> { x: 1 }.clone();
    |                              ^^^^^ method cannot be called on `Bar<NotClone>` due to unsatisfied trait bounds
    |
-   = note: the following trait bounds were not satisfied:
-           `NotClone: Clone`
-           which is required by `Bar<NotClone>: Clone`
+note: the following trait bounds were not satisfied because of the requirements of the implementation of `Clone` for `_`:
+      `NotClone: Clone`
+  --> $DIR/derive-assoc-type-not-impl.rs:6:10
+   |
+LL | #[derive(Clone)]
+   |          ^^^^^
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `clone`, perhaps you need to implement it:
            candidate #1: `Clone`
+   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `NotClone` with `#[derive(Clone)]`
    |
 LL | #[derive(Clone)]
index c5bc50e407b25787dbd8d5ca2278e6597311a926..cc874576cb7b95790db4a29a4b0b2f00520c23b1 100644 (file)
@@ -7,11 +7,6 @@ LL | #[derive(Clone)]
 LL |      x: Error
    |      ^^^^^^^^ the trait `Clone` is not implemented for `Error`
    |
-note: required by `clone`
-  --> $SRC_DIR/core/src/clone.rs:LL:COL
-   |
-LL |     fn clone(&self) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index a6dc818eb6fe4ea4786377c627695c123ef41ae3..a4870635de87001579455dc6a29d38689711bddc 100644 (file)
@@ -7,11 +7,6 @@ LL | #[derive(Clone)]
 LL |      Error
    |      ^^^^^ the trait `Clone` is not implemented for `Error`
    |
-note: required by `clone`
-  --> $SRC_DIR/core/src/clone.rs:LL:COL
-   |
-LL |     fn clone(&self) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index cf7b9ec276e2542e52adadf8f645899bad42f4d5..4507eeccc3aee51301a7212b8d4e8eb961b268e5 100644 (file)
@@ -7,11 +7,6 @@ LL | struct Struct {
 LL |     x: Error
    |     ^^^^^^^^ the trait `Clone` is not implemented for `Error`
    |
-note: required by `clone`
-  --> $SRC_DIR/core/src/clone.rs:LL:COL
-   |
-LL |     fn clone(&self) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 80733d62730d7a2fc78e3ddc5c377d34ec996cce..a79be7f574d6f77fc83f67fe1d912a168107ebdb 100644 (file)
@@ -7,11 +7,6 @@ LL | struct Struct(
 LL |     Error
    |     ^^^^^ the trait `Clone` is not implemented for `Error`
    |
-note: required by `clone`
-  --> $SRC_DIR/core/src/clone.rs:LL:COL
-   |
-LL |     fn clone(&self) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index c60b6ac456ebf962e42821018a919f461e06bbc5..dd2cfaf89bb8f7f13923bb9fec194dbef68026ff 100644 (file)
@@ -7,11 +7,6 @@ LL | struct Struct {
 LL |     x: Error
    |     ^^^^^^^^ the trait `Default` is not implemented for `Error`
    |
-note: required by `std::default::Default::default`
-  --> $SRC_DIR/core/src/default.rs:LL:COL
-   |
-LL |     fn default() -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index ed342f539da03e3f80e567b0bd8e90ed3cde3a39..0674d635d3d0e2c234940954618897321787aeaa 100644 (file)
@@ -7,11 +7,6 @@ LL | struct Struct(
 LL |     Error
    |     ^^^^^ the trait `Default` is not implemented for `Error`
    |
-note: required by `std::default::Default::default`
-  --> $SRC_DIR/core/src/default.rs:LL:COL
-   |
-LL |     fn default() -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 47c7f1c2c33408ec70a5ec983f934a8b81cef8a0..7f24be959f01930b3b4a859f358d178871c9ad2a 100644 (file)
@@ -7,11 +7,6 @@ LL | #[derive(Hash)]
 LL |      x: Error
    |      ^^^^^^^^ the trait `Hash` is not implemented for `Error`
    |
-note: required by a bound in `std::hash::Hash::hash`
-  --> $SRC_DIR/core/src/hash/mod.rs:LL:COL
-   |
-LL |     fn hash<H: Hasher>(&self, state: &mut H);
-   |             ^ required by this bound in `std::hash::Hash::hash`
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 92f084b58e35be50a69503ed7ff9617a4dadad88..ae2921a16b315a60556a42b319caf7e31ccc681b 100644 (file)
@@ -7,11 +7,6 @@ LL | #[derive(Hash)]
 LL |      Error
    |      ^^^^^ the trait `Hash` is not implemented for `Error`
    |
-note: required by a bound in `std::hash::Hash::hash`
-  --> $SRC_DIR/core/src/hash/mod.rs:LL:COL
-   |
-LL |     fn hash<H: Hasher>(&self, state: &mut H);
-   |             ^ required by this bound in `std::hash::Hash::hash`
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index c57cebe04ebcbacb0e07e616ebefc10cbae2c9ba..37b3af702a0c143fbce682529c90bebe6621f4ac 100644 (file)
@@ -7,11 +7,6 @@ LL | struct Struct {
 LL |     x: Error
    |     ^^^^^^^^ the trait `Hash` is not implemented for `Error`
    |
-note: required by a bound in `std::hash::Hash::hash`
-  --> $SRC_DIR/core/src/hash/mod.rs:LL:COL
-   |
-LL |     fn hash<H: Hasher>(&self, state: &mut H);
-   |             ^ required by this bound in `std::hash::Hash::hash`
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 200937f0c9fc380dbaee757da9f1a166c6ed0dc5..18624667d25ee77a798fce38827f50f88cd02deb 100644 (file)
@@ -7,11 +7,6 @@ LL | struct Struct(
 LL |     Error
    |     ^^^^^ the trait `Hash` is not implemented for `Error`
    |
-note: required by a bound in `std::hash::Hash::hash`
-  --> $SRC_DIR/core/src/hash/mod.rs:LL:COL
-   |
-LL |     fn hash<H: Hasher>(&self, state: &mut H);
-   |             ^ required by this bound in `std::hash::Hash::hash`
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 1e1cd715e6479343fc3ba6b9828a0a8d9cb8c6bd..b52c5a0d6a504793f17d3234de0021d36006724b 100644 (file)
@@ -7,11 +7,6 @@ LL | #[derive(Ord,Eq,PartialOrd,PartialEq)]
 LL |      x: Error
    |      ^^^^^^^^ the trait `Ord` is not implemented for `Error`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 43abe9a954738ca3cbe4f86009de01b75162107d..2ea0496ea0db784bbc0c2a8101e8aaa8737263f9 100644 (file)
@@ -7,11 +7,6 @@ LL | #[derive(Ord,Eq,PartialOrd,PartialEq)]
 LL |      Error
    |      ^^^^^ the trait `Ord` is not implemented for `Error`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 44f6bab08c127854a2dd332374e30d3f6eb7e329..52cf0cf8cd75d9195089c26b7e1a4bc967b1f4ac 100644 (file)
@@ -7,11 +7,6 @@ LL | struct Struct {
 LL |     x: Error
    |     ^^^^^^^^ the trait `Ord` is not implemented for `Error`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index e604018245ae3a6aeb0e7882a4f36337ee85245a..ecdf8d8cb5931e5063c2ecfee74f28aa0b2a5b4a 100644 (file)
@@ -7,11 +7,6 @@ LL | struct Struct(
 LL |     Error
    |     ^^^^^ the trait `Ord` is not implemented for `Error`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 9a716048e26aa0a0694bc974b9ef636cb6b33b20..fc8eb1ebfd3e2189576e73111a938400d7315801 100644 (file)
@@ -8,11 +8,6 @@ LL |      x: Error
    |      ^^^^^^^^ no implementation for `Error < Error` and `Error > Error`
    |
    = help: the trait `PartialOrd` is not implemented for `Error`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index c726d33eab0135ef850f8c547e5b98fbcf0294ce..38053495a0572aa5b3be11fe6d5271341fa6483f 100644 (file)
@@ -8,11 +8,6 @@ LL |      Error
    |      ^^^^^ no implementation for `Error < Error` and `Error > Error`
    |
    = help: the trait `PartialOrd` is not implemented for `Error`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index a56c163ca788ae061cbeff8d8afb601f9559e4d7..1c07b98f983def4d70adb0f9238aaf9447f4fe6a 100644 (file)
@@ -8,11 +8,6 @@ LL |     x: Error
    |     ^^^^^^^^ no implementation for `Error < Error` and `Error > Error`
    |
    = help: the trait `PartialOrd` is not implemented for `Error`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 7a0a52e582444861a996ec12cc1aba12099cde47..bf01252b07b8def98007e562d40bfb795cca07a1 100644 (file)
@@ -8,11 +8,6 @@ LL |     Error
    |     ^^^^^ no implementation for `Error < Error` and `Error > Error`
    |
    = help: the trait `PartialOrd` is not implemented for `Error`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index e322db97fab493ab59b02d9148cfeb686ab5b7b2..d64b4509b260bc45981e381d7e8bfa933fde6f8e 100644 (file)
@@ -47,11 +47,6 @@ LL | struct C {
 LL |     x: NoCloneOrEq
    |     ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoCloneOrEq`
    |
-note: required by `clone`
-  --> $SRC_DIR/core/src/clone.rs:LL:COL
-   |
-LL |     fn clone(&self) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
diff --git a/src/test/ui/did_you_mean/compatible-variants.rs b/src/test/ui/did_you_mean/compatible-variants.rs
new file mode 100644 (file)
index 0000000..fb6b6a5
--- /dev/null
@@ -0,0 +1,43 @@
+enum Hey<A, B> {
+    A(A),
+    B(B),
+}
+
+fn f() {}
+
+fn a() -> Option<()> {
+    while false {
+        //~^ ERROR mismatched types
+        f();
+    }
+    //~^ HELP try adding an expression
+}
+
+fn b() -> Result<(), ()> {
+    f()
+    //~^ ERROR mismatched types
+    //~| HELP try adding an expression
+}
+
+fn main() {
+    let _: Option<()> = while false {};
+    //~^ ERROR mismatched types
+    //~| HELP try wrapping
+    let _: Option<()> = {
+        while false {}
+        //~^ ERROR mismatched types
+        //~| HELP try adding an expression
+    };
+    let _: Result<i32, i32> = 1;
+    //~^ ERROR mismatched types
+    //~| HELP try wrapping
+    let _: Option<i32> = 1;
+    //~^ ERROR mismatched types
+    //~| HELP try wrapping
+    let _: Hey<i32, i32> = 1;
+    //~^ ERROR mismatched types
+    //~| HELP try wrapping
+    let _: Hey<i32, bool> = false;
+    //~^ ERROR mismatched types
+    //~| HELP try wrapping
+}
diff --git a/src/test/ui/did_you_mean/compatible-variants.stderr b/src/test/ui/did_you_mean/compatible-variants.stderr
new file mode 100644 (file)
index 0000000..e779496
--- /dev/null
@@ -0,0 +1,137 @@
+error[E0308]: mismatched types
+  --> $DIR/compatible-variants.rs:9:5
+   |
+LL |   fn a() -> Option<()> {
+   |             ---------- expected `Option<()>` because of return type
+LL | /     while false {
+LL | |
+LL | |         f();
+LL | |     }
+   | |_____^ expected enum `Option`, found `()`
+   |
+   = note:   expected enum `Option<()>`
+           found unit type `()`
+help: try adding an expression at the end of the block
+   |
+LL ~     }
+LL +     None
+   |
+LL ~     }
+LL +     Some(())
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/compatible-variants.rs:17:5
+   |
+LL | fn b() -> Result<(), ()> {
+   |           -------------- expected `Result<(), ()>` because of return type
+LL |     f()
+   |     ^^^ expected enum `Result`, found `()`
+   |
+   = note:   expected enum `Result<(), ()>`
+           found unit type `()`
+help: try adding an expression at the end of the block
+   |
+LL ~     f();
+LL +     Ok(())
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/compatible-variants.rs:23:25
+   |
+LL |     let _: Option<()> = while false {};
+   |            ----------   ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
+   |            |
+   |            expected due to this
+   |
+   = note:   expected enum `Option<()>`
+           found unit type `()`
+help: try wrapping the expression in `Some`
+   |
+LL |     let _: Option<()> = Some(while false {});
+   |                         +++++              +
+
+error[E0308]: mismatched types
+  --> $DIR/compatible-variants.rs:27:9
+   |
+LL |         while false {}
+   |         ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
+   |
+   = note:   expected enum `Option<()>`
+           found unit type `()`
+help: try adding an expression at the end of the block
+   |
+LL ~         while false {}
+LL +         None
+   |
+LL ~         while false {}
+LL +         Some(())
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/compatible-variants.rs:31:31
+   |
+LL |     let _: Result<i32, i32> = 1;
+   |            ----------------   ^ expected enum `Result`, found integer
+   |            |
+   |            expected due to this
+   |
+   = note: expected enum `Result<i32, i32>`
+              found type `{integer}`
+help: try wrapping the expression in a variant of `Result`
+   |
+LL |     let _: Result<i32, i32> = Ok(1);
+   |                               +++ +
+LL |     let _: Result<i32, i32> = Err(1);
+   |                               ++++ +
+
+error[E0308]: mismatched types
+  --> $DIR/compatible-variants.rs:34:26
+   |
+LL |     let _: Option<i32> = 1;
+   |            -----------   ^ expected enum `Option`, found integer
+   |            |
+   |            expected due to this
+   |
+   = note: expected enum `Option<i32>`
+              found type `{integer}`
+help: try wrapping the expression in `Some`
+   |
+LL |     let _: Option<i32> = Some(1);
+   |                          +++++ +
+
+error[E0308]: mismatched types
+  --> $DIR/compatible-variants.rs:37:28
+   |
+LL |     let _: Hey<i32, i32> = 1;
+   |            -------------   ^ expected enum `Hey`, found integer
+   |            |
+   |            expected due to this
+   |
+   = note: expected enum `Hey<i32, i32>`
+              found type `{integer}`
+help: try wrapping the expression in a variant of `Hey`
+   |
+LL |     let _: Hey<i32, i32> = Hey::A(1);
+   |                            +++++++ +
+LL |     let _: Hey<i32, i32> = Hey::B(1);
+   |                            +++++++ +
+
+error[E0308]: mismatched types
+  --> $DIR/compatible-variants.rs:40:29
+   |
+LL |     let _: Hey<i32, bool> = false;
+   |            --------------   ^^^^^ expected enum `Hey`, found `bool`
+   |            |
+   |            expected due to this
+   |
+   = note: expected enum `Hey<i32, bool>`
+              found type `bool`
+help: try wrapping the expression in `Hey::B`
+   |
+LL |     let _: Hey<i32, bool> = Hey::B(false);
+   |                             +++++++     +
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index c7458916c536492e9b7da88fa3de4b435fefe4fd..5381a717dc3cfd2312b14e3c2b0fecb6f88c48ae 100644 (file)
@@ -12,11 +12,6 @@ LL |     Foo::<i32>::bar(&1i8);
              <i8 as Foo<u32>>
              <i8 as Foo<u64>>
              <i8 as Foo<u8>>
-note: required by `Foo::bar`
-  --> $DIR/issue-39802-show-5-trait-impls.rs:2:5
-   |
-LL |     fn bar(&self){}
-   |     ^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
   --> $DIR/issue-39802-show-5-trait-impls.rs:25:21
@@ -31,11 +26,6 @@ LL |     Foo::<i32>::bar(&1u8);
              <u8 as Foo<u16>>
              <u8 as Foo<u32>>
              <u8 as Foo<u64>>
-note: required by `Foo::bar`
-  --> $DIR/issue-39802-show-5-trait-impls.rs:2:5
-   |
-LL |     fn bar(&self){}
-   |     ^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
   --> $DIR/issue-39802-show-5-trait-impls.rs:26:21
@@ -51,11 +41,6 @@ LL |     Foo::<i32>::bar(&true);
              <bool as Foo<u16>>
              <bool as Foo<u32>>
            and 2 others
-note: required by `Foo::bar`
-  --> $DIR/issue-39802-show-5-trait-impls.rs:2:5
-   |
-LL |     fn bar(&self){}
-   |     ^^^^^^^^^^^^^
 
 error: aborting due to 3 previous errors
 
index 700f8128a939a8b17a2a7153c58d80f3add6779d..6da640b2b7c765b26054fc0248512e8fb23be270 100644 (file)
@@ -10,7 +10,7 @@ fn main() {
     let n: usize = 42;
     this_function_expects_a_double_option(n);
     //~^ ERROR mismatched types
-    //~| HELP try using a variant of the expected enum
+    //~| HELP try wrapping the expression in a variant of `DoubleOption`
 }
 
 
index bc8a93757a5994288cdd9aa9856433338fb78abf..dbe46704b9320224edc810d5b2488f9a5ca0deef 100644 (file)
@@ -6,12 +6,12 @@ LL |     this_function_expects_a_double_option(n);
    |
    = note: expected enum `DoubleOption<_>`
               found type `usize`
-help: try using a variant of the expected enum
+help: try wrapping the expression in a variant of `DoubleOption`
    |
-LL |     this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
-   |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 LL |     this_function_expects_a_double_option(DoubleOption::FirstSome(n));
-   |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~
+   |                                           ++++++++++++++++++++++++ +
+LL |     this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
+   |                                           ++++++++++++++++++++++++++++++ +
 
 error[E0308]: mismatched types
   --> $DIR/issue-42764.rs:27:33
diff --git a/src/test/ui/drop/issue-90752-raw-ptr-shenanigans.rs b/src/test/ui/drop/issue-90752-raw-ptr-shenanigans.rs
new file mode 100644 (file)
index 0000000..4e67b35
--- /dev/null
@@ -0,0 +1,41 @@
+// run-pass
+
+use std::cell::RefCell;
+
+struct S<'a>(i32, &'a RefCell<Vec<i32>>);
+
+impl<'a> Drop for S<'a> {
+    fn drop(&mut self) {
+        self.1.borrow_mut().push(self.0);
+    }
+}
+
+fn test(drops: &RefCell<Vec<i32>>) {
+    let mut foo = None;
+    let pfoo: *mut _ = &mut foo;
+
+    match foo {
+        None => (),
+        _ => return,
+    }
+
+    // Both S(0) and S(1) should be dropped, but aren't.
+    unsafe { *pfoo = Some((S(0, drops), S(1, drops))); }
+
+    match foo {
+        Some((_x, _)) => {}
+        _ => {}
+    }
+}
+
+fn main() {
+    let drops = RefCell::new(Vec::new());
+    test(&drops);
+
+    // Ideally, we want this...
+    //assert_eq!(*drops.borrow(), &[0, 1]);
+
+    // But the delayed access through the raw pointer confuses drop elaboration,
+    // causing S(1) to be leaked.
+    assert_eq!(*drops.borrow(), &[0]);
+}
diff --git a/src/test/ui/drop/issue-90752.rs b/src/test/ui/drop/issue-90752.rs
new file mode 100644 (file)
index 0000000..4395e45
--- /dev/null
@@ -0,0 +1,32 @@
+// run-pass
+
+use std::cell::RefCell;
+
+struct S<'a>(i32, &'a RefCell<Vec<i32>>);
+
+impl<'a> Drop for S<'a> {
+    fn drop(&mut self) {
+        self.1.borrow_mut().push(self.0);
+    }
+}
+
+fn test(drops: &RefCell<Vec<i32>>) {
+    let mut foo = None;
+    match foo {
+        None => (),
+        _ => return,
+    }
+
+    *(&mut foo) = Some((S(0, drops), S(1, drops))); // Both S(0) and S(1) should be dropped
+
+    match foo {
+        Some((_x, _)) => {}
+        _ => {}
+    }
+}
+
+fn main() {
+    let drops = RefCell::new(Vec::new());
+    test(&drops);
+    assert_eq!(*drops.borrow(), &[0, 1]);
+}
diff --git a/src/test/ui/dropck/cleanup-arm-conditional.rs b/src/test/ui/dropck/cleanup-arm-conditional.rs
new file mode 100644 (file)
index 0000000..38c7170
--- /dev/null
@@ -0,0 +1,39 @@
+// run-pass
+
+#![allow(stable_features)]
+#![allow(unused_imports)]
+// Test that cleanup scope for temporaries created in a match
+// arm is confined to the match arm itself.
+
+// pretty-expanded FIXME #23616
+
+#![feature(os)]
+
+use std::os;
+
+struct Test { x: isize }
+
+impl Test {
+    fn get_x(&self) -> Option<Box<isize>> {
+        Some(Box::new(self.x))
+    }
+}
+
+fn do_something(t: &Test) -> isize {
+
+    // The cleanup scope for the result of `t.get_x()` should be the
+    // arm itself and not the match, otherwise we'll (potentially) get
+    // a crash trying to free an uninitialized stack slot.
+
+    match t {
+        &Test { x: 2 } if t.get_x().is_some() => {
+            t.x * 2
+        }
+        _ => { 22 }
+    }
+}
+
+pub fn main() {
+    let t = Test { x: 1 };
+    do_something(&t);
+}
diff --git a/src/test/ui/dyn-trait-compatibility.rs b/src/test/ui/dyn-trait-compatibility.rs
deleted file mode 100644 (file)
index d2b02cc..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-type A0 = dyn;
-//~^ ERROR cannot find type `dyn` in this scope
-type A1 = dyn::dyn;
-//~^ ERROR use of undeclared crate or module `dyn`
-type A2 = dyn<dyn, dyn>;
-//~^ ERROR cannot find type `dyn` in this scope
-//~| ERROR cannot find type `dyn` in this scope
-//~| ERROR cannot find type `dyn` in this scope
-type A3 = dyn<<dyn as dyn>::dyn>;
-//~^ ERROR cannot find type `dyn` in this scope
-//~| ERROR cannot find type `dyn` in this scope
-//~| ERROR use of undeclared crate or module `dyn`
-
-fn main() {}
diff --git a/src/test/ui/dyn-trait-compatibility.stderr b/src/test/ui/dyn-trait-compatibility.stderr
deleted file mode 100644 (file)
index 9218ae9..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `dyn`
-  --> $DIR/dyn-trait-compatibility.rs:3:11
-   |
-LL | type A1 = dyn::dyn;
-   |           ^^^ use of undeclared crate or module `dyn`
-
-error[E0433]: failed to resolve: use of undeclared crate or module `dyn`
-  --> $DIR/dyn-trait-compatibility.rs:9:23
-   |
-LL | type A3 = dyn<<dyn as dyn>::dyn>;
-   |                       ^^^ use of undeclared crate or module `dyn`
-
-error[E0412]: cannot find type `dyn` in this scope
-  --> $DIR/dyn-trait-compatibility.rs:1:11
-   |
-LL | type A0 = dyn;
-   |           ^^^ not found in this scope
-
-error[E0412]: cannot find type `dyn` in this scope
-  --> $DIR/dyn-trait-compatibility.rs:5:11
-   |
-LL | type A2 = dyn<dyn, dyn>;
-   |           ^^^ not found in this scope
-
-error[E0412]: cannot find type `dyn` in this scope
-  --> $DIR/dyn-trait-compatibility.rs:5:15
-   |
-LL | type A2 = dyn<dyn, dyn>;
-   |        -      ^^^ not found in this scope
-   |        |
-   |        help: you might be missing a type parameter: `<dyn>`
-
-error[E0412]: cannot find type `dyn` in this scope
-  --> $DIR/dyn-trait-compatibility.rs:5:20
-   |
-LL | type A2 = dyn<dyn, dyn>;
-   |        -           ^^^ not found in this scope
-   |        |
-   |        help: you might be missing a type parameter: `<dyn>`
-
-error[E0412]: cannot find type `dyn` in this scope
-  --> $DIR/dyn-trait-compatibility.rs:9:11
-   |
-LL | type A3 = dyn<<dyn as dyn>::dyn>;
-   |           ^^^ not found in this scope
-
-error[E0412]: cannot find type `dyn` in this scope
-  --> $DIR/dyn-trait-compatibility.rs:9:16
-   |
-LL | type A3 = dyn<<dyn as dyn>::dyn>;
-   |        -       ^^^ not found in this scope
-   |        |
-   |        help: you might be missing a type parameter: `<dyn>`
-
-error: aborting due to 8 previous errors
-
-Some errors have detailed explanations: E0412, E0433.
-For more information about an error, try `rustc --explain E0412`.
diff --git a/src/test/ui/early-vtbl-resolution.rs b/src/test/ui/early-vtbl-resolution.rs
deleted file mode 100644 (file)
index f4b69c1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// run-pass
-
-#![allow(non_camel_case_types)]
-#![allow(dead_code)]
-// pretty-expanded FIXME #23616
-
-trait thing<A> {
-    fn foo(&self) -> Option<A>;
-}
-impl<A> thing<A> for isize {
-    fn foo(&self) -> Option<A> { None }
-}
-fn foo_func<A, B: thing<A>>(x: B) -> Option<A> { x.foo() }
-
-struct A { a: isize }
-
-pub fn main() {
-    let _x: Option<f64> = foo_func(0);
-}
diff --git a/src/test/ui/edition-keywords-2015-2018.rs b/src/test/ui/edition-keywords-2015-2018.rs
deleted file mode 100644 (file)
index 8c3397c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// run-pass
-
-#![allow(unused_mut)]
-#![allow(unused_assignments)]
-#![allow(unused_variables)]
-// edition:2015
-// aux-build:edition-kw-macro-2018.rs
-
-#[macro_use]
-extern crate edition_kw_macro_2018;
-
-pub fn check_async() {
-    let mut async = 1; // OK
-    let mut r#async = 1; // OK
-
-    r#async = consumes_async!(async); // OK
-    // r#async = consumes_async!(r#async); // ERROR, not a match
-    // r#async = consumes_async_raw!(async); // ERROR, not a match
-    r#async = consumes_async_raw!(r#async); // OK
-
-    if passes_ident!(async) == 1 {} // OK
-    if passes_ident!(r#async) == 1 {} // OK
-    // one_async::async(); // ERROR, unresolved name
-    // one_async::r#async(); // ERROR, unresolved name
-    two_async::async(); // OK
-    two_async::r#async(); // OK
-}
-
-mod one_async {
-    // produces_async! {} // ERROR, reserved
-}
-mod two_async {
-    produces_async_raw! {} // OK
-}
-
-fn main() {}
diff --git a/src/test/ui/edition-keywords-2018-2018.rs b/src/test/ui/edition-keywords-2018-2018.rs
deleted file mode 100644 (file)
index 5043440..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// run-pass
-
-#![allow(unused_assignments)]
-// edition:2018
-// aux-build:edition-kw-macro-2018.rs
-
-#[macro_use]
-extern crate edition_kw_macro_2018;
-
-pub fn check_async() {
-    // let mut async = 1; // ERROR, reserved
-    let mut r#async = 1; // OK
-
-    r#async = consumes_async!(async); // OK
-    // r#async = consumes_async!(r#async); // ERROR, not a match
-    // r#async = consumes_async_raw!(async); // ERROR, not a match
-    r#async = consumes_async_raw!(r#async); // OK
-
-    // if passes_ident!(async) == 1 {} // ERROR, reserved
-    if passes_ident!(r#async) == 1 {} // OK
-    // one_async::async(); // ERROR, reserved
-    // one_async::r#async(); // ERROR, unresolved name
-    // two_async::async(); // ERROR, reserved
-    two_async::r#async(); // OK
-}
-
-mod one_async {
-    // produces_async! {} // ERROR, reserved
-}
-mod two_async {
-    produces_async_raw! {} // OK
-}
-
-fn main() {}
diff --git a/src/test/ui/editions/edition-keywords-2015-2018.rs b/src/test/ui/editions/edition-keywords-2015-2018.rs
new file mode 100644 (file)
index 0000000..8c3397c
--- /dev/null
@@ -0,0 +1,36 @@
+// run-pass
+
+#![allow(unused_mut)]
+#![allow(unused_assignments)]
+#![allow(unused_variables)]
+// edition:2015
+// aux-build:edition-kw-macro-2018.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2018;
+
+pub fn check_async() {
+    let mut async = 1; // OK
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    // r#async = consumes_async!(r#async); // ERROR, not a match
+    // r#async = consumes_async_raw!(async); // ERROR, not a match
+    r#async = consumes_async_raw!(r#async); // OK
+
+    if passes_ident!(async) == 1 {} // OK
+    if passes_ident!(r#async) == 1 {} // OK
+    // one_async::async(); // ERROR, unresolved name
+    // one_async::r#async(); // ERROR, unresolved name
+    two_async::async(); // OK
+    two_async::r#async(); // OK
+}
+
+mod one_async {
+    // produces_async! {} // ERROR, reserved
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/src/test/ui/editions/edition-keywords-2018-2018.rs b/src/test/ui/editions/edition-keywords-2018-2018.rs
new file mode 100644 (file)
index 0000000..5043440
--- /dev/null
@@ -0,0 +1,34 @@
+// run-pass
+
+#![allow(unused_assignments)]
+// edition:2018
+// aux-build:edition-kw-macro-2018.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2018;
+
+pub fn check_async() {
+    // let mut async = 1; // ERROR, reserved
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    // r#async = consumes_async!(r#async); // ERROR, not a match
+    // r#async = consumes_async_raw!(async); // ERROR, not a match
+    r#async = consumes_async_raw!(r#async); // OK
+
+    // if passes_ident!(async) == 1 {} // ERROR, reserved
+    if passes_ident!(r#async) == 1 {} // OK
+    // one_async::async(); // ERROR, reserved
+    // one_async::r#async(); // ERROR, unresolved name
+    // two_async::async(); // ERROR, reserved
+    two_async::r#async(); // OK
+}
+
+mod one_async {
+    // produces_async! {} // ERROR, reserved
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/src/test/ui/empty/empty-attributes.rs b/src/test/ui/empty/empty-attributes.rs
new file mode 100644 (file)
index 0000000..7e9b055
--- /dev/null
@@ -0,0 +1,14 @@
+#![deny(unused_attributes)]
+#![allow()] //~ ERROR unused attribute
+#![warn()] //~ ERROR unused attribute
+#![deny()] //~ ERROR unused attribute
+#![forbid()] //~ ERROR unused attribute
+#![feature()] //~ ERROR unused attribute
+
+#[repr()] //~ ERROR unused attribute
+pub struct S;
+
+#[target_feature()] //~ ERROR unused attribute
+pub unsafe fn foo() {}
+
+fn main() {}
diff --git a/src/test/ui/empty/empty-attributes.stderr b/src/test/ui/empty/empty-attributes.stderr
new file mode 100644 (file)
index 0000000..e0798e4
--- /dev/null
@@ -0,0 +1,63 @@
+error: unused attribute
+  --> $DIR/empty-attributes.rs:8:1
+   |
+LL | #[repr()]
+   | ^^^^^^^^^ help: remove this attribute
+   |
+note: the lint level is defined here
+  --> $DIR/empty-attributes.rs:1:9
+   |
+LL | #![deny(unused_attributes)]
+   |         ^^^^^^^^^^^^^^^^^
+   = note: attribute `repr` with an empty list has no effect
+
+error: unused attribute
+  --> $DIR/empty-attributes.rs:11:1
+   |
+LL | #[target_feature()]
+   | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+   = note: attribute `target_feature` with an empty list has no effect
+
+error: unused attribute
+  --> $DIR/empty-attributes.rs:2:1
+   |
+LL | #![allow()]
+   | ^^^^^^^^^^^ help: remove this attribute
+   |
+   = note: attribute `allow` with an empty list has no effect
+
+error: unused attribute
+  --> $DIR/empty-attributes.rs:3:1
+   |
+LL | #![warn()]
+   | ^^^^^^^^^^ help: remove this attribute
+   |
+   = note: attribute `warn` with an empty list has no effect
+
+error: unused attribute
+  --> $DIR/empty-attributes.rs:4:1
+   |
+LL | #![deny()]
+   | ^^^^^^^^^^ help: remove this attribute
+   |
+   = note: attribute `deny` with an empty list has no effect
+
+error: unused attribute
+  --> $DIR/empty-attributes.rs:5:1
+   |
+LL | #![forbid()]
+   | ^^^^^^^^^^^^ help: remove this attribute
+   |
+   = note: attribute `forbid` with an empty list has no effect
+
+error: unused attribute
+  --> $DIR/empty-attributes.rs:6:1
+   |
+LL | #![feature()]
+   | ^^^^^^^^^^^^^ help: remove this attribute
+   |
+   = note: attribute `feature` with an empty list has no effect
+
+error: aborting due to 7 previous errors
+
index 26bfc4355fa114d4398ee2dc639aa1c9d8ae506f..81651c5bf6f40c4842a0d8108dcf5c2f5f453205 100644 (file)
@@ -22,8 +22,9 @@ LL |     let e4 = E::Empty4();
    |
 help: `E::Empty4` is a unit variant, you need to write it without the parentheses
    |
-LL |     let e4 = E::Empty4;
-   |              ~~~~~~~~~
+LL -     let e4 = E::Empty4();
+LL +     let e4 = E::Empty4;
+   | 
 
 error[E0618]: expected function, found `empty_struct::XEmpty2`
   --> $DIR/empty-struct-unit-expr.rs:18:15
@@ -43,8 +44,9 @@ LL |     let xe4 = XE::XEmpty4();
    |
 help: `XE::XEmpty4` is a unit variant, you need to write it without the parentheses
    |
-LL |     let xe4 = XE::XEmpty4;
-   |               ~~~~~~~~~~~
+LL -     let xe4 = XE::XEmpty4();
+LL +     let xe4 = XE::XEmpty4;
+   | 
 
 error: aborting due to 4 previous errors
 
index e13f0961a18cf2e00de92686f04ed559d01f65b9..dfffbb182ad31566d1044c3d306506915dcff60c 100644 (file)
@@ -12,11 +12,6 @@ LL | impl<T> Foo for T where Bar<T>: Foo {}
    |         ^^^     ^
    = note: 127 redundant requirements hidden
    = note: required because of the requirements on the impl of `Foo` for `Bar<T>`
-note: required by a bound in `Foo`
-  --> $DIR/E0275.rs:1:1
-   |
-LL | trait Foo {}
-   | ^^^^^^^^^ required by this bound in `Foo`
 
 error: aborting due to previous error
 
index 8857e1646eee04c5032b4e2d2096db08a2d60b61..1013f041bbe3c68fd2a64d26b8356e7170f38769 100644 (file)
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/E0276.rs:6:5
+  --> $DIR/E0276.rs:6:30
    |
 LL |     fn foo<T>(x: T);
    |     ---------------- definition of `foo` from trait
 ...
 LL |     fn foo<T>(x: T) where T: Copy {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Copy`
+   |                              ^^^^ impl has extra requirement `T: Copy`
 
 error: aborting due to previous error
 
index 95437bf11adecf9229393d7e458e5346214b640f..7dcfe96b35c9a04b4a5600bcae3a93717bf76b7a 100644 (file)
@@ -5,11 +5,6 @@ LL |     let cont: u32 = Generator::create();
    |                     ^^^^^^^^^^^^^^^^^ cannot infer type
    |
    = note: cannot satisfy `_: Generator`
-note: required by `Generator::create`
-  --> $DIR/E0283.rs:2:5
-   |
-LL |     fn create() -> u32;
-   |     ^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/E0283.rs:35:24
index f12ff96bb8aee0e9c7db0e6b00e3ff6511b037f5..464109247c9bab81b2d77a4e5b8940b5e162ddab 100644 (file)
@@ -3,6 +3,6 @@ mod foo {
 }
 
 pub use foo as foo2;
-//~^ ERROR `foo` is private, and cannot be re-exported [E0365]
+//~^ ERROR `foo` is only public within the crate, and cannot be re-exported outside [E0365]
 
 fn main() {}
index c8fc59f8ba958e612440c34a9dd2006a6ef3bb34..5bfcf1394d9fe3a7006e7e765402f03a7826f08f 100644 (file)
@@ -1,8 +1,8 @@
-error[E0365]: `foo` is private, and cannot be re-exported
+error[E0365]: `foo` is only public within the crate, and cannot be re-exported outside
   --> $DIR/E0365.rs:5:9
    |
 LL | pub use foo as foo2;
-   |         ^^^^^^^^^^^ re-export of private `foo`
+   |         ^^^^^^^^^^^ re-export of crate public `foo`
    |
    = note: consider declaring type or module `foo` with `pub`
 
index db1b3f098374e5bf51a92faf3ca88d60a990a13e..a3a90968df704c38e5ccf3e15636de2d09f3e98a 100644 (file)
@@ -11,8 +11,9 @@ LL |     X::Entry();
    |
 help: `X::Entry` is a unit variant, you need to write it without the parentheses
    |
-LL |     X::Entry;
-   |     ~~~~~~~~
+LL -     X::Entry();
+LL +     X::Entry;
+   | 
 
 error[E0618]: expected function, found `i32`
   --> $DIR/E0618.rs:9:5
diff --git a/src/test/ui/export-fully-qualified.rs b/src/test/ui/export-fully-qualified.rs
deleted file mode 100644 (file)
index 4e73a2c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// In this test baz isn't resolved when called as foo.baz even though
-// it's called from inside foo. This is somewhat surprising and may
-// want to change eventually.
-
-mod foo {
-    pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of undeclared crate or module `foo`
-
-    fn baz() { }
-}
-
-fn main() { }
diff --git a/src/test/ui/export-fully-qualified.stderr b/src/test/ui/export-fully-qualified.stderr
deleted file mode 100644 (file)
index 7ee352e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `foo`
-  --> $DIR/export-fully-qualified.rs:6:20
-   |
-LL |     pub fn bar() { foo::baz(); }
-   |                    ^^^ use of undeclared crate or module `foo`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/export-tag-variant.rs b/src/test/ui/export-tag-variant.rs
deleted file mode 100644 (file)
index 46c1006..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-mod foo {
-    pub fn x() { }
-
-    enum Y { Y1 }
-}
-
-fn main() { let z = foo::Y::Y1; } //~ ERROR: enum `Y` is private
diff --git a/src/test/ui/export-tag-variant.stderr b/src/test/ui/export-tag-variant.stderr
deleted file mode 100644 (file)
index f73bd45..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0603]: enum `Y` is private
-  --> $DIR/export-tag-variant.rs:7:26
-   |
-LL | fn main() { let z = foo::Y::Y1; }
-   |                          ^ private enum
-   |
-note: the enum `Y` is defined here
-  --> $DIR/export-tag-variant.rs:4:5
-   |
-LL |     enum Y { Y1 }
-   |     ^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/export.rs b/src/test/ui/export.rs
deleted file mode 100644 (file)
index 73ceec6..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-mod foo {
-    pub fn x(y: isize) { log(debug, y); }
-    //~^ ERROR cannot find function `log` in this scope
-    //~| ERROR cannot find value `debug` in this scope
-    fn z(y: isize) { log(debug, y); }
-    //~^ ERROR cannot find function `log` in this scope
-    //~| ERROR cannot find value `debug` in this scope
-}
-
-fn main() { foo::z(10); } //~ ERROR function `z` is private
diff --git a/src/test/ui/export.stderr b/src/test/ui/export.stderr
deleted file mode 100644 (file)
index 23c29b3..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-error[E0425]: cannot find function `log` in this scope
-  --> $DIR/export.rs:2:26
-   |
-LL |     pub fn x(y: isize) { log(debug, y); }
-   |                          ^^^ not found in this scope
-
-error[E0425]: cannot find value `debug` in this scope
-  --> $DIR/export.rs:2:30
-   |
-LL |     pub fn x(y: isize) { log(debug, y); }
-   |                              ^^^^^ not found in this scope
-
-error[E0425]: cannot find function `log` in this scope
-  --> $DIR/export.rs:5:22
-   |
-LL |     fn z(y: isize) { log(debug, y); }
-   |                      ^^^ not found in this scope
-
-error[E0425]: cannot find value `debug` in this scope
-  --> $DIR/export.rs:5:26
-   |
-LL |     fn z(y: isize) { log(debug, y); }
-   |                          ^^^^^ not found in this scope
-
-error[E0603]: function `z` is private
-  --> $DIR/export.rs:10:18
-   |
-LL | fn main() { foo::z(10); }
-   |                  ^ private function
-   |
-note: the function `z` is defined here
-  --> $DIR/export.rs:5:5
-   |
-LL |     fn z(y: isize) { log(debug, y); }
-   |     ^^^^^^^^^^^^^^
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0425, E0603.
-For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/ui/expr-block-slot.rs b/src/test/ui/expr-block-slot.rs
deleted file mode 100644 (file)
index 54bcbb3..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-// Regression test for issue #377
-
-
-struct A { a: isize }
-struct V { v: isize }
-
-pub fn main() {
-    let a = { let b = A {a: 3}; b };
-    assert_eq!(a.a, 3);
-    let c = { let d = V {v: 3}; d };
-    assert_eq!(c.v, 3);
-}
index 14d28b59648c1abfe943890319391d7f82ce3091..53924e24e4638a40107a6c0e31011d9d7b13dbd2 100644 (file)
@@ -20,6 +20,11 @@ LL | |     });
    | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
    |
    = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
+note: required by a bound in `Option::<T>::and_then`
+  --> $SRC_DIR/core/src/option.rs:LL:COL
+   |
+LL |     pub fn and_then<U, F: FnOnce(T) -> Option<U>>(self, f: F) -> Option<U> {
+   |                           ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::and_then`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/extern/auxiliary/no-mangle-associated-fn.rs b/src/test/ui/extern/auxiliary/no-mangle-associated-fn.rs
new file mode 100644 (file)
index 0000000..7fc73c7
--- /dev/null
@@ -0,0 +1,21 @@
+#![crate_type = "lib"]
+
+struct Bar;
+
+impl Bar {
+    #[no_mangle]
+    fn bar() -> u8 {
+        2
+    }
+}
+
+trait Foo {
+    fn baz() -> u8;
+}
+
+impl Foo for Bar {
+    #[no_mangle]
+    fn baz() -> u8 {
+        3
+    }
+}
diff --git a/src/test/ui/extern/no-mangle-associated-fn.rs b/src/test/ui/extern/no-mangle-associated-fn.rs
new file mode 100644 (file)
index 0000000..ecd44ab
--- /dev/null
@@ -0,0 +1,37 @@
+// aux-build: no-mangle-associated-fn.rs
+// run-pass
+
+extern crate no_mangle_associated_fn;
+
+struct Foo;
+
+impl Foo {
+    #[no_mangle]
+    fn foo() -> u8 {
+        1
+    }
+}
+
+trait Bar {
+    fn qux() -> u8;
+}
+
+impl Bar for Foo {
+    #[no_mangle]
+    fn qux() -> u8 {
+        4
+    }
+}
+
+fn main() {
+    extern "Rust" {
+        fn foo() -> u8;
+        fn bar() -> u8;
+        fn baz() -> u8;
+        fn qux() -> u8;
+    }
+    assert_eq!(unsafe { foo() }, 1);
+    assert_eq!(unsafe { bar() }, 2);
+    assert_eq!(unsafe { baz() }, 3);
+    assert_eq!(unsafe { qux() }, 4);
+}
index 8df5fbcc7eba290e17c5d8c0f20ab15f3a6de60d..8c5d72d7efefb37fcc3b8694e136a372de15fc4e 100644 (file)
@@ -139,13 +139,6 @@ error[E0277]: the trait bound `<<Self as _Tr3>::A as Iterator>::Item: Copy` is n
 LL |     type A: Iterator<Item: Copy>;
    |                            ^^^^ the trait `Copy` is not implemented for `<<Self as _Tr3>::A as Iterator>::Item`
    |
-note: required by a bound in `Copy`
-  --> $SRC_DIR/core/src/marker.rs:LL:COL
-   |
-LL | / pub trait Copy: Clone {
-LL | |     // Empty.
-LL | | }
-   | |_^ required by this bound in `Copy`
 help: consider further restricting the associated type
    |
 LL | trait _Tr3 where <<Self as _Tr3>::A as Iterator>::Item: Copy {
diff --git a/src/test/ui/feature-gates/feature-gate-inline_const_pat.rs b/src/test/ui/feature-gates/feature-gate-inline_const_pat.rs
new file mode 100644 (file)
index 0000000..3d0df28
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {
+    let const { () } = ();
+    //~^ ERROR inline-const in pattern position is experimental [E0658]
+}
diff --git a/src/test/ui/feature-gates/feature-gate-inline_const_pat.stderr b/src/test/ui/feature-gates/feature-gate-inline_const_pat.stderr
new file mode 100644 (file)
index 0000000..ca533d8
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0658]: inline-const in pattern position is experimental
+  --> $DIR/feature-gate-inline_const_pat.rs:2:9
+   |
+LL |     let const { () } = ();
+   |         ^^^^^
+   |
+   = note: see issue #76001 <https://github.com/rust-lang/rust/issues/76001> for more information
+   = help: add `#![feature(inline_const_pat)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
index 44abe160f87168d499d3361b9f89e2355cc249e1..1fe133ac2bc98d04d8a97e8cedd18538c1efcbd4 100644 (file)
@@ -134,4 +134,27 @@ mod inner { #![start] }
     //~^ ERROR: `start` attribute can only be used on functions
 }
 
+#[repr(C)]
+//~^ ERROR: attribute should be applied to a struct, enum, or union
+mod repr {
+//~^ NOTE not a struct, enum, or union
+    mod inner { #![repr(C)] }
+    //~^ ERROR: attribute should be applied to a struct, enum, or union
+    //~| NOTE not a struct, enum, or union
+
+    #[repr(C)] fn f() { }
+    //~^ ERROR: attribute should be applied to a struct, enum, or union
+    //~| NOTE not a struct, enum, or union
+
+    struct S;
+
+    #[repr(C)] type T = S;
+    //~^ ERROR: attribute should be applied to a struct, enum, or union
+    //~| NOTE not a struct, enum, or union
+
+    #[repr(C)] impl S { }
+    //~^ ERROR: attribute should be applied to a struct, enum, or union
+    //~| NOTE not a struct, enum, or union
+}
+
 fn main() {}
index aed1312155db57d597fbdc6bc667db6f9645a57e..9e2e2d4137d258ca3aa4c20044f66164b342f0da 100644 (file)
@@ -91,6 +91,21 @@ LL | |     }
 LL | | }
    | |_- not a free function, impl method or static
 
+error[E0517]: attribute should be applied to a struct, enum, or union
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:137:8
+   |
+LL |   #[repr(C)]
+   |          ^
+LL |
+LL | / mod repr {
+LL | |
+LL | |     mod inner { #![repr(C)] }
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_- not a struct, enum, or union
+
 error: attribute should be applied to an `extern crate` item
   --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:25:1
    |
@@ -235,7 +250,31 @@ error: attribute should be applied to a free function, impl method or static
 LL |         #[export_name = "2200"] fn bar() {}
    |         ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static
 
-error: aborting due to 34 previous errors
+error[E0517]: attribute should be applied to a struct, enum, or union
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:141:25
+   |
+LL |     mod inner { #![repr(C)] }
+   |     --------------------^---- not a struct, enum, or union
+
+error[E0517]: attribute should be applied to a struct, enum, or union
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:145:12
+   |
+LL |     #[repr(C)] fn f() { }
+   |            ^   ---------- not a struct, enum, or union
+
+error[E0517]: attribute should be applied to a struct, enum, or union
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:12
+   |
+LL |     #[repr(C)] type T = S;
+   |            ^   ----------- not a struct, enum, or union
+
+error[E0517]: attribute should be applied to a struct, enum, or union
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:155:12
+   |
+LL |     #[repr(C)] impl S { }
+   |            ^   ---------- not a struct, enum, or union
+
+error: aborting due to 39 previous errors
 
-Some errors have detailed explanations: E0518, E0658.
-For more information about an error, try `rustc --explain E0518`.
+Some errors have detailed explanations: E0517, E0518, E0658.
+For more information about an error, try `rustc --explain E0517`.
index 97fa775967da4675f3c74e200caa6a6546658dd6..1ddf8508cc8ccf9e42649de3cc076d8715d05ba6 100644 (file)
@@ -245,19 +245,6 @@ mod inner { #![bench] }
     impl S { }
 }
 
-#[repr()]
-mod repr {
-    mod inner { #![repr()] }
-
-    #[repr()] fn f() { }
-
-    struct S;
-
-    #[repr()] type T = S;
-
-    #[repr()] impl S { }
-}
-
 #[path = "3800"]
 mod path {
     mod inner { #![path="3800"] }
index 214584f47e9baeeaf883c12e51dcb19a20964968..b98374bfa80ccc4de89cad9b00452b583b3f00c5 100644 (file)
@@ -173,7 +173,7 @@ LL |     #[deny(x5100)] impl S { }
    |            ^^^^^
 
 warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:412:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:399:17
    |
 LL |     mod inner { #![macro_escape] }
    |                 ^^^^^^^^^^^^^^^^
@@ -181,7 +181,7 @@ LL |     mod inner { #![macro_escape] }
    = help: try an outer attribute: `#[macro_use]`
 
 warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:396:1
    |
 LL | #[macro_escape]
    | ^^^^^^^^^^^^^^^
@@ -213,13 +213,13 @@ LL | #![warn(unused_attributes, unknown_lints)]
    |         ^^^^^^^^^^^^^^^^^
 
 warning: `#[automatically_derived]` only has an effect on items
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:278:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:265:1
    |
 LL | #[automatically_derived]
    | ^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:296:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:283:1
    |
 LL |   #[no_mangle]
    |   ^^^^^^^^^^^^
@@ -236,31 +236,31 @@ LL | | }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[should_panic]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:336:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:323:1
    |
 LL | #[should_panic]
    | ^^^^^^^^^^^^^^^
 
 warning: `#[ignore]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:354:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:1
    |
 LL | #[ignore]
    | ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:1
    |
 LL | #[reexport_test_harness_main = "2900"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:1
    |
 LL | #[no_std]
    | ^^^^^^^^^
 
 warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:465:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:1
    |
 LL |   #[cold]
    |   ^^^^^^^
@@ -277,7 +277,7 @@ LL | | }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:481:1
    |
 LL |   #[link_name = "1900"]
    |   ^^^^^^^^^^^^^^^^^^^^^
@@ -294,7 +294,7 @@ LL | | }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:533:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:520:1
    |
 LL |   #[link_section = "1800"]
    |   ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -311,37 +311,37 @@ LL | | }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:624:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:611:1
    |
 LL | #[crate_name = "0900"]
    | ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:630:1
    |
 LL | #[crate_type = "0800"]
    | ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:662:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:1
    |
 LL | #[feature(x0600)]
    | ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:669:1
    |
 LL | #[no_main]
    | ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:714:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:1
    |
 LL | #[recursion_limit="0200"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:733:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:1
    |
 LL | #[type_length_limit="0100"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -443,55 +443,55 @@ LL |     #[macro_export] impl S { }
    |     ^^^^^^^^^^^^^^^
 
 warning: `#[path]` only has an effect on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:265:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:252:5
    |
 LL |     #[path = "3800"] fn f() { }
    |     ^^^^^^^^^^^^^^^^
 
 warning: `#[path]` only has an effect on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:268:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:255:5
    |
 LL |     #[path = "3800"]  struct S;
    |     ^^^^^^^^^^^^^^^^
 
 warning: `#[path]` only has an effect on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:258:5
    |
 LL |     #[path = "3800"] type T = S;
    |     ^^^^^^^^^^^^^^^^
 
 warning: `#[path]` only has an effect on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:261:5
    |
 LL |     #[path = "3800"] impl S { }
    |     ^^^^^^^^^^^^^^^^
 
 warning: `#[automatically_derived]` only has an effect on items
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:281:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:268:17
    |
 LL |     mod inner { #![automatically_derived] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[automatically_derived]` only has an effect on items
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:284:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5
    |
 LL |     #[automatically_derived] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[automatically_derived]` only has an effect on items
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:287:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5
    |
 LL |     #[automatically_derived] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[automatically_derived]` only has an effect on items
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:290:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:277:5
    |
 LL |     #[automatically_derived] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:301:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:288:17
    |
 LL |     mod inner { #![no_mangle] }
    |     ------------^^^^^^^^^^^^^-- not a free function, impl method or static
@@ -499,7 +499,7 @@ LL |     mod inner { #![no_mangle] }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:308:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:295:5
    |
 LL |     #[no_mangle] struct S;
    |     ^^^^^^^^^^^^ --------- not a free function, impl method or static
@@ -507,7 +507,7 @@ LL |     #[no_mangle] struct S;
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:313:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:300:5
    |
 LL |     #[no_mangle] type T = S;
    |     ^^^^^^^^^^^^ ----------- not a free function, impl method or static
@@ -515,7 +515,7 @@ LL |     #[no_mangle] type T = S;
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:318:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:305:5
    |
 LL |     #[no_mangle] impl S { }
    |     ^^^^^^^^^^^^ ---------- not a free function, impl method or static
@@ -523,7 +523,7 @@ LL |     #[no_mangle] impl S { }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:324:9
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:311:9
    |
 LL |         #[no_mangle] fn foo();
    |         ^^^^^^^^^^^^ --------- not a free function, impl method or static
@@ -531,7 +531,7 @@ LL |         #[no_mangle] fn foo();
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a free function, impl method or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:329:9
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:316:9
    |
 LL |         #[no_mangle] fn bar() {}
    |         ^^^^^^^^^^^^ ----------- not a free function, impl method or static
@@ -539,163 +539,163 @@ LL |         #[no_mangle] fn bar() {}
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: `#[should_panic]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:339:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:326:17
    |
 LL |     mod inner { #![should_panic] }
    |                 ^^^^^^^^^^^^^^^^
 
 warning: `#[should_panic]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:331:5
    |
 LL |     #[should_panic] struct S;
    |     ^^^^^^^^^^^^^^^
 
 warning: `#[should_panic]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:347:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:334:5
    |
 LL |     #[should_panic] type T = S;
    |     ^^^^^^^^^^^^^^^
 
 warning: `#[should_panic]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:350:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:337:5
    |
 LL |     #[should_panic] impl S { }
    |     ^^^^^^^^^^^^^^^
 
 warning: `#[ignore]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:357:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:17
    |
 LL |     mod inner { #![ignore] }
    |                 ^^^^^^^^^^
 
 warning: `#[ignore]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:362:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:5
    |
 LL |     #[ignore] struct S;
    |     ^^^^^^^^^
 
 warning: `#[ignore]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:365:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:352:5
    |
 LL |     #[ignore] type T = S;
    |     ^^^^^^^^^
 
 warning: `#[ignore]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:5
    |
 LL |     #[ignore] impl S { }
    |     ^^^^^^^^^
 
 warning: `#[no_implicit_prelude]` only has an effect on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:363:5
    |
 LL |     #[no_implicit_prelude] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[no_implicit_prelude]` only has an effect on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:366:5
    |
 LL |     #[no_implicit_prelude] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[no_implicit_prelude]` only has an effect on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:369:5
    |
 LL |     #[no_implicit_prelude] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[no_implicit_prelude]` only has an effect on modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:385:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:372:5
    |
 LL |     #[no_implicit_prelude] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:17
    |
 LL |     mod inner { #![reexport_test_harness_main="2900"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:5
    |
 LL |     #[reexport_test_harness_main = "2900"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:385:5
    |
 LL |     #[reexport_test_harness_main = "2900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:388:5
    |
 LL |     #[reexport_test_harness_main = "2900"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:391:5
    |
 LL |     #[reexport_test_harness_main = "2900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[macro_escape]` only has an effect on `extern crate` and modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:403:5
    |
 LL |     #[macro_escape] fn f() { }
    |     ^^^^^^^^^^^^^^^
 
 warning: `#[macro_escape]` only has an effect on `extern crate` and modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:406:5
    |
 LL |     #[macro_escape] struct S;
    |     ^^^^^^^^^^^^^^^
 
 warning: `#[macro_escape]` only has an effect on `extern crate` and modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:422:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:5
    |
 LL |     #[macro_escape] type T = S;
    |     ^^^^^^^^^^^^^^^
 
 warning: `#[macro_escape]` only has an effect on `extern crate` and modules
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:425:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:412:5
    |
 LL |     #[macro_escape] impl S { }
    |     ^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:17
    |
 LL |     mod inner { #![no_std] }
    |                 ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:422:5
    |
 LL |     #[no_std] fn f() { }
    |     ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:425:5
    |
 LL |     #[no_std] struct S;
    |     ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:441:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:428:5
    |
 LL |     #[no_std] type T = S;
    |     ^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:444:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:431:5
    |
 LL |     #[no_std] impl S { }
    |     ^^^^^^^^^
 
 warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:17
    |
 LL |     mod inner { #![cold] }
    |     ------------^^^^^^^^-- not a function
@@ -703,7 +703,7 @@ LL |     mod inner { #![cold] }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:478:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:465:5
    |
 LL |     #[cold] struct S;
    |     ^^^^^^^ --------- not a function
@@ -711,7 +711,7 @@ LL |     #[cold] struct S;
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:5
    |
 LL |     #[cold] type T = S;
    |     ^^^^^^^ ----------- not a function
@@ -719,7 +719,7 @@ LL |     #[cold] type T = S;
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:475:5
    |
 LL |     #[cold] impl S { }
    |     ^^^^^^^ ---------- not a function
@@ -727,7 +727,7 @@ LL |     #[cold] impl S { }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5
    |
 LL |     #[link_name = "1900"]
    |     ^^^^^^^^^^^^^^^^^^^^^
@@ -737,13 +737,13 @@ LL |     extern "C" { }
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 help: try `#[link(name = "1900")]` instead
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5
    |
 LL |     #[link_name = "1900"]
    |     ^^^^^^^^^^^^^^^^^^^^^
 
 warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:507:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:17
    |
 LL |     mod inner { #![link_name="1900"] }
    |     ------------^^^^^^^^^^^^^^^^^^^^-- not a foreign function or static
@@ -751,7 +751,7 @@ LL |     mod inner { #![link_name="1900"] }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:499:5
    |
 LL |     #[link_name = "1900"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
@@ -759,7 +759,7 @@ LL |     #[link_name = "1900"] fn f() { }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:517:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:504:5
    |
 LL |     #[link_name = "1900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^ --------- not a foreign function or static
@@ -767,7 +767,7 @@ LL |     #[link_name = "1900"] struct S;
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:522:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:509:5
    |
 LL |     #[link_name = "1900"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^ ----------- not a foreign function or static
@@ -775,7 +775,7 @@ LL |     #[link_name = "1900"] type T = S;
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a foreign function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:514:5
    |
 LL |     #[link_name = "1900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
@@ -783,7 +783,7 @@ LL |     #[link_name = "1900"] impl S { }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:526:17
    |
 LL |     mod inner { #![link_section="1800"] }
    |     ------------^^^^^^^^^^^^^^^^^^^^^^^-- not a function or static
@@ -791,7 +791,7 @@ LL |     mod inner { #![link_section="1800"] }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:546:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:533:5
    |
 LL |     #[link_section = "1800"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ --------- not a function or static
@@ -799,7 +799,7 @@ LL |     #[link_section = "1800"] struct S;
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:551:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:538:5
    |
 LL |     #[link_section = "1800"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a function or static
@@ -807,7 +807,7 @@ LL |     #[link_section = "1800"] type T = S;
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: attribute should be applied to a function or static
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:556:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:543:5
    |
 LL |     #[link_section = "1800"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a function or static
@@ -815,181 +815,181 @@ LL |     #[link_section = "1800"] impl S { }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:627:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:614:17
    |
 LL |     mod inner { #![crate_name="0900"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:630:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:617:5
    |
 LL |     #[crate_name = "0900"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:633:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:620:5
    |
 LL |     #[crate_name = "0900"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:636:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:623:5
    |
 LL |     #[crate_name = "0900"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:626:5
    |
 LL |     #[crate_name = "0900"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:633:17
    |
 LL |     mod inner { #![crate_type="0800"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:636:5
    |
 LL |     #[crate_type = "0800"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:652:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5
    |
 LL |     #[crate_type = "0800"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:642:5
    |
 LL |     #[crate_type = "0800"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:658:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:645:5
    |
 LL |     #[crate_type = "0800"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:665:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:652:17
    |
 LL |     mod inner { #![feature(x0600)] }
    |                 ^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:5
    |
 LL |     #[feature(x0600)] fn f() { }
    |     ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:671:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:658:5
    |
 LL |     #[feature(x0600)] struct S;
    |     ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:661:5
    |
 LL |     #[feature(x0600)] type T = S;
    |     ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:677:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:5
    |
 LL |     #[feature(x0600)] impl S { }
    |     ^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:17
    |
 LL |     mod inner { #![no_main] }
    |                 ^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:5
    |
 LL |     #[no_main] fn f() { }
    |     ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:678:5
    |
 LL |     #[no_main] struct S;
    |     ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:5
    |
 LL |     #[no_main] type T = S;
    |     ^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:5
    |
 LL |     #[no_main] impl S { }
    |     ^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:717:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:704:17
    |
 LL |     mod inner { #![recursion_limit="0200"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5
    |
 LL |     #[recursion_limit="0200"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:710:5
    |
 LL |     #[recursion_limit="0200"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:713:5
    |
 LL |     #[recursion_limit="0200"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5
    |
 LL |     #[recursion_limit="0200"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be in the root module
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:17
    |
 LL |     mod inner { #![type_length_limit="0100"] }
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:739:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5
    |
 LL |     #[type_length_limit="0100"] fn f() { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:742:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:5
    |
 LL |     #[type_length_limit="0100"] struct S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5
    |
 LL |     #[type_length_limit="0100"] type T = S;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:735:5
    |
 LL |     #[type_length_limit="0100"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/float-literal-inference-restrictions.rs b/src/test/ui/float-literal-inference-restrictions.rs
deleted file mode 100644 (file)
index 34079b6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {
-    let x: f32 = 1; //~ ERROR mismatched types
-    let y: f32 = 1f64; //~ ERROR mismatched types
-}
diff --git a/src/test/ui/float-literal-inference-restrictions.stderr b/src/test/ui/float-literal-inference-restrictions.stderr
deleted file mode 100644 (file)
index 454373c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/float-literal-inference-restrictions.rs:2:18
-   |
-LL |     let x: f32 = 1;
-   |            ---   ^
-   |            |     |
-   |            |     expected `f32`, found integer
-   |            |     help: use a float literal: `1.0`
-   |            expected due to this
-
-error[E0308]: mismatched types
-  --> $DIR/float-literal-inference-restrictions.rs:3:18
-   |
-LL |     let y: f32 = 1f64;
-   |            ---   ^^^^ expected `f32`, found `f64`
-   |            |
-   |            expected due to this
-   |
-help: change the type of the numeric literal from `f64` to `f32`
-   |
-LL |     let y: f32 = 1f32;
-   |                   ~~~
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
index 0a68c24b6067cdfa2b41f6be87f541d2a1657aab..bee165437cb15152afa821ebf5f69210a9e56b43 100644 (file)
@@ -5,11 +5,6 @@ LL |     format!("{:X}", "3");
    |                     ^^^ the trait `UpperHex` is not implemented for `str`
    |
    = note: required because of the requirements on the impl of `UpperHex` for `&str`
-note: required by `std::fmt::UpperHex::fmt`
-  --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
-   |
-LL |     fn fmt(&self, f: &mut Formatter<'_>) -> Result;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
diff --git a/src/test/ui/fn/fun-call-variants.rs b/src/test/ui/fn/fun-call-variants.rs
new file mode 100644 (file)
index 0000000..5b83e26
--- /dev/null
@@ -0,0 +1,12 @@
+// run-pass
+
+fn ho<F>(f: F) -> isize where F: FnOnce(isize) -> isize { let n: isize = f(3); return n; }
+
+fn direct(x: isize) -> isize { return x + 1; }
+
+pub fn main() {
+    let a: isize = direct(3); // direct
+    let b: isize = ho(direct); // indirect unbound
+
+    assert_eq!(a, b);
+}
diff --git a/src/test/ui/for-loop-while/break-outside-loop.rs b/src/test/ui/for-loop-while/break-outside-loop.rs
new file mode 100644 (file)
index 0000000..26769b3
--- /dev/null
@@ -0,0 +1,35 @@
+struct Foo {
+    t: String
+}
+
+fn cond() -> bool { true }
+
+fn foo<F>(_: F) where F: FnOnce() {}
+
+fn main() {
+    let pth = break; //~ ERROR: `break` outside of a loop
+    if cond() { continue } //~ ERROR: `continue` outside of a loop
+
+    while cond() {
+        if cond() { break }
+        if cond() { continue }
+        foo(|| {
+            if cond() { break } //~ ERROR: `break` inside of a closure
+            if cond() { continue } //~ ERROR: `continue` inside of a closure
+        })
+    }
+
+    let rs: Foo = Foo{t: pth};
+
+    let unconstrained = break; //~ ERROR: `break` outside of a loop
+
+    // This used to ICE because `target_id` passed to `check_expr_break` would be the closure and
+    // not the `loop`, which failed in the call to `find_breakable`. (#65383)
+    'lab: loop {
+        || {
+            break 'lab;
+            //~^ ERROR use of unreachable label `'lab`
+            //~| ERROR `break` inside of a closure
+        };
+    }
+}
diff --git a/src/test/ui/for-loop-while/break-outside-loop.stderr b/src/test/ui/for-loop-while/break-outside-loop.stderr
new file mode 100644 (file)
index 0000000..287bf9a
--- /dev/null
@@ -0,0 +1,58 @@
+error[E0767]: use of unreachable label `'lab`
+  --> $DIR/break-outside-loop.rs:30:19
+   |
+LL |     'lab: loop {
+   |     ---- unreachable label defined here
+LL |         || {
+LL |             break 'lab;
+   |                   ^^^^ unreachable label `'lab`
+   |
+   = note: labels are unreachable through functions, closures, async blocks and modules
+
+error[E0268]: `break` outside of a loop
+  --> $DIR/break-outside-loop.rs:10:15
+   |
+LL |     let pth = break;
+   |               ^^^^^ cannot `break` outside of a loop
+
+error[E0268]: `continue` outside of a loop
+  --> $DIR/break-outside-loop.rs:11:17
+   |
+LL |     if cond() { continue }
+   |                 ^^^^^^^^ cannot `continue` outside of a loop
+
+error[E0267]: `break` inside of a closure
+  --> $DIR/break-outside-loop.rs:17:25
+   |
+LL |         foo(|| {
+   |             -- enclosing closure
+LL |             if cond() { break }
+   |                         ^^^^^ cannot `break` inside of a closure
+
+error[E0267]: `continue` inside of a closure
+  --> $DIR/break-outside-loop.rs:18:25
+   |
+LL |         foo(|| {
+   |             -- enclosing closure
+LL |             if cond() { break }
+LL |             if cond() { continue }
+   |                         ^^^^^^^^ cannot `continue` inside of a closure
+
+error[E0268]: `break` outside of a loop
+  --> $DIR/break-outside-loop.rs:24:25
+   |
+LL |     let unconstrained = break;
+   |                         ^^^^^ cannot `break` outside of a loop
+
+error[E0267]: `break` inside of a closure
+  --> $DIR/break-outside-loop.rs:30:13
+   |
+LL |         || {
+   |         -- enclosing closure
+LL |             break 'lab;
+   |             ^^^^^^^^^^ cannot `break` inside of a closure
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0267, E0268, E0767.
+For more information about an error, try `rustc --explain E0267`.
diff --git a/src/test/ui/for-loop-while/break-while-condition.rs b/src/test/ui/for-loop-while/break-while-condition.rs
new file mode 100644 (file)
index 0000000..6064e6a
--- /dev/null
@@ -0,0 +1,29 @@
+#![feature(never_type)]
+
+fn main() {
+    // The `if false` expressions are simply to
+    // make sure we don't avoid checking everything
+    // simply because a few expressions are unreachable.
+
+    if false {
+        let _: ! = { //~ ERROR mismatched types
+            'a: while break 'a {};
+        };
+    }
+
+    if false {
+        let _: ! = {
+            while false { //~ ERROR mismatched types
+                break
+            }
+        };
+    }
+
+    if false {
+        let _: ! = {
+            while false { //~ ERROR mismatched types
+                return
+            }
+        };
+    }
+}
diff --git a/src/test/ui/for-loop-while/break-while-condition.stderr b/src/test/ui/for-loop-while/break-while-condition.stderr
new file mode 100644 (file)
index 0000000..6960c4f
--- /dev/null
@@ -0,0 +1,37 @@
+error[E0308]: mismatched types
+  --> $DIR/break-while-condition.rs:9:20
+   |
+LL |           let _: ! = {
+   |  ____________________^
+LL | |             'a: while break 'a {};
+LL | |         };
+   | |_________^ expected `!`, found `()`
+   |
+   = note:   expected type `!`
+           found unit type `()`
+
+error[E0308]: mismatched types
+  --> $DIR/break-while-condition.rs:16:13
+   |
+LL | /             while false {
+LL | |                 break
+LL | |             }
+   | |_____________^ expected `!`, found `()`
+   |
+   = note:   expected type `!`
+           found unit type `()`
+
+error[E0308]: mismatched types
+  --> $DIR/break-while-condition.rs:24:13
+   |
+LL | /             while false {
+LL | |                 return
+LL | |             }
+   | |_____________^ expected `!`, found `()`
+   |
+   = note:   expected type `!`
+           found unit type `()`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 97a4ea53af583ce28e4b428721e5232495279c7a..86a1c1a34e93036fc5213e83faf3c3de4c1239ab 100644 (file)
@@ -6,8 +6,6 @@ fn main() {
         //~| NOTE `&str` is not an iterator
         //~| HELP the trait `Iterator` is not implemented for `&str`
         //~| NOTE required because of the requirements on the impl of `IntoIterator` for `&str`
-        //~| NOTE required by `into_iter`
-        //~| NOTE in this expansion of desugaring of `for` loop
         //~| NOTE in this expansion of desugaring of `for` loop
         //~| NOTE in this expansion of desugaring of `for` loop
         //~| NOTE in this expansion of desugaring of `for` loop
index 7eac8c9c5a8df12fabbb531da3fe5942dfc9494e..07ddc8ea78f391707e3a8b857fce0d3b0e916c1a 100644 (file)
@@ -6,11 +6,6 @@ LL |     for c in "asdf" {
    |
    = help: the trait `Iterator` is not implemented for `&str`
    = note: required because of the requirements on the impl of `IntoIterator` for `&str`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 288243325c48c412064798a85a89becb012a869c..0bdd75b3555be2f81d59822b2db16db1eb91fc0b 100644 (file)
@@ -6,11 +6,6 @@ LL |     for x in bogus {
    |
    = help: the trait `Iterator` is not implemented for `MyStruct`
    = note: required because of the requirements on the impl of `IntoIterator` for `MyStruct`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 0672014a9292928ada4105fb3ca9c24b4a04e5d9..580b135ac2d712fdff96b5cc299c226f74f48c6b 100644 (file)
@@ -1,8 +1,10 @@
 error[E0282]: type annotations needed
-  --> $DIR/for-loop-unconstrained-element-type.rs:8:14
+  --> $DIR/for-loop-unconstrained-element-type.rs:8:9
    |
 LL |     for i in Vec::new() { }
-   |              ^^^^^^^^^^ the element type for this iterator is not specified
+   |         ^    ---------- the element type for this iterator is not specified
+   |         |
+   |         cannot infer type
 
 error: aborting due to previous error
 
index b5018b47b7bf7701c665b6bda1d2034b8734ca81..03fb299b39cd2e11721ef522431735637305485c 100644 (file)
@@ -2,13 +2,14 @@ error[E0308]: mismatched types
   --> $DIR/fully-qualified-type-name1.rs:5:9
    |
 LL |     x = 5;
-   |         ^
-   |         |
-   |         expected enum `Option`, found integer
-   |         help: try using a variant of the expected enum: `Some(5)`
+   |         ^ expected enum `Option`, found integer
    |
    = note: expected enum `Option<usize>`
               found type `{integer}`
+help: try wrapping the expression in `Some`
+   |
+LL |     x = Some(5);
+   |         +++++ +
 
 error: aborting due to previous error
 
index b9574e39758167ace764a8316e229656f23d8cfa..778b13f24cf5667b82e8e1d0bcbd0aa22c362002 100644 (file)
@@ -4,13 +4,14 @@ error[E0308]: mismatched types
 LL | fn bar(x: usize) -> Option<usize> {
    |                     ------------- expected `Option<usize>` because of return type
 LL |     return x;
-   |            ^
-   |            |
-   |            expected enum `Option`, found `usize`
-   |            help: try using a variant of the expected enum: `Some(x)`
+   |            ^ expected enum `Option`, found `usize`
    |
    = note: expected enum `Option<usize>`
               found type `usize`
+help: try wrapping the expression in `Some`
+   |
+LL |     return Some(x);
+   |            +++++ +
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/fun-call-variants.rs b/src/test/ui/fun-call-variants.rs
deleted file mode 100644 (file)
index 5b83e26..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-
-fn ho<F>(f: F) -> isize where F: FnOnce(isize) -> isize { let n: isize = f(3); return n; }
-
-fn direct(x: isize) -> isize { return x + 1; }
-
-pub fn main() {
-    let a: isize = direct(3); // direct
-    let b: isize = ho(direct); // indirect unbound
-
-    assert_eq!(a, b);
-}
index dff743bc35b2dafd67d0decd1966f9ec7d8d84b1..ee1afbe5b5843cf08116f79ad319255531e7f4ac 100644 (file)
@@ -13,11 +13,6 @@ LL |     yield || for i in 0 { }
    = help: the trait `Iterator` is not implemented for `{integer}`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `{integer}`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index f47b5f81e25b2c2a5fc55d7c3f44021dc827c2e6..1c8a1f09af5a3228c4a9931a5755189a5a9e1a05 100644 (file)
@@ -59,10 +59,10 @@ LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
    |       +++++++++++++++++++
 
 error[E0277]: the trait bound `T: Copy` is not satisfied
-  --> $DIR/impl_bounds.rs:22:5
+  --> $DIR/impl_bounds.rs:22:24
    |
 LL |     fn d() where Self: Copy {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
+   |                        ^^^^ the trait `Copy` is not implemented for `T`
    |
 note: required because of the requirements on the impl of `Copy` for `Fooy<T>`
   --> $DIR/impl_bounds.rs:11:10
index d6978794e1e957304cda22c17a6f820f59cbf609..2f29cd5d9e900176a6fa820e796b44a66e6db1e1 100644 (file)
@@ -11,8 +11,9 @@ LL | | {
 ...  |
 LL | |
 LL | | }
-   | |_^ ...so that the type `T` will meet its required lifetime bounds...
+   | |_^
    |
+   = note: ...so that the type `T` will meet its required lifetime bounds...
 note: ...that is required by this bound
   --> $DIR/issue-86483.rs:7:16
    |
index 6db249221b849821494b7dad00ee512693baa4bb..8b6f7c41a7c66833de3a3a9081f97fd942d0b058 100644 (file)
@@ -12,6 +12,7 @@ fn f(&self) {}
 }
 
 impl<T: X<Y<i32> = i32>> M for T {}
+//~^ NOTE the following trait bounds were not satisfied
 
 struct S;
 //~^ NOTE method `f` not found for this
@@ -26,7 +27,6 @@ fn f(a: S) {
     a.f();
     //~^ ERROR the method `f` exists for struct `S`, but its trait bounds were not satisfied
     //~| NOTE method cannot be called on `S` due to unsatisfied trait bounds
-    //~| NOTE the following trait bounds were not satisfied:
 }
 
 fn main() {}
index 8af9fbed872e15e72da14bb01cd84696eaed08ed..3eeb9540e73513440ba56bd48ec36ee0516a7708 100644 (file)
@@ -1,5 +1,5 @@
 error[E0599]: the method `f` exists for struct `S`, but its trait bounds were not satisfied
-  --> $DIR/method-unsatified-assoc-type-predicate.rs:26:7
+  --> $DIR/method-unsatified-assoc-type-predicate.rs:27:7
    |
 LL | struct S;
    | ---------
@@ -11,9 +11,12 @@ LL | struct S;
 LL |     a.f();
    |       ^ method cannot be called on `S` due to unsatisfied trait bounds
    |
-   = note: the following trait bounds were not satisfied:
-           `<S as X>::Y<i32> = i32`
-           which is required by `S: M`
+note: the following trait bounds were not satisfied because of the requirements of the implementation of `M` for `_`:
+      `<S as X>::Y<i32> = i32`
+  --> $DIR/method-unsatified-assoc-type-predicate.rs:14:26
+   |
+LL | impl<T: X<Y<i32> = i32>> M for T {}
+   |                          ^     ^
 
 error: aborting due to previous error
 
index 4f478a69881429e37e1384c428b0c8db4d01eeb2..8f745e8104f811b3a2f4823d6ec7a60591352700 100644 (file)
@@ -2,7 +2,7 @@
 #![allow(incomplete_features)]
 #![feature(exclusive_range_pattern)]
 #![feature(half_open_range_patterns)]
-#![feature(inline_const)]
+#![feature(inline_const_pat)]
 
 fn main() {
     let mut if_lettable = vec![];
index 0afb51260591228bae8900f87cd1401ac4a3b32f..41c7e46dfc1ed2fdf6f12b830ab9d4c8f966cd0f 100644 (file)
@@ -12,7 +12,7 @@ fn main() {
             y @ (0..5 | 6) => or_two.push(y),
             //~^ exclusive range pattern syntax is experimental
             y @ 0..const { 5 + 1 } => assert_eq!(y, 5),
-            //~^ inline-const is experimental
+            //~^ inline-const in pattern position is experimental
             //~| exclusive range pattern syntax is experimental
             y @ -5.. => range_from.push(y),
             y @ ..-7 => assert_eq!(y, -8),
index 8278e7cc6cfde785b3a3994219900f1f4ff043f9..5e36996a462b283968818c4c197801aa74cffb2f 100644 (file)
@@ -7,14 +7,14 @@ LL |             y @ ..-7 => assert_eq!(y, -8),
    = note: see issue #67264 <https://github.com/rust-lang/rust/issues/67264> for more information
    = help: add `#![feature(half_open_range_patterns)]` to the crate attributes to enable
 
-error[E0658]: inline-const is experimental
+error[E0658]: inline-const in pattern position is experimental
   --> $DIR/range_pat_interactions3.rs:14:20
    |
 LL |             y @ 0..const { 5 + 1 } => assert_eq!(y, 5),
    |                    ^^^^^
    |
    = note: see issue #76001 <https://github.com/rust-lang/rust/issues/76001> for more information
-   = help: add `#![feature(inline_const)]` to the crate attributes to enable
+   = help: add `#![feature(inline_const_pat)]` to the crate attributes to enable
 
 error[E0658]: exclusive range pattern syntax is experimental
   --> $DIR/range_pat_interactions3.rs:10:17
index a769872d83a524d0147d91a4543d2649bb81c4c2..a497c6257dab65226de295274c21664eabc767e6 100644 (file)
@@ -10,13 +10,14 @@ LL | pub struct Map<S, F> {
 LL |     let filter = map.filterx(|x: &_| true);
    |                      ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>` due to unsatisfied trait bounds
    |
-   = note: the following trait bounds were not satisfied:
-           `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
-           which is required by `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
-           `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
-           which is required by `&Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
-           `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
-           which is required by `&mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
+note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`:
+      `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
+      `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
+      `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
+  --> $DIR/issue-30786.rs:106:9
+   |
+LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
+   |         ^^^^^^^^^     ^
 
 error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`, but its trait bounds were not satisfied
   --> $DIR/issue-30786.rs:141:24
@@ -30,13 +31,14 @@ LL | pub struct Filter<S, F> {
 LL |     let count = filter.countx();
    |                        ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` due to unsatisfied trait bounds
    |
-   = note: the following trait bounds were not satisfied:
-           `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
-           which is required by `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt`
-           `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
-           which is required by `&Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt`
-           `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
-           which is required by `&mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt`
+note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`:
+      `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
+      `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
+      `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
+  --> $DIR/issue-30786.rs:106:9
+   |
+LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
+   |         ^^^^^^^^^     ^
 
 error: aborting due to 2 previous errors
 
index a769872d83a524d0147d91a4543d2649bb81c4c2..a497c6257dab65226de295274c21664eabc767e6 100644 (file)
@@ -10,13 +10,14 @@ LL | pub struct Map<S, F> {
 LL |     let filter = map.filterx(|x: &_| true);
    |                      ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>` due to unsatisfied trait bounds
    |
-   = note: the following trait bounds were not satisfied:
-           `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
-           which is required by `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
-           `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
-           which is required by `&Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
-           `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
-           which is required by `&mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: StreamExt`
+note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`:
+      `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
+      `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
+      `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream`
+  --> $DIR/issue-30786.rs:106:9
+   |
+LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
+   |         ^^^^^^^^^     ^
 
 error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`, but its trait bounds were not satisfied
   --> $DIR/issue-30786.rs:141:24
@@ -30,13 +31,14 @@ LL | pub struct Filter<S, F> {
 LL |     let count = filter.countx();
    |                        ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` due to unsatisfied trait bounds
    |
-   = note: the following trait bounds were not satisfied:
-           `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
-           which is required by `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt`
-           `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
-           which is required by `&Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt`
-           `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
-           which is required by `&mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: StreamExt`
+note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`:
+      `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
+      `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
+      `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream`
+  --> $DIR/issue-30786.rs:106:9
+   |
+LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
+   |         ^^^^^^^^^     ^
 
 error: aborting due to 2 previous errors
 
index 4c5c59c22099ae2abbfec71ff4d2900719a22e9e..5db17cb1bf4ec63b8c49109a354762c5dd0d217e 100644 (file)
@@ -2,12 +2,20 @@ error[E0271]: type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb
   --> $DIR/issue-62203-hrtb-ice.rs:38:19
    |
 LL |     let v = Unit2.m(
-   |                   ^ expected struct `Unit4`, found associated type
+   |                   ^ expected associated type, found struct `Unit4`
    |
-   = note:       expected struct `Unit4`
-           found associated type `<_ as Ty<'_>>::V`
-   = help: consider constraining the associated type `<_ as Ty<'_>>::V` to `Unit4`
+   = note: expected associated type `<_ as Ty<'_>>::V`
+                       found struct `Unit4`
+   = help: consider constraining the associated type `<_ as Ty<'_>>::V` to `Unit4` or calling a method that returns `<_ as Ty<'_>>::V`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
+note: required by a bound in `T1::m`
+  --> $DIR/issue-62203-hrtb-ice.rs:27:51
+   |
+LL |     fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1
+   |        - required by a bound in this
+LL |     where
+LL |         F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
+   |                                                   ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
 
 error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39] as FnOnce<((&'r u8,),)>>::Output == Unit3`
   --> $DIR/issue-62203-hrtb-ice.rs:40:9
@@ -19,13 +27,21 @@ LL | /         L {
 LL | |
 LL | |             f : |x| { drop(x); Unit4 }
 LL | |         });
-   | |_________^ expected struct `Unit4`, found struct `Unit3`
+   | |_________^ expected struct `Unit3`, found struct `Unit4`
    |
 note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]>`
   --> $DIR/issue-62203-hrtb-ice.rs:17:16
    |
 LL | impl<'a, A, T> T0<'a, A> for L<T>
    |                ^^^^^^^^^     ^^^^
+note: required by a bound in `T1::m`
+  --> $DIR/issue-62203-hrtb-ice.rs:27:12
+   |
+LL |     fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1
+   |        - required by a bound in this
+LL |     where
+LL |         F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/hygiene/thread-local-not-in-prelude.rs b/src/test/ui/hygiene/thread-local-not-in-prelude.rs
new file mode 100644 (file)
index 0000000..e5ed09c
--- /dev/null
@@ -0,0 +1,9 @@
+// run-pass
+#![no_std]
+
+extern crate std;
+
+std::thread_local!(static A: usize = 30);
+
+fn main() {
+}
diff --git a/src/test/ui/ignore-all-the-things.rs b/src/test/ui/ignore-all-the-things.rs
deleted file mode 100644 (file)
index 5980e1a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// run-pass
-
-#![allow(non_shorthand_field_patterns)]
-#![allow(dead_code)]
-#![allow(unused_variables)]
-
-struct Foo(isize, isize, isize, isize);
-struct Bar{a: isize, b: isize, c: isize, d: isize}
-
-pub fn main() {
-    let Foo(..) = Foo(5, 5, 5, 5);
-    let Foo(..) = Foo(5, 5, 5, 5);
-    let Bar{..} = Bar{a: 5, b: 5, c: 5, d: 5};
-    let (..) = (5, 5, 5, 5);
-    let Foo(a, b, ..) = Foo(5, 5, 5, 5);
-    let Foo(.., d) = Foo(5, 5, 5, 5);
-    let (a, b, ..) = (5, 5, 5, 5);
-    let (.., c, d) = (5, 5, 5, 5);
-    let Bar{b: b, ..} = Bar{a: 5, b: 5, c: 5, d: 5};
-    match [5, 5, 5, 5] {
-        [..] => { }
-    }
-    match [5, 5, 5, 5] {
-        [a, ..] => { }
-    }
-    match [5, 5, 5, 5] {
-        [.., b] => { }
-    }
-    match [5, 5, 5, 5] {
-        [a, .., b] => { }
-    }
-    match [5, 5, 5] {
-        [..] => { }
-    }
-    match [5, 5, 5] {
-        [a, ..] => { }
-    }
-    match [5, 5, 5] {
-        [.., a] => { }
-    }
-    match [5, 5, 5] {
-        [a, .., b] => { }
-    }
-}
diff --git a/src/test/ui/immut-function-arguments.rs b/src/test/ui/immut-function-arguments.rs
deleted file mode 100644 (file)
index 242a33e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-fn f(y: Box<isize>) {
-    *y = 5; //~ ERROR cannot assign
-}
-
-fn g() {
-    let _frob = |q: Box<isize>| { *q = 2; }; //~ ERROR cannot assign
-}
-
-fn main() {}
diff --git a/src/test/ui/immut-function-arguments.stderr b/src/test/ui/immut-function-arguments.stderr
deleted file mode 100644 (file)
index 7238dd1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable
-  --> $DIR/immut-function-arguments.rs:2:5
-   |
-LL | fn f(y: Box<isize>) {
-   |      - help: consider changing this to be mutable: `mut y`
-LL |     *y = 5;
-   |     ^^^^^^ cannot assign
-
-error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable
-  --> $DIR/immut-function-arguments.rs:6:35
-   |
-LL |     let _frob = |q: Box<isize>| { *q = 2; };
-   |                  -                ^^^^^^ cannot assign
-   |                  |
-   |                  help: consider changing this to be mutable: `mut q`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/impl-privacy-xc-2.rs b/src/test/ui/impl-privacy-xc-2.rs
deleted file mode 100644 (file)
index 3907645..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-pass
-// aux-build:impl_privacy_xc_2.rs
-
-extern crate impl_privacy_xc_2;
-
-pub fn main() {
-    let fish1 = impl_privacy_xc_2::Fish { x: 1 };
-    let fish2 = impl_privacy_xc_2::Fish { x: 2 };
-    if fish1.eq(&fish2) { println!("yes") } else { println!("no") };
-}
index e772445a56c9a7af48eccd643b4bfd99f7be4c65..2d1142fd0c52cff2e0c8db7b6adf44d6a8f0458c 100644 (file)
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/issue-55872-1.rs:12:5
+  --> $DIR/issue-55872-1.rs:12:15
    |
 LL |     fn foo<T>() -> Self::E;
    |     ----------------------- definition of `foo` from trait
 ...
 LL |     fn foo<T: Default>() -> Self::E {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Default`
+   |               ^^^^^^^ impl has extra requirement `T: Default`
 
 error[E0277]: the trait bound `S: Copy` is not satisfied in `(S, T)`
   --> $DIR/issue-55872-1.rs:12:29
index 5e432e76496041bc2f475aba5dcdfa6c49b2e616..86bde9a0cddab967e843d72c87f133d05165caef 100644 (file)
@@ -14,8 +14,8 @@ LL |         let f: F = async { 1 };
 LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
    |                                           ------------------------------- the found opaque type
    |
-   = note: expected opaque type `impl Future` (opaque type at <$DIR/issue-78722.rs:5:10>)
-              found opaque type `impl Future` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>)
+   = note: expected opaque type `impl Future<Output = u8>`
+              found opaque type `impl Future`
    = note: distinct uses of `impl Trait` result in different opaque types
 
 error: aborting due to previous error
diff --git a/src/test/ui/imports/absolute-paths-in-nested-use-groups.rs b/src/test/ui/imports/absolute-paths-in-nested-use-groups.rs
new file mode 100644 (file)
index 0000000..96b5131
--- /dev/null
@@ -0,0 +1,11 @@
+#![allow(unused_imports)]
+
+mod foo {}
+
+use foo::{
+    ::bar,       //~ ERROR crate root in paths can only be used in start position
+    super::bar,  //~ ERROR `super` in paths can only be used in start position
+    self::bar,   //~ ERROR `self` in paths can only be used in start position
+};
+
+fn main() {}
diff --git a/src/test/ui/imports/absolute-paths-in-nested-use-groups.stderr b/src/test/ui/imports/absolute-paths-in-nested-use-groups.stderr
new file mode 100644 (file)
index 0000000..e41590a
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0433]: failed to resolve: crate root in paths can only be used in start position
+  --> $DIR/absolute-paths-in-nested-use-groups.rs:6:5
+   |
+LL |     ::bar,
+   |     ^ crate root in paths can only be used in start position
+
+error[E0433]: failed to resolve: `super` in paths can only be used in start position
+  --> $DIR/absolute-paths-in-nested-use-groups.rs:7:5
+   |
+LL |     super::bar,
+   |     ^^^^^ `super` in paths can only be used in start position
+
+error[E0433]: failed to resolve: `self` in paths can only be used in start position
+  --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5
+   |
+LL |     self::bar,
+   |     ^^^^ `self` in paths can only be used in start position
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/imports/reexport-star.rs b/src/test/ui/imports/reexport-star.rs
new file mode 100644 (file)
index 0000000..639ab1a
--- /dev/null
@@ -0,0 +1,16 @@
+// run-pass
+// pretty-expanded FIXME #23616
+
+mod a {
+    pub fn f() {}
+    pub fn g() {}
+}
+
+mod b {
+    pub use a::*;
+}
+
+pub fn main() {
+    b::f();
+    b::g();
+}
index 91fc398f7418396ea23c9f65f07cb039cba696d5..04bc0b1a8ac4a1b11033eb3b00cf3c4474f935b8 100644 (file)
@@ -1,4 +1,5 @@
 #![feature(staged_api)]
+#![feature(arbitrary_self_types)]
 
 #![stable(feature = "ipu_iterator", since = "1.0.0")]
 
@@ -8,6 +9,22 @@ pub trait IpuIterator {
     fn ipu_flatten(&self) -> u32 {
         0
     }
+
+    #[unstable(feature = "ipu_flatten", issue = "99999")]
+    fn ipu_by_value_vs_by_ref(self) -> u32 where Self: Sized {
+        0
+    }
+
+    #[unstable(feature = "ipu_flatten", issue = "99999")]
+    fn ipu_by_ref_vs_by_ref_mut(&self) -> u32 {
+        0
+    }
+
+    #[unstable(feature = "ipu_flatten", issue = "99999")]
+    fn ipu_by_mut_ptr_vs_by_const_ptr(self: *mut Self) -> u32 {
+        0
+    }
+
     #[unstable(feature = "assoc_const_ipu_iter", issue = "99999")]
     const C: i32;
 }
index e00adda5c33820bbafd817097bc95c9610ad6343..fa1efbcfefc5d926b55381e2bb28b3a557a9ce2f 100644 (file)
@@ -1,8 +1,22 @@
+#![feature(arbitrary_self_types)]
+
 pub trait IpuItertools {
     fn ipu_flatten(&self) -> u32 {
         1
     }
 
+    fn ipu_by_value_vs_by_ref(&self) -> u32 {
+        1
+    }
+
+    fn ipu_by_ref_vs_by_ref_mut(&mut self) -> u32 {
+        1
+    }
+
+    fn ipu_by_mut_ptr_vs_by_const_ptr(self: *const Self) -> u32 {
+        1
+    }
+
     const C: i32;
 }
 
index 86bb62b8a5f64ad3b449b02349763bb2303bfb80..daf0cf042c40234b40fbe83f84c40ff22ff55d4b 100644 (file)
 fn main() {
     assert_eq!('x'.ipu_flatten(), 1);
 //~^ WARN an associated function with this name may be added to the standard library in the future
+//~| WARN once this associated item is added to the standard library, the ambiguity may cause an
+    assert_eq!('x'.ipu_by_value_vs_by_ref(), 1);
+//~^ WARN an associated function with this name may be added to the standard library in the future
+//~| WARN once this associated item is added to the standard library, the ambiguity may cause an
+    assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1);
+//~^ WARN an associated function with this name may be added to the standard library in the future
+//~| WARN once this associated item is added to the standard library, the ambiguity may cause an
+    assert_eq!((&mut 'x' as *mut char).ipu_by_mut_ptr_vs_by_const_ptr(), 1);
+//~^ WARN an associated function with this name may be added to the standard library in the future
 //~| WARN once this associated item is added to the standard library, the ambiguity may cause an
     assert_eq!(char::C, 1);
 //~^ WARN an associated constant with this name may be added to the standard library in the future
index 2c282e610b29c6d426e5ca5644521aa47ec97cbb..df7a09686bf8501d8500c6a2bd6e0ac6d03bc308 100644 (file)
@@ -10,8 +10,41 @@ LL |     assert_eq!('x'.ipu_flatten(), 1);
    = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_flatten(...)` to keep using the current method
    = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten`
 
+warning: an associated function with this name may be added to the standard library in the future
+  --> $DIR/inference_unstable.rs:19:20
+   |
+LL |     assert_eq!('x'.ipu_by_value_vs_by_ref(), 1);
+   |                    ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
+   = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
+   = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_value_vs_by_ref(...)` to keep using the current method
+   = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_value_vs_by_ref`
+
+warning: an associated function with this name may be added to the standard library in the future
+  --> $DIR/inference_unstable.rs:22:20
+   |
+LL |     assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1);
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
+   = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
+   = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_ref_vs_by_ref_mut(...)` to keep using the current method
+   = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_ref_vs_by_ref_mut`
+
+warning: an associated function with this name may be added to the standard library in the future
+  --> $DIR/inference_unstable.rs:25:40
+   |
+LL |     assert_eq!((&mut 'x' as *mut char).ipu_by_mut_ptr_vs_by_const_ptr(), 1);
+   |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
+   = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
+   = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_mut_ptr_vs_by_const_ptr(...)` to keep using the current method
+   = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_mut_ptr_vs_by_const_ptr`
+
 warning: an associated constant with this name may be added to the standard library in the future
-  --> $DIR/inference_unstable.rs:19:16
+  --> $DIR/inference_unstable.rs:28:16
    |
 LL |     assert_eq!(char::C, 1);
    |                ^^^^^^^ help: use the fully qualified path to the associated const: `<char as IpuItertools>::C`
@@ -20,5 +53,5 @@ LL |     assert_eq!(char::C, 1);
    = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
    = help: add `#![feature(assoc_const_ipu_iter)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::C`
 
-warning: 2 warnings emitted
+warning: 5 warnings emitted
 
index 739847c5cd5405e79143c0d8af9a20347ed22857..0369196c9108eda7de5377a4d9d4563762ada94c 100644 (file)
@@ -10,6 +10,15 @@ LL |         .get(&"key".into())
            - impl Borrow<str> for String;
            - impl<T> Borrow<T> for T
              where T: ?Sized;
+note: required by a bound in `HashMap::<K, V, S>::get`
+  --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
+   |
+LL |         K: Borrow<Q>,
+   |            ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get`
+help: consider specifying the type argument in the function call
+   |
+LL |         .get::<Q>(&"key".into())
+   |             +++++
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/inference/newlambdas-ret-infer.rs b/src/test/ui/inference/newlambdas-ret-infer.rs
new file mode 100644 (file)
index 0000000..9b62983
--- /dev/null
@@ -0,0 +1,12 @@
+// run-pass
+
+#![allow(dead_code)]
+// Test that the lambda kind is inferred correctly as a return
+// expression
+
+// pretty-expanded FIXME #23616
+
+fn unique() -> Box<dyn FnMut()+'static> { return Box::new(|| ()); }
+
+pub fn main() {
+}
diff --git a/src/test/ui/inference/newlambdas-ret-infer2.rs b/src/test/ui/inference/newlambdas-ret-infer2.rs
new file mode 100644 (file)
index 0000000..abe31a0
--- /dev/null
@@ -0,0 +1,12 @@
+// run-pass
+
+#![allow(dead_code)]
+// Test that the lambda kind is inferred correctly as a return
+// expression
+
+// pretty-expanded FIXME #23616
+
+fn unique() -> Box<dyn FnMut()+'static> { Box::new(|| ()) }
+
+pub fn main() {
+}
diff --git a/src/test/ui/inference/range-type-infer.rs b/src/test/ui/inference/range-type-infer.rs
new file mode 100644 (file)
index 0000000..f07c041
--- /dev/null
@@ -0,0 +1,22 @@
+// run-pass
+
+#![allow(unused_must_use)]
+// Make sure the type inference for the new range expression work as
+// good as the old one. Check out issue #21672, #21595 and #21649 for
+// more details.
+
+
+fn main() {
+    let xs = (0..8).map(|i| i == 1u64).collect::<Vec<_>>();
+    assert_eq!(xs[1], true);
+    let xs = (0..8).map(|i| 1u64 == i).collect::<Vec<_>>();
+    assert_eq!(xs[1], true);
+    let xs: Vec<u8> = (0..10).collect();
+    assert_eq!(xs.len(), 10);
+
+    for x in 0..10 { x % 2; }
+    for x in 0..100 { x as f32; }
+
+    let array = [true, false];
+    for i in 0..1 { array[i]; }
+}
diff --git a/src/test/ui/inference/tutorial-suffix-inference-test.rs b/src/test/ui/inference/tutorial-suffix-inference-test.rs
new file mode 100644 (file)
index 0000000..849adfd
--- /dev/null
@@ -0,0 +1,24 @@
+fn main() {
+    let x = 3;
+    let y: i32 = 3;
+
+    fn identity_u8(n: u8) -> u8 { n }
+    fn identity_u16(n: u16) -> u16 { n }
+
+    identity_u8(x);  // after this, `x` is assumed to have type `u8`
+    identity_u16(x);
+    //~^ ERROR mismatched types
+    //~| expected `u16`, found `u8`
+    identity_u16(y);
+    //~^ ERROR mismatched types
+    //~| expected `u16`, found `i32`
+
+    let a = 3;
+
+    fn identity_i(n: isize) -> isize { n }
+
+    identity_i(a); // ok
+    identity_u16(a);
+    //~^ ERROR mismatched types
+    //~| expected `u16`, found `isize`
+}
diff --git a/src/test/ui/inference/tutorial-suffix-inference-test.stderr b/src/test/ui/inference/tutorial-suffix-inference-test.stderr
new file mode 100644 (file)
index 0000000..fbfbffb
--- /dev/null
@@ -0,0 +1,36 @@
+error[E0308]: mismatched types
+  --> $DIR/tutorial-suffix-inference-test.rs:9:18
+   |
+LL |     identity_u16(x);
+   |                  ^ expected `u16`, found `u8`
+   |
+help: you can convert a `u8` to a `u16`
+   |
+LL |     identity_u16(x.into());
+   |                   +++++++
+
+error[E0308]: mismatched types
+  --> $DIR/tutorial-suffix-inference-test.rs:12:18
+   |
+LL |     identity_u16(y);
+   |                  ^ expected `u16`, found `i32`
+   |
+help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
+   |
+LL |     identity_u16(y.try_into().unwrap());
+   |                   ++++++++++++++++++++
+
+error[E0308]: mismatched types
+  --> $DIR/tutorial-suffix-inference-test.rs:21:18
+   |
+LL |     identity_u16(a);
+   |                  ^ expected `u16`, found `isize`
+   |
+help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit
+   |
+LL |     identity_u16(a.try_into().unwrap());
+   |                   ++++++++++++++++++++
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/inference/type-infer-generalize-ty-var.rs b/src/test/ui/inference/type-infer-generalize-ty-var.rs
new file mode 100644 (file)
index 0000000..a3d6916
--- /dev/null
@@ -0,0 +1,56 @@
+// run-pass
+
+#![allow(non_upper_case_globals)]
+#![allow(dead_code)]
+#![allow(unused_assignments)]
+#![allow(unused_variables)]
+// Test a scenario where we generate a constraint like `?1 <: &?2`.
+// In such a case, it is important that we instantiate `?1` with `&?3`
+// where `?3 <: ?2`, and not with `&?2`. This is a regression test for
+// #18653. The important thing is that we build.
+
+use std::cell::RefCell;
+
+enum Wrap<A> {
+    WrapSome(A),
+    WrapNone
+}
+
+use Wrap::*;
+
+struct T;
+struct U;
+
+trait Get<T: ?Sized> {
+    fn get(&self) -> &T;
+}
+
+impl Get<dyn MyShow + 'static> for Wrap<T> {
+    fn get(&self) -> &(dyn MyShow + 'static) {
+        static x: usize = 42;
+        &x
+    }
+}
+
+impl Get<usize> for Wrap<U> {
+    fn get(&self) -> &usize {
+        static x: usize = 55;
+        &x
+    }
+}
+
+trait MyShow { fn dummy(&self) { } }
+impl<'a> MyShow for &'a (dyn MyShow + 'a) { }
+impl MyShow for usize { }
+fn constrain<'a>(rc: RefCell<&'a (dyn MyShow + 'a)>) { }
+
+fn main() {
+    let mut collection: Wrap<_> = WrapNone;
+
+    {
+        let __arg0 = Get::get(&collection);
+        let __args_cell = RefCell::new(__arg0);
+        constrain(__args_cell);
+    }
+    collection = WrapSome(T);
+}
diff --git a/src/test/ui/init-large-type.rs b/src/test/ui/init-large-type.rs
deleted file mode 100644 (file)
index ce90557..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// compile-flags: -O
-// run-pass
-
-#![allow(unused_must_use)]
-// Makes sure that zero-initializing large types is reasonably fast,
-// Doing it incorrectly causes massive slowdown in LLVM during
-// optimisation.
-
-// pretty-expanded FIXME #23616
-// ignore-emscripten no threads support
-
-#![feature(intrinsics)]
-
-use std::{mem, thread};
-
-const SIZE: usize = 1024 * 1024;
-
-fn main() {
-    // do the test in a new thread to avoid (spurious?) stack overflows
-    thread::spawn(|| {
-        let _memory: [u8; SIZE] = unsafe { mem::zeroed() };
-    }).join();
-}
index 8bb5dab1fa00d27a2cea3f7e415f505bca1a1dcf..8a92cdbc0f9811975808fa07199033501016a27c 100644 (file)
@@ -1,6 +1,5 @@
 // build-pass
 
-#![allow(incomplete_features)]
 #![feature(inline_const)]
 
 use std::cell::Cell;
index 9254c96a1e7a60ac6d75629f9579ae348d42b2fd..dac46fe25ecfc84e266480dc2c96fd922915b6b7 100644 (file)
@@ -1,7 +1,7 @@
 // run-pass
 
-#![allow(incomplete_features)]
 #![feature(inline_const)]
+
 fn foo() -> i32 {
     const {
         let x = 5 + 10;
index 6aa2a2f3367fcf59bfda7d1c368b15b357205652..0d5892a74d9565dc4d09bfcdf37797b64897d6a3 100644 (file)
@@ -1,7 +1,6 @@
 // check-pass
 
 #![feature(inline_const)]
-#![allow(incomplete_features)]
 
 pub fn todo<T>() -> T {
     const { todo!() }
index e56cbc94038a01c3fe8774f65e4a2186c23dd34c..0a032a7338ad065e24e4ea113f01de4e9fc5f338 100644 (file)
@@ -1,4 +1,3 @@
-#![allow(incomplete_features)]
 #![feature(const_mut_refs)]
 #![feature(inline_const)]
 
index 30ecd338a856d7c93cc9acf2fc5420b8039b24b4..a23f7c9a796c53b1a74726d14c1efccdcadb12f0 100644 (file)
@@ -1,5 +1,5 @@
 error[E0597]: `y` does not live long enough
-  --> $DIR/const-expr-lifetime-err.rs:24:30
+  --> $DIR/const-expr-lifetime-err.rs:23:30
    |
 LL | fn foo<'a>() {
    |        -- lifetime `'a` defined here
index f622f2cbddf482b5c33b561eff4298e748ca5eeb..d883deb2845d35993011adb50cf085359ba93c47 100644 (file)
@@ -1,6 +1,5 @@
 // run-pass
 
-#![allow(incomplete_features)]
 #![feature(const_mut_refs)]
 #![feature(inline_const)]
 
index 66b58571751ceb6b5660092d84aa167e2e4c9857..041f3e15a29b9822564052c20305a84cd656fcf8 100644 (file)
@@ -1,7 +1,7 @@
 // run-pass
 
-#![allow(incomplete_features)]
 #![feature(inline_const)]
+
 macro_rules! do_const_block{
     ($val:block) => { const $val }
 }
index 747f14e4bd0aa4cf7503d41875a84322b551d6dd..a54d879f69d748134340cda1d6506f2072ed6848 100644 (file)
@@ -1,6 +1,5 @@
 // run-pass
 
-#![allow(incomplete_features)]
 #![feature(inline_const)]
 
 const fn bar() -> i32 {
index 61680d653d021b2846a62932fde9826f1b46c8a7..4486411698af964d0adae9b8ba5e3b098f56d841 100644 (file)
@@ -1,5 +1,5 @@
 #![allow(incomplete_features)]
-#![feature(inline_const)]
+#![feature(inline_const_pat)]
 
 // rust-lang/rust#82518: ICE with inline-const in match referencing const-generic parameter
 
index 61188ed5d47bdb348b01ed8d4a252205f3815e08..d83ae6e983486fe3bd21018fc8f2679f4999faeb 100644 (file)
@@ -1,6 +1,6 @@
 // check-pass
 
-#![feature(inline_const)]
+#![feature(inline_const_pat)]
 #![allow(incomplete_features)]
 
 fn main() {
index bc5aa24894427ea83ca19c0d3c30d8e5660e1c2b..436b8037f3093a586de0d1d8ea0ff5f034a4c29b 100644 (file)
@@ -2,7 +2,7 @@
 
 #![allow(incomplete_features)]
 #![feature(const_mut_refs)]
-#![feature(inline_const)]
+#![feature(inline_const_pat)]
 
 use std::marker::PhantomData;
 
index 3d986f0d9ee08161957a9da31a27ac52288a41ca..6d943bbcc0160f2ce184413ae0158b9353d68413 100644 (file)
@@ -3,6 +3,7 @@
 #![allow(incomplete_features)]
 #![feature(const_mut_refs)]
 #![feature(inline_const)]
+#![feature(inline_const_pat)]
 
 use std::marker::PhantomData;
 
index eefe43a1a2297fa04b38b93ec7bfc4b671cd143b..7dc8c11355ab035990bd63a1cba36920dc74f774 100644 (file)
@@ -1,7 +1,7 @@
 // build-pass
 
 #![allow(incomplete_features)]
-#![feature(inline_const, half_open_range_patterns, exclusive_range_pattern)]
+#![feature(inline_const_pat, half_open_range_patterns, exclusive_range_pattern)]
 fn main() {
     const N: u32 = 10;
     let x: u32 = 3;
index c0dc90d971a4902eb0aca407acfa166cd9477348..2f55e16b35cd934617108ed762dd94b86bc67cd5 100644 (file)
@@ -1,7 +1,7 @@
 // run-pass
 
 #![allow(incomplete_features)]
-#![feature(inline_const)]
+#![feature(inline_const_pat)]
 const MMIO_BIT1: u8 = 4;
 const MMIO_BIT2: u8 = 5;
 
diff --git a/src/test/ui/issue-73914.rs b/src/test/ui/issue-73914.rs
deleted file mode 100644 (file)
index 1e99faa..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// build-pass
-// compile-flags:-Copt-level=0
-// edition:2018
-
-struct S<T>(std::marker::PhantomData<T>);
-
-impl<T> std::ops::Deref for S<T> {
-    type Target = T;
-
-    fn deref(&self) -> &Self::Target {
-        todo!()
-    }
-}
-impl<T> std::ops::DerefMut for S<T> {
-    fn deref_mut(&mut self) -> &mut Self::Target {
-        todo!()
-    }
-}
-
-async fn new() -> S<u64> {
-    todo!()
-}
-
-async fn crash() {
-    *new().await = 1 + 1;
-}
-
-fn main() {
-    let _ = crash();
-}
diff --git a/src/test/ui/issues/auxiliary/issue-69725.rs b/src/test/ui/issues/auxiliary/issue-69725.rs
deleted file mode 100644 (file)
index 13606e4..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#[derive(Clone)]
-pub struct Struct<A>(A);
-
-impl<A> Struct<A> {
-    pub fn new() -> Self {
-        todo!()
-    }
-}
index 6fc1055049261d7f4912cb586d7513a0151ee4a2..2adcf55eca97f9f4c5801774133db7176ea04b61 100644 (file)
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/issue-14853.rs:12:5
+  --> $DIR/issue-14853.rs:12:15
    |
 LL |     fn yay<T: Debug>(_: Option<Self>, thing: &[T]);
    |     ----------------------------------------------- definition of `yay` from trait
 ...
 LL |     fn yay<T: Str>(_:Option<X>, thing: &[T]) {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Str`
+   |               ^^^ impl has extra requirement `T: Str`
 
 error: aborting due to previous error
 
index 214477f6c60ef4881258e7fa883a53453acb06f9..efaaeeda2fab6798d18b0b99e1f2eee73d8f9597 100644 (file)
@@ -7,11 +7,11 @@ LL |     (|| Box::new(*(&[0][..])))();
    |         required by a bound introduced by this call
    |
    = help: the trait `Sized` is not implemented for `[{integer}]`
-note: required by `Box::<T>::new`
+note: required by a bound in `Box::<T>::new`
   --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
    |
-LL |     pub fn new(x: T) -> Self {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+LL | impl<T> Box<T> {
+   |      ^ required by this bound in `Box::<T>::new`
 
 error: aborting due to previous error
 
index b702196abdf94b2f5ebc0d77ac812b204a22fa92..bd18d46223e69162ae8cdd869df402f0d84b35d7 100644 (file)
@@ -3,12 +3,6 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied
    |
 LL | fn add_state(op: <isize as HasState>::State) {
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize`
-   |
-note: required by a bound in `HasState`
-  --> $DIR/issue-18611.rs:5:1
-   |
-LL | trait HasState {
-   | ^^^^^^^^^^^^^^ required by this bound in `HasState`
 
 error: aborting due to previous error
 
index ab4c9c736d8963326a99ff1a483ac0e57c7151b2..af85e5b2b02ab3a9295584aabd2dcdb0e03a5ae6 100644 (file)
@@ -16,8 +16,8 @@ fn foo<F>(&mut self, f: F)
 }
 
 impl<'a> A<'a> for B {
-    fn foo<F>(&mut self, f: F) //~ ERROR impl has stricter
-        where F: fmt::Debug + 'static,
+    fn foo<F>(&mut self, f: F)
+        where F: fmt::Debug + 'static, //~ ERROR impl has stricter
     {
         self.list.push(Box::new(f));
     }
index ac302caecc33592bf3bbfa0bc0e2578d296f3dd9..5e2ba0ef4fc5ae4547e45f0766fa3e98e33f1828 100644 (file)
@@ -1,17 +1,13 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/issue-18937.rs:19:5
+  --> $DIR/issue-18937.rs:20:31
    |
 LL | /     fn foo<F>(&mut self, f: F)
 LL | |         where F: fmt::Debug + 'a,
 LL | |               Self: Sized;
    | |__________________________- definition of `foo` from trait
 ...
-LL | /     fn foo<F>(&mut self, f: F)
-LL | |         where F: fmt::Debug + 'static,
-LL | |     {
-LL | |         self.list.push(Box::new(f));
-LL | |     }
-   | |_____^ impl has extra requirement `F: 'static`
+LL |           where F: fmt::Debug + 'static,
+   |                                 ^^^^^^^ impl has extra requirement `F: 'static`
 
 error: aborting due to previous error
 
index ef1eb2ea6c02ce72eef851d4e88b9230eb511412..6848c3f0d8a546cc01d1b50a7bc78caec63a081d 100644 (file)
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `X: Ord` is not satisfied
    |
 LL |     b.sort();
    |       ^^^^ the trait `Ord` is not implemented for `X`
+   |
+note: required by a bound in `slice::<impl [T]>::sort`
+  --> $SRC_DIR/alloc/src/slice.rs:LL:COL
+   |
+LL |         T: Ord,
+   |            ^^^ required by this bound in `slice::<impl [T]>::sort`
 
 error: aborting due to previous error
 
index c6c3f32dfe7d8f3a8a8f8fe6a578dd16acc9bb24..6330364c92b6a68e62061c3dc46c31f5ef4dfe4b 100644 (file)
@@ -1,8 +1,8 @@
-error[E0282]: type annotations needed for `&(_,)`
+error[E0282]: type annotations needed for `(_,)`
   --> $DIR/issue-20261.rs:4:11
    |
 LL |     for (ref i,) in [].iter() {
-   |                     --------- the element type for this iterator is not specified
+   |                     --------- this method call resolves to `std::slice::Iter<'_, T>`
 LL |         i.clone();
    |           ^^^^^ cannot infer type
    |
index 9135c5ac36af5919552c93c0bc54bd14910ff5bf..29352141404199317fab24d480df91af27c55fd7 100644 (file)
@@ -21,11 +21,6 @@ LL | impl<T> Foo for T where NoData<T>: Foo {
    |         ^^^     ^
    = note: 127 redundant requirements hidden
    = note: required because of the requirements on the impl of `Foo` for `NoData<T>`
-note: required by a bound in `Foo`
-  --> $DIR/issue-20413.rs:1:1
-   |
-LL | trait Foo {
-   | ^^^^^^^^^ required by this bound in `Foo`
 
 error[E0275]: overflow evaluating the requirement `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<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo`
   --> $DIR/issue-20413.rs:8:36
@@ -41,11 +36,6 @@ LL | impl<T> Foo for T where NoData<T>: Foo {
    |         ^^^     ^
    = note: 127 redundant requirements hidden
    = note: required because of the requirements on the impl of `Foo` for `NoData<T>`
-note: required by a bound in `Foo`
-  --> $DIR/issue-20413.rs:1:1
-   |
-LL | trait Foo {
-   | ^^^^^^^^^ required by this bound in `Foo`
 
 error[E0275]: overflow evaluating the requirement `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<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz`
   --> $DIR/issue-20413.rs:28:42
@@ -66,11 +56,6 @@ LL | impl<T> Baz for T where AlmostNoData<T>: Bar {
    |         ^^^     ^
    = note: 126 redundant requirements hidden
    = note: required because of the requirements on the impl of `Baz` for `EvenLessData<T>`
-note: required by a bound in `Baz`
-  --> $DIR/issue-20413.rs:20:1
-   |
-LL | trait Baz {
-   | ^^^^^^^^^ required by this bound in `Baz`
 
 error[E0275]: overflow evaluating the requirement `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<AlmostNoData<EvenLessData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz`
   --> $DIR/issue-20413.rs:28:42
@@ -91,11 +76,6 @@ LL | impl<T> Baz for T where AlmostNoData<T>: Bar {
    |         ^^^     ^
    = note: 126 redundant requirements hidden
    = note: required because of the requirements on the impl of `Baz` for `EvenLessData<T>`
-note: required by a bound in `Baz`
-  --> $DIR/issue-20413.rs:20:1
-   |
-LL | trait Baz {
-   | ^^^^^^^^^ required by this bound in `Baz`
 
 error[E0275]: overflow evaluating the requirement `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<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar`
   --> $DIR/issue-20413.rs:36:42
@@ -116,11 +96,6 @@ LL | impl<T> Bar for T where EvenLessData<T>: Baz {
    |         ^^^     ^
    = note: 126 redundant requirements hidden
    = note: required because of the requirements on the impl of `Bar` for `AlmostNoData<T>`
-note: required by a bound in `Bar`
-  --> $DIR/issue-20413.rs:16:1
-   |
-LL | trait Bar {
-   | ^^^^^^^^^ required by this bound in `Bar`
 
 error[E0275]: overflow evaluating the requirement `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<EvenLessData<AlmostNoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar`
   --> $DIR/issue-20413.rs:36:42
@@ -141,11 +116,6 @@ LL | impl<T> Bar for T where EvenLessData<T>: Baz {
    |         ^^^     ^
    = note: 126 redundant requirements hidden
    = note: required because of the requirements on the impl of `Bar` for `AlmostNoData<T>`
-note: required by a bound in `Bar`
-  --> $DIR/issue-20413.rs:16:1
-   |
-LL | trait Bar {
-   | ^^^^^^^^^ required by this bound in `Bar`
 
 error: aborting due to 7 previous errors
 
index 5a67aead75a73d44f9de286329e756c0d393b76f..41eefe3f8e9b54c605ec61a55fe3dbcbd7f6769e 100644 (file)
@@ -6,11 +6,6 @@ LL |     for item in *things { *item = 0 }
    |
    = note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
    = note: required because of the requirements on the impl of `IntoIterator` for `dyn Iterator<Item = &'a mut u8>`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider mutably borrowing here
    |
 LL |     for item in &mut *things { *item = 0 }
index 92742b50619e011746406ff19c536dac0f72f97e..300c1272ef6c0eb9d4811a7b00148ffe81ae2ae6 100644 (file)
@@ -6,11 +6,6 @@ LL | #[derive(Hash)]
 LL | struct Foo(Bar);
    |            ^^^ the trait `Hash` is not implemented for `Bar`
    |
-note: required by a bound in `std::hash::Hash::hash`
-  --> $SRC_DIR/core/src/hash/mod.rs:LL:COL
-   |
-LL |     fn hash<H: Hasher>(&self, state: &mut H);
-   |             ^ required by this bound in `std::hash::Hash::hash`
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 3b6663513bb5fa7c1a7be194fffa4817fa9acdf6..dfabde9abc97809921a2cc60647bd29086df890d 100644 (file)
@@ -5,11 +5,6 @@ LL |     where &'a T : Foo,
    |                   ^^^ cannot infer type for reference `&'a T`
    |
    = note: cannot satisfy `&'a T: Foo`
-note: required by a bound in `Foo`
-  --> $DIR/issue-21974.rs:6:1
-   |
-LL | trait Foo {
-   | ^^^^^^^^^ required by this bound in `Foo`
 
 error: aborting due to previous error
 
index 9c87ee6104a0d27e25f56b3cd47020ca8ccabee1..ae8233d5c76e6aa2011bead773b94998c719182c 100644 (file)
@@ -7,6 +7,11 @@ LL |     "".chars().fold(|_, _| (), ());
    |                required by a bound introduced by this call
    |
    = help: the trait `FnMut<(_, char)>` is not implemented for `()`
+note: required by a bound in `fold`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(B, Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `fold`
 
 error: aborting due to previous error
 
index 4896006b645da20d3a3a2fa2e46fc850398db8d0..fa59da852f9018019191a59dc7e3ac22efc0b6b0 100644 (file)
@@ -5,11 +5,6 @@ LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : T
    |                                                         ^^^^^^^^^^^ cannot infer type for type parameter `T0`
    |
    = note: cannot satisfy `T0: Trait0<'l0>`
-note: required by a bound in `Trait0`
-  --> $DIR/issue-24424.rs:2:1
-   |
-LL | trait Trait0<'l0>  {}
-   | ^^^^^^^^^^^^^^^^^ required by this bound in `Trait0`
 
 error: aborting due to previous error
 
index 6a74f4ed489a16828f1224aa340f28d24610bd0c..3beb9929244bfce2d248251636bbd5e8d299ab12 100644 (file)
@@ -7,11 +7,6 @@ LL |     let _ = Iterator::next(&mut ());
    |             required by a bound introduced by this call
    |
    = help: the trait `Iterator` is not implemented for `()`
-note: required by `std::iter::Iterator::next`
-  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-   |
-LL |     fn next(&mut self) -> Option<Self::Item>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `bool` is not an iterator
   --> $DIR/issue-28098.rs:6:14
@@ -21,11 +16,6 @@ LL |     for _ in false {}
    |
    = help: the trait `Iterator` is not implemented for `bool`
    = note: required because of the requirements on the impl of `IntoIterator` for `bool`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `()` is not an iterator
   --> $DIR/issue-28098.rs:9:28
@@ -36,11 +26,6 @@ LL |     let _ = Iterator::next(&mut ());
    |             required by a bound introduced by this call
    |
    = help: the trait `Iterator` is not implemented for `()`
-note: required by `std::iter::Iterator::next`
-  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-   |
-LL |     fn next(&mut self) -> Option<Self::Item>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `()` is not an iterator
   --> $DIR/issue-28098.rs:2:13
@@ -59,11 +44,6 @@ LL |     let _ = Iterator::next(&mut ());
    |             required by a bound introduced by this call
    |
    = help: the trait `Iterator` is not implemented for `()`
-note: required by `std::iter::Iterator::next`
-  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-   |
-LL |     fn next(&mut self) -> Option<Self::Item>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `()` is not an iterator
   --> $DIR/issue-28098.rs:22:28
@@ -74,11 +54,6 @@ LL |     let _ = Iterator::next(&mut ());
    |             required by a bound introduced by this call
    |
    = help: the trait `Iterator` is not implemented for `()`
-note: required by `std::iter::Iterator::next`
-  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-   |
-LL |     fn next(&mut self) -> Option<Self::Item>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `bool` is not an iterator
   --> $DIR/issue-28098.rs:25:14
@@ -88,11 +63,6 @@ LL |     for _ in false {}
    |
    = help: the trait `Iterator` is not implemented for `bool`
    = note: required because of the requirements on the impl of `IntoIterator` for `bool`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `()` is not an iterator
   --> $DIR/issue-28098.rs:18:13
index 3b011f58b259d798ae98367bffa3d6df956d6c46..5570e887edce5752524df39fb77818b891334b27 100644 (file)
@@ -11,11 +11,6 @@ LL | impl Foo for S5<u32> { fn xxx(&self) {} }
    | ^^^^^^^^^^^^^^^^^^^^
 LL | impl Foo for S5<u64> { fn xxx(&self) {} }
    | ^^^^^^^^^^^^^^^^^^^^
-note: required by `Foo::xxx`
-  --> $DIR/issue-29147.rs:10:13
-   |
-LL | trait Foo { fn xxx(&self); }
-   |             ^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 40475426cff7afb4003eddb426891439835e6079..48061ae54ae206ebff1f353987d860789eee296f 100644 (file)
@@ -9,8 +9,6 @@ pub fn get_tok(it: &mut IntoIter<u8>) {
     })
         .cloned()
         //~^ ERROR type mismatch resolving
-        //~| expected type `u8`
-        //~| found reference `&_`
         .collect(); //~ ERROR the method
 }
 
index 8b7871ce3118605598e8887618bdff46550d98f4..982b6118ce659bb2fe80aea8a5d4f0cfd53aa681 100644 (file)
@@ -2,13 +2,18 @@ error[E0271]: type mismatch resolving `<TakeWhile<&mut std::vec::IntoIter<u8>, [
   --> $DIR/issue-31173.rs:10:10
    |
 LL |         .cloned()
-   |          ^^^^^^ expected `u8`, found reference
+   |          ^^^^^^ expected reference, found `u8`
    |
-   = note:   expected type `u8`
-           found reference `&_`
+   = note: expected reference `&_`
+                   found type `u8`
+note: required by a bound in `cloned`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         Self: Sized + Iterator<Item = &'a T>,
+   |                                ^^^^^^^^^^^^ required by this bound in `cloned`
 
 error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>`, but its trait bounds were not satisfied
-  --> $DIR/issue-31173.rs:14:10
+  --> $DIR/issue-31173.rs:12:10
    |
 LL |         .collect();
    |          ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>` due to unsatisfied trait bounds
index bc7eb0688ee84bb68bafa8803967f1f8b974b909..b4c3f148e32b5e348f69eb422901bc0086e06529 100644 (file)
@@ -8,11 +8,6 @@ LL |     Err(5)?;
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = note: required because of the requirements on the impl of `FromResidual<Result<Infallible, {integer}>>` for `Result<i32, ()>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 4fb805b37e03f02330f2bc77637b0a231b539b80..ccaa6334856b45f55487e44c1301abdd1d7b83a9 100644 (file)
@@ -3,5 +3,4 @@
 fn main() {
     for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch
     //~^ ERROR type mismatch
-    //~| ERROR type mismatch
 }
index d588214f5077c9f3d459e943bfd09d6e9e099c27..eb98a3a29a6981ff524fde56a9dba6abae84d5b8 100644 (file)
@@ -2,26 +2,15 @@ error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _,
   --> $DIR/issue-33941.rs:4:36
    |
 LL |     for _ in HashMap::new().iter().cloned() {}
-   |                                    ^^^^^^ expected tuple, found reference
-   |
-   = note:  expected tuple `(&_, &_)`
-           found reference `&_`
-
-error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_`
-  --> $DIR/issue-33941.rs:4:14
-   |
-LL |     for _ in HashMap::new().iter().cloned() {}
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found tuple
+   |                                    ^^^^^^ expected reference, found tuple
    |
    = note: expected reference `&_`
                   found tuple `(&_, &_)`
-   = note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
-   = note: required because of the requirements on the impl of `IntoIterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+note: required by a bound in `cloned`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
    |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |         Self: Sized + Iterator<Item = &'a T>,
+   |                                ^^^^^^^^^^^^ required by this bound in `cloned`
 
 error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_`
   --> $DIR/issue-33941.rs:4:14
@@ -32,12 +21,8 @@ LL |     for _ in HashMap::new().iter().cloned() {}
    = note: expected reference `&_`
                   found tuple `(&_, &_)`
    = note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
-note: required by `std::iter::Iterator::next`
-  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-   |
-LL |     fn next(&mut self) -> Option<Self::Item>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: required because of the requirements on the impl of `IntoIterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0271`.
index fba75de8cc0523f8c746178f738a838df4ee0b11..71e02f2fd86cc2426b7ee86332938ee673e23e78 100644 (file)
@@ -7,11 +7,6 @@ LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable);
    |                     in this derive macro expansion
    |
    = help: the trait `PartialOrd` is not implemented for `Comparable`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index acb44ce2c3545a27c8ad7f87a26ce4d15a49097b..49d6709a8601737aec47b3b09c79e884a90470c3 100644 (file)
@@ -14,6 +14,11 @@ LL |     let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_rece
    |                                                                                       ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>`
    |
    = help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>`
+note: required by a bound in `collect`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |     fn collect<B: FromIterator<Self::Item>>(self) -> B
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-35677.rs b/src/test/ui/issues/issue-35677.rs
deleted file mode 100644 (file)
index 15d1397..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-use std::collections::HashSet;
-
-fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool {
-    this.is_subset(other)
-    //~^ ERROR the method
-}
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-35677.stderr b/src/test/ui/issues/issue-35677.stderr
deleted file mode 100644 (file)
index ab59e5d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0599]: the method `is_subset` exists for reference `&HashSet<T>`, but its trait bounds were not satisfied
-  --> $DIR/issue-35677.rs:4:10
-   |
-LL |     this.is_subset(other)
-   |          ^^^^^^^^^ method cannot be called on `&HashSet<T>` due to unsatisfied trait bounds
-   |
-   = note: the following trait bounds were not satisfied:
-           `T: Eq`
-           `T: Hash`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0599`.
index f609e47e818d493bfb9447be009384952c30f312..ffcac1f47057104c4e31cd06c3adc6277b0441a7 100644 (file)
@@ -9,11 +9,6 @@ note: required because of the requirements on the impl of `Visit` for `()`
    |
 LL | impl Visit for () where
    |      ^^^^^     ^^
-note: required by `Visit::visit`
-  --> $DIR/issue-39970.rs:6:5
-   |
-LL |     fn visit() {}
-   |     ^^^^^^^^^^
 
 error: aborting due to previous error
 
index 2e542644b70d4db676b8ab44bef27bf45efd0ca9..eb0c80f8f0d1ea23554ee1a2dca4c08db7a1d333 100644 (file)
@@ -7,6 +7,12 @@ LL |         None::<()>.map(Self::f);
    |                    --- ^^^^^^^ expected function that takes a single 0-tuple as argument
    |                    |
    |                    required by a bound introduced by this call
+   |
+note: required by a bound in `Option::<T>::map`
+  --> $SRC_DIR/core/src/option.rs:LL:COL
+   |
+LL |     pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> {
+   |                      ^^^^^^^^^^^^^^ required by this bound in `Option::<T>::map`
 
 error: aborting due to previous error
 
index acf7626c634e3c3100c82ee00e31d8e35701dc26..237b2b9e798593484377335a816f21af0b527eab 100644 (file)
@@ -8,6 +8,12 @@ LL |         self.foo.map(Foo::new)
    |                  --- ^^^^^^^^ expected function that takes 1 argument
    |                  |
    |                  required by a bound introduced by this call
+   |
+note: required by a bound in `Option::<T>::map`
+  --> $SRC_DIR/core/src/option.rs:LL:COL
+   |
+LL |     pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> {
+   |                      ^^^^^^^^^^^^^^ required by this bound in `Option::<T>::map`
 
 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
   --> $DIR/issue-47706.rs:27:9
index 0f61e03c3b58fb522d4d34d44407b74703719a54..15d2ef3fce8da150c21091a7338ac19c841f1c13 100644 (file)
@@ -12,10 +12,10 @@ help: try removing this `?`
 LL -     missing_discourses()?
 LL +     missing_discourses()
    | 
-help: try using a variant of the expected enum
+help: try wrapping the expression in `Ok`
    |
 LL |     Ok(missing_discourses()?)
-   |
+   |     +++                     +
 
 error: aborting due to previous error
 
index 314d1fddbd76a5ff9598bc3505d44d46e69cba3e..d1bc279c7589a6c5eb5bd2b126fb33ef84a0ef8c 100644 (file)
@@ -8,6 +8,10 @@ LL |         Either::Right(_) => {}
    |
    = note: expected struct `S`
                 found enum `Either<_, _>`
+help: you might have meant to use field `0` whose type is `Either<usize, usize>`
+   |
+LL |     match S(Either::Left(5)).0 {
+   |           ~~~~~~~~~~~~~~~~~~~~
 
 error: aborting due to previous error
 
index df76a985559d08481719a915195ff666e87acd2e..efe2ef504a2ba16fcea5c3a274b745f881dfd2f9 100644 (file)
@@ -11,11 +11,6 @@ LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
    |
    = note: cannot satisfy `_: Tt`
-note: required by a bound in `Tt::const_val`
-  --> $DIR/issue-54954.rs:5:24
-   |
-LL |     const fn const_val<T: Sized>() -> usize {
-   |                        ^ required by this bound in `Tt::const_val`
 
 error: aborting due to 2 previous errors
 
index a1715bd99e094c8bdd9373465c0dcc157a8bd0e7..0128b70e21643df4f287da95801adf708835f934 100644 (file)
@@ -15,11 +15,6 @@ LL |     fn new(slice: &[u8; Foo::SIZE]) -> Self;
    |
    = note: cannot satisfy `_: Foo`
    = note: associated constants cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl`
-note: required by `Foo::SIZE`
-  --> $DIR/issue-58022.rs:2:5
-   |
-LL |     const SIZE: usize;
-   |     ^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index 282e236d3d021d84217a3ee3195f2df31e70efc0..3356180974f88920d2c4244e03f9c3a87db00662 100644 (file)
@@ -11,12 +11,6 @@ LL |     _Func::< <() as _A>::AssocT >::func(());
    |     ----------------------------------- ^^ the trait `_Func<_>` is not implemented for `()`
    |     |
    |     required by a bound introduced by this call
-   |
-note: required by `_Func::func`
-  --> $DIR/issue-66353.rs:4:5
-   |
-LL |     fn func(_: Self);
-   |     ^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index a08531000bc64d2832a1f757a39f45b95d12a8e5..6a96709cbacdb5b5afc406f97550db2c82849af0 100644 (file)
@@ -5,6 +5,11 @@ LL |     let x2: Vec<f64> = x1.into_iter().collect();
    |                                       ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
    |
    = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
+note: required by a bound in `collect`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |     fn collect<B: FromIterator<Self::Item>>(self) -> B
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect`
 
 error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64`
   --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29
@@ -13,6 +18,11 @@ LL |     let x3 = x1.into_iter().collect::<Vec<f64>>();
    |                             ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
    |
    = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
+note: required by a bound in `collect`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |     fn collect<B: FromIterator<Self::Item>>(self) -> B
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect`
 
 error: aborting due to 2 previous errors
 
index ecf78e48e0e2af68b276a8b26cc8a8dbece5b730..b53923eec1d8868a5d4da3b0e364120811f9801f 100644 (file)
@@ -18,6 +18,14 @@ LL | impl<T> Element<()> for T {
 ...
 LL | impl<T: Element<S>, S> Element<[S; 3]> for T {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: required by a bound in `Foo::foo`
+  --> $DIR/issue-69683.rs:15:9
+   |
+LL |     u8: Element<I>,
+   |         ^^^^^^^^^^ required by this bound in `Foo::foo`
+LL | {
+LL |     fn foo(self, x: <u8 as Element<I>>::Array);
+   |        --- required by a bound in this
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-69725.rs b/src/test/ui/issues/issue-69725.rs
deleted file mode 100644 (file)
index 7c77293..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// aux-build:issue-69725.rs
-
-extern crate issue_69725;
-use issue_69725::Struct;
-
-fn crash<A>() {
-    let _ = Struct::<A>::new().clone();
-    //~^ ERROR: the method
-}
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-69725.stderr b/src/test/ui/issues/issue-69725.stderr
deleted file mode 100644 (file)
index b1ba89f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0599]: the method `clone` exists for struct `Struct<A>`, but its trait bounds were not satisfied
-  --> $DIR/issue-69725.rs:7:32
-   |
-LL |     let _ = Struct::<A>::new().clone();
-   |                                ^^^^^ method cannot be called on `Struct<A>` due to unsatisfied trait bounds
-   |
-  ::: $DIR/auxiliary/issue-69725.rs:2:1
-   |
-LL | pub struct Struct<A>(A);
-   | ------------------------ doesn't satisfy `Struct<A>: Clone`
-   |
-   = note: the following trait bounds were not satisfied:
-           `A: Clone`
-           which is required by `Struct<A>: Clone`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0599`.
index 1747ca5bb04b89c15ac765404186f42f942cbfdd..629ccea2577bd70e81155f0666dc50ca3927542d 100644 (file)
@@ -7,11 +7,6 @@ LL |     String::from("x".as_ref());
    = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
            - impl<> From<&String> for String;
            - impl<> From<&str> for String;
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:7:22
@@ -43,11 +38,6 @@ LL |     |x| String::from("x".as_ref());
    = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
            - impl<> From<&String> for String;
            - impl<> From<&str> for String;
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:12:26
@@ -87,11 +77,6 @@ LL |     String::from("x".as_ref());
    = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
            - impl<> From<&String> for String;
            - impl<> From<&str> for String;
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:22:22
@@ -117,11 +102,6 @@ LL |     String::from("x".as_ref());
    = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
            - impl<> From<&String> for String;
            - impl<> From<&str> for String;
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:29:22
@@ -147,11 +127,6 @@ LL |     String::from("x".as_ref());
    = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
            - impl<> From<&String> for String;
            - impl<> From<&str> for String;
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:38:22
@@ -177,11 +152,6 @@ LL |     String::from("x".as_ref());
    = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
            - impl<> From<&String> for String;
            - impl<> From<&str> for String;
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:47:22
@@ -207,11 +177,6 @@ LL |     String::from("x".as_ref());
    = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
            - impl<> From<&String> for String;
            - impl<> From<&str> for String;
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:54:22
@@ -237,11 +202,6 @@ LL |     String::from("x".as_ref());
    = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
            - impl<> From<&String> for String;
            - impl<> From<&str> for String;
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:63:22
index 60b2cbfdf4592f2ddcf24fef389c88d49ad2530a..5e2744bab95c1819b7bb067bd082df8a236ebc0d 100644 (file)
@@ -7,11 +7,6 @@ LL |     for _ in 42 {}
    = help: the trait `Iterator` is not implemented for `{integer}`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `{integer}`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `u8` is not an iterator
   --> $DIR/integral.rs:4:14
@@ -22,11 +17,6 @@ LL |     for _ in 42 as u8 {}
    = help: the trait `Iterator` is not implemented for `u8`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `u8`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `i8` is not an iterator
   --> $DIR/integral.rs:6:14
@@ -37,11 +27,6 @@ LL |     for _ in 42 as i8 {}
    = help: the trait `Iterator` is not implemented for `i8`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `i8`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `u16` is not an iterator
   --> $DIR/integral.rs:8:14
@@ -52,11 +37,6 @@ LL |     for _ in 42 as u16 {}
    = help: the trait `Iterator` is not implemented for `u16`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `u16`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `i16` is not an iterator
   --> $DIR/integral.rs:10:14
@@ -67,11 +47,6 @@ LL |     for _ in 42 as i16 {}
    = help: the trait `Iterator` is not implemented for `i16`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `i16`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `u32` is not an iterator
   --> $DIR/integral.rs:12:14
@@ -82,11 +57,6 @@ LL |     for _ in 42 as u32 {}
    = help: the trait `Iterator` is not implemented for `u32`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `u32`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `i32` is not an iterator
   --> $DIR/integral.rs:14:14
@@ -97,11 +67,6 @@ LL |     for _ in 42 as i32 {}
    = help: the trait `Iterator` is not implemented for `i32`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `i32`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `u64` is not an iterator
   --> $DIR/integral.rs:16:14
@@ -112,11 +77,6 @@ LL |     for _ in 42 as u64 {}
    = help: the trait `Iterator` is not implemented for `u64`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `u64`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `i64` is not an iterator
   --> $DIR/integral.rs:18:14
@@ -127,11 +87,6 @@ LL |     for _ in 42 as i64 {}
    = help: the trait `Iterator` is not implemented for `i64`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `i64`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `usize` is not an iterator
   --> $DIR/integral.rs:20:14
@@ -142,11 +97,6 @@ LL |     for _ in 42 as usize {}
    = help: the trait `Iterator` is not implemented for `usize`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `usize`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `isize` is not an iterator
   --> $DIR/integral.rs:22:14
@@ -157,11 +107,6 @@ LL |     for _ in 42 as isize {}
    = help: the trait `Iterator` is not implemented for `isize`
    = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `isize`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `{float}` is not an iterator
   --> $DIR/integral.rs:24:14
@@ -171,11 +116,6 @@ LL |     for _ in 42.0 {}
    |
    = help: the trait `Iterator` is not implemented for `{float}`
    = note: required because of the requirements on the impl of `IntoIterator` for `{float}`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 12 previous errors
 
index fdc33862c0aba1392f72c2c9d5e0fdcc6a7ea261..440a8960a4ca3a3543d89c02619de932abeb9520 100644 (file)
@@ -7,11 +7,6 @@ LL |     for _ in ..10 {}
    = help: the trait `Iterator` is not implemented for `RangeTo<{integer}>`
    = note: `..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a bounded `Range`: `0..end`
    = note: required because of the requirements on the impl of `IntoIterator` for `RangeTo<{integer}>`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `RangeToInclusive<{integer}>` is not an iterator
   --> $DIR/ranges.rs:4:14
@@ -22,11 +17,6 @@ LL |     for _ in ..=10 {}
    = help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>`
    = note: `..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant to have a bounded `RangeInclusive`: `0..=end`
    = note: required because of the requirements on the impl of `IntoIterator` for `RangeToInclusive<{integer}>`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index f7089be2772968ce60112912f3ead2fcd4f14375..d9c40fe1ba6a41aeca44a69db198d48b871a44c5 100644 (file)
@@ -6,11 +6,6 @@ LL |     for _ in "".to_owned() {}
    |
    = help: the trait `Iterator` is not implemented for `String`
    = note: required because of the requirements on the impl of `IntoIterator` for `String`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: `&str` is not an iterator
   --> $DIR/string.rs:4:14
@@ -20,11 +15,6 @@ LL |     for _ in "" {}
    |
    = help: the trait `Iterator` is not implemented for `&str`
    = note: required because of the requirements on the impl of `IntoIterator` for `&str`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/kindck-implicit-close-over-mut-var.rs b/src/test/ui/kindck-implicit-close-over-mut-var.rs
deleted file mode 100644 (file)
index 5b5d86e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// run-pass
-
-#![allow(unused_must_use)]
-#![allow(dead_code)]
-use std::thread;
-
-fn user(_i: isize) {}
-
-fn foo() {
-    // Here, i is *copied* into the proc (heap closure).
-    // Requires allocation.  The proc's copy is not mutable.
-    let mut i = 0;
-    let t = thread::spawn(move|| {
-        user(i);
-        println!("spawned {}", i)
-    });
-    i += 1;
-    println!("original {}", i);
-    t.join();
-}
-
-fn bar() {
-    // Here, the original i has not been moved, only copied, so is still
-    // mutable outside of the proc.
-    let mut i = 0;
-    while i < 10 {
-        let t = thread::spawn(move|| {
-            user(i);
-        });
-        i += 1;
-        t.join();
-    }
-}
-
-fn car() {
-    // Here, i must be shadowed in the proc to be mutable.
-    let mut i = 0;
-    while i < 10 {
-        let t = thread::spawn(move|| {
-            let mut i = i;
-            i += 1;
-            user(i);
-        });
-        i += 1;
-        t.join();
-    }
-}
-
-pub fn main() {}
diff --git a/src/test/ui/lang-items/issue-87573.rs b/src/test/ui/lang-items/issue-87573.rs
new file mode 100644 (file)
index 0000000..aeb0c24
--- /dev/null
@@ -0,0 +1,28 @@
+// Regression test for #87573, ensures that duplicate lang items or invalid generics
+// for lang items doesn't cause ICE.
+
+#![feature(no_core, lang_items)]
+#![no_core]
+#![crate_type = "lib"]
+
+pub static STATIC_BOOL: bool = true;
+
+#[lang = "sized"]
+trait Sized {}
+
+#[lang = "copy"]
+trait Copy {}
+
+#[lang = "sync"]
+trait Sync {}
+impl Sync for bool {}
+
+#[lang = "drop_in_place"]
+//~^ ERROR: `drop_in_place` language item must be applied to a function with at least 1 generic argument
+fn drop_fn() {
+    while false {}
+}
+
+#[lang = "start"]
+//~^ ERROR: `start` language item must be applied to a function with 1 generic argument
+fn start(){}
diff --git a/src/test/ui/lang-items/issue-87573.stderr b/src/test/ui/lang-items/issue-87573.stderr
new file mode 100644 (file)
index 0000000..25560cf
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0718]: `drop_in_place` language item must be applied to a function with at least 1 generic argument
+  --> $DIR/issue-87573.rs:20:1
+   |
+LL | #[lang = "drop_in_place"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | fn drop_fn() {
+   |           - this function has 0 generic arguments
+
+error[E0718]: `start` language item must be applied to a function with 1 generic argument
+  --> $DIR/issue-87573.rs:26:1
+   |
+LL | #[lang = "start"]
+   | ^^^^^^^^^^^^^^^^^
+LL |
+LL | fn start(){}
+   |         - this function has 0 generic arguments
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0718`.
index 1a371c6b17000b6c93d2a491f88321ba4ee95230..418f780d62c971ea985059fa1074e79b4c72c4d9 100644 (file)
 error: layout_of(E) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I32,
-                false,
-            ),
-            valid_range: 0..=0,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 0,
-                    },
-                    pref: $PREF_ALIGN,
-                },
-                size: Size {
-                    raw: 4,
-                },
-            },
-            Layout {
-                fields: Arbitrary {
-                    offsets: [
-                        Size {
-                            raw: 4,
-                        },
-                        Size {
-                            raw: 4,
-                        },
-                        Size {
-                            raw: 8,
-                        },
-                    ],
-                    memory_index: [
-                        0,
-                        1,
-                        2,
-                    ],
-                },
-                variants: Single {
-                    index: 1,
-                },
-                abi: Uninhabited,
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 2,
-                    },
-                    pref: $PREF_ALIGN,
-                },
-                size: Size {
-                    raw: 12,
-                },
-            },
-        ],
-    },
-    abi: Aggregate {
-        sized: true,
-    },
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I32,
-                    false,
-                ),
-                valid_range: 0..=0,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 2,
-        },
-        pref: $PREF_ALIGN,
-    },
-    size: Size {
-        raw: 12,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I32,
+                       false,
+                   ),
+                   valid_range: 0..=0,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 0,
+                           },
+                           pref: $PREF_ALIGN,
+                       },
+                       size: Size {
+                           raw: 4,
+                       },
+                   },
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [
+                               Size {
+                                   raw: 4,
+                               },
+                               Size {
+                                   raw: 4,
+                               },
+                               Size {
+                                   raw: 8,
+                               },
+                           ],
+                           memory_index: [
+                               0,
+                               1,
+                               2,
+                           ],
+                       },
+                       variants: Single {
+                           index: 1,
+                       },
+                       abi: Uninhabited,
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 2,
+                           },
+                           pref: $PREF_ALIGN,
+                       },
+                       size: Size {
+                           raw: 12,
+                       },
+                   },
+               ],
+           },
+           abi: Aggregate {
+               sized: true,
+           },
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I32,
+                           false,
+                       ),
+                       valid_range: 0..=0,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 2,
+               },
+               pref: $PREF_ALIGN,
+           },
+           size: Size {
+               raw: 12,
+           },
+       }
   --> $DIR/debug.rs:6:1
    |
 LL | enum E { Foo, Bar(!, i32, i32) }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(S) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-            Size {
-                raw: 0,
-            },
-            Size {
-                raw: 4,
-            },
-        ],
-        memory_index: [
-            1,
-            0,
-            2,
-        ],
-    },
-    variants: Single {
-        index: 0,
-    },
-    abi: ScalarPair(
-        Scalar {
-            value: Int(
-                I32,
-                true,
-            ),
-            valid_range: 0..=4294967295,
-        },
-        Scalar {
-            value: Int(
-                I32,
-                true,
-            ),
-            valid_range: 0..=4294967295,
-        },
-    ),
-    largest_niche: None,
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 2,
-        },
-        pref: $PREF_ALIGN,
-    },
-    size: Size {
-        raw: 8,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+                   Size {
+                       raw: 0,
+                   },
+                   Size {
+                       raw: 4,
+                   },
+               ],
+               memory_index: [
+                   1,
+                   0,
+                   2,
+               ],
+           },
+           variants: Single {
+               index: 0,
+           },
+           abi: ScalarPair(
+               Scalar {
+                   value: Int(
+                       I32,
+                       true,
+                   ),
+                   valid_range: 0..=4294967295,
+               },
+               Scalar {
+                   value: Int(
+                       I32,
+                       true,
+                   ),
+                   valid_range: 0..=4294967295,
+               },
+           ),
+           largest_niche: None,
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 2,
+               },
+               pref: $PREF_ALIGN,
+           },
+           size: Size {
+               raw: 8,
+           },
+       }
   --> $DIR/debug.rs:9:1
    |
 LL | struct S { f1: i32, f2: (), f3: i32 }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(U) = Layout {
-    fields: Union(
-        2,
-    ),
-    variants: Single {
-        index: 0,
-    },
-    abi: Aggregate {
-        sized: true,
-    },
-    largest_niche: None,
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 2,
-        },
-        pref: $PREF_ALIGN,
-    },
-    size: Size {
-        raw: 8,
-    },
-}
+           fields: Union(
+               2,
+           ),
+           variants: Single {
+               index: 0,
+           },
+           abi: Aggregate {
+               sized: true,
+           },
+           largest_niche: None,
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 2,
+               },
+               pref: $PREF_ALIGN,
+           },
+           size: Size {
+               raw: 8,
+           },
+       }
   --> $DIR/debug.rs:12:1
    |
 LL | union U { f1: (i32, i32), f3: i32 }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(std::result::Result<i32, i32>) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I32,
-                false,
-            ),
-            valid_range: 0..=1,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [
-                        Size {
-                            raw: 4,
-                        },
-                    ],
-                    memory_index: [
-                        0,
-                    ],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 2,
-                    },
-                    pref: $PREF_ALIGN,
-                },
-                size: Size {
-                    raw: 8,
-                },
-            },
-            Layout {
-                fields: Arbitrary {
-                    offsets: [
-                        Size {
-                            raw: 4,
-                        },
-                    ],
-                    memory_index: [
-                        0,
-                    ],
-                },
-                variants: Single {
-                    index: 1,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 2,
-                    },
-                    pref: $PREF_ALIGN,
-                },
-                size: Size {
-                    raw: 8,
-                },
-            },
-        ],
-    },
-    abi: ScalarPair(
-        Scalar {
-            value: Int(
-                I32,
-                false,
-            ),
-            valid_range: 0..=1,
-        },
-        Scalar {
-            value: Int(
-                I32,
-                true,
-            ),
-            valid_range: 0..=4294967295,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I32,
-                    false,
-                ),
-                valid_range: 0..=1,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 2,
-        },
-        pref: $PREF_ALIGN,
-    },
-    size: Size {
-        raw: 8,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I32,
+                       false,
+                   ),
+                   valid_range: 0..=1,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [
+                               Size {
+                                   raw: 4,
+                               },
+                           ],
+                           memory_index: [
+                               0,
+                           ],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 2,
+                           },
+                           pref: $PREF_ALIGN,
+                       },
+                       size: Size {
+                           raw: 8,
+                       },
+                   },
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [
+                               Size {
+                                   raw: 4,
+                               },
+                           ],
+                           memory_index: [
+                               0,
+                           ],
+                       },
+                       variants: Single {
+                           index: 1,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 2,
+                           },
+                           pref: $PREF_ALIGN,
+                       },
+                       size: Size {
+                           raw: 8,
+                       },
+                   },
+               ],
+           },
+           abi: ScalarPair(
+               Scalar {
+                   value: Int(
+                       I32,
+                       false,
+                   ),
+                   valid_range: 0..=1,
+               },
+               Scalar {
+                   value: Int(
+                       I32,
+                       true,
+                   ),
+                   valid_range: 0..=4294967295,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I32,
+                           false,
+                       ),
+                       valid_range: 0..=1,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 2,
+               },
+               pref: $PREF_ALIGN,
+           },
+           size: Size {
+               raw: 8,
+           },
+       }
   --> $DIR/debug.rs:15:1
    |
 LL | type Test = Result<i32, i32>;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(i32) = Layout {
-    fields: Primitive,
-    variants: Single {
-        index: 0,
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I32,
-                true,
-            ),
-            valid_range: 0..=4294967295,
-        },
-    ),
-    largest_niche: None,
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 2,
-        },
-        pref: $PREF_ALIGN,
-    },
-    size: Size {
-        raw: 4,
-    },
-}
+           fields: Primitive,
+           variants: Single {
+               index: 0,
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I32,
+                       true,
+                   ),
+                   valid_range: 0..=4294967295,
+               },
+           ),
+           largest_niche: None,
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 2,
+               },
+               pref: $PREF_ALIGN,
+           },
+           size: Size {
+               raw: 4,
+           },
+       }
   --> $DIR/debug.rs:18:1
    |
 LL | type T = impl std::fmt::Debug;
index d4676a5afb25e227f19eb6a3867692e635ddda8c..39b23cb4b572ef8e3afb75aa22ccab3b605c1099 100644 (file)
 error: layout_of(A) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I8,
-                false,
-            ),
-            valid_range: 0..=0,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 0,
-                    },
-                    pref: Align {
-                        pow2: 0,
-                    },
-                },
-                size: Size {
-                    raw: 1,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I8,
-                false,
-            ),
-            valid_range: 0..=0,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I8,
-                    false,
-                ),
-                valid_range: 0..=0,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 0,
-        },
-        pref: Align {
-            pow2: 0,
-        },
-    },
-    size: Size {
-        raw: 1,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I8,
+                       false,
+                   ),
+                   valid_range: 0..=0,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 0,
+                           },
+                           pref: Align {
+                               pow2: 0,
+                           },
+                       },
+                       size: Size {
+                           raw: 1,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I8,
+                       false,
+                   ),
+                   valid_range: 0..=0,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I8,
+                           false,
+                       ),
+                       valid_range: 0..=0,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 0,
+               },
+               pref: Align {
+                   pow2: 0,
+               },
+           },
+           size: Size {
+               raw: 1,
+           },
+       }
   --> $DIR/hexagon-enum.rs:16:1
    |
 LL | enum A { Apple }
    | ^^^^^^^^^^^^^^^^
 
 error: layout_of(B) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I8,
-                false,
-            ),
-            valid_range: 255..=255,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 0,
-                    },
-                    pref: Align {
-                        pow2: 0,
-                    },
-                },
-                size: Size {
-                    raw: 1,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I8,
-                false,
-            ),
-            valid_range: 255..=255,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I8,
-                    false,
-                ),
-                valid_range: 255..=255,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 0,
-        },
-        pref: Align {
-            pow2: 0,
-        },
-    },
-    size: Size {
-        raw: 1,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I8,
+                       false,
+                   ),
+                   valid_range: 255..=255,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 0,
+                           },
+                           pref: Align {
+                               pow2: 0,
+                           },
+                       },
+                       size: Size {
+                           raw: 1,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I8,
+                       false,
+                   ),
+                   valid_range: 255..=255,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I8,
+                           false,
+                       ),
+                       valid_range: 255..=255,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 0,
+               },
+               pref: Align {
+                   pow2: 0,
+               },
+           },
+           size: Size {
+               raw: 1,
+           },
+       }
   --> $DIR/hexagon-enum.rs:20:1
    |
 LL | enum B { Banana = 255, }
    | ^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(C) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I16,
-                false,
-            ),
-            valid_range: 256..=256,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 1,
-                    },
-                    pref: Align {
-                        pow2: 1,
-                    },
-                },
-                size: Size {
-                    raw: 2,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I16,
-                false,
-            ),
-            valid_range: 256..=256,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I16,
-                    false,
-                ),
-                valid_range: 256..=256,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 1,
-        },
-        pref: Align {
-            pow2: 1,
-        },
-    },
-    size: Size {
-        raw: 2,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I16,
+                       false,
+                   ),
+                   valid_range: 256..=256,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 1,
+                           },
+                           pref: Align {
+                               pow2: 1,
+                           },
+                       },
+                       size: Size {
+                           raw: 2,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I16,
+                       false,
+                   ),
+                   valid_range: 256..=256,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I16,
+                           false,
+                       ),
+                       valid_range: 256..=256,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 1,
+               },
+               pref: Align {
+                   pow2: 1,
+               },
+           },
+           size: Size {
+               raw: 2,
+           },
+       }
   --> $DIR/hexagon-enum.rs:24:1
    |
 LL | enum C { Chaenomeles = 256, }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(P) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I32,
-                false,
-            ),
-            valid_range: 268435456..=268435456,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 2,
-                    },
-                    pref: Align {
-                        pow2: 2,
-                    },
-                },
-                size: Size {
-                    raw: 4,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I32,
-                false,
-            ),
-            valid_range: 268435456..=268435456,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I32,
-                    false,
-                ),
-                valid_range: 268435456..=268435456,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 2,
-        },
-        pref: Align {
-            pow2: 2,
-        },
-    },
-    size: Size {
-        raw: 4,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I32,
+                       false,
+                   ),
+                   valid_range: 268435456..=268435456,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 2,
+                           },
+                           pref: Align {
+                               pow2: 2,
+                           },
+                       },
+                       size: Size {
+                           raw: 4,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I32,
+                       false,
+                   ),
+                   valid_range: 268435456..=268435456,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I32,
+                           false,
+                       ),
+                       valid_range: 268435456..=268435456,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 2,
+               },
+               pref: Align {
+                   pow2: 2,
+               },
+           },
+           size: Size {
+               raw: 4,
+           },
+       }
   --> $DIR/hexagon-enum.rs:28:1
    |
 LL | enum P { Peach = 0x1000_0000isize, }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(T) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I32,
-                true,
-            ),
-            valid_range: 2164260864..=2164260864,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 2,
-                    },
-                    pref: Align {
-                        pow2: 2,
-                    },
-                },
-                size: Size {
-                    raw: 4,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I32,
-                true,
-            ),
-            valid_range: 2164260864..=2164260864,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I32,
-                    true,
-                ),
-                valid_range: 2164260864..=2164260864,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 2,
-        },
-        pref: Align {
-            pow2: 2,
-        },
-    },
-    size: Size {
-        raw: 4,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I32,
+                       true,
+                   ),
+                   valid_range: 2164260864..=2164260864,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 2,
+                           },
+                           pref: Align {
+                               pow2: 2,
+                           },
+                       },
+                       size: Size {
+                           raw: 4,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I32,
+                       true,
+                   ),
+                   valid_range: 2164260864..=2164260864,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I32,
+                           true,
+                       ),
+                       valid_range: 2164260864..=2164260864,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 2,
+               },
+               pref: Align {
+                   pow2: 2,
+               },
+           },
+           size: Size {
+               raw: 4,
+           },
+       }
   --> $DIR/hexagon-enum.rs:34:1
    |
 LL | enum T { Tangerine = TANGERINE as isize }
index 898a61b904db50bd0dbf1fa8f6feb492d2878290..144ab02792e5018020b06ba9e4346ffc35de1a3b 100644 (file)
 error: layout_of(A) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I8,
-                false,
-            ),
-            valid_range: 0..=0,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 0,
-                    },
-                    pref: Align {
-                        pow2: 2,
-                    },
-                },
-                size: Size {
-                    raw: 1,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I8,
-                false,
-            ),
-            valid_range: 0..=0,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I8,
-                    false,
-                ),
-                valid_range: 0..=0,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 0,
-        },
-        pref: Align {
-            pow2: 2,
-        },
-    },
-    size: Size {
-        raw: 1,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I8,
+                       false,
+                   ),
+                   valid_range: 0..=0,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 0,
+                           },
+                           pref: Align {
+                               pow2: 2,
+                           },
+                       },
+                       size: Size {
+                           raw: 1,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I8,
+                       false,
+                   ),
+                   valid_range: 0..=0,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I8,
+                           false,
+                       ),
+                       valid_range: 0..=0,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 0,
+               },
+               pref: Align {
+                   pow2: 2,
+               },
+           },
+           size: Size {
+               raw: 1,
+           },
+       }
   --> $DIR/thumb-enum.rs:16:1
    |
 LL | enum A { Apple }
    | ^^^^^^^^^^^^^^^^
 
 error: layout_of(B) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I8,
-                false,
-            ),
-            valid_range: 255..=255,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 0,
-                    },
-                    pref: Align {
-                        pow2: 2,
-                    },
-                },
-                size: Size {
-                    raw: 1,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I8,
-                false,
-            ),
-            valid_range: 255..=255,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I8,
-                    false,
-                ),
-                valid_range: 255..=255,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 0,
-        },
-        pref: Align {
-            pow2: 2,
-        },
-    },
-    size: Size {
-        raw: 1,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I8,
+                       false,
+                   ),
+                   valid_range: 255..=255,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 0,
+                           },
+                           pref: Align {
+                               pow2: 2,
+                           },
+                       },
+                       size: Size {
+                           raw: 1,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I8,
+                       false,
+                   ),
+                   valid_range: 255..=255,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I8,
+                           false,
+                       ),
+                       valid_range: 255..=255,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 0,
+               },
+               pref: Align {
+                   pow2: 2,
+               },
+           },
+           size: Size {
+               raw: 1,
+           },
+       }
   --> $DIR/thumb-enum.rs:20:1
    |
 LL | enum B { Banana = 255, }
    | ^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(C) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I16,
-                false,
-            ),
-            valid_range: 256..=256,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 1,
-                    },
-                    pref: Align {
-                        pow2: 2,
-                    },
-                },
-                size: Size {
-                    raw: 2,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I16,
-                false,
-            ),
-            valid_range: 256..=256,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I16,
-                    false,
-                ),
-                valid_range: 256..=256,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 1,
-        },
-        pref: Align {
-            pow2: 2,
-        },
-    },
-    size: Size {
-        raw: 2,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I16,
+                       false,
+                   ),
+                   valid_range: 256..=256,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 1,
+                           },
+                           pref: Align {
+                               pow2: 2,
+                           },
+                       },
+                       size: Size {
+                           raw: 2,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I16,
+                       false,
+                   ),
+                   valid_range: 256..=256,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I16,
+                           false,
+                       ),
+                       valid_range: 256..=256,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 1,
+               },
+               pref: Align {
+                   pow2: 2,
+               },
+           },
+           size: Size {
+               raw: 2,
+           },
+       }
   --> $DIR/thumb-enum.rs:24:1
    |
 LL | enum C { Chaenomeles = 256, }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(P) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I32,
-                false,
-            ),
-            valid_range: 268435456..=268435456,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 2,
-                    },
-                    pref: Align {
-                        pow2: 2,
-                    },
-                },
-                size: Size {
-                    raw: 4,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I32,
-                false,
-            ),
-            valid_range: 268435456..=268435456,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I32,
-                    false,
-                ),
-                valid_range: 268435456..=268435456,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 2,
-        },
-        pref: Align {
-            pow2: 2,
-        },
-    },
-    size: Size {
-        raw: 4,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I32,
+                       false,
+                   ),
+                   valid_range: 268435456..=268435456,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 2,
+                           },
+                           pref: Align {
+                               pow2: 2,
+                           },
+                       },
+                       size: Size {
+                           raw: 4,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I32,
+                       false,
+                   ),
+                   valid_range: 268435456..=268435456,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I32,
+                           false,
+                       ),
+                       valid_range: 268435456..=268435456,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 2,
+               },
+               pref: Align {
+                   pow2: 2,
+               },
+           },
+           size: Size {
+               raw: 4,
+           },
+       }
   --> $DIR/thumb-enum.rs:28:1
    |
 LL | enum P { Peach = 0x1000_0000isize, }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(T) = Layout {
-    fields: Arbitrary {
-        offsets: [
-            Size {
-                raw: 0,
-            },
-        ],
-        memory_index: [
-            0,
-        ],
-    },
-    variants: Multiple {
-        tag: Scalar {
-            value: Int(
-                I32,
-                true,
-            ),
-            valid_range: 2164260864..=2164260864,
-        },
-        tag_encoding: Direct,
-        tag_field: 0,
-        variants: [
-            Layout {
-                fields: Arbitrary {
-                    offsets: [],
-                    memory_index: [],
-                },
-                variants: Single {
-                    index: 0,
-                },
-                abi: Aggregate {
-                    sized: true,
-                },
-                largest_niche: None,
-                align: AbiAndPrefAlign {
-                    abi: Align {
-                        pow2: 2,
-                    },
-                    pref: Align {
-                        pow2: 2,
-                    },
-                },
-                size: Size {
-                    raw: 4,
-                },
-            },
-        ],
-    },
-    abi: Scalar(
-        Scalar {
-            value: Int(
-                I32,
-                true,
-            ),
-            valid_range: 2164260864..=2164260864,
-        },
-    ),
-    largest_niche: Some(
-        Niche {
-            offset: Size {
-                raw: 0,
-            },
-            scalar: Scalar {
-                value: Int(
-                    I32,
-                    true,
-                ),
-                valid_range: 2164260864..=2164260864,
-            },
-        },
-    ),
-    align: AbiAndPrefAlign {
-        abi: Align {
-            pow2: 2,
-        },
-        pref: Align {
-            pow2: 2,
-        },
-    },
-    size: Size {
-        raw: 4,
-    },
-}
+           fields: Arbitrary {
+               offsets: [
+                   Size {
+                       raw: 0,
+                   },
+               ],
+               memory_index: [
+                   0,
+               ],
+           },
+           variants: Multiple {
+               tag: Scalar {
+                   value: Int(
+                       I32,
+                       true,
+                   ),
+                   valid_range: 2164260864..=2164260864,
+               },
+               tag_encoding: Direct,
+               tag_field: 0,
+               variants: [
+                   Layout {
+                       fields: Arbitrary {
+                           offsets: [],
+                           memory_index: [],
+                       },
+                       variants: Single {
+                           index: 0,
+                       },
+                       abi: Aggregate {
+                           sized: true,
+                       },
+                       largest_niche: None,
+                       align: AbiAndPrefAlign {
+                           abi: Align {
+                               pow2: 2,
+                           },
+                           pref: Align {
+                               pow2: 2,
+                           },
+                       },
+                       size: Size {
+                           raw: 4,
+                       },
+                   },
+               ],
+           },
+           abi: Scalar(
+               Scalar {
+                   value: Int(
+                       I32,
+                       true,
+                   ),
+                   valid_range: 2164260864..=2164260864,
+               },
+           ),
+           largest_niche: Some(
+               Niche {
+                   offset: Size {
+                       raw: 0,
+                   },
+                   scalar: Scalar {
+                       value: Int(
+                           I32,
+                           true,
+                       ),
+                       valid_range: 2164260864..=2164260864,
+                   },
+               },
+           ),
+           align: AbiAndPrefAlign {
+               abi: Align {
+                   pow2: 2,
+               },
+               pref: Align {
+                   pow2: 2,
+               },
+           },
+           size: Size {
+               raw: 4,
+           },
+       }
   --> $DIR/thumb-enum.rs:34:1
    |
 LL | enum T { Tangerine = TANGERINE as isize }
diff --git a/src/test/ui/leak-unique-as-tydesc.rs b/src/test/ui/leak-unique-as-tydesc.rs
deleted file mode 100644 (file)
index 322f726..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-
-fn leaky<T>(_t: T) { }
-
-pub fn main() {
-    let x = Box::new(10);
-    leaky::<Box<isize>>(x);
-}
index b76d71a3d43c4840e60b19fa8a61f19c5eea3840..1b97f8d818a453a0c400ed3211e9742b49b56bb1 100644 (file)
@@ -5,11 +5,6 @@ LL |     &'a (): Foo,
    |             ^^^ cannot infer type for reference `&'a ()`
    |
    = note: cannot satisfy `&'a (): Foo`
-note: required by a bound in `Foo`
-  --> $DIR/issue-34979.rs:1:1
-   |
-LL | trait Foo {}
-   | ^^^^^^^^^ required by this bound in `Foo`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/link-cfg-works.rs b/src/test/ui/link-cfg-works.rs
deleted file mode 100644 (file)
index 254091f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-// aux-build:link-cfg-works-transitive-rlib.rs
-// aux-build:link-cfg-works-transitive-dylib.rs
-
-#![feature(link_cfg)]
-
-extern crate link_cfg_works_transitive_dylib;
-extern crate link_cfg_works_transitive_rlib;
-
-#[link(name = "foo", cfg(foo))]
-extern "C" {}
-
-fn main() {}
diff --git a/src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs b/src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs
new file mode 100644 (file)
index 0000000..0d92711
--- /dev/null
@@ -0,0 +1,4 @@
+#![feature(link_cfg)]
+
+#[link(name = "foo", cfg(foo))]
+extern "C" {}
diff --git a/src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs b/src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs
new file mode 100644 (file)
index 0000000..0a296f0
--- /dev/null
@@ -0,0 +1,7 @@
+// no-prefer-dynamic
+
+#![feature(link_cfg)]
+#![crate_type = "rlib"]
+
+#[link(name = "foo", cfg(foo))]
+extern "C" {}
diff --git a/src/test/ui/linkage-attr/link-cfg-works.rs b/src/test/ui/linkage-attr/link-cfg-works.rs
new file mode 100644 (file)
index 0000000..254091f
--- /dev/null
@@ -0,0 +1,13 @@
+// run-pass
+// aux-build:link-cfg-works-transitive-rlib.rs
+// aux-build:link-cfg-works-transitive-dylib.rs
+
+#![feature(link_cfg)]
+
+extern crate link_cfg_works_transitive_dylib;
+extern crate link_cfg_works_transitive_rlib;
+
+#[link(name = "foo", cfg(foo))]
+extern "C" {}
+
+fn main() {}
diff --git a/src/test/ui/lint-cap.rs b/src/test/ui/lint-cap.rs
deleted file mode 100644 (file)
index 461b923..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-pass
-// compile-flags: --cap-lints allow
-
-#![deny(warnings)]
-
-use std::option;
-
-fn main() {}
index 4c6211a279a58e9483da41ba47f542e0e86b0a16..d3e39c0de69c85db3a6bfff5bad18ff1526ed826 100644 (file)
@@ -1,5 +1,5 @@
 // check-pass
-#![feature(inline_const)]
+#![feature(inline_const_pat)]
 #![allow(incomplete_features)]
 #![deny(dead_code)]
 
diff --git a/src/test/ui/lint/lint-cap.rs b/src/test/ui/lint/lint-cap.rs
new file mode 100644 (file)
index 0000000..461b923
--- /dev/null
@@ -0,0 +1,8 @@
+// run-pass
+// compile-flags: --cap-lints allow
+
+#![deny(warnings)]
+
+use std::option;
+
+fn main() {}
diff --git a/src/test/ui/lint/unused/unused-attr-duplicate.rs b/src/test/ui/lint/unused/unused-attr-duplicate.rs
new file mode 100644 (file)
index 0000000..074d5a9
--- /dev/null
@@ -0,0 +1,108 @@
+// Tests for repeating attribute warnings.
+// aux-build:lint_unused_extern_crate.rs
+// compile-flags:--test
+// Not tested due to extra requirements:
+// - panic_handler: needs extra setup
+// - target_feature: platform-specific
+// - link_section: platform-specific
+// - proc_macro, proc_macro_derive, proc_macro_attribute: needs to be a
+//   proc-macro, and have special handling for mixing.
+// - unstable attributes (not going to bother)
+// - no_main: extra setup
+#![deny(unused_attributes)]
+#![crate_name = "unused_attr_duplicate"]
+#![crate_name = "unused_attr_duplicate2"] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+#![crate_type = "bin"]
+#![crate_type = "rlib"] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+#![recursion_limit = "128"]
+#![recursion_limit = "256"] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+#![type_length_limit = "1048576"]
+#![type_length_limit = "1"] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+#![no_std]
+#![no_std] //~ ERROR unused attribute
+#![no_implicit_prelude]
+#![no_implicit_prelude] //~ ERROR unused attribute
+#![windows_subsystem = "console"]
+#![windows_subsystem = "windows"] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+#![no_builtins]
+#![no_builtins] //~ ERROR unused attribute
+
+#[no_link]
+#[no_link] //~ ERROR unused attribute
+extern crate lint_unused_extern_crate;
+
+#[macro_use]
+#[macro_use] //~ ERROR unused attribute
+pub mod m {
+    #[macro_export]
+    #[macro_export] //~ ERROR unused attribute
+    macro_rules! foo {
+        () => {};
+    }
+}
+
+#[path = "auxiliary/lint_unused_extern_crate.rs"]
+#[path = "bar.rs"] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+pub mod from_path;
+
+#[test]
+#[ignore]
+#[ignore = "some text"] //~ ERROR unused attribute
+#[should_panic]
+#[should_panic(expected = "values don't match")] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+fn t1() {}
+
+#[must_use]
+#[must_use = "some message"] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+// No warnings for #[repr], would require more logic.
+#[repr(C)]
+#[repr(C)]
+#[non_exhaustive]
+#[non_exhaustive] //~ ERROR unused attribute
+pub struct X;
+
+#[automatically_derived]
+#[automatically_derived] //~ ERROR unused attribute
+impl X {}
+
+#[inline(always)]
+#[inline(never)] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+#[cold]
+#[cold] //~ ERROR unused attribute
+#[track_caller]
+#[track_caller] //~ ERROR unused attribute
+pub fn xyz() {}
+
+// No warnings for #[link], would require more logic.
+#[link(name = "rust_test_helpers", kind = "static")]
+#[link(name = "rust_test_helpers", kind = "static")]
+extern "C" {
+    #[link_name = "this_does_not_exist"] //~ ERROR unused attribute
+    //~^ WARN this was previously accepted
+    #[link_name = "rust_dbg_extern_identity_u32"]
+    pub fn name_in_rust(v: u32) -> u32;
+}
+
+#[export_name = "exported_symbol_name"] //~ ERROR unused attribute
+//~^ WARN this was previously accepted
+#[export_name = "exported_symbol_name2"]
+pub fn export_test() {}
+
+#[no_mangle]
+#[no_mangle] //~ ERROR unused attribute
+pub fn no_mangle_test() {}
+
+#[used]
+#[used] //~ ERROR unused attribute
+static FOO: u32 = 0;
+
+fn main() {}
diff --git a/src/test/ui/lint/unused/unused-attr-duplicate.stderr b/src/test/ui/lint/unused/unused-attr-duplicate.stderr
new file mode 100644 (file)
index 0000000..d4305ad
--- /dev/null
@@ -0,0 +1,306 @@
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:36:1
+   |
+LL | #[no_link]
+   | ^^^^^^^^^^ help: remove this attribute
+   |
+note: the lint level is defined here
+  --> $DIR/unused-attr-duplicate.rs:12:9
+   |
+LL | #![deny(unused_attributes)]
+   |         ^^^^^^^^^^^^^^^^^
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:35:1
+   |
+LL | #[no_link]
+   | ^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:40:1
+   |
+LL | #[macro_use]
+   | ^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:39:1
+   |
+LL | #[macro_use]
+   | ^^^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:50:1
+   |
+LL | #[path = "bar.rs"]
+   | ^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:49:1
+   |
+LL | #[path = "auxiliary/lint_unused_extern_crate.rs"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:56:1
+   |
+LL | #[ignore = "some text"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:55:1
+   |
+LL | #[ignore]
+   | ^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:58:1
+   |
+LL | #[should_panic(expected = "values don't match")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:57:1
+   |
+LL | #[should_panic]
+   | ^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:63:1
+   |
+LL | #[must_use = "some message"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:62:1
+   |
+LL | #[must_use]
+   | ^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:69:1
+   |
+LL | #[non_exhaustive]
+   | ^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:68:1
+   |
+LL | #[non_exhaustive]
+   | ^^^^^^^^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:73:1
+   |
+LL | #[automatically_derived]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:72:1
+   |
+LL | #[automatically_derived]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:77:1
+   |
+LL | #[inline(never)]
+   | ^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:76:1
+   |
+LL | #[inline(always)]
+   | ^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:80:1
+   |
+LL | #[cold]
+   | ^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:79:1
+   |
+LL | #[cold]
+   | ^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:82:1
+   |
+LL | #[track_caller]
+   | ^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:81:1
+   |
+LL | #[track_caller]
+   | ^^^^^^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:95:1
+   |
+LL | #[export_name = "exported_symbol_name"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:97:1
+   |
+LL | #[export_name = "exported_symbol_name2"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:101:1
+   |
+LL | #[no_mangle]
+   | ^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:100:1
+   |
+LL | #[no_mangle]
+   | ^^^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:105:1
+   |
+LL | #[used]
+   | ^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:104:1
+   |
+LL | #[used]
+   | ^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:89:5
+   |
+LL |     #[link_name = "this_does_not_exist"]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:91:5
+   |
+LL |     #[link_name = "rust_dbg_extern_identity_u32"]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:14:1
+   |
+LL | #![crate_name = "unused_attr_duplicate2"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:13:1
+   |
+LL | #![crate_name = "unused_attr_duplicate"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:17:1
+   |
+LL | #![crate_type = "rlib"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:16:1
+   |
+LL | #![crate_type = "bin"]
+   | ^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:20:1
+   |
+LL | #![recursion_limit = "256"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:19:1
+   |
+LL | #![recursion_limit = "128"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:23:1
+   |
+LL | #![type_length_limit = "1"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:22:1
+   |
+LL | #![type_length_limit = "1048576"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:26:1
+   |
+LL | #![no_std]
+   | ^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:25:1
+   |
+LL | #![no_std]
+   | ^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:28:1
+   |
+LL | #![no_implicit_prelude]
+   | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:27:1
+   |
+LL | #![no_implicit_prelude]
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:30:1
+   |
+LL | #![windows_subsystem = "windows"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:29:1
+   |
+LL | #![windows_subsystem = "console"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:33:1
+   |
+LL | #![no_builtins]
+   | ^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:32:1
+   |
+LL | #![no_builtins]
+   | ^^^^^^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:43:5
+   |
+LL |     #[macro_export]
+   |     ^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:42:5
+   |
+LL |     #[macro_export]
+   |     ^^^^^^^^^^^^^^^
+
+error: aborting due to 24 previous errors
+
diff --git a/src/test/ui/liveness-assign-imm-local-after-ret.rs b/src/test/ui/liveness-assign-imm-local-after-ret.rs
deleted file mode 100644 (file)
index b463f43..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// run-pass
-
-#![allow(unreachable_code)]
-// pretty-expanded FIXME #23616
-
-#![allow(dead_code)]
-
-fn test() {
-    let _v: isize;
-    _v = 1;
-    return;
-    _v = 2;
-}
-
-pub fn main() {
-}
diff --git a/src/test/ui/liveness/liveness-assign-imm-local-after-ret.rs b/src/test/ui/liveness/liveness-assign-imm-local-after-ret.rs
new file mode 100644 (file)
index 0000000..b463f43
--- /dev/null
@@ -0,0 +1,16 @@
+// run-pass
+
+#![allow(unreachable_code)]
+// pretty-expanded FIXME #23616
+
+#![allow(dead_code)]
+
+fn test() {
+    let _v: isize;
+    _v = 1;
+    return;
+    _v = 2;
+}
+
+pub fn main() {
+}
diff --git a/src/test/ui/llvm-pr32379.rs b/src/test/ui/llvm-pr32379.rs
deleted file mode 100644 (file)
index 8a1f032..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-pass
-// aux-build:llvm_pr32379.rs
-
-// LLVM PR #32379 (https://bugs.llvm.org/show_bug.cgi?id=32379), which
-// applies to upstream LLVM 3.9.1, is known to cause rustc itself to be
-// miscompiled on ARM (Rust issue #40593). Because cross builds don't test
-// our *compiler* on ARM, have a test for the miscompilation directly.
-
-extern crate llvm_pr32379;
-
-pub fn main() {
-    let val = llvm_pr32379::pr32379(2, false, false);
-    assert_eq!(val, 2);
-}
diff --git a/src/test/ui/lub-if.nll.stderr b/src/test/ui/lub-if.nll.stderr
deleted file mode 100644 (file)
index 832688f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error: lifetime may not live long enough
-  --> $DIR/lub-if.rs:28:9
-   |
-LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
-   |                 -- lifetime `'a` defined here
-...
-LL |         s
-   |         ^ returning this value requires that `'a` must outlive `'static`
-
-error: lifetime may not live long enough
-  --> $DIR/lub-if.rs:35:9
-   |
-LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
-   |                 -- lifetime `'a` defined here
-...
-LL |         s
-   |         ^ returning this value requires that `'a` must outlive `'static`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/lub-if.rs b/src/test/ui/lub-if.rs
deleted file mode 100644 (file)
index 132b838..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-// Test that we correctly consider the type of `match` to be the LUB
-// of the various arms, particularly in the case where regions are
-// involved.
-
-pub fn opt_str0<'a>(maybestr: &'a Option<String>) -> &'a str {
-    if maybestr.is_none() {
-        "(none)"
-    } else {
-        let s: &'a str = maybestr.as_ref().unwrap();
-        s
-    }
-}
-
-pub fn opt_str1<'a>(maybestr: &'a Option<String>) -> &'a str {
-    if maybestr.is_some() {
-        let s: &'a str = maybestr.as_ref().unwrap();
-        s
-    } else {
-        "(none)"
-    }
-}
-
-pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
-    if maybestr.is_none() {
-        "(none)"
-    } else {
-        let s: &'a str = maybestr.as_ref().unwrap();
-        s  //~ ERROR E0312
-    }
-}
-
-pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
-    if maybestr.is_some() {
-        let s: &'a str = maybestr.as_ref().unwrap();
-        s  //~ ERROR E0312
-    } else {
-        "(none)"
-    }
-}
-
-
-fn main() {}
diff --git a/src/test/ui/lub-if.stderr b/src/test/ui/lub-if.stderr
deleted file mode 100644 (file)
index a12c485..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-error[E0312]: lifetime of reference outlives lifetime of borrowed content...
-  --> $DIR/lub-if.rs:28:9
-   |
-LL |         s
-   |         ^
-   |
-   = note: ...the reference is valid for the static lifetime...
-note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
-  --> $DIR/lub-if.rs:23:17
-   |
-LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
-   |                 ^^
-
-error[E0312]: lifetime of reference outlives lifetime of borrowed content...
-  --> $DIR/lub-if.rs:35:9
-   |
-LL |         s
-   |         ^
-   |
-   = note: ...the reference is valid for the static lifetime...
-note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
-  --> $DIR/lub-if.rs:32:17
-   |
-LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
-   |                 ^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0312`.
index bdee5f4d872a8e73cc9af80a59cf77dd03cbd5e3..6de7ffb2f635b2f971ba37188d165c4cd6d22078 100644 (file)
@@ -2,13 +2,14 @@ warning: unused attribute
   --> $DIR/macro-use-all-and-none.rs:7:1
    |
 LL | #[macro_use()]
-   | ^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^ help: remove this attribute
    |
 note: the lint level is defined here
   --> $DIR/macro-use-all-and-none.rs:4:9
    |
 LL | #![warn(unused_attributes)]
    |         ^^^^^^^^^^^^^^^^^
+   = note: attribute `macro_use` with an empty list has no effect
 
 warning: 1 warning emitted
 
diff --git a/src/test/ui/map-types.rs b/src/test/ui/map-types.rs
deleted file mode 100644 (file)
index dc33b96..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-use std::collections::HashMap;
-
-
-
-trait Map<K, V>
-{
-    fn get(&self, k: K) -> V { panic!() }
-}
-
-impl<K, V> Map<K, V> for HashMap<K, V> {}
-
-// Test that trait types printed in error msgs include the type arguments.
-
-fn main() {
-    let x: Box<HashMap<isize, isize>> = HashMap::new().into();
-    let x: Box<dyn Map<isize, isize>> = x;
-    let y: Box<dyn Map<usize, isize>> = Box::new(x);
-    //~^ ERROR `Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied
-}
diff --git a/src/test/ui/map-types.stderr b/src/test/ui/map-types.stderr
deleted file mode 100644 (file)
index 71006e1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0277]: the trait bound `Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied
-  --> $DIR/map-types.rs:17:41
-   |
-LL |     let y: Box<dyn Map<usize, isize>> = Box::new(x);
-   |                                         ^^^^^^^^^^^ the trait `Map<usize, isize>` is not implemented for `Box<dyn Map<isize, isize>>`
-   |
-   = note: required for the cast to the object type `dyn Map<usize, isize>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
index c1cc6cdaf53fa3b4106d0886751de0480102f3d8..2eeab801e3d9c4914ecf8b9405e4f47bbdeabbfa 100644 (file)
@@ -11,11 +11,6 @@ LL | impl<'a> A for (&'static (), &'a ()) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 LL | impl<'a> A for (&'a (), &'static ()) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `A`
-  --> $DIR/region-overlap.rs:4:1
-   |
-LL | trait A {}
-   | ^^^^^^^ required by this bound in `A`
 
 error[E0283]: type annotations needed
   --> $DIR/region-overlap.rs:6:10
@@ -30,11 +25,6 @@ LL | impl<'a> A for (&'static (), &'a ()) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 LL | impl<'a> A for (&'a (), &'static ()) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `A`
-  --> $DIR/region-overlap.rs:4:1
-   |
-LL | trait A {}
-   | ^^^^^^^ required by this bound in `A`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/match-on-negative-integer-ranges.rs b/src/test/ui/match-on-negative-integer-ranges.rs
deleted file mode 100644 (file)
index 53e9ea9..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-pass
-
-fn main() {
-    assert_eq!(false, match -50_i8 { -128i8..=-101i8 => true, _ => false, });
-
-    assert_eq!(false, if let -128i8..=-101i8 = -50_i8 { true } else { false });
-}
diff --git a/src/test/ui/match/issue-91058.rs b/src/test/ui/match/issue-91058.rs
new file mode 100644 (file)
index 0000000..4845937
--- /dev/null
@@ -0,0 +1,11 @@
+struct S(());
+
+fn main() {
+    let array = [S(())];
+
+    match array {
+        [()] => {}
+        //~^ ERROR mismatched types [E0308]
+        _ => {}
+    }
+}
diff --git a/src/test/ui/match/issue-91058.stderr b/src/test/ui/match/issue-91058.stderr
new file mode 100644 (file)
index 0000000..ec1d7e2
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-91058.rs:7:10
+   |
+LL |     match array {
+   |           ----- this expression has type `[S; 1]`
+LL |         [()] => {}
+   |          ^^ expected struct `S`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/match/match-on-negative-integer-ranges.rs b/src/test/ui/match/match-on-negative-integer-ranges.rs
new file mode 100644 (file)
index 0000000..53e9ea9
--- /dev/null
@@ -0,0 +1,7 @@
+// run-pass
+
+fn main() {
+    assert_eq!(false, match -50_i8 { -128i8..=-101i8 => true, _ => false, });
+
+    assert_eq!(false, if let -128i8..=-101i8 = -50_i8 { true } else { false });
+}
diff --git a/src/test/ui/matches2021.rs b/src/test/ui/matches2021.rs
deleted file mode 100644 (file)
index 9143a8c..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-// edition:2021
-
-// regression test for https://github.com/rust-lang/rust/pull/85678
-
-#![feature(assert_matches)]
-
-use std::assert_matches::assert_matches;
-
-fn main() {
-    assert!(matches!((), ()));
-    assert_matches!((), ());
-}
diff --git a/src/test/ui/maybe-bounds-where.rs b/src/test/ui/maybe-bounds-where.rs
deleted file mode 100644 (file)
index d7af0c4..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-struct S1<T>(T) where (T): ?Sized;
-//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
-
-struct S2<T>(T) where u8: ?Sized;
-//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
-
-struct S3<T>(T) where &'static T: ?Sized;
-//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
-
-trait Trait<'a> {}
-
-struct S4<T>(T) where for<'a> T: ?Trait<'a>;
-//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
-//~| WARN default bound relaxed for a type parameter
-
-struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
-//~^ ERROR type parameter has more than one relaxed default bound
-//~| WARN default bound relaxed for a type parameter
-
-impl<T> S1<T> {
-    fn f() where T: ?Sized {}
-    //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
-}
-
-fn main() {
-    let u = vec![1, 2, 3];
-    let _s: S5<[u8]> = S5(&u[..]); // OK
-}
diff --git a/src/test/ui/maybe-bounds-where.stderr b/src/test/ui/maybe-bounds-where.stderr
deleted file mode 100644 (file)
index 39bc1b8..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-error: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:1:28
-   |
-LL | struct S1<T>(T) where (T): ?Sized;
-   |                            ^^^^^^
-
-error: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:4:27
-   |
-LL | struct S2<T>(T) where u8: ?Sized;
-   |                           ^^^^^^
-
-error: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:7:35
-   |
-LL | struct S3<T>(T) where &'static T: ?Sized;
-   |                                   ^^^^^^
-
-error: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:12:34
-   |
-LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
-   |                                  ^^^^^^^^^^
-
-error: `?Trait` bounds are only permitted at the point where a type parameter is declared
-  --> $DIR/maybe-bounds-where.rs:21:21
-   |
-LL |     fn f() where T: ?Sized {}
-   |                     ^^^^^^
-
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
-  --> $DIR/maybe-bounds-where.rs:12:11
-   |
-LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
-   |           ^
-
-error[E0203]: type parameter has more than one relaxed default bound, only one is supported
-  --> $DIR/maybe-bounds-where.rs:16:11
-   |
-LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
-   |           ^
-
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
-  --> $DIR/maybe-bounds-where.rs:16:11
-   |
-LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
-   |           ^
-
-error: aborting due to 6 previous errors; 2 warnings emitted
-
-For more information about this error, try `rustc --explain E0203`.
diff --git a/src/test/ui/minmax-stability-issue-23687.rs b/src/test/ui/minmax-stability-issue-23687.rs
deleted file mode 100644 (file)
index 9100bfb..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// run-pass
-
-use std::fmt::Debug;
-use std::cmp::{self, PartialOrd, Ordering};
-
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-struct Foo {
-    n: u8,
-    name: &'static str
-}
-
-impl PartialOrd for Foo {
-    fn partial_cmp(&self, other: &Foo) -> Option<Ordering> {
-        Some(self.cmp(other))
-    }
-}
-
-impl Ord for Foo {
-    fn cmp(&self, other: &Foo) -> Ordering {
-        self.n.cmp(&other.n)
-    }
-}
-
-fn main() {
-    let a = Foo { n: 4, name: "a" };
-    let b = Foo { n: 4, name: "b" };
-    let c = Foo { n: 8, name: "c" };
-    let d = Foo { n: 8, name: "d" };
-    let e = Foo { n: 22, name: "e" };
-    let f = Foo { n: 22, name: "f" };
-
-    let data = [a, b, c, d, e, f];
-
-    // `min` should return the left when the values are equal
-    assert_eq!(data.iter().min(), Some(&a));
-    assert_eq!(data.iter().min_by_key(|a| a.n), Some(&a));
-    assert_eq!(cmp::min(a, b), a);
-    assert_eq!(cmp::min(b, a), b);
-
-    // `max` should return the right when the values are equal
-    assert_eq!(data.iter().max(), Some(&f));
-    assert_eq!(data.iter().max_by_key(|a| a.n), Some(&f));
-    assert_eq!(cmp::max(e, f), f);
-    assert_eq!(cmp::max(f, e), e);
-
-    let mut presorted = data.to_vec();
-    presorted.sort();
-    assert_stable(&presorted);
-
-    let mut presorted = data.to_vec();
-    presorted.sort_by(|a, b| a.cmp(b));
-    assert_stable(&presorted);
-
-    // Assert that sorted and min/max are the same
-    fn assert_stable<T: Ord + Debug>(presorted: &[T]) {
-        for slice in presorted.windows(2) {
-            let a = &slice[0];
-            let b = &slice[1];
-
-            assert_eq!(a, cmp::min(a, b));
-            assert_eq!(b, cmp::max(a, b));
-        }
-    }
-}
diff --git a/src/test/ui/mir/issue-73914.rs b/src/test/ui/mir/issue-73914.rs
new file mode 100644 (file)
index 0000000..1e99faa
--- /dev/null
@@ -0,0 +1,30 @@
+// build-pass
+// compile-flags:-Copt-level=0
+// edition:2018
+
+struct S<T>(std::marker::PhantomData<T>);
+
+impl<T> std::ops::Deref for S<T> {
+    type Target = T;
+
+    fn deref(&self) -> &Self::Target {
+        todo!()
+    }
+}
+impl<T> std::ops::DerefMut for S<T> {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        todo!()
+    }
+}
+
+async fn new() -> S<u64> {
+    todo!()
+}
+
+async fn crash() {
+    *new().await = 1 + 1;
+}
+
+fn main() {
+    let _ = crash();
+}
index db4e8589291b7023c9848073286930ea2b7f33be..ff1a836c9aec034b7e2cbd5e929b5a190a05b89a 100644 (file)
@@ -26,13 +26,14 @@ error[E0308]: mismatched types
 LL | fn b() -> Option<Foo> {
    |           ----------- expected `Option<Foo>` because of return type
 LL |     Foo { bar: 1 }
-   |     ^^^^^^^^^^^^^^
-   |     |
-   |     expected enum `Option`, found struct `Foo`
-   |     help: try using a variant of the expected enum: `Some(Foo { bar: 1 })`
+   |     ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo`
    |
    = note: expected enum `Option<Foo>`
             found struct `Foo`
+help: try wrapping the expression in `Some`
+   |
+LL |     Some(Foo { bar: 1 })
+   |     +++++              +
 
 error[E0308]: mismatched types
   --> $DIR/abridged.rs:28:5
@@ -40,13 +41,14 @@ error[E0308]: mismatched types
 LL | fn c() -> Result<Foo, Bar> {
    |           ---------------- expected `Result<Foo, Bar>` because of return type
 LL |     Foo { bar: 1 }
-   |     ^^^^^^^^^^^^^^
-   |     |
-   |     expected enum `Result`, found struct `Foo`
-   |     help: try using a variant of the expected enum: `Ok(Foo { bar: 1 })`
+   |     ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo`
    |
    = note: expected enum `Result<Foo, Bar>`
             found struct `Foo`
+help: try wrapping the expression in `Ok`
+   |
+LL |     Ok(Foo { bar: 1 })
+   |     +++              +
 
 error[E0308]: mismatched types
   --> $DIR/abridged.rs:39:5
diff --git a/src/test/ui/mismatched_types/assignment-operator-unimplemented.rs b/src/test/ui/mismatched_types/assignment-operator-unimplemented.rs
new file mode 100644 (file)
index 0000000..21df464
--- /dev/null
@@ -0,0 +1,7 @@
+struct Foo;
+
+fn main() {
+  let mut a = Foo;
+  let ref b = Foo;
+  a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo`
+}
diff --git a/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr b/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr
new file mode 100644 (file)
index 0000000..73c9f86
--- /dev/null
@@ -0,0 +1,28 @@
+error[E0368]: binary assignment operation `+=` cannot be applied to type `Foo`
+  --> $DIR/assignment-operator-unimplemented.rs:6:3
+   |
+LL |   a += *b;
+   |   -^^^^^^
+   |   |
+   |   cannot use `+=` on type `Foo`
+   |
+note: an implementation of `AddAssign<_>` might be missing for `Foo`
+  --> $DIR/assignment-operator-unimplemented.rs:1:1
+   |
+LL | struct Foo;
+   | ^^^^^^^^^^^ must implement `AddAssign<_>`
+note: the following trait must be implemented
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+   |
+LL | / pub trait AddAssign<Rhs = Self> {
+LL | |     /// Performs the `+=` operation.
+LL | |     ///
+LL | |     /// # Example
+...  |
+LL | |     fn add_assign(&mut self, rhs: Rhs);
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0368`.
index e8fcf80e940d29b7c152fd791fa359e9978f2002..fed47e0f1747179ba5fe92d5a06ddabfd0e4074c 100644 (file)
@@ -125,6 +125,12 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
 ...
 LL | fn foo() {}
    | -------- takes 0 arguments
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
   --> $DIR/closure-arg-count.rs:27:57
@@ -135,6 +141,12 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
    |                                                     --- ^^^ expected closure that takes a single 2-tuple as argument
    |                                                     |
    |                                                     required by a bound introduced by this call
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
   --> $DIR/closure-arg-count.rs:29:57
@@ -146,6 +158,12 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
 ...
 LL | fn qux(x: usize, y: usize) {}
    | -------------------------- takes 2 distinct arguments
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
   --> $DIR/closure-arg-count.rs:32:45
@@ -154,6 +172,12 @@ LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
    |                                         --- ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument
    |                                         |
    |                                         required by a bound introduced by this call
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
   --> $DIR/closure-arg-count.rs:35:10
index 6ed91b20ab8a6f88815d0f18fd3b8f3cd5918f53..1f46229cb5a6a666f4a7345513f1b3f3178f1eb3 100644 (file)
@@ -5,6 +5,12 @@ LL |     a.iter().map(|_: (u32, u32)| 45);
    |              ^^^ ------------------ found signature of `fn((u32, u32)) -> _`
    |              |
    |              expected signature of `fn(&(u32, u32)) -> _`
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error[E0631]: type mismatch in closure arguments
   --> $DIR/closure-arg-type-mismatch.rs:4:14
@@ -13,6 +19,12 @@ LL |     a.iter().map(|_: &(u16, u16)| 45);
    |              ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _`
    |              |
    |              expected signature of `fn(&(u32, u32)) -> _`
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error[E0631]: type mismatch in closure arguments
   --> $DIR/closure-arg-type-mismatch.rs:5:14
@@ -21,6 +33,12 @@ LL |     a.iter().map(|_: (u16, u16)| 45);
    |              ^^^ ------------------ found signature of `fn((u16, u16)) -> _`
    |              |
    |              expected signature of `fn(&(u32, u32)) -> _`
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error: aborting due to 3 previous errors
 
index 0ec282dac45e21a45579eb3f02f5c3c4a46d77cb..f34ac35c75713764f7d76ffc5049dd49a9dea380 100644 (file)
@@ -5,6 +5,12 @@ LL |     a.iter().map(|_: (u32, u32)| 45);
    |              ^^^ ------------------ found signature of `fn((u32, u32)) -> _`
    |              |
    |              expected signature of `fn(&(u32, u32)) -> _`
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error[E0631]: type mismatch in closure arguments
   --> $DIR/closure-arg-type-mismatch.rs:4:14
@@ -13,6 +19,12 @@ LL |     a.iter().map(|_: &(u16, u16)| 45);
    |              ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _`
    |              |
    |              expected signature of `fn(&(u32, u32)) -> _`
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error[E0631]: type mismatch in closure arguments
   --> $DIR/closure-arg-type-mismatch.rs:5:14
@@ -21,6 +33,12 @@ LL |     a.iter().map(|_: (u16, u16)| 45);
    |              ^^^ ------------------ found signature of `fn((u16, u16)) -> _`
    |              |
    |              expected signature of `fn(&(u32, u32)) -> _`
+   |
+note: required by a bound in `map`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         F: FnMut(Self::Item) -> B,
+   |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
 
 error[E0308]: mismatched types
   --> $DIR/closure-arg-type-mismatch.rs:10:5
diff --git a/src/test/ui/mismatched_types/float-literal-inference-restrictions.rs b/src/test/ui/mismatched_types/float-literal-inference-restrictions.rs
new file mode 100644 (file)
index 0000000..34079b6
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {
+    let x: f32 = 1; //~ ERROR mismatched types
+    let y: f32 = 1f64; //~ ERROR mismatched types
+}
diff --git a/src/test/ui/mismatched_types/float-literal-inference-restrictions.stderr b/src/test/ui/mismatched_types/float-literal-inference-restrictions.stderr
new file mode 100644 (file)
index 0000000..454373c
--- /dev/null
@@ -0,0 +1,26 @@
+error[E0308]: mismatched types
+  --> $DIR/float-literal-inference-restrictions.rs:2:18
+   |
+LL |     let x: f32 = 1;
+   |            ---   ^
+   |            |     |
+   |            |     expected `f32`, found integer
+   |            |     help: use a float literal: `1.0`
+   |            expected due to this
+
+error[E0308]: mismatched types
+  --> $DIR/float-literal-inference-restrictions.rs:3:18
+   |
+LL |     let y: f32 = 1f64;
+   |            ---   ^^^^ expected `f32`, found `f64`
+   |            |
+   |            expected due to this
+   |
+help: change the type of the numeric literal from `f64` to `f32`
+   |
+LL |     let y: f32 = 1f32;
+   |                   ~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
index 67e8ee2283689d9c2d09d942005c30238d84618a..a8bcdf5efe91e30214a5f24f844e1d80dfd2f79a 100644 (file)
@@ -5,6 +5,12 @@ LL |     once::<&str>("str").fuse().filter(|a: &str| true).count();
    |                                ^^^^^^ -------------- found signature of `for<'r> fn(&'r str) -> _`
    |                                |
    |                                expected signature of `for<'r> fn(&'r &str) -> _`
+   |
+note: required by a bound in `filter`
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |         P: FnMut(&Self::Item) -> bool,
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `filter`
 
 error[E0599]: the method `count` exists for struct `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>`, but its trait bounds were not satisfied
   --> $DIR/issue-36053-2.rs:7:55
diff --git a/src/test/ui/missing-trait-bounds/auxiliary/issue-69725.rs b/src/test/ui/missing-trait-bounds/auxiliary/issue-69725.rs
new file mode 100644 (file)
index 0000000..13606e4
--- /dev/null
@@ -0,0 +1,8 @@
+#[derive(Clone)]
+pub struct Struct<A>(A);
+
+impl<A> Struct<A> {
+    pub fn new() -> Self {
+        todo!()
+    }
+}
diff --git a/src/test/ui/missing-trait-bounds/issue-35677.fixed b/src/test/ui/missing-trait-bounds/issue-35677.fixed
new file mode 100644 (file)
index 0000000..08174d8
--- /dev/null
@@ -0,0 +1,11 @@
+// run-rustfix
+#![allow(dead_code)]
+use std::collections::HashSet;
+use std::hash::Hash;
+
+fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool where T: Eq, T: Hash {
+    this.is_subset(other)
+    //~^ ERROR the method
+}
+
+fn main() {}
diff --git a/src/test/ui/missing-trait-bounds/issue-35677.rs b/src/test/ui/missing-trait-bounds/issue-35677.rs
new file mode 100644 (file)
index 0000000..2cb3943
--- /dev/null
@@ -0,0 +1,11 @@
+// run-rustfix
+#![allow(dead_code)]
+use std::collections::HashSet;
+use std::hash::Hash;
+
+fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool {
+    this.is_subset(other)
+    //~^ ERROR the method
+}
+
+fn main() {}
diff --git a/src/test/ui/missing-trait-bounds/issue-35677.stderr b/src/test/ui/missing-trait-bounds/issue-35677.stderr
new file mode 100644 (file)
index 0000000..a2201b9
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0599]: the method `is_subset` exists for reference `&HashSet<T>`, but its trait bounds were not satisfied
+  --> $DIR/issue-35677.rs:7:10
+   |
+LL |     this.is_subset(other)
+   |          ^^^^^^^^^ method cannot be called on `&HashSet<T>` due to unsatisfied trait bounds
+   |
+   = note: the following trait bounds were not satisfied:
+           `T: Eq`
+           `T: Hash`
+help: consider restricting the type parameters to satisfy the trait bounds
+   |
+LL | fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool where T: Eq, T: Hash {
+   |                                                                ++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/missing-trait-bounds/issue-69725.fixed b/src/test/ui/missing-trait-bounds/issue-69725.fixed
new file mode 100644 (file)
index 0000000..d57badc
--- /dev/null
@@ -0,0 +1,13 @@
+// run-rustfix
+// aux-build:issue-69725.rs
+#![allow(dead_code)]
+
+extern crate issue_69725;
+use issue_69725::Struct;
+
+fn crash<A>() where A: Clone {
+    let _ = Struct::<A>::new().clone();
+    //~^ ERROR: the method
+}
+
+fn main() {}
diff --git a/src/test/ui/missing-trait-bounds/issue-69725.rs b/src/test/ui/missing-trait-bounds/issue-69725.rs
new file mode 100644 (file)
index 0000000..9c88969
--- /dev/null
@@ -0,0 +1,13 @@
+// run-rustfix
+// aux-build:issue-69725.rs
+#![allow(dead_code)]
+
+extern crate issue_69725;
+use issue_69725::Struct;
+
+fn crash<A>() {
+    let _ = Struct::<A>::new().clone();
+    //~^ ERROR: the method
+}
+
+fn main() {}
diff --git a/src/test/ui/missing-trait-bounds/issue-69725.stderr b/src/test/ui/missing-trait-bounds/issue-69725.stderr
new file mode 100644 (file)
index 0000000..6395bca
--- /dev/null
@@ -0,0 +1,22 @@
+error[E0599]: the method `clone` exists for struct `Struct<A>`, but its trait bounds were not satisfied
+  --> $DIR/issue-69725.rs:9:32
+   |
+LL |     let _ = Struct::<A>::new().clone();
+   |                                ^^^^^ method cannot be called on `Struct<A>` due to unsatisfied trait bounds
+   |
+  ::: $DIR/auxiliary/issue-69725.rs:2:1
+   |
+LL | pub struct Struct<A>(A);
+   | ------------------------ doesn't satisfy `Struct<A>: Clone`
+   |
+   = note: the following trait bounds were not satisfied:
+           `A: Clone`
+           which is required by `Struct<A>: Clone`
+help: consider restricting the type parameter to satisfy the trait bound
+   |
+LL | fn crash<A>() where A: Clone {
+   |               ++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.fixed b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.fixed
new file mode 100644 (file)
index 0000000..6b24375
--- /dev/null
@@ -0,0 +1,7 @@
+// run-rustfix
+
+pub fn foo<T: std::cmp::PartialEq>(s: &[T], t: &[T]) {
+    let _ = s == t; //~ ERROR binary operation `==` cannot be applied to type `&[T]`
+}
+
+fn main() {}
diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.rs b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.rs
new file mode 100644 (file)
index 0000000..df47be0
--- /dev/null
@@ -0,0 +1,7 @@
+// run-rustfix
+
+pub fn foo<T>(s: &[T], t: &[T]) {
+    let _ = s == t; //~ ERROR binary operation `==` cannot be applied to type `&[T]`
+}
+
+fn main() {}
diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr
new file mode 100644 (file)
index 0000000..cde0755
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0369]: binary operation `==` cannot be applied to type `&[T]`
+  --> $DIR/missing-trait-bound-for-op.rs:4:15
+   |
+LL |     let _ = s == t;
+   |             - ^^ - &[T]
+   |             |
+   |             &[T]
+   |
+help: consider restricting type parameter `T`
+   |
+LL | pub fn foo<T: std::cmp::PartialEq>(s: &[T], t: &[T]) {
+   |             +++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs
new file mode 100644 (file)
index 0000000..afd47f7
--- /dev/null
@@ -0,0 +1,31 @@
+#[derive(Default, PartialEq)]
+struct Foo<T> {
+    bar: Box<[T]>,
+}
+
+trait Bar {
+    fn foo(&self) {}
+}
+
+impl<T: Default + Bar> Bar for Foo<T> {}
+
+impl<T> Foo<T> {
+    fn bar(&self) {
+        self.foo();
+        //~^ ERROR the method
+    }
+}
+
+struct Fin<T> where T: Bar {
+    bar: Box<[T]>,
+}
+
+impl<T: Default + Bar> Bar for Fin<T> {}
+
+impl<T: Bar> Fin<T> {
+    fn bar(&self) {
+        self.foo();
+        //~^ ERROR the method
+    }
+}
+fn main() {}
diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr
new file mode 100644 (file)
index 0000000..2f0fd69
--- /dev/null
@@ -0,0 +1,39 @@
+error[E0599]: the method `foo` exists for reference `&Foo<T>`, but its trait bounds were not satisfied
+  --> $DIR/missing-trait-bounds-for-method-call.rs:14:14
+   |
+LL | struct Foo<T> {
+   | ------------- doesn't satisfy `Foo<T>: Bar`
+...
+LL |         self.foo();
+   |              ^^^ method cannot be called on `&Foo<T>` due to unsatisfied trait bounds
+   |
+   = note: the following trait bounds were not satisfied:
+           `T: Default`
+           which is required by `Foo<T>: Bar`
+           `T: Bar`
+           which is required by `Foo<T>: Bar`
+help: consider restricting the type parameters to satisfy the trait bounds
+   |
+LL | struct Foo<T> where T: Bar, T: Default {
+   |               ++++++++++++++++++++++++
+
+error[E0599]: the method `foo` exists for reference `&Fin<T>`, but its trait bounds were not satisfied
+  --> $DIR/missing-trait-bounds-for-method-call.rs:27:14
+   |
+LL | struct Fin<T> where T: Bar {
+   | -------------------------- doesn't satisfy `Fin<T>: Bar`
+...
+LL |         self.foo();
+   |              ^^^ method cannot be called on `&Fin<T>` due to unsatisfied trait bounds
+   |
+   = note: the following trait bounds were not satisfied:
+           `T: Default`
+           which is required by `Fin<T>: Bar`
+help: consider restricting the type parameter to satisfy the trait bound
+   |
+LL | struct Fin<T> where T: Bar, T: Default {
+   |                           ++++++++++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0599`.
index 163651a7ef607465170a0bd2dc6246517ef2bb4e..0a20f5fe98562f6827ee378aa57d66c77a0991df 100644 (file)
@@ -5,7 +5,7 @@ macro_rules! import {
             mod $name;
             pub use self::$name;
             //~^ ERROR the name `issue_56411_aux` is defined multiple times
-            //~| ERROR `issue_56411_aux` is private, and cannot be re-exported
+            //~| ERROR `issue_56411_aux` is only public within the crate, and cannot be re-exported outside
 
         )*
     }
index 5ab4542b0402bc7e4b460c31156084998183ac69..6732a8a3d7324ea383bf5bb7181954bfba5a66d9 100644 (file)
@@ -15,11 +15,11 @@ LL | import!(("issue-56411-aux.rs", issue_56411_aux));
    = note: `issue_56411_aux` must be defined only once in the type namespace of this module
    = note: this error originates in the macro `import` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0365]: `issue_56411_aux` is private, and cannot be re-exported
+error[E0365]: `issue_56411_aux` is only public within the crate, and cannot be re-exported outside
   --> $DIR/issue-56411.rs:6:21
    |
 LL |             pub use self::$name;
-   |                     ^^^^^^^^^^^ re-export of private `issue_56411_aux`
+   |                     ^^^^^^^^^^^ re-export of crate public `issue_56411_aux`
 ...
 LL | import!(("issue-56411-aux.rs", issue_56411_aux));
    | ------------------------------------------------ in this macro invocation
diff --git a/src/test/ui/moves/move-of-addr-of-mut.rs b/src/test/ui/moves/move-of-addr-of-mut.rs
new file mode 100644 (file)
index 0000000..f2f64e4
--- /dev/null
@@ -0,0 +1,12 @@
+// Ensure that taking a mutable raw ptr to an uninitialized variable does not change its
+// initializedness.
+
+struct S;
+
+fn main() {
+    let mut x: S;
+    std::ptr::addr_of_mut!(x); //~ borrow of
+
+    let y = x; // Should error here if `addr_of_mut` is ever allowed on uninitialized variables
+    drop(y);
+}
diff --git a/src/test/ui/moves/move-of-addr-of-mut.stderr b/src/test/ui/moves/move-of-addr-of-mut.stderr
new file mode 100644 (file)
index 0000000..ce8fb02
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0381]: borrow of possibly-uninitialized variable: `x`
+  --> $DIR/move-of-addr-of-mut.rs:8:5
+   |
+LL |     std::ptr::addr_of_mut!(x);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly-uninitialized `x`
+   |
+   = note: this error originates in the macro `std::ptr::addr_of_mut` (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 E0381`.
diff --git a/src/test/ui/multi-panic.rs b/src/test/ui/multi-panic.rs
deleted file mode 100644 (file)
index 37e8b99..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// run-pass
-// ignore-emscripten no processes
-// ignore-sgx no processes
-
-fn check_for_no_backtrace(test: std::process::Output) {
-    assert!(!test.status.success());
-    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(), 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(), None);
-}
-
-fn main() {
-    let args: Vec<String> = std::env::args().collect();
-    if args.len() > 1 && args[1] == "run_test" {
-        let _ = std::thread::spawn(|| {
-            panic!();
-        }).join();
-
-        panic!();
-    } else {
-        let test = std::process::Command::new(&args[0]).arg("run_test")
-                                                       .env_remove("RUST_BACKTRACE")
-                                                       .output()
-                                                       .unwrap();
-        check_for_no_backtrace(test);
-        let test = std::process::Command::new(&args[0]).arg("run_test")
-                                                       .env("RUST_BACKTRACE","0")
-                                                       .output()
-                                                       .unwrap();
-        check_for_no_backtrace(test);
-    }
-}
diff --git a/src/test/ui/native-print-no-runtime.rs b/src/test/ui/native-print-no-runtime.rs
deleted file mode 100644 (file)
index f17c9fa..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-pass
-
-#![feature(start)]
-
-#[start]
-pub fn main(_: isize, _: *const *const u8) -> isize {
-    println!("hello");
-    0
-}
index 614cdff1f80222fd553404239db09f1c36b02e27..a14253e384a3a52f9cf27e4068b14099ab83cb93 100644 (file)
@@ -6,11 +6,6 @@ LL |     <E as From<_>>::from(never);
    |
    = help: the following implementations were found:
              <E as From<!>>
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/newlambdas-ret-infer.rs b/src/test/ui/newlambdas-ret-infer.rs
deleted file mode 100644 (file)
index 9b62983..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-
-#![allow(dead_code)]
-// Test that the lambda kind is inferred correctly as a return
-// expression
-
-// pretty-expanded FIXME #23616
-
-fn unique() -> Box<dyn FnMut()+'static> { return Box::new(|| ()); }
-
-pub fn main() {
-}
diff --git a/src/test/ui/newlambdas-ret-infer2.rs b/src/test/ui/newlambdas-ret-infer2.rs
deleted file mode 100644 (file)
index abe31a0..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-
-#![allow(dead_code)]
-// Test that the lambda kind is inferred correctly as a return
-// expression
-
-// pretty-expanded FIXME #23616
-
-fn unique() -> Box<dyn FnMut()+'static> { Box::new(|| ()) }
-
-pub fn main() {
-}
diff --git a/src/test/ui/newtype-temporary.rs b/src/test/ui/newtype-temporary.rs
deleted file mode 100644 (file)
index 8ee75b2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-
-#[derive(PartialEq, Debug)]
-struct Foo(usize);
-
-fn foo() -> Foo {
-    Foo(42)
-}
-
-pub fn main() {
-    assert_eq!(foo(), Foo(42));
-}
index 88773def8b7c840e44fab37dc429a407f0c0fa8f..fad6121cbca52f4da0e2c0031dea932e322e78ea 100644 (file)
@@ -2,7 +2,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
   --> $DIR/dont-print-desugared.rs:4:10
    |
 LL |     for &ref mut x in s {}
-   |          ^^^^^^^^^ cannot borrow as mutable through `&` reference
+   |          ^^^^^^^^^ cannot borrow as mutable
 
 error[E0597]: `y` does not live long enough
   --> $DIR/dont-print-desugared.rs:17:16
index 11cd423295aaef93134fe8341c34b93bab558b32..90cba2a145f5592fbdfb7f2b42dc81753b3f143f 100644 (file)
@@ -2,12 +2,10 @@ 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
 LL |
 LL |     }
    |     - here, drop of `child` needs exclusive access to `*child.raw`, because the type `C<'_>` implements the `Drop` trait
-LL |     members.len();
-   |     ------------- borrow later used here
    |
    = note: consider using a `let` binding to create a longer lived value
 
diff --git a/src/test/ui/nll/lub-if.nll.stderr b/src/test/ui/nll/lub-if.nll.stderr
new file mode 100644 (file)
index 0000000..832688f
--- /dev/null
@@ -0,0 +1,20 @@
+error: lifetime may not live long enough
+  --> $DIR/lub-if.rs:28:9
+   |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |         s
+   |         ^ returning this value requires that `'a` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/lub-if.rs:35:9
+   |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 -- lifetime `'a` defined here
+...
+LL |         s
+   |         ^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/nll/lub-if.rs b/src/test/ui/nll/lub-if.rs
new file mode 100644 (file)
index 0000000..132b838
--- /dev/null
@@ -0,0 +1,42 @@
+// Test that we correctly consider the type of `match` to be the LUB
+// of the various arms, particularly in the case where regions are
+// involved.
+
+pub fn opt_str0<'a>(maybestr: &'a Option<String>) -> &'a str {
+    if maybestr.is_none() {
+        "(none)"
+    } else {
+        let s: &'a str = maybestr.as_ref().unwrap();
+        s
+    }
+}
+
+pub fn opt_str1<'a>(maybestr: &'a Option<String>) -> &'a str {
+    if maybestr.is_some() {
+        let s: &'a str = maybestr.as_ref().unwrap();
+        s
+    } else {
+        "(none)"
+    }
+}
+
+pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+    if maybestr.is_none() {
+        "(none)"
+    } else {
+        let s: &'a str = maybestr.as_ref().unwrap();
+        s  //~ ERROR E0312
+    }
+}
+
+pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+    if maybestr.is_some() {
+        let s: &'a str = maybestr.as_ref().unwrap();
+        s  //~ ERROR E0312
+    } else {
+        "(none)"
+    }
+}
+
+
+fn main() {}
diff --git a/src/test/ui/nll/lub-if.stderr b/src/test/ui/nll/lub-if.stderr
new file mode 100644 (file)
index 0000000..a12c485
--- /dev/null
@@ -0,0 +1,29 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/lub-if.rs:28:9
+   |
+LL |         s
+   |         ^
+   |
+   = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
+  --> $DIR/lub-if.rs:23:17
+   |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 ^^
+
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/lub-if.rs:35:9
+   |
+LL |         s
+   |         ^
+   |
+   = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
+  --> $DIR/lub-if.rs:32:17
+   |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+   |                 ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0312`.
diff --git a/src/test/ui/no-mangle-associated-fn.rs b/src/test/ui/no-mangle-associated-fn.rs
deleted file mode 100644 (file)
index ecd44ab..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// aux-build: no-mangle-associated-fn.rs
-// run-pass
-
-extern crate no_mangle_associated_fn;
-
-struct Foo;
-
-impl Foo {
-    #[no_mangle]
-    fn foo() -> u8 {
-        1
-    }
-}
-
-trait Bar {
-    fn qux() -> u8;
-}
-
-impl Bar for Foo {
-    #[no_mangle]
-    fn qux() -> u8 {
-        4
-    }
-}
-
-fn main() {
-    extern "Rust" {
-        fn foo() -> u8;
-        fn bar() -> u8;
-        fn baz() -> u8;
-        fn qux() -> u8;
-    }
-    assert_eq!(unsafe { foo() }, 1);
-    assert_eq!(unsafe { bar() }, 2);
-    assert_eq!(unsafe { baz() }, 3);
-    assert_eq!(unsafe { qux() }, 4);
-}
diff --git a/src/test/ui/no-std-1.rs b/src/test/ui/no-std-1.rs
deleted file mode 100644 (file)
index 5b59e9b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-pass
-
-#![no_std]
-
-extern crate std;
-
-fn main() {
-    let a = Some("foo");
-    a.unwrap();
-}
diff --git a/src/test/ui/no-std-2.rs b/src/test/ui/no-std-2.rs
deleted file mode 100644 (file)
index 487d416..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-pass
-
-#![no_std]
-
-extern crate std;
-
-fn main() {
-    let a = core::option::Option::Some("foo");
-    a.unwrap();
-}
diff --git a/src/test/ui/no-std-3.rs b/src/test/ui/no-std-3.rs
deleted file mode 100644 (file)
index f6c4ed5..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// run-pass
-
-#![no_std]
-
-extern crate std;
-
-mod foo {
-    pub fn test() -> Option<i32> {
-        Some(2)
-    }
-}
-
-fn main() {
-    let a = core::option::Option::Some("foo");
-    a.unwrap();
-    foo::test().unwrap();
-}
diff --git a/src/test/ui/no-stdio.rs b/src/test/ui/no-stdio.rs
deleted file mode 100644 (file)
index 2498538..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-// run-pass
-// ignore-android
-// ignore-emscripten no processes
-// ignore-sgx no processes
-// revisions: mir thir
-// [thir]compile-flags: -Zthir-unsafeck
-
-#![feature(rustc_private)]
-
-extern crate libc;
-
-use std::process::{Command, Stdio};
-use std::env;
-use std::io::{self, Read, Write};
-
-#[cfg(unix)]
-unsafe fn without_stdio<R, F: FnOnce() -> R>(f: F) -> R {
-    let doit = |a| {
-        let r = libc::dup(a);
-        assert!(r >= 0);
-        return r
-    };
-    let a = doit(0);
-    let b = doit(1);
-    let c = doit(2);
-
-    assert!(libc::close(0) >= 0);
-    assert!(libc::close(1) >= 0);
-    assert!(libc::close(2) >= 0);
-
-    let r = f();
-
-    assert!(libc::dup2(a, 0) >= 0);
-    assert!(libc::dup2(b, 1) >= 0);
-    assert!(libc::dup2(c, 2) >= 0);
-
-    return r
-}
-
-#[cfg(unix)]
-fn assert_fd_is_valid(fd: libc::c_int) {
-    if unsafe { libc::fcntl(fd, libc::F_GETFD) == -1 } {
-        panic!("file descriptor {} is not valid: {}", fd, io::Error::last_os_error());
-    }
-}
-
-#[cfg(windows)]
-fn assert_fd_is_valid(_fd: libc::c_int) {}
-
-#[cfg(windows)]
-unsafe fn without_stdio<R, F: FnOnce() -> R>(f: F) -> R {
-    type DWORD = u32;
-    type HANDLE = *mut u8;
-    type BOOL = i32;
-
-    const STD_INPUT_HANDLE: DWORD = -10i32 as DWORD;
-    const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD;
-    const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
-    const INVALID_HANDLE_VALUE: HANDLE = !0 as HANDLE;
-
-    extern "system" {
-        fn GetStdHandle(which: DWORD) -> HANDLE;
-        fn SetStdHandle(which: DWORD, handle: HANDLE) -> BOOL;
-    }
-
-    let doit = |id| {
-        let handle = GetStdHandle(id);
-        assert!(handle != INVALID_HANDLE_VALUE);
-        assert!(SetStdHandle(id, INVALID_HANDLE_VALUE) != 0);
-        return handle
-    };
-
-    let a = doit(STD_INPUT_HANDLE);
-    let b = doit(STD_OUTPUT_HANDLE);
-    let c = doit(STD_ERROR_HANDLE);
-
-    let r = f();
-
-    let doit = |id, handle| {
-        assert!(SetStdHandle(id, handle) != 0);
-    };
-    doit(STD_INPUT_HANDLE, a);
-    doit(STD_OUTPUT_HANDLE, b);
-    doit(STD_ERROR_HANDLE, c);
-
-    return r
-}
-
-fn main() {
-    if env::args().len() > 1 {
-        // Writing to stdout & stderr should not panic.
-        println!("test");
-        assert!(io::stdout().write(b"test\n").is_ok());
-        assert!(io::stderr().write(b"test\n").is_ok());
-
-        // Stdin should be at EOF.
-        assert_eq!(io::stdin().read(&mut [0; 10]).unwrap(), 0);
-
-        // Standard file descriptors should be valid on UNIX:
-        assert_fd_is_valid(0);
-        assert_fd_is_valid(1);
-        assert_fd_is_valid(2);
-        return
-    }
-
-    // First, make sure reads/writes without stdio work if stdio itself is
-    // missing.
-    let (a, b, c) = unsafe {
-        without_stdio(|| {
-            let a = io::stdout().write(b"test\n");
-            let b = io::stderr().write(b"test\n");
-            let c = io::stdin().read(&mut [0; 10]);
-
-            (a, b, c)
-        })
-    };
-
-    assert_eq!(a.unwrap(), 5);
-    assert_eq!(b.unwrap(), 5);
-    assert_eq!(c.unwrap(), 0);
-
-    // Second, spawn a child and do some work with "null" descriptors to make
-    // sure it's ok
-    let me = env::current_exe().unwrap();
-    let status = Command::new(&me)
-                        .arg("next")
-                        .stdin(Stdio::null())
-                        .stdout(Stdio::null())
-                        .stderr(Stdio::null())
-                        .status().unwrap();
-    assert!(status.success(), "{} isn't a success", status);
-
-    // Finally, close everything then spawn a child to make sure everything is
-    // *still* ok.
-    let status = unsafe {
-        without_stdio(|| Command::new(&me).arg("next").status())
-    }.unwrap();
-    assert!(status.success(), "{} isn't a success", status);
-}
diff --git a/src/test/ui/no-type-for-node-ice.rs b/src/test/ui/no-type-for-node-ice.rs
deleted file mode 100644 (file)
index d0cfdbf..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// Related issues: #20401, #20506, #20614, #20752, #20829, #20846, #20885, #20886
-
-fn main() {
-    "".homura[""]; //~ no field `homura` on type `&'static str`
-}
diff --git a/src/test/ui/no-type-for-node-ice.stderr b/src/test/ui/no-type-for-node-ice.stderr
deleted file mode 100644 (file)
index b50241f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0609]: no field `homura` on type `&'static str`
-  --> $DIR/no-type-for-node-ice.rs:4:8
-   |
-LL |     "".homura[""];
-   |        ^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/ui/no_send-struct.rs b/src/test/ui/no_send-struct.rs
deleted file mode 100644 (file)
index 75a363f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#![feature(negative_impls)]
-
-use std::marker::Send;
-
-struct Foo {
-    a: isize,
-}
-
-impl !Send for Foo {}
-
-fn bar<T: Send>(_: T) {}
-
-fn main() {
-    let x = Foo { a: 5 };
-    bar(x);
-    //~^ ERROR `Foo` cannot be sent between threads safely
-}
diff --git a/src/test/ui/no_send-struct.stderr b/src/test/ui/no_send-struct.stderr
deleted file mode 100644 (file)
index ee7bdf2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0277]: `Foo` cannot be sent between threads safely
-  --> $DIR/no_send-struct.rs:15:9
-   |
-LL |     bar(x);
-   |     --- ^ `Foo` cannot be sent between threads safely
-   |     |
-   |     required by a bound introduced by this call
-   |
-   = help: the trait `Send` is not implemented for `Foo`
-note: required by a bound in `bar`
-  --> $DIR/no_send-struct.rs:11:11
-   |
-LL | fn bar<T: Send>(_: T) {}
-   |           ^^^^ 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/src/test/ui/non-legacy-modes.rs b/src/test/ui/non-legacy-modes.rs
deleted file mode 100644 (file)
index 38c83e0..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-
-struct X {
-    repr: isize
-}
-
-fn apply<T, F>(x: T, f: F) where F: FnOnce(T) {
-    f(x);
-}
-
-fn check_int(x: isize) {
-    assert_eq!(x, 22);
-}
-
-fn check_struct(x: X) {
-    check_int(x.repr);
-}
-
-pub fn main() {
-    apply(22, check_int);
-    apply(X {repr: 22}, check_struct);
-}
diff --git a/src/test/ui/not-sync.rs b/src/test/ui/not-sync.rs
deleted file mode 100644 (file)
index f464899..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-use std::cell::{Cell, RefCell};
-use std::rc::{Rc, Weak};
-use std::sync::mpsc::{Receiver, Sender};
-
-fn test<T: Sync>() {}
-
-fn main() {
-    test::<Cell<i32>>();
-    //~^ ERROR `Cell<i32>` cannot be shared between threads safely [E0277]
-    test::<RefCell<i32>>();
-    //~^ ERROR `RefCell<i32>` cannot be shared between threads safely [E0277]
-
-    test::<Rc<i32>>();
-    //~^ ERROR `Rc<i32>` cannot be shared between threads safely [E0277]
-    test::<Weak<i32>>();
-    //~^ ERROR `std::rc::Weak<i32>` cannot be shared between threads safely [E0277]
-
-    test::<Receiver<i32>>();
-    //~^ ERROR `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely [E0277]
-    test::<Sender<i32>>();
-    //~^ ERROR `Sender<i32>` cannot be shared between threads safely [E0277]
-}
diff --git a/src/test/ui/not-sync.stderr b/src/test/ui/not-sync.stderr
deleted file mode 100644 (file)
index 1ee358b..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0277]: `Cell<i32>` cannot be shared between threads safely
-  --> $DIR/not-sync.rs:8:12
-   |
-LL |     test::<Cell<i32>>();
-   |            ^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely
-   |
-   = help: the trait `Sync` is not implemented for `Cell<i32>`
-note: required by a bound in `test`
-  --> $DIR/not-sync.rs:5:12
-   |
-LL | fn test<T: Sync>() {}
-   |            ^^^^ required by this bound in `test`
-
-error[E0277]: `RefCell<i32>` cannot be shared between threads safely
-  --> $DIR/not-sync.rs:10:12
-   |
-LL |     test::<RefCell<i32>>();
-   |            ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
-   |
-   = help: the trait `Sync` is not implemented for `RefCell<i32>`
-note: required by a bound in `test`
-  --> $DIR/not-sync.rs:5:12
-   |
-LL | fn test<T: Sync>() {}
-   |            ^^^^ required by this bound in `test`
-
-error[E0277]: `Rc<i32>` cannot be shared between threads safely
-  --> $DIR/not-sync.rs:13:12
-   |
-LL |     test::<Rc<i32>>();
-   |            ^^^^^^^ `Rc<i32>` cannot be shared between threads safely
-   |
-   = help: the trait `Sync` is not implemented for `Rc<i32>`
-note: required by a bound in `test`
-  --> $DIR/not-sync.rs:5:12
-   |
-LL | fn test<T: Sync>() {}
-   |            ^^^^ required by this bound in `test`
-
-error[E0277]: `std::rc::Weak<i32>` cannot be shared between threads safely
-  --> $DIR/not-sync.rs:15:12
-   |
-LL |     test::<Weak<i32>>();
-   |            ^^^^^^^^^ `std::rc::Weak<i32>` cannot be shared between threads safely
-   |
-   = help: the trait `Sync` is not implemented for `std::rc::Weak<i32>`
-note: required by a bound in `test`
-  --> $DIR/not-sync.rs:5:12
-   |
-LL | fn test<T: Sync>() {}
-   |            ^^^^ required by this bound in `test`
-
-error[E0277]: `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely
-  --> $DIR/not-sync.rs:18:12
-   |
-LL |     test::<Receiver<i32>>();
-   |            ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely
-   |
-   = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<i32>`
-note: required by a bound in `test`
-  --> $DIR/not-sync.rs:5:12
-   |
-LL | fn test<T: Sync>() {}
-   |            ^^^^ required by this bound in `test`
-
-error[E0277]: `Sender<i32>` cannot be shared between threads safely
-  --> $DIR/not-sync.rs:20:12
-   |
-LL |     test::<Sender<i32>>();
-   |            ^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely
-   |
-   = help: the trait `Sync` is not implemented for `Sender<i32>`
-note: required by a bound in `test`
-  --> $DIR/not-sync.rs:5:12
-   |
-LL | fn test<T: Sync>() {}
-   |            ^^^^ required by this bound in `test`
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
index a3658f224260633b69b14b9503596b588fb49a56..76aa128e242f922a88fbb099e7139470fa137b81 100644 (file)
@@ -7,11 +7,6 @@ LL |     Index::index(&[] as &[i32], 2u32);
    |     required by a bound introduced by this call
    |
    = help: the trait `Index<u32>` is not implemented for `[i32]`
-note: required by `Index::index`
-  --> $DIR/multiple-impls.rs:12:5
-   |
-LL |     fn index(&self, index: Idx) -> &Self::Output;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied
   --> $DIR/multiple-impls.rs:36:18
@@ -22,11 +17,6 @@ LL |     Index::index(&[] as &[i32], Foo(2u32));
    |     required by a bound introduced by this call
    |
    = help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
-note: required by `Index::index`
-  --> $DIR/multiple-impls.rs:12:5
-   |
-LL |     fn index(&self, index: Idx) -> &Self::Output;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied
   --> $DIR/multiple-impls.rs:39:18
@@ -37,11 +27,6 @@ LL |     Index::index(&[] as &[i32], Bar(2u32));
    |     required by a bound introduced by this call
    |
    = help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
-note: required by `Index::index`
-  --> $DIR/multiple-impls.rs:12:5
-   |
-LL |     fn index(&self, index: Idx) -> &Self::Output;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
   --> $DIR/multiple-impls.rs:33:5
index 18eca06ba698111d36a1b8c1b6424b23a7127eef..940763fae51b8096ebbf4591163393c76fe23441 100644 (file)
@@ -7,11 +7,6 @@ LL |     Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
    |     required by a bound introduced by this call
    |
    = help: the trait `Index<u32>` is not implemented for `[i32]`
-note: required by `Index::index`
-  --> $DIR/on-impl.rs:9:5
-   |
-LL |     fn index(&self, index: Idx) -> &Self::Output;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
   --> $DIR/on-impl.rs:22:5
diff --git a/src/test/ui/once-move-out-on-heap.rs b/src/test/ui/once-move-out-on-heap.rs
deleted file mode 100644 (file)
index 4e2e400..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// run-pass
-// Testing guarantees provided by once functions.
-
-
-
-use std::sync::Arc;
-
-fn foo<F:FnOnce()>(blk: F) {
-    blk();
-}
-
-pub fn main() {
-    let x = Arc::new(true);
-    foo(move|| {
-        assert!(*x);
-        drop(x);
-    });
-}
diff --git a/src/test/ui/operator-associativity.rs b/src/test/ui/operator-associativity.rs
deleted file mode 100644 (file)
index 4f40c80..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// run-pass
-// Testcase for issue #130, operator associativity.
-
-pub fn main() { assert_eq!(3 * 5 / 2, 7); }
diff --git a/src/test/ui/operator-multidispatch.rs b/src/test/ui/operator-multidispatch.rs
deleted file mode 100644 (file)
index 0d1dcfd..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// run-pass
-// Test that we can overload the `+` operator for points so that two
-// points can be added, and a point can be added to an integer.
-
-use std::ops;
-
-#[derive(Debug,PartialEq,Eq)]
-struct Point {
-    x: isize,
-    y: isize
-}
-
-impl ops::Add for Point {
-    type Output = Point;
-
-    fn add(self, other: Point) -> Point {
-        Point {x: self.x + other.x, y: self.y + other.y}
-    }
-}
-
-impl ops::Add<isize> for Point {
-    type Output = Point;
-
-    fn add(self, other: isize) -> Point {
-        Point {x: self.x + other,
-               y: self.y + other}
-    }
-}
-
-pub fn main() {
-    let mut p = Point {x: 10, y: 20};
-    p = p + Point {x: 101, y: 102};
-    assert_eq!(p, Point {x: 111, y: 122});
-    p = p + 1;
-    assert_eq!(p, Point {x: 112, y: 123});
-}
diff --git a/src/test/ui/operator-overloading.rs b/src/test/ui/operator-overloading.rs
deleted file mode 100644 (file)
index 6b3abcb..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// run-pass
-
-#![allow(unused_variables)]
-use std::cmp;
-use std::ops;
-
-#[derive(Copy, Clone, Debug)]
-struct Point {
-    x: isize,
-    y: isize
-}
-
-impl ops::Add for Point {
-    type Output = Point;
-
-    fn add(self, other: Point) -> Point {
-        Point {x: self.x + other.x, y: self.y + other.y}
-    }
-}
-
-impl ops::Sub for Point {
-    type Output = Point;
-
-    fn sub(self, other: Point) -> Point {
-        Point {x: self.x - other.x, y: self.y - other.y}
-    }
-}
-
-impl ops::Neg for Point {
-    type Output = Point;
-
-    fn neg(self) -> Point {
-        Point {x: -self.x, y: -self.y}
-    }
-}
-
-impl ops::Not for Point {
-    type Output = Point;
-
-    fn not(self) -> Point {
-        Point {x: !self.x, y: !self.y }
-    }
-}
-
-impl ops::Index<bool> for Point {
-    type Output = isize;
-
-    fn index(&self, x: bool) -> &isize {
-        if x {
-            &self.x
-        } else {
-            &self.y
-        }
-    }
-}
-
-impl cmp::PartialEq for Point {
-    fn eq(&self, other: &Point) -> bool {
-        (*self).x == (*other).x && (*self).y == (*other).y
-    }
-    fn ne(&self, other: &Point) -> bool { !(*self).eq(other) }
-}
-
-pub fn main() {
-    let mut p = Point {x: 10, y: 20};
-    p = p + Point {x: 101, y: 102};
-    p = p - Point {x: 100, y: 100};
-    assert_eq!(p + Point {x: 5, y: 5}, Point {x: 16, y: 27});
-    assert_eq!(-p, Point {x: -11, y: -22});
-    assert_eq!(p[true], 11);
-    assert_eq!(p[false], 22);
-
-    let q = !p;
-    assert_eq!(q.x, !(p.x));
-    assert_eq!(q.y, !(p.y));
-
-    // Issue #1733
-    result(p[true]);
-}
-
-fn result(i: isize) { }
diff --git a/src/test/ui/overloaded-calls-nontuple.rs b/src/test/ui/overloaded-calls-nontuple.rs
deleted file mode 100644 (file)
index 07d44ff..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#![feature(fn_traits, unboxed_closures)]
-
-use std::ops::FnMut;
-
-struct S {
-    x: isize,
-    y: isize,
-}
-
-impl FnMut<isize> for S {
-    extern "rust-call" fn call_mut(&mut self, z: isize) -> isize {
-        self.x + self.y + z
-    }
-    //~^^^ ERROR functions with the "rust-call" ABI must take a single non-self argument
-}
-
-impl FnOnce<isize> for S {
-    type Output = isize;
-    extern "rust-call" fn call_once(mut self, z: isize) -> isize { self.call_mut(z) }
-    //~^ ERROR functions with the "rust-call" ABI must take a single non-self argument
-}
-
-fn main() {
-    let mut s = S {
-        x: 1,
-        y: 2,
-    };
-    drop(s(3))  //~ ERROR cannot use call notation
-}
diff --git a/src/test/ui/overloaded-calls-nontuple.stderr b/src/test/ui/overloaded-calls-nontuple.stderr
deleted file mode 100644 (file)
index 8f299bc..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-error: functions with the "rust-call" ABI must take a single non-self argument that is a tuple
-  --> $DIR/overloaded-calls-nontuple.rs:11:5
-   |
-LL |     extern "rust-call" fn call_mut(&mut self, z: isize) -> isize {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: functions with the "rust-call" ABI must take a single non-self argument that is a tuple
-  --> $DIR/overloaded-calls-nontuple.rs:19:5
-   |
-LL |     extern "rust-call" fn call_once(mut self, z: isize) -> isize { self.call_mut(z) }
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
-  --> $DIR/overloaded-calls-nontuple.rs:28:10
-   |
-LL |     drop(s(3))
-   |          ^^^^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0059`.
diff --git a/src/test/ui/overloaded/overloaded-calls-nontuple.rs b/src/test/ui/overloaded/overloaded-calls-nontuple.rs
new file mode 100644 (file)
index 0000000..07d44ff
--- /dev/null
@@ -0,0 +1,29 @@
+#![feature(fn_traits, unboxed_closures)]
+
+use std::ops::FnMut;
+
+struct S {
+    x: isize,
+    y: isize,
+}
+
+impl FnMut<isize> for S {
+    extern "rust-call" fn call_mut(&mut self, z: isize) -> isize {
+        self.x + self.y + z
+    }
+    //~^^^ ERROR functions with the "rust-call" ABI must take a single non-self argument
+}
+
+impl FnOnce<isize> for S {
+    type Output = isize;
+    extern "rust-call" fn call_once(mut self, z: isize) -> isize { self.call_mut(z) }
+    //~^ ERROR functions with the "rust-call" ABI must take a single non-self argument
+}
+
+fn main() {
+    let mut s = S {
+        x: 1,
+        y: 2,
+    };
+    drop(s(3))  //~ ERROR cannot use call notation
+}
diff --git a/src/test/ui/overloaded/overloaded-calls-nontuple.stderr b/src/test/ui/overloaded/overloaded-calls-nontuple.stderr
new file mode 100644 (file)
index 0000000..8f299bc
--- /dev/null
@@ -0,0 +1,21 @@
+error: functions with the "rust-call" ABI must take a single non-self argument that is a tuple
+  --> $DIR/overloaded-calls-nontuple.rs:11:5
+   |
+LL |     extern "rust-call" fn call_mut(&mut self, z: isize) -> isize {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: functions with the "rust-call" ABI must take a single non-self argument that is a tuple
+  --> $DIR/overloaded-calls-nontuple.rs:19:5
+   |
+LL |     extern "rust-call" fn call_once(mut self, z: isize) -> isize { self.call_mut(z) }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
+  --> $DIR/overloaded-calls-nontuple.rs:28:10
+   |
+LL |     drop(s(3))
+   |          ^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0059`.
diff --git a/src/test/ui/parser/attribute-with-no-generics-in-parameter-list.rs b/src/test/ui/parser/attribute-with-no-generics-in-parameter-list.rs
new file mode 100644 (file)
index 0000000..c2cc91d
--- /dev/null
@@ -0,0 +1,3 @@
+fn foo<#[attr]>() {} //~ ERROR attribute without generic parameters
+
+fn main() {}
diff --git a/src/test/ui/parser/attribute-with-no-generics-in-parameter-list.stderr b/src/test/ui/parser/attribute-with-no-generics-in-parameter-list.stderr
new file mode 100644 (file)
index 0000000..4c59647
--- /dev/null
@@ -0,0 +1,8 @@
+error: attribute without generic parameters
+  --> $DIR/attribute-with-no-generics-in-parameter-list.rs:1:8
+   |
+LL | fn foo<#[attr]>() {}
+   |        ^^^^^^^ attributes are only permitted when preceding parameters
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/auxiliary/issue-21146-inc.rs b/src/test/ui/parser/auxiliary/issue-21146-inc.rs
deleted file mode 100644 (file)
index 32a3b9d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// include file for issue-21146.rs
-
-parse_error
diff --git a/src/test/ui/parser/auxiliary/issue-89971-outer-attr-following-inner-attr-ice.rs b/src/test/ui/parser/auxiliary/issue-89971-outer-attr-following-inner-attr-ice.rs
deleted file mode 100644 (file)
index e5604b8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(ICE)]
-pub fn derive(_: TokenStream) -> TokenStream {
-    r#"#[allow(missing_docs)] struct X { }"#.parse().unwrap()
-}
diff --git a/src/test/ui/parser/dyn-trait-compatibility.rs b/src/test/ui/parser/dyn-trait-compatibility.rs
new file mode 100644 (file)
index 0000000..d2b02cc
--- /dev/null
@@ -0,0 +1,14 @@
+type A0 = dyn;
+//~^ ERROR cannot find type `dyn` in this scope
+type A1 = dyn::dyn;
+//~^ ERROR use of undeclared crate or module `dyn`
+type A2 = dyn<dyn, dyn>;
+//~^ ERROR cannot find type `dyn` in this scope
+//~| ERROR cannot find type `dyn` in this scope
+//~| ERROR cannot find type `dyn` in this scope
+type A3 = dyn<<dyn as dyn>::dyn>;
+//~^ ERROR cannot find type `dyn` in this scope
+//~| ERROR cannot find type `dyn` in this scope
+//~| ERROR use of undeclared crate or module `dyn`
+
+fn main() {}
diff --git a/src/test/ui/parser/dyn-trait-compatibility.stderr b/src/test/ui/parser/dyn-trait-compatibility.stderr
new file mode 100644 (file)
index 0000000..9218ae9
--- /dev/null
@@ -0,0 +1,58 @@
+error[E0433]: failed to resolve: use of undeclared crate or module `dyn`
+  --> $DIR/dyn-trait-compatibility.rs:3:11
+   |
+LL | type A1 = dyn::dyn;
+   |           ^^^ use of undeclared crate or module `dyn`
+
+error[E0433]: failed to resolve: use of undeclared crate or module `dyn`
+  --> $DIR/dyn-trait-compatibility.rs:9:23
+   |
+LL | type A3 = dyn<<dyn as dyn>::dyn>;
+   |                       ^^^ use of undeclared crate or module `dyn`
+
+error[E0412]: cannot find type `dyn` in this scope
+  --> $DIR/dyn-trait-compatibility.rs:1:11
+   |
+LL | type A0 = dyn;
+   |           ^^^ not found in this scope
+
+error[E0412]: cannot find type `dyn` in this scope
+  --> $DIR/dyn-trait-compatibility.rs:5:11
+   |
+LL | type A2 = dyn<dyn, dyn>;
+   |           ^^^ not found in this scope
+
+error[E0412]: cannot find type `dyn` in this scope
+  --> $DIR/dyn-trait-compatibility.rs:5:15
+   |
+LL | type A2 = dyn<dyn, dyn>;
+   |        -      ^^^ not found in this scope
+   |        |
+   |        help: you might be missing a type parameter: `<dyn>`
+
+error[E0412]: cannot find type `dyn` in this scope
+  --> $DIR/dyn-trait-compatibility.rs:5:20
+   |
+LL | type A2 = dyn<dyn, dyn>;
+   |        -           ^^^ not found in this scope
+   |        |
+   |        help: you might be missing a type parameter: `<dyn>`
+
+error[E0412]: cannot find type `dyn` in this scope
+  --> $DIR/dyn-trait-compatibility.rs:9:11
+   |
+LL | type A3 = dyn<<dyn as dyn>::dyn>;
+   |           ^^^ not found in this scope
+
+error[E0412]: cannot find type `dyn` in this scope
+  --> $DIR/dyn-trait-compatibility.rs:9:16
+   |
+LL | type A3 = dyn<<dyn as dyn>::dyn>;
+   |        -       ^^^ not found in this scope
+   |        |
+   |        help: you might be missing a type parameter: `<dyn>`
+
+error: aborting due to 8 previous errors
+
+Some errors have detailed explanations: E0412, E0433.
+For more information about an error, try `rustc --explain E0412`.
index 0adfa5b47a3e25a28cb0d717a4e491d950b396fc..75c60a0ea2a393e1ede0460d46c4c6a528c27048 100644 (file)
@@ -194,7 +194,7 @@ LL |         async fn ft1() {}
    |
    = note: while checking the return type of the `async fn`
    = note: expected fn pointer `fn()`
-              found fn pointer `fn() -> impl Future`
+              found fn pointer `fn() -> impl Future<Output = ()>`
 
 error[E0053]: method `ft5` has an incompatible type for trait
   --> $DIR/fn-header-semantic-fail.rs:33:48
@@ -210,7 +210,7 @@ LL |         const async unsafe extern "C" fn ft5() {}
    |
    = note: while checking the return type of the `async fn`
    = note: expected fn pointer `unsafe extern "C" fn()`
-              found fn pointer `unsafe extern "C" fn() -> impl Future`
+              found fn pointer `unsafe extern "C" fn() -> impl Future<Output = ()>`
 
 error: aborting due to 20 previous errors
 
diff --git a/src/test/ui/parser/issue-10392-2.fixed b/src/test/ui/parser/issue-10392-2.fixed
deleted file mode 100644 (file)
index 3386fac..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-rustfix
-
-pub struct A { pub foo: isize }
-
-fn a() -> A { panic!() }
-
-fn main() {
-    let A { .. } = a(); //~ ERROR: expected `}`
-}
diff --git a/src/test/ui/parser/issue-10392-2.rs b/src/test/ui/parser/issue-10392-2.rs
deleted file mode 100644 (file)
index 30628ae..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-rustfix
-
-pub struct A { pub foo: isize }
-
-fn a() -> A { panic!() }
-
-fn main() {
-    let A { .., } = a(); //~ ERROR: expected `}`
-}
diff --git a/src/test/ui/parser/issue-10392-2.stderr b/src/test/ui/parser/issue-10392-2.stderr
deleted file mode 100644 (file)
index 4154ecf..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error: expected `}`, found `,`
-  --> $DIR/issue-10392-2.rs:8:15
-   |
-LL |     let A { .., } = a();
-   |             --^
-   |             | |
-   |             | expected `}`
-   |             | help: remove this comma
-   |             `..` must be at the end and cannot have a trailing comma
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-10392.rs b/src/test/ui/parser/issue-10392.rs
deleted file mode 100644 (file)
index 5b0c2fc..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-struct A { foo: isize }
-
-fn a() -> A { panic!() }
-
-fn main() {
-    let A { , } = a(); //~ ERROR expected ident
-}
diff --git a/src/test/ui/parser/issue-10392.stderr b/src/test/ui/parser/issue-10392.stderr
deleted file mode 100644 (file)
index 438ea67..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: expected identifier, found `,`
-  --> $DIR/issue-10392.rs:6:13
-   |
-LL |     let A { , } = a();
-   |         -   ^ expected identifier
-   |         |
-   |         while parsing the fields for this pattern
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-10636-1.rs b/src/test/ui/parser/issue-10636-1.rs
deleted file mode 100644 (file)
index 77c6072..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-struct Obj {
-    //~^ NOTE: unclosed delimiter
-    member: usize
-)
-//~^ ERROR mismatched closing delimiter
-//~| NOTE mismatched closing delimiter
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-10636-1.stderr b/src/test/ui/parser/issue-10636-1.stderr
deleted file mode 100644 (file)
index 1e6294e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: mismatched closing delimiter: `)`
-  --> $DIR/issue-10636-1.rs:1:12
-   |
-LL | struct Obj {
-   |            ^ unclosed delimiter
-...
-LL | )
-   | ^ mismatched closing delimiter
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-10636-2.rs b/src/test/ui/parser/issue-10636-2.rs
deleted file mode 100644 (file)
index 6fb6363..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// FIXME(31528) we emit a bunch of silly errors here due to continuing past the
-// first one. This would be easy-ish to address by better recovery in tokenisation.
-
-pub fn trace_option(option: Option<isize>) {
-    option.map(|some| 42;
-                          //~^ ERROR: expected one of
-
-}
-//~^ ERROR: expected expression, found `)`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-10636-2.stderr b/src/test/ui/parser/issue-10636-2.stderr
deleted file mode 100644 (file)
index d4f2da9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;`
-  --> $DIR/issue-10636-2.rs:5:15
-   |
-LL |     option.map(|some| 42;
-   |               ^         ^ help: `)` may belong here
-   |               |
-   |               unclosed delimiter
-
-error: expected expression, found `)`
-  --> $DIR/issue-10636-2.rs:8:1
-   |
-LL | }
-   | ^ expected expression
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-13483.rs b/src/test/ui/parser/issue-13483.rs
deleted file mode 100644 (file)
index a2fd926..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-fn main() {
-    if true {
-    } else if { //~ ERROR missing condition
-    //~^ ERROR mismatched types
-    } else {
-    }
-}
-
-fn foo() {
-    if true {
-    } else if { //~ ERROR missing condition
-    //~^ ERROR mismatched types
-    }
-    bar();
-}
-
-fn bar() {}
diff --git a/src/test/ui/parser/issue-13483.stderr b/src/test/ui/parser/issue-13483.stderr
deleted file mode 100644 (file)
index 5fd05b1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-error: missing condition for `if` expression
-  --> $DIR/issue-13483.rs:3:14
-   |
-LL |     } else if {
-   |              ^ expected if condition here
-
-error: missing condition for `if` expression
-  --> $DIR/issue-13483.rs:11:14
-   |
-LL |     } else if {
-   |              ^ expected if condition here
-
-error[E0308]: mismatched types
-  --> $DIR/issue-13483.rs:3:15
-   |
-LL |       } else if {
-   |  _______________^
-LL | |
-LL | |     } else {
-   | |_____^ expected `bool`, found `()`
-
-error[E0308]: mismatched types
-  --> $DIR/issue-13483.rs:11:15
-   |
-LL |       } else if {
-   |  _______________^
-LL | |
-LL | |     }
-   | |_____^ expected `bool`, found `()`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issue-14303-enum.rs b/src/test/ui/parser/issue-14303-enum.rs
deleted file mode 100644 (file)
index a610615..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-enum X<'a, T, 'b> {
-//~^ ERROR lifetime parameters must be declared prior to type parameters
-    A(&'a &'b T)
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-14303-enum.stderr b/src/test/ui/parser/issue-14303-enum.stderr
deleted file mode 100644 (file)
index bcecd75..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
-  --> $DIR/issue-14303-enum.rs:1:15
-   |
-LL | enum X<'a, T, 'b> {
-   |       --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-14303-fn-def.rs b/src/test/ui/parser/issue-14303-fn-def.rs
deleted file mode 100644 (file)
index 221bd31..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn foo<'a, T, 'b>(x: &'a T) {}
-//~^ ERROR lifetime parameters must be declared prior to type parameters
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-14303-fn-def.stderr b/src/test/ui/parser/issue-14303-fn-def.stderr
deleted file mode 100644 (file)
index 082c37e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
-  --> $DIR/issue-14303-fn-def.rs:1:15
-   |
-LL | fn foo<'a, T, 'b>(x: &'a T) {}
-   |       --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-14303-fncall.full.stderr b/src/test/ui/parser/issue-14303-fncall.full.stderr
deleted file mode 100644 (file)
index 02af61e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0747]: type provided when a lifetime was expected
-  --> $DIR/issue-14303-fncall.rs:16:26
-   |
-LL |         .collect::<Vec<S<_, 'a>>>();
-   |                          ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/parser/issue-14303-fncall.generic_arg.stderr b/src/test/ui/parser/issue-14303-fncall.generic_arg.stderr
deleted file mode 100644 (file)
index 9f3359b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0747]: inferred provided when a lifetime was expected
-  --> $DIR/issue-14303-fncall.rs:16:26
-   |
-LL |         .collect::<Vec<S<_, 'a>>>();
-   |                          ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/parser/issue-14303-fncall.rs b/src/test/ui/parser/issue-14303-fncall.rs
deleted file mode 100644 (file)
index 976a79a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// revisions: full generic_arg
-// compile-flags: -Zborrowck=mir
-// can't run rustfix because it doesn't handle multipart suggestions correctly
-// we need the above to avoid ast borrowck failure in recovered code
-#![cfg_attr(generic_arg, feature(generic_arg_infer))]
-
-
-struct S<'a, T> {
-    a: &'a T,
-    b: &'a T,
-}
-
-fn foo<'a, 'b>(start: &'a usize, end: &'a usize) {
-    let _x = (*start..*end)
-        .map(|x| S { a: start, b: end })
-        .collect::<Vec<S<_, 'a>>>();
-        //[generic_arg]~^ ERROR inferred provided when a lifetime was expected
-        //[full]~^^ ERROR type provided when a lifetime was expected
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-14303-impl.rs b/src/test/ui/parser/issue-14303-impl.rs
deleted file mode 100644 (file)
index 4dc2c66..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-struct X<T>(T);
-
-impl<'a, T, 'b> X<T> {}
-//~^ ERROR lifetime parameters must be declared prior to type parameters
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-14303-impl.stderr b/src/test/ui/parser/issue-14303-impl.stderr
deleted file mode 100644 (file)
index 3b5615d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
-  --> $DIR/issue-14303-impl.rs:3:13
-   |
-LL | impl<'a, T, 'b> X<T> {}
-   |     --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-14303-path.rs b/src/test/ui/parser/issue-14303-path.rs
deleted file mode 100644 (file)
index 89ef914..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-mod foo {
-    pub struct X<'a, 'b, 'c, T> {
-        a: &'a str,
-        b: &'b str,
-        c: &'c str,
-        t: T,
-    }
-}
-
-fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
-//~^ ERROR type provided when a lifetime was expected
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-14303-path.stderr b/src/test/ui/parser/issue-14303-path.stderr
deleted file mode 100644 (file)
index 841e63e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0747]: type provided when a lifetime was expected
-  --> $DIR/issue-14303-path.rs:10:37
-   |
-LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
-   |                                     ^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/parser/issue-14303-struct.rs b/src/test/ui/parser/issue-14303-struct.rs
deleted file mode 100644 (file)
index 0bd10b4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-struct X<'a, T, 'b> {
-//~^ ERROR lifetime parameters must be declared prior to type parameters
-    x: &'a &'b T
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-14303-struct.stderr b/src/test/ui/parser/issue-14303-struct.stderr
deleted file mode 100644 (file)
index dbd0b98..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
-  --> $DIR/issue-14303-struct.rs:1:17
-   |
-LL | struct X<'a, T, 'b> {
-   |         --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-14303-trait.rs b/src/test/ui/parser/issue-14303-trait.rs
deleted file mode 100644 (file)
index f253de9..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-trait Foo<'a, T, 'b> {}
-//~^ ERROR lifetime parameters must be declared prior to type parameters
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-14303-trait.stderr b/src/test/ui/parser/issue-14303-trait.stderr
deleted file mode 100644 (file)
index 7dfa62d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: lifetime parameters must be declared prior to type parameters
-  --> $DIR/issue-14303-trait.rs:1:18
-   |
-LL | trait Foo<'a, T, 'b> {}
-   |          --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-15914.rs b/src/test/ui/parser/issue-15914.rs
deleted file mode 100644 (file)
index 4a5606a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {
-    let ref
-        (); //~ ERROR expected identifier, found `(`
-}
diff --git a/src/test/ui/parser/issue-15914.stderr b/src/test/ui/parser/issue-15914.stderr
deleted file mode 100644 (file)
index ea26453..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected identifier, found `(`
-  --> $DIR/issue-15914.rs:3:9
-   |
-LL |         ();
-   |         ^ expected identifier
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-15980.rs b/src/test/ui/parser/issue-15980.rs
deleted file mode 100644 (file)
index 87faa7d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-use std::io;
-
-fn main(){
-    let x: io::Result<()> = Ok(());
-    match x {
-        Err(ref e) if e.kind == io::EndOfFile {
-            //~^ NOTE while parsing this struct
-            return
-            //~^ ERROR expected identifier, found keyword `return`
-            //~| NOTE expected identifier, found keyword
-        }
-        //~^ NOTE expected one of `.`, `=>`, `?`, or an operator
-        _ => {}
-        //~^ ERROR expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
-        //~| NOTE unexpected token
-    }
-}
diff --git a/src/test/ui/parser/issue-15980.stderr b/src/test/ui/parser/issue-15980.stderr
deleted file mode 100644 (file)
index 5cefead..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-error: expected identifier, found keyword `return`
-  --> $DIR/issue-15980.rs:8:13
-   |
-LL |         Err(ref e) if e.kind == io::EndOfFile {
-   |                                 ------------- while parsing this struct
-LL |
-LL |             return
-   |             ^^^^^^ expected identifier, found keyword
-   |
-help: you can escape reserved keywords to use them as identifiers
-   |
-LL |             r#return
-   |
-
-error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
-  --> $DIR/issue-15980.rs:13:9
-   |
-LL |         }
-   |          - expected one of `.`, `=>`, `?`, or an operator
-LL |
-LL |         _ => {}
-   |         ^ unexpected token
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-1655.rs b/src/test/ui/parser/issue-1655.rs
deleted file mode 100644 (file)
index e9fc6f1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-mod blade_runner {
-    #vec[doc( //~ ERROR expected one of `!` or `[`, found `vec`
-        brief = "Blade Runner is probably the best movie ever",
-        desc = "I like that in the world of Blade Runner it is always
-                raining, and that it's always night time. And Aliens
-                was also a really good movie.
-
-                Alien 3 was crap though."
-    )]
-}
diff --git a/src/test/ui/parser/issue-1655.stderr b/src/test/ui/parser/issue-1655.stderr
deleted file mode 100644 (file)
index 0c390a0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `!` or `[`, found `vec`
-  --> $DIR/issue-1655.rs:2:6
-   |
-LL |     #vec[doc(
-   |      ^^^ expected one of `!` or `[`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-17383.rs b/src/test/ui/parser/issue-17383.rs
deleted file mode 100644 (file)
index 7bf0e64..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-enum X {
-    A = 3,
-    //~^ ERROR custom discriminant values are not allowed in enums with tuple or struct variants
-    B(usize)
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-17383.stderr b/src/test/ui/parser/issue-17383.stderr
deleted file mode 100644 (file)
index 265d6e1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants
-  --> $DIR/issue-17383.rs:2:9
-   |
-LL |     A = 3,
-   |         ^ disallowed custom discriminant
-LL |
-LL |     B(usize)
-   |     -------- tuple variant defined here
-   |
-   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
-   = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/parser/issue-17718-const-mut.rs b/src/test/ui/parser/issue-17718-const-mut.rs
deleted file mode 100644 (file)
index 795a8c7..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-const
-mut //~ ERROR: const globals cannot be mutable
-//~^^ HELP you might want to declare a static instead
-FOO: usize = 3;
-
-fn main() {
-}
diff --git a/src/test/ui/parser/issue-17718-const-mut.stderr b/src/test/ui/parser/issue-17718-const-mut.stderr
deleted file mode 100644 (file)
index 8251ce9..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: const globals cannot be mutable
-  --> $DIR/issue-17718-const-mut.rs:2:1
-   |
-LL | const
-   | ----- help: you might want to declare a static instead: `static`
-LL | mut
-   | ^^^ cannot be mutable
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-17904-2.rs b/src/test/ui/parser/issue-17904-2.rs
deleted file mode 100644 (file)
index 186a955..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-struct Bar<T> { x: T } where T: Copy //~ ERROR expected item, found keyword `where`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-17904-2.stderr b/src/test/ui/parser/issue-17904-2.stderr
deleted file mode 100644 (file)
index 9c7fdf6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected item, found keyword `where`
-  --> $DIR/issue-17904-2.rs:1:24
-   |
-LL | struct Bar<T> { x: T } where T: Copy
-   |                        ^^^^^ expected item
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-17904.rs b/src/test/ui/parser/issue-17904.rs
deleted file mode 100644 (file)
index 7d6a54f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-struct Baz<U> where U: Eq(U); //This is parsed as the new Fn* style parenthesis syntax.
-struct Baz<U> where U: Eq(U) -> R; // Notice this parses as well.
-struct Baz<U>(U) where U: Eq; // This rightfully signals no error as well.
-struct Foo<T> where T: Copy, (T); //~ ERROR expected one of `:`, `==`, or `=`, found `;`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-17904.stderr b/src/test/ui/parser/issue-17904.stderr
deleted file mode 100644 (file)
index a3cac67..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `:`, `==`, or `=`, found `;`
-  --> $DIR/issue-17904.rs:4:33
-   |
-LL | struct Foo<T> where T: Copy, (T);
-   |                                 ^ expected one of `:`, `==`, or `=`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-1802-1.rs b/src/test/ui/parser/issue-1802-1.rs
deleted file mode 100644 (file)
index 3c34b0d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-fn log(a: i32, b: i32) {}
-
-fn main() {
-    let error = 42;
-    log(error, 0b);
-    //~^ ERROR no valid digits found for number
-}
diff --git a/src/test/ui/parser/issue-1802-1.stderr b/src/test/ui/parser/issue-1802-1.stderr
deleted file mode 100644 (file)
index 954cc0b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0768]: no valid digits found for number
-  --> $DIR/issue-1802-1.rs:5:16
-   |
-LL |     log(error, 0b);
-   |                ^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0768`.
diff --git a/src/test/ui/parser/issue-1802-2.rs b/src/test/ui/parser/issue-1802-2.rs
deleted file mode 100644 (file)
index 3c34b0d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-fn log(a: i32, b: i32) {}
-
-fn main() {
-    let error = 42;
-    log(error, 0b);
-    //~^ ERROR no valid digits found for number
-}
diff --git a/src/test/ui/parser/issue-1802-2.stderr b/src/test/ui/parser/issue-1802-2.stderr
deleted file mode 100644 (file)
index 49043d0..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0768]: no valid digits found for number
-  --> $DIR/issue-1802-2.rs:5:16
-   |
-LL |     log(error, 0b);
-   |                ^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0768`.
diff --git a/src/test/ui/parser/issue-19096.rs b/src/test/ui/parser/issue-19096.rs
deleted file mode 100644 (file)
index c5bfd10..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-fn main() { // we don't complain about the return type being `{integer}`
-    let t = (42, 42);
-    t.0::<isize>; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::`
-}
-
-fn foo() -> usize { // we don't complain about the return type being unit
-    let t = (42, 42);
-    t.0::<isize>; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::`
-    42;
-}
diff --git a/src/test/ui/parser/issue-19096.stderr b/src/test/ui/parser/issue-19096.stderr
deleted file mode 100644 (file)
index 4df7f87..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-error: expected one of `.`, `;`, `?`, `}`, or an operator, found `::`
-  --> $DIR/issue-19096.rs:3:8
-   |
-LL |     t.0::<isize>;
-   |        ^^ expected one of `.`, `;`, `?`, `}`, or an operator
-
-error: expected one of `.`, `;`, `?`, `}`, or an operator, found `::`
-  --> $DIR/issue-19096.rs:8:8
-   |
-LL |     t.0::<isize>;
-   |        ^^ expected one of `.`, `;`, `?`, `}`, or an operator
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-19398.rs b/src/test/ui/parser/issue-19398.rs
deleted file mode 100644 (file)
index 46eb320..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-trait T {
-    extern "Rust" unsafe fn foo();
-    //~^ ERROR expected `{`, found keyword `unsafe`
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-19398.stderr b/src/test/ui/parser/issue-19398.stderr
deleted file mode 100644 (file)
index 1da0096..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected `{`, found keyword `unsafe`
-  --> $DIR/issue-19398.rs:2:19
-   |
-LL | trait T {
-   |         - while parsing this item list starting here
-LL |     extern "Rust" unsafe fn foo();
-   |                   ^^^^^^ expected `{`
-LL |
-LL | }
-   | - the item list ends here
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20616-1.rs b/src/test/ui/parser/issue-20616-1.rs
deleted file mode 100644 (file)
index 49e9cb3..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-type Type_1<'a T> = &'a T; //~ error: expected one of `,`, `:`, or `>`, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issue-20616-1.stderr b/src/test/ui/parser/issue-20616-1.stderr
deleted file mode 100644 (file)
index 8160462..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `,`, `:`, or `>`, found `T`
-  --> $DIR/issue-20616-1.rs:9:16
-   |
-LL | type Type_1<'a T> = &'a T;
-   |                ^ expected one of `,`, `:`, or `>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20616-2.rs b/src/test/ui/parser/issue-20616-2.rs
deleted file mode 100644 (file)
index f108ae5..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,`, `:`, `=`, or `>`, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issue-20616-2.stderr b/src/test/ui/parser/issue-20616-2.stderr
deleted file mode 100644 (file)
index 01e3d3d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `,`, `:`, `=`, or `>`, found `(`
-  --> $DIR/issue-20616-2.rs:12:31
-   |
-LL | type Type_2 = Type_1_<'static ()>;
-   |                               ^ expected one of `,`, `:`, `=`, or `>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20616-3.rs b/src/test/ui/parser/issue-20616-3.rs
deleted file mode 100644 (file)
index b237105..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-type Type_3<T> = Box<T,,>;
-//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issue-20616-3.stderr b/src/test/ui/parser/issue-20616-3.stderr
deleted file mode 100644 (file)
index b535c7a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `>`, a const expression, lifetime, or type, found `,`
-  --> $DIR/issue-20616-3.rs:13:24
-   |
-LL | type Type_3<T> = Box<T,,>;
-   |                        ^ expected one of `>`, a const expression, lifetime, or type
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20616-4.rs b/src/test/ui/parser/issue-20616-4.rs
deleted file mode 100644 (file)
index a71f47c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-type Type_4<T> = Type_1_<'static,, T>;
-//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issue-20616-4.stderr b/src/test/ui/parser/issue-20616-4.stderr
deleted file mode 100644 (file)
index 2b3b75f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `>`, a const expression, lifetime, or type, found `,`
-  --> $DIR/issue-20616-4.rs:16:34
-   |
-LL | type Type_4<T> = Type_1_<'static,, T>;
-   |                                  ^ expected one of `>`, a const expression, lifetime, or type
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20616-5.rs b/src/test/ui/parser/issue-20616-5.rs
deleted file mode 100644 (file)
index b96d09d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-type Type_5<'a> = Type_1_<'a, (),,>;
-//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issue-20616-5.stderr b/src/test/ui/parser/issue-20616-5.stderr
deleted file mode 100644 (file)
index 1ec1dbd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `>`, a const expression, lifetime, or type, found `,`
-  --> $DIR/issue-20616-5.rs:22:34
-   |
-LL | type Type_5<'a> = Type_1_<'a, (),,>;
-   |                                  ^ expected one of `>`, a const expression, lifetime, or type
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20616-6.rs b/src/test/ui/parser/issue-20616-6.rs
deleted file mode 100644 (file)
index a2c45ec..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-type Type_6 = Type_5_<'a,,>;
-//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issue-20616-6.stderr b/src/test/ui/parser/issue-20616-6.stderr
deleted file mode 100644 (file)
index 7401abd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `>`, a const expression, lifetime, or type, found `,`
-  --> $DIR/issue-20616-6.rs:25:26
-   |
-LL | type Type_6 = Type_5_<'a,,>;
-   |                          ^ expected one of `>`, a const expression, lifetime, or type
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20616-7.rs b/src/test/ui/parser/issue-20616-7.rs
deleted file mode 100644 (file)
index 67209c0..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-type Type_7 = Box<(),,>;
-//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issue-20616-7.stderr b/src/test/ui/parser/issue-20616-7.stderr
deleted file mode 100644 (file)
index e2c3efe..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `>`, a const expression, lifetime, or type, found `,`
-  --> $DIR/issue-20616-7.rs:28:22
-   |
-LL | type Type_7 = Box<(),,>;
-   |                      ^ expected one of `>`, a const expression, lifetime, or type
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20616-8.rs b/src/test/ui/parser/issue-20616-8.rs
deleted file mode 100644 (file)
index 3ceb58d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-type Type_8<'a,,> = &'a ();
-//~^ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected identifier, found `,`
diff --git a/src/test/ui/parser/issue-20616-8.stderr b/src/test/ui/parser/issue-20616-8.stderr
deleted file mode 100644 (file)
index e9f37e5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
-  --> $DIR/issue-20616-8.rs:31:16
-   |
-LL | type Type_8<'a,,> = &'a ();
-   |                ^ expected one of `#`, `>`, `const`, identifier, or lifetime
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20616-9.rs b/src/test/ui/parser/issue-20616-9.rs
deleted file mode 100644 (file)
index 7f84284..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected identifier, found `,`
-
-
-type Type_9<T,,> = Box<T>;
-//~^ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
diff --git a/src/test/ui/parser/issue-20616-9.stderr b/src/test/ui/parser/issue-20616-9.stderr
deleted file mode 100644 (file)
index dc309d1..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
-  --> $DIR/issue-20616-9.rs:34:15
-   |
-LL | type Type_9<T,,> = Box<T>;
-   |               ^ expected one of `#`, `>`, `const`, identifier, or lifetime
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20711-2.rs b/src/test/ui/parser/issue-20711-2.rs
deleted file mode 100644 (file)
index 168c7e7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-struct Foo;
-
-impl Foo {
-    fn foo() {}
-
-    #[stable(feature = "rust1", since = "1.0.0")]
-    //~^ ERROR expected item after attributes
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-20711-2.stderr b/src/test/ui/parser/issue-20711-2.stderr
deleted file mode 100644 (file)
index 12b18bb..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-error: expected item after attributes
-  --> $DIR/issue-20711-2.rs:6:5
-   |
-LL | impl Foo {
-   |          - while parsing this item list starting here
-...
-LL |     #[stable(feature = "rust1", since = "1.0.0")]
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-LL |
-LL | }
-   | - the item list ends here
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-20711.rs b/src/test/ui/parser/issue-20711.rs
deleted file mode 100644 (file)
index 020bb79..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-struct Foo;
-
-impl Foo {
-    #[stable(feature = "rust1", since = "1.0.0")]
-    //~^ ERROR expected item after attributes
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-20711.stderr b/src/test/ui/parser/issue-20711.stderr
deleted file mode 100644 (file)
index 4af4b22..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected item after attributes
-  --> $DIR/issue-20711.rs:4:5
-   |
-LL | impl Foo {
-   |          - while parsing this item list starting here
-LL |     #[stable(feature = "rust1", since = "1.0.0")]
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-LL |
-LL | }
-   | - the item list ends here
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-21146.rs b/src/test/ui/parser/issue-21146.rs
deleted file mode 100644 (file)
index 19eaffc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// error-pattern: expected one of `!` or `::`, found `<eof>`
-include!("auxiliary/issue-21146-inc.rs");
-fn main() {}
diff --git a/src/test/ui/parser/issue-21146.stderr b/src/test/ui/parser/issue-21146.stderr
deleted file mode 100644 (file)
index c71fda3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `!` or `::`, found `<eof>`
-  --> $DIR/auxiliary/issue-21146-inc.rs:3:1
-   |
-LL | parse_error
-   | ^^^^^^^^^^^ expected one of `!` or `::`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-21153.rs b/src/test/ui/parser/issue-21153.rs
deleted file mode 100644 (file)
index bf5fdb1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-trait MyTrait<T>: Iterator {
-    Item = T;
-    //~^ ERROR expected one of `!` or `::`, found `=`
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-21153.stderr b/src/test/ui/parser/issue-21153.stderr
deleted file mode 100644 (file)
index cbfa9de..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected one of `!` or `::`, found `=`
-  --> $DIR/issue-21153.rs:2:10
-   |
-LL | trait MyTrait<T>: Iterator {
-   |                            - while parsing this item list starting here
-LL |     Item = T;
-   |          ^ expected one of `!` or `::`
-LL |
-LL | }
-   | - the item list ends here
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-21475.rs b/src/test/ui/parser/issue-21475.rs
deleted file mode 100644 (file)
index b028fca..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// run-pass
-#![allow(unused_imports, overlapping_range_endpoints)]
-// pretty-expanded FIXME #23616
-
-use m::{START, END};
-
-fn main() {
-    match 42 {
-        m::START..=m::END => {},
-        0..=m::END => {},
-        m::START..=59 => {},
-        _  => {},
-    }
-}
-
-mod m {
-  pub const START: u32 = 4;
-  pub const END:   u32 = 14;
-}
diff --git a/src/test/ui/parser/issue-22647.rs b/src/test/ui/parser/issue-22647.rs
deleted file mode 100644 (file)
index a686141..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-fn main() {
-    let caller<F> = |f: F|  //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
-    where F: Fn() -> i32
-    {
-        let x = f();
-        println!("Y {}",x);
-        return x;
-    };
-
-    caller(bar_handler);
-}
-
-fn bar_handler() -> i32 {
-    5
-}
diff --git a/src/test/ui/parser/issue-22647.stderr b/src/test/ui/parser/issue-22647.stderr
deleted file mode 100644 (file)
index 89b454d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
-  --> $DIR/issue-22647.rs:2:15
-   |
-LL |     let caller<F> = |f: F|
-   |               ^ expected one of `:`, `;`, `=`, `@`, or `|`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-22712.rs b/src/test/ui/parser/issue-22712.rs
deleted file mode 100644 (file)
index 774de9c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-struct Foo<B> {
-    buffer: B
-}
-
-fn bar() {
-    let Foo<Vec<u8>>  //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-22712.stderr b/src/test/ui/parser/issue-22712.stderr
deleted file mode 100644 (file)
index 30fabac..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
-  --> $DIR/issue-22712.rs:6:12
-   |
-LL |     let Foo<Vec<u8>>
-   |            ^ expected one of `:`, `;`, `=`, `@`, or `|`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-2354-1.rs b/src/test/ui/parser/issue-2354-1.rs
deleted file mode 100644 (file)
index 996cf1b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-static foo: isize = 2; } //~ ERROR unexpected closing delimiter:
diff --git a/src/test/ui/parser/issue-2354-1.stderr b/src/test/ui/parser/issue-2354-1.stderr
deleted file mode 100644 (file)
index 7ea0f2a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: unexpected closing delimiter: `}`
-  --> $DIR/issue-2354-1.rs:1:24
-   |
-LL | static foo: isize = 2; }
-   |                        ^ unexpected closing delimiter
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-2354.rs b/src/test/ui/parser/issue-2354.rs
deleted file mode 100644 (file)
index c422040..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-fn foo() { //~ NOTE unclosed delimiter
-  match Some(10) {
-  //~^ NOTE this delimiter might not be properly closed...
-      Some(y) => { panic!(); }
-      None => { panic!(); }
-}
-//~^ NOTE ...as it matches this but it has different indentation
-
-fn bar() {
-    let mut i = 0;
-    while (i < 1000) {}
-}
-
-fn main() {}
-//~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/issue-2354.stderr b/src/test/ui/parser/issue-2354.stderr
deleted file mode 100644 (file)
index b89ed39..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-2354.rs:15:52
-   |
-LL | fn foo() {
-   |          - unclosed delimiter
-LL |   match Some(10) {
-   |                  - this delimiter might not be properly closed...
-...
-LL | }
-   | - ...as it matches this but it has different indentation
-...
-LL |
-   |                                                    ^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-23620-invalid-escapes.rs b/src/test/ui/parser/issue-23620-invalid-escapes.rs
deleted file mode 100644 (file)
index c1355f0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-fn main() {
-    let _ = b"\u{a66e}";
-    //~^ ERROR unicode escape in byte string
-
-    let _ = b'\u{a66e}';
-    //~^ ERROR unicode escape in byte string
-
-    let _ = b'\u';
-    //~^ ERROR incorrect unicode escape sequence
-
-    let _ = b'\x5';
-    //~^ ERROR numeric character escape is too short
-
-    let _ = b'\xxy';
-    //~^ ERROR invalid character in numeric character escape: `x`
-
-    let _ = '\x5';
-    //~^ ERROR numeric character escape is too short
-
-    let _ = '\xxy';
-    //~^ ERROR invalid character in numeric character escape: `x`
-
-    let _ = b"\u{a4a4} \xf \u";
-    //~^ ERROR unicode escape in byte string
-    //~^^ ERROR invalid character in numeric character escape: ` `
-    //~^^^ ERROR incorrect unicode escape sequence
-
-    let _ = "\xf \u";
-    //~^ ERROR invalid character in numeric character escape: ` `
-    //~^^ ERROR incorrect unicode escape sequence
-
-    let _ = "\u8f";
-    //~^ ERROR incorrect unicode escape sequence
-}
diff --git a/src/test/ui/parser/issue-23620-invalid-escapes.stderr b/src/test/ui/parser/issue-23620-invalid-escapes.stderr
deleted file mode 100644 (file)
index 88d97c7..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-error: unicode escape in byte string
-  --> $DIR/issue-23620-invalid-escapes.rs:2:15
-   |
-LL |     let _ = b"\u{a66e}";
-   |               ^^^^^^^^ unicode escape in byte string
-   |
-   = help: unicode escape sequences cannot be used as a byte or in a byte string
-
-error: unicode escape in byte string
-  --> $DIR/issue-23620-invalid-escapes.rs:5:15
-   |
-LL |     let _ = b'\u{a66e}';
-   |               ^^^^^^^^ unicode escape in byte string
-   |
-   = help: unicode escape sequences cannot be used as a byte or in a byte string
-
-error: incorrect unicode escape sequence
-  --> $DIR/issue-23620-invalid-escapes.rs:8:15
-   |
-LL |     let _ = b'\u';
-   |               ^^ incorrect unicode escape sequence
-   |
-   = help: format of unicode escape sequences is `\u{...}`
-
-error: numeric character escape is too short
-  --> $DIR/issue-23620-invalid-escapes.rs:11:15
-   |
-LL |     let _ = b'\x5';
-   |               ^^^
-
-error: invalid character in numeric character escape: `x`
-  --> $DIR/issue-23620-invalid-escapes.rs:14:17
-   |
-LL |     let _ = b'\xxy';
-   |                 ^ invalid character in numeric character escape
-
-error: numeric character escape is too short
-  --> $DIR/issue-23620-invalid-escapes.rs:17:14
-   |
-LL |     let _ = '\x5';
-   |              ^^^
-
-error: invalid character in numeric character escape: `x`
-  --> $DIR/issue-23620-invalid-escapes.rs:20:16
-   |
-LL |     let _ = '\xxy';
-   |                ^ invalid character in numeric character escape
-
-error: unicode escape in byte string
-  --> $DIR/issue-23620-invalid-escapes.rs:23:15
-   |
-LL |     let _ = b"\u{a4a4} \xf \u";
-   |               ^^^^^^^^ unicode escape in byte string
-   |
-   = help: unicode escape sequences cannot be used as a byte or in a byte string
-
-error: invalid character in numeric character escape: ` `
-  --> $DIR/issue-23620-invalid-escapes.rs:23:27
-   |
-LL |     let _ = b"\u{a4a4} \xf \u";
-   |                           ^ invalid character in numeric character escape
-
-error: incorrect unicode escape sequence
-  --> $DIR/issue-23620-invalid-escapes.rs:23:28
-   |
-LL |     let _ = b"\u{a4a4} \xf \u";
-   |                            ^^ incorrect unicode escape sequence
-   |
-   = help: format of unicode escape sequences is `\u{...}`
-
-error: invalid character in numeric character escape: ` `
-  --> $DIR/issue-23620-invalid-escapes.rs:28:17
-   |
-LL |     let _ = "\xf \u";
-   |                 ^ invalid character in numeric character escape
-
-error: incorrect unicode escape sequence
-  --> $DIR/issue-23620-invalid-escapes.rs:28:18
-   |
-LL |     let _ = "\xf \u";
-   |                  ^^ incorrect unicode escape sequence
-   |
-   = help: format of unicode escape sequences is `\u{...}`
-
-error: incorrect unicode escape sequence
-  --> $DIR/issue-23620-invalid-escapes.rs:32:14
-   |
-LL |     let _ = "\u8f";
-   |              ^^^-
-   |              |
-   |              help: format of unicode escape sequences uses braces: `\u{8f}`
-
-error: aborting due to 13 previous errors
-
diff --git a/src/test/ui/parser/issue-24197.rs b/src/test/ui/parser/issue-24197.rs
deleted file mode 100644 (file)
index aaf5137..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() {
-    let buf[0] = 0; //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
-}
diff --git a/src/test/ui/parser/issue-24197.stderr b/src/test/ui/parser/issue-24197.stderr
deleted file mode 100644 (file)
index fd7015c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
-  --> $DIR/issue-24197.rs:2:12
-   |
-LL |     let buf[0] = 0;
-   |            ^ expected one of `:`, `;`, `=`, `@`, or `|`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-24375.rs b/src/test/ui/parser/issue-24375.rs
deleted file mode 100644 (file)
index 1d128d3..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-static tmp : [&'static str; 2]  = ["hello", "he"];
-
-fn main() {
-    let z = "hello";
-    match z {
-        tmp[0] => {} //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `[`
-        _ => {}
-    }
-}
diff --git a/src/test/ui/parser/issue-24375.stderr b/src/test/ui/parser/issue-24375.stderr
deleted file mode 100644 (file)
index 7aed887..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `=>`, `@`, `if`, or `|`, found `[`
-  --> $DIR/issue-24375.rs:6:12
-   |
-LL |         tmp[0] => {}
-   |            ^ expected one of `=>`, `@`, `if`, or `|`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-24780.rs b/src/test/ui/parser/issue-24780.rs
deleted file mode 100644 (file)
index 480d9bc..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// Verify that '>' is not both expected and found at the same time, as it used
-// to happen in #24780. For example, following should be an error:
-// expected one of ..., `>`, ... found `>`.
-
-fn foo() -> Vec<usize>> { //~ ERROR expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>`
-    Vec::new()
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-24780.stderr b/src/test/ui/parser/issue-24780.stderr
deleted file mode 100644 (file)
index bdd089b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>`
-  --> $DIR/issue-24780.rs:5:23
-   |
-LL | fn foo() -> Vec<usize>> {
-   |                       ^ expected one of `!`, `+`, `::`, `;`, `where`, or `{`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-27255.rs b/src/test/ui/parser/issue-27255.rs
deleted file mode 100644 (file)
index d619688..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-trait A {}
-
-impl A .. {}
-//~^ ERROR missing `for` in a trait impl
-//~| ERROR `impl Trait for .. {}` is an obsolete syntax
-
-impl A      usize {}
-//~^ ERROR missing `for` in a trait impl
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-27255.stderr b/src/test/ui/parser/issue-27255.stderr
deleted file mode 100644 (file)
index 391a235..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-error: missing `for` in a trait impl
-  --> $DIR/issue-27255.rs:3:7
-   |
-LL | impl A .. {}
-   |       ^ help: add `for` here
-
-error: missing `for` in a trait impl
-  --> $DIR/issue-27255.rs:7:7
-   |
-LL | impl A      usize {}
-   |       ^^^^^^ help: add `for` here
-
-error: `impl Trait for .. {}` is an obsolete syntax
-  --> $DIR/issue-27255.rs:3:1
-   |
-LL | impl A .. {}
-   | ^^^^^^^^^^^^
-   |
-   = help: use `auto trait Trait {}` instead
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/parser/issue-30318.fixed b/src/test/ui/parser/issue-30318.fixed
deleted file mode 100644 (file)
index 71fc821..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// run-rustfix
-#![allow(unused)]
-fn foo() { }
-
-/// Misplaced comment...
-//~^ ERROR expected outer doc comment
-fn bar() { } //~ NOTE the inner doc comment doesn't annotate this function
-
-#[test] //~ ERROR an inner attribute is not permitted in this context
-fn baz() { } //~ NOTE the inner attribute doesn't annotate this function
-//~^^ NOTE inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually
-
-/** Misplaced comment... */
-//~^ ERROR expected outer doc comment
-fn bat() { } //~ NOTE the inner doc comment doesn't annotate this function
-
-fn main() { }
-
-// Misplaced comment...
-//~^ ERROR expected outer doc comment
-//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
-//~| NOTE other attributes here
-/* Misplaced comment... */
-//~^ ERROR expected outer doc comment
-//~| NOTE this doc comment doesn't document anything
-//~| ERROR expected item after doc comment
-//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
diff --git a/src/test/ui/parser/issue-30318.rs b/src/test/ui/parser/issue-30318.rs
deleted file mode 100644 (file)
index 465dca2..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// run-rustfix
-#![allow(unused)]
-fn foo() { }
-
-//! Misplaced comment...
-//~^ ERROR expected outer doc comment
-fn bar() { } //~ NOTE the inner doc comment doesn't annotate this function
-
-#![test] //~ ERROR an inner attribute is not permitted in this context
-fn baz() { } //~ NOTE the inner attribute doesn't annotate this function
-//~^^ NOTE inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually
-
-/*! Misplaced comment... */
-//~^ ERROR expected outer doc comment
-fn bat() { } //~ NOTE the inner doc comment doesn't annotate this function
-
-fn main() { }
-
-//! Misplaced comment...
-//~^ ERROR expected outer doc comment
-//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
-//~| NOTE other attributes here
-/*! Misplaced comment... */
-//~^ ERROR expected outer doc comment
-//~| NOTE this doc comment doesn't document anything
-//~| ERROR expected item after doc comment
-//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
diff --git a/src/test/ui/parser/issue-30318.stderr b/src/test/ui/parser/issue-30318.stderr
deleted file mode 100644 (file)
index 7e71088..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0753]: expected outer doc comment
-  --> $DIR/issue-30318.rs:5:1
-   |
-LL | //! Misplaced comment...
-   | ^^^^^^^^^^^^^^^^^^^^^^^^
-LL |
-LL | fn bar() { }
-   | ------------ the inner doc comment doesn't annotate this function
-   |
-help: to annotate the function, change the doc comment from inner to outer style
-   |
-LL | /// Misplaced comment...
-   |   ~
-
-error: an inner attribute is not permitted in this context
-  --> $DIR/issue-30318.rs:9:1
-   |
-LL | #![test]
-   | ^^^^^^^^
-LL | fn baz() { }
-   | ------------ the inner attribute doesn't annotate this function
-   |
-   = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
-help: to annotate the function, change the attribute from inner to outer style
-   |
-LL - #![test]
-LL + #[test]
-   | 
-
-error[E0753]: expected outer doc comment
-  --> $DIR/issue-30318.rs:13:1
-   |
-LL | /*! Misplaced comment... */
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-LL |
-LL | fn bat() { }
-   | ------------ the inner doc comment doesn't annotate this function
-   |
-help: to annotate the function, change the doc comment from inner to outer style
-   |
-LL | /** Misplaced comment... */
-   |   ~
-
-error[E0753]: expected outer doc comment
-  --> $DIR/issue-30318.rs:19:1
-   |
-LL | //! Misplaced comment...
-   | ^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
-help: you might have meant to write a regular comment
-   |
-LL - //! Misplaced comment...
-LL + // Misplaced comment...
-   | 
-
-error[E0753]: expected outer doc comment
-  --> $DIR/issue-30318.rs:23:1
-   |
-LL | /*! Misplaced comment... */
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
-help: you might have meant to write a regular comment
-   |
-LL - /*! Misplaced comment... */
-LL + /* Misplaced comment... */
-   | 
-
-error: expected item after doc comment
-  --> $DIR/issue-30318.rs:23:1
-   |
-LL | //! Misplaced comment...
-   | ------------------------ other attributes here
-...
-LL | /*! Misplaced comment... */
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment doesn't document anything
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0753`.
diff --git a/src/test/ui/parser/issue-3036.fixed b/src/test/ui/parser/issue-3036.fixed
deleted file mode 100644 (file)
index e5d5622..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-rustfix
-
-// Testing that semicolon tokens are printed correctly in errors
-
-fn main() {
-    let _x = 3; //~ ERROR: expected `;`
-}
diff --git a/src/test/ui/parser/issue-3036.rs b/src/test/ui/parser/issue-3036.rs
deleted file mode 100644 (file)
index 2f76fb9..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-rustfix
-
-// Testing that semicolon tokens are printed correctly in errors
-
-fn main() {
-    let _x = 3 //~ ERROR: expected `;`
-}
diff --git a/src/test/ui/parser/issue-3036.stderr b/src/test/ui/parser/issue-3036.stderr
deleted file mode 100644 (file)
index e022239..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: expected `;`, found `}`
-  --> $DIR/issue-3036.rs:6:15
-   |
-LL |     let _x = 3
-   |               ^ help: add `;` here
-LL | }
-   | - unexpected token
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-31804.rs b/src/test/ui/parser/issue-31804.rs
deleted file mode 100644 (file)
index d056b77..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// Test that error recovery in the parser to an EOF does not give an infinite
-// spew of errors.
-
-fn main() {
-    let
-} //~ ERROR expected pattern, found `}`
diff --git a/src/test/ui/parser/issue-31804.stderr b/src/test/ui/parser/issue-31804.stderr
deleted file mode 100644 (file)
index 76e68b0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected pattern, found `}`
-  --> $DIR/issue-31804.rs:6:1
-   |
-LL | }
-   | ^ expected pattern
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-32214.rs b/src/test/ui/parser/issue-32214.rs
deleted file mode 100644 (file)
index 1379eeb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-trait Trait<T> { type Item; }
-
-pub fn test<W, I: Trait<Item=(), W> >() {}
-//~^ ERROR generic arguments must come before the first constraint
-
-fn main() { }
diff --git a/src/test/ui/parser/issue-32214.stderr b/src/test/ui/parser/issue-32214.stderr
deleted file mode 100644 (file)
index d0a9b52..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-error: generic arguments must come before the first constraint
-  --> $DIR/issue-32214.rs:3:34
-   |
-LL | pub fn test<W, I: Trait<Item=(), W> >() {}
-   |                         -------  ^ generic argument
-   |                         |
-   |                         constraint
-   |
-help: move the constraint after the generic argument
-   |
-LL | pub fn test<W, I: Trait<W, Item = ()> >() {}
-   |                        ~~~~~~~~~~~~~~
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-32446.rs b/src/test/ui/parser/issue-32446.rs
deleted file mode 100644 (file)
index 53e519a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {}
-
-// This used to end up in an infite loop trying to bump past EOF.
-trait T { ... } //~ ERROR
diff --git a/src/test/ui/parser/issue-32446.stderr b/src/test/ui/parser/issue-32446.stderr
deleted file mode 100644 (file)
index 7515369..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: non-item in item list
-  --> $DIR/issue-32446.rs:4:11
-   |
-LL | trait T { ... }
-   |         - ^^^ - item list ends here
-   |         | |
-   |         | non-item starts here
-   |         item list starts here
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-32501.rs b/src/test/ui/parser/issue-32501.rs
deleted file mode 100644 (file)
index 5002420..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-fn main() {
-    let a = 0;
-    let _b = 0;
-    let _ = 0;
-    let mut b = 0;
-    let mut _b = 0;
-    let mut _ = 0;
-    //~^ ERROR `mut` must be followed by a named binding
-}
diff --git a/src/test/ui/parser/issue-32501.stderr b/src/test/ui/parser/issue-32501.stderr
deleted file mode 100644 (file)
index d533024..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: `mut` must be followed by a named binding
-  --> $DIR/issue-32501.rs:7:9
-   |
-LL |     let mut _ = 0;
-   |         ^^^^^ help: remove the `mut` prefix: `_`
-   |
-   = note: `mut` may be followed by `variable` and `variable @ pattern`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-32505.rs b/src/test/ui/parser/issue-32505.rs
deleted file mode 100644 (file)
index f31c00e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-pub fn test() {
-    foo(|_|) //~ ERROR expected expression, found `)`
-}
-
-fn main() { }
diff --git a/src/test/ui/parser/issue-32505.stderr b/src/test/ui/parser/issue-32505.stderr
deleted file mode 100644 (file)
index cdd779a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected expression, found `)`
-  --> $DIR/issue-32505.rs:2:12
-   |
-LL |     foo(|_|)
-   |            ^ expected expression
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-33262.rs b/src/test/ui/parser/issue-33262.rs
deleted file mode 100644 (file)
index 3a612f9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// Issue #33262
-
-pub fn main() {
-    for i in 0..a as { }
-    //~^ ERROR expected type, found `{`
-}
diff --git a/src/test/ui/parser/issue-33262.stderr b/src/test/ui/parser/issue-33262.stderr
deleted file mode 100644 (file)
index 2aff328..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected type, found `{`
-  --> $DIR/issue-33262.rs:4:22
-   |
-LL |     for i in 0..a as { }
-   |                      ^ expected type
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-33413.rs b/src/test/ui/parser/issue-33413.rs
deleted file mode 100644 (file)
index 7291732..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-struct S;
-
-impl S {
-    fn f(*, a: u8) -> u8 {}
-    //~^ ERROR expected parameter name, found `*`
-    //~| ERROR mismatched types
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-33413.stderr b/src/test/ui/parser/issue-33413.stderr
deleted file mode 100644 (file)
index ac320f0..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-error: expected parameter name, found `*`
-  --> $DIR/issue-33413.rs:4:10
-   |
-LL |     fn f(*, a: u8) -> u8 {}
-   |          ^ expected parameter name
-
-error[E0308]: mismatched types
-  --> $DIR/issue-33413.rs:4:23
-   |
-LL |     fn f(*, a: u8) -> u8 {}
-   |        -              ^^ expected `u8`, found `()`
-   |        |
-   |        implicitly returns `()` as its body has no tail or `return` expression
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issue-33418.fixed b/src/test/ui/parser/issue-33418.fixed
deleted file mode 100644 (file)
index ed885ae..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// run-rustfix
-
-trait Tr {}
-//~^ ERROR negative bounds are not supported
-trait Tr2: SuperA {}
-//~^ ERROR negative bounds are not supported
-trait Tr3: SuperB {}
-//~^ ERROR negative bounds are not supported
-trait Tr4: SuperB + SuperD {}
-//~^ ERROR negative bounds are not supported
-trait Tr5 {}
-//~^ ERROR negative bounds are not supported
-
-trait SuperA {}
-trait SuperB {}
-trait SuperC {}
-trait SuperD {}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-33418.rs b/src/test/ui/parser/issue-33418.rs
deleted file mode 100644 (file)
index 9934284..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// run-rustfix
-
-trait Tr: !SuperA {}
-//~^ ERROR negative bounds are not supported
-trait Tr2: SuperA + !SuperB {}
-//~^ ERROR negative bounds are not supported
-trait Tr3: !SuperA + SuperB {}
-//~^ ERROR negative bounds are not supported
-trait Tr4: !SuperA + SuperB
-    + !SuperC + SuperD {}
-//~^ ERROR negative bounds are not supported
-trait Tr5: !SuperA
-    + !SuperB {}
-//~^ ERROR negative bounds are not supported
-
-trait SuperA {}
-trait SuperB {}
-trait SuperC {}
-trait SuperD {}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-33418.stderr b/src/test/ui/parser/issue-33418.stderr
deleted file mode 100644 (file)
index 9a8733e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-error: negative bounds are not supported
-  --> $DIR/issue-33418.rs:3:9
-   |
-LL | trait Tr: !SuperA {}
-   |         ^^^^^^^^^ negative bounds are not supported
-
-error: negative bounds are not supported
-  --> $DIR/issue-33418.rs:5:19
-   |
-LL | trait Tr2: SuperA + !SuperB {}
-   |                   ^^^^^^^^^ negative bounds are not supported
-
-error: negative bounds are not supported
-  --> $DIR/issue-33418.rs:7:10
-   |
-LL | trait Tr3: !SuperA + SuperB {}
-   |          ^^^^^^^^^ negative bounds are not supported
-
-error: negative bounds are not supported
-  --> $DIR/issue-33418.rs:9:10
-   |
-LL | trait Tr4: !SuperA + SuperB
-   |          ^^^^^^^^^
-LL |     + !SuperC + SuperD {}
-   |     ^^^^^^^^^ negative bounds are not supported
-
-error: negative bounds are not supported
-  --> $DIR/issue-33418.rs:12:10
-   |
-LL | trait Tr5: !SuperA
-   |          ^^^^^^^^^
-LL |     + !SuperB {}
-   |     ^^^^^^^^^ negative bounds are not supported
-
-error: aborting due to 5 previous errors
-
diff --git a/src/test/ui/parser/issue-33455.rs b/src/test/ui/parser/issue-33455.rs
deleted file mode 100644 (file)
index 6dff63f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-use foo.bar; //~ ERROR expected one of `::`, `;`, or `as`, found `.`
diff --git a/src/test/ui/parser/issue-33455.stderr b/src/test/ui/parser/issue-33455.stderr
deleted file mode 100644 (file)
index c535ef2..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `::`, `;`, or `as`, found `.`
-  --> $DIR/issue-33455.rs:1:8
-   |
-LL | use foo.bar;
-   |        ^ expected one of `::`, `;`, or `as`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-34222-1.rs b/src/test/ui/parser/issue-34222-1.rs
deleted file mode 100644 (file)
index d36dddc..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() {
-    /// comment //~ ERROR found a documentation comment that doesn't document anything
-}
diff --git a/src/test/ui/parser/issue-34222-1.stderr b/src/test/ui/parser/issue-34222-1.stderr
deleted file mode 100644 (file)
index 0799656..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0585]: found a documentation comment that doesn't document anything
-  --> $DIR/issue-34222-1.rs:2:5
-   |
-LL |     /// comment
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: doc comments must come before what they document, maybe a comment was intended with `//`?
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0585`.
diff --git a/src/test/ui/parser/issue-34255-1.rs b/src/test/ui/parser/issue-34255-1.rs
deleted file mode 100644 (file)
index c70cd8b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-enum Test {
-    Drill {
-        field: i32,
-    }
-}
-
-fn main() {
-    Test::Drill(field: 42);
-    //~^ ERROR invalid `struct` delimiters or `fn` call arguments
-}
diff --git a/src/test/ui/parser/issue-34255-1.stderr b/src/test/ui/parser/issue-34255-1.stderr
deleted file mode 100644 (file)
index fbff75e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error: invalid `struct` delimiters or `fn` call arguments
-  --> $DIR/issue-34255-1.rs:8:5
-   |
-LL |     Test::Drill(field: 42);
-   |     ^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: if `Test::Drill` is a struct, use braces as delimiters
-   |
-LL |     Test::Drill { field: 42 };
-   |                 ~           ~
-help: if `Test::Drill` is a function, use the arguments directly
-   |
-LL -     Test::Drill(field: 42);
-LL +     Test::Drill(42);
-   | 
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-35813-postfix-after-cast.rs b/src/test/ui/parser/issue-35813-postfix-after-cast.rs
deleted file mode 100644 (file)
index e725aa5..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-// edition:2018
-#![crate_type = "lib"]
-#![feature(type_ascription)]
-use std::future::Future;
-use std::pin::Pin;
-
-// This tests the parser for "x as Y[z]". It errors, but we want to give useful
-// errors and parse such that further code gives useful errors.
-pub fn index_after_as_cast() {
-    vec![1, 2, 3] as Vec<i32>[0];
-    //~^ ERROR: casts cannot be followed by indexing
-    vec![1, 2, 3]: Vec<i32>[0];
-    //~^ ERROR: casts cannot be followed by indexing
-}
-
-pub fn index_after_cast_to_index() {
-    (&[0]) as &[i32][0];
-    //~^ ERROR: casts cannot be followed by indexing
-    (&[0i32]): &[i32; 1][0];
-    //~^ ERROR: casts cannot be followed by indexing
-}
-
-pub fn cast_after_cast() {
-    if 5u64 as i32 as u16 == 0u16 {
-
-    }
-    if 5u64: u64: u64 == 0u64 {
-
-    }
-    let _ = 5u64: u64: u64 as u8 as i8 == 9i8;
-    let _ = 0i32: i32: i32;
-    let _ = 0 as i32: i32;
-    let _ = 0i32: i32 as i32;
-    let _ = 0 as i32 as i32;
-    let _ = 0i32: i32: i32 as u32 as i32;
-}
-
-pub fn cast_cast_method_call() {
-    let _ = 0i32: i32: i32.count_ones();
-    //~^ ERROR: casts cannot be followed by a method call
-    let _ = 0 as i32: i32.count_ones();
-    //~^ ERROR: casts cannot be followed by a method call
-    let _ = 0i32: i32 as i32.count_ones();
-    //~^ ERROR: casts cannot be followed by a method call
-    let _ = 0 as i32 as i32.count_ones();
-    //~^ ERROR: casts cannot be followed by a method call
-    let _ = 0i32: i32: i32 as u32 as i32.count_ones();
-    //~^ ERROR: casts cannot be followed by a method call
-    let _ = 0i32: i32.count_ones(): u32;
-    //~^ ERROR: casts cannot be followed by a method call
-    let _ = 0 as i32.count_ones(): u32;
-    //~^ ERROR: casts cannot be followed by a method call
-    let _ = 0i32: i32.count_ones() as u32;
-    //~^ ERROR: casts cannot be followed by a method call
-    let _ = 0 as i32.count_ones() as u32;
-    //~^ ERROR: casts cannot be followed by a method call
-    let _ = 0i32: i32: i32.count_ones() as u32 as i32;
-    //~^ ERROR: casts cannot be followed by a method call
-}
-
-pub fn multiline_error() {
-    let _ = 0
-        as i32
-        .count_ones();
-    //~^^^ ERROR: casts cannot be followed by a method call
-}
-
-// this tests that the precedence for `!x as Y.Z` is still what we expect
-pub fn precedence() {
-    let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0];
-    //~^ ERROR: casts cannot be followed by indexing
-}
-
-pub fn method_calls() {
-    0 as i32.max(0);
-    //~^ ERROR: casts cannot be followed by a method call
-    0: i32.max(0);
-    //~^ ERROR: casts cannot be followed by a method call
-}
-
-pub fn complex() {
-    let _ = format!(
-        "{} and {}",
-        if true { 33 } else { 44 } as i32.max(0),
-        //~^ ERROR: casts cannot be followed by a method call
-        if true { 33 } else { 44 }: i32.max(0)
-        //~^ ERROR: casts cannot be followed by a method call
-    );
-}
-
-pub fn in_condition() {
-    if 5u64 as i32.max(0) == 0 {
-        //~^ ERROR: casts cannot be followed by a method call
-    }
-    if 5u64: u64.max(0) == 0 {
-        //~^ ERROR: casts cannot be followed by a method call
-    }
-}
-
-pub fn inside_block() {
-    let _ = if true {
-        5u64 as u32.max(0) == 0
-        //~^ ERROR: casts cannot be followed by a method call
-    } else { false };
-    let _ = if true {
-        5u64: u64.max(0) == 0
-        //~^ ERROR: casts cannot be followed by a method call
-    } else { false };
-}
-
-static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]);
-//~^ ERROR: casts cannot be followed by indexing
-
-static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
-//~^ ERROR: casts cannot be followed by indexing
-
-
-pub fn cast_then_try() -> Result<u64,u64> {
-    Err(0u64) as Result<u64,u64>?;
-    //~^ ERROR: casts cannot be followed by ?
-    Err(0u64): Result<u64,u64>?;
-    //~^ ERROR: casts cannot be followed by ?
-    Ok(1)
-}
-
-
-pub fn cast_then_call() {
-    type F = fn(u8);
-    // type ascription won't actually do [unique drop fn type] -> fn(u8) casts.
-    let drop_ptr = drop as fn(u8);
-    drop as F();
-    //~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214]
-    drop_ptr: F();
-    //~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214]
-}
-
-pub fn cast_to_fn_should_work() {
-    let drop_ptr = drop as fn(u8);
-    drop as fn(u8);
-    drop_ptr: fn(u8);
-}
-
-pub fn parens_after_cast_error() {
-    let drop_ptr = drop as fn(u8);
-    drop as fn(u8)(0);
-    //~^ ERROR: casts cannot be followed by a function call
-    drop_ptr: fn(u8)(0);
-    //~^ ERROR: casts cannot be followed by a function call
-}
-
-pub async fn cast_then_await() {
-    Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await;
-    //~^ ERROR: casts cannot be followed by `.await`
-
-    Box::pin(noop()): Pin<Box<_>>.await;
-    //~^ ERROR: casts cannot be followed by `.await`
-}
-
-pub async fn noop() {}
-
-#[derive(Default)]
-pub struct Foo {
-    pub bar: u32,
-}
-
-pub fn struct_field() {
-    Foo::default() as Foo.bar;
-    //~^ ERROR: cannot be followed by a field access
-    Foo::default(): Foo.bar;
-    //~^ ERROR: cannot be followed by a field access
-}
diff --git a/src/test/ui/parser/issue-35813-postfix-after-cast.stderr b/src/test/ui/parser/issue-35813-postfix-after-cast.stderr
deleted file mode 100644 (file)
index 19b6855..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-error: casts cannot be followed by indexing
-  --> $DIR/issue-35813-postfix-after-cast.rs:10:5
-   |
-LL |     vec![1, 2, 3] as Vec<i32>[0];
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (vec![1, 2, 3] as Vec<i32>)[0];
-   |     +                         +
-
-error: casts cannot be followed by indexing
-  --> $DIR/issue-35813-postfix-after-cast.rs:12:5
-   |
-LL |     vec![1, 2, 3]: Vec<i32>[0];
-   |     ^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (vec![1, 2, 3]: Vec<i32>)[0];
-   |     +                       +
-
-error: casts cannot be followed by indexing
-  --> $DIR/issue-35813-postfix-after-cast.rs:17:5
-   |
-LL |     (&[0]) as &[i32][0];
-   |     ^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     ((&[0]) as &[i32])[0];
-   |     +                +
-
-error: casts cannot be followed by indexing
-  --> $DIR/issue-35813-postfix-after-cast.rs:19:5
-   |
-LL |     (&[0i32]): &[i32; 1][0];
-   |     ^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     ((&[0i32]): &[i32; 1])[0];
-   |     +                    +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:39:13
-   |
-LL |     let _ = 0i32: i32: i32.count_ones();
-   |             ^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0i32: i32: i32).count_ones();
-   |             +              +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:41:13
-   |
-LL |     let _ = 0 as i32: i32.count_ones();
-   |             ^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0 as i32: i32).count_ones();
-   |             +             +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:43:13
-   |
-LL |     let _ = 0i32: i32 as i32.count_ones();
-   |             ^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0i32: i32 as i32).count_ones();
-   |             +                +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:45:13
-   |
-LL |     let _ = 0 as i32 as i32.count_ones();
-   |             ^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0 as i32 as i32).count_ones();
-   |             +               +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:47:13
-   |
-LL |     let _ = 0i32: i32: i32 as u32 as i32.count_ones();
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0i32: i32: i32 as u32 as i32).count_ones();
-   |             +                            +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:49:13
-   |
-LL |     let _ = 0i32: i32.count_ones(): u32;
-   |             ^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0i32: i32).count_ones(): u32;
-   |             +         +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:51:13
-   |
-LL |     let _ = 0 as i32.count_ones(): u32;
-   |             ^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0 as i32).count_ones(): u32;
-   |             +        +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:53:13
-   |
-LL |     let _ = 0i32: i32.count_ones() as u32;
-   |             ^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0i32: i32).count_ones() as u32;
-   |             +         +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:55:13
-   |
-LL |     let _ = 0 as i32.count_ones() as u32;
-   |             ^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0 as i32).count_ones() as u32;
-   |             +        +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:57:13
-   |
-LL |     let _ = 0i32: i32: i32.count_ones() as u32 as i32;
-   |             ^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let _ = (0i32: i32: i32).count_ones() as u32 as i32;
-   |             +              +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:62:13
-   |
-LL |       let _ = 0
-   |  _____________^
-LL | |         as i32
-   | |______________^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL ~     let _ = (0
-LL ~         as i32)
-   |
-
-error: casts cannot be followed by indexing
-  --> $DIR/issue-35813-postfix-after-cast.rs:70:18
-   |
-LL |     let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0];
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     let x: i32 = (&vec![1, 2, 3] as &Vec<i32>)[0];
-   |                  +                           +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:75:5
-   |
-LL |     0 as i32.max(0);
-   |     ^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (0 as i32).max(0);
-   |     +        +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:77:5
-   |
-LL |     0: i32.max(0);
-   |     ^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (0: i32).max(0);
-   |     +      +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:92:8
-   |
-LL |     if 5u64 as i32.max(0) == 0 {
-   |        ^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     if (5u64 as i32).max(0) == 0 {
-   |        +           +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:95:8
-   |
-LL |     if 5u64: u64.max(0) == 0 {
-   |        ^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     if (5u64: u64).max(0) == 0 {
-   |        +         +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:102:9
-   |
-LL |         5u64 as u32.max(0) == 0
-   |         ^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |         (5u64 as u32).max(0) == 0
-   |         +           +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:106:9
-   |
-LL |         5u64: u64.max(0) == 0
-   |         ^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |         (5u64: u64).max(0) == 0
-   |         +         +
-
-error: casts cannot be followed by indexing
-  --> $DIR/issue-35813-postfix-after-cast.rs:111:24
-   |
-LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]);
-   |                        ^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL | static bar: &[i32] = &((&[1,2,3] as &[i32])[0..1]);
-   |                        +                  +
-
-error: casts cannot be followed by indexing
-  --> $DIR/issue-35813-postfix-after-cast.rs:114:25
-   |
-LL | static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
-   |                         ^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL | static bar2: &[i32] = &((&[1i32,2,3]: &[i32; 3])[0..1]);
-   |                         +                      +
-
-error: casts cannot be followed by ?
-  --> $DIR/issue-35813-postfix-after-cast.rs:119:5
-   |
-LL |     Err(0u64) as Result<u64,u64>?;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (Err(0u64) as Result<u64,u64>)?;
-   |     +                            +
-
-error: casts cannot be followed by ?
-  --> $DIR/issue-35813-postfix-after-cast.rs:121:5
-   |
-LL |     Err(0u64): Result<u64,u64>?;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (Err(0u64): Result<u64,u64>)?;
-   |     +                          +
-
-error: casts cannot be followed by a function call
-  --> $DIR/issue-35813-postfix-after-cast.rs:145:5
-   |
-LL |     drop as fn(u8)(0);
-   |     ^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (drop as fn(u8))(0);
-   |     +              +
-
-error: casts cannot be followed by a function call
-  --> $DIR/issue-35813-postfix-after-cast.rs:147:5
-   |
-LL |     drop_ptr: fn(u8)(0);
-   |     ^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (drop_ptr: fn(u8))(0);
-   |     +                +
-
-error: casts cannot be followed by `.await`
-  --> $DIR/issue-35813-postfix-after-cast.rs:152:5
-   |
-LL |     Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>).await;
-   |     +                                                     +
-
-error: casts cannot be followed by `.await`
-  --> $DIR/issue-35813-postfix-after-cast.rs:155:5
-   |
-LL |     Box::pin(noop()): Pin<Box<_>>.await;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (Box::pin(noop()): Pin<Box<_>>).await;
-   |     +                             +
-
-error: casts cannot be followed by a field access
-  --> $DIR/issue-35813-postfix-after-cast.rs:167:5
-   |
-LL |     Foo::default() as Foo.bar;
-   |     ^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (Foo::default() as Foo).bar;
-   |     +                     +
-
-error: casts cannot be followed by a field access
-  --> $DIR/issue-35813-postfix-after-cast.rs:169:5
-   |
-LL |     Foo::default(): Foo.bar;
-   |     ^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |     (Foo::default(): Foo).bar;
-   |     +                   +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:84:9
-   |
-LL |         if true { 33 } else { 44 } as i32.max(0),
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |         (if true { 33 } else { 44 } as i32).max(0),
-   |         +                                 +
-
-error: casts cannot be followed by a method call
-  --> $DIR/issue-35813-postfix-after-cast.rs:86:9
-   |
-LL |         if true { 33 } else { 44 }: i32.max(0)
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: try surrounding the expression in parentheses
-   |
-LL |         (if true { 33 } else { 44 }: i32).max(0)
-   |         +                               +
-
-error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
-  --> $DIR/issue-35813-postfix-after-cast.rs:131:13
-   |
-LL |     drop as F();
-   |             ^^^ only `Fn` traits may use parentheses
-
-error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
-  --> $DIR/issue-35813-postfix-after-cast.rs:133:15
-   |
-LL |     drop_ptr: F();
-   |               ^^^ only `Fn` traits may use parentheses
-
-error: aborting due to 36 previous errors
-
-For more information about this error, try `rustc --explain E0214`.
diff --git a/src/test/ui/parser/issue-41155.rs b/src/test/ui/parser/issue-41155.rs
deleted file mode 100644 (file)
index 5a7488e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-struct S;
-
-impl S {
-    pub //~ ERROR visibility `pub` is not followed by an item
-} //~ ERROR non-item in item list
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-41155.stderr b/src/test/ui/parser/issue-41155.stderr
deleted file mode 100644 (file)
index 8491afa..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-error: visibility `pub` is not followed by an item
-  --> $DIR/issue-41155.rs:4:5
-   |
-LL |     pub
-   |     ^^^ the visibility
-   |
-   = help: you likely meant to define an item, e.g., `pub fn foo() {}`
-
-error: non-item in item list
-  --> $DIR/issue-41155.rs:5:1
-   |
-LL | impl S {
-   |        - item list starts here
-LL |     pub
-LL | }
-   | ^
-   | |
-   | non-item starts here
-   | item list ends here
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-43196.rs b/src/test/ui/parser/issue-43196.rs
deleted file mode 100644 (file)
index 0eefa01..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main() {
-    |
-}
-//~^ ERROR expected `|`, found `}`
-|
-//~^ ERROR expected item, found `|`
diff --git a/src/test/ui/parser/issue-43196.stderr b/src/test/ui/parser/issue-43196.stderr
deleted file mode 100644 (file)
index 4f7ed5c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-error: expected `|`, found `}`
-  --> $DIR/issue-43196.rs:3:1
-   |
-LL |     |
-   |      - expected `|`
-LL | }
-   | ^ unexpected token
-
-error: expected item, found `|`
-  --> $DIR/issue-43196.rs:5:1
-   |
-LL | |
-   | ^ expected item
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-43692.rs b/src/test/ui/parser/issue-43692.rs
deleted file mode 100644 (file)
index baf8baf..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() {
-    '\u{_10FFFF}'; //~ ERROR invalid start of unicode escape
-}
diff --git a/src/test/ui/parser/issue-43692.stderr b/src/test/ui/parser/issue-43692.stderr
deleted file mode 100644 (file)
index baf9980..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: invalid start of unicode escape: `_`
-  --> $DIR/issue-43692.rs:2:9
-   |
-LL |     '\u{_10FFFF}';
-   |         ^ invalid start of unicode escape
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-44021.rs b/src/test/ui/parser/issue-44021.rs
deleted file mode 100644 (file)
index 0b9558c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-struct MyStruct;
-impl MyStruct {
-    fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}`
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-44021.stderr b/src/test/ui/parser/issue-44021.stderr
deleted file mode 100644 (file)
index b888cd9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `:`, `@`, or `|`, found `}`
-  --> $DIR/issue-44021.rs:3:18
-   |
-LL |     fn f() {|x, y}
-   |                  ^ expected one of `:`, `@`, or `|`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-44406.rs b/src/test/ui/parser/issue-44406.rs
deleted file mode 100644 (file)
index a5b7e83..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-macro_rules! foo {
-    ($rest: tt) => {
-        bar(baz: $rest) //~ ERROR invalid `struct` delimiters or `fn` call arguments
-    }
-}
-
-fn main() {
-    foo!(true);
-    //~^ ERROR expected identifier, found keyword
-}
diff --git a/src/test/ui/parser/issue-44406.stderr b/src/test/ui/parser/issue-44406.stderr
deleted file mode 100644 (file)
index 6141904..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-error: expected identifier, found keyword `true`
-  --> $DIR/issue-44406.rs:8:10
-   |
-LL |     foo!(true);
-   |          ^^^^ expected identifier, found keyword
-   |
-help: you can escape reserved keywords to use them as identifiers
-   |
-LL |     foo!(r#true);
-   |          ~~~~~~
-
-error: invalid `struct` delimiters or `fn` call arguments
-  --> $DIR/issue-44406.rs:3:9
-   |
-LL |         bar(baz: $rest)
-   |         ^^^^^^^^^^^^^^^
-...
-LL |     foo!(true);
-   |     ---------- in this macro invocation
-   |
-   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: if `bar` is a struct, use braces as delimiters
-   |
-LL |         bar {  }
-   |             ~
-help: if `bar` is a function, use the arguments directly
-   |
-LL -         bar(baz: $rest)
-LL +         bar(: $rest)
-   | 
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-45296.rs b/src/test/ui/parser/issue-45296.rs
deleted file mode 100644 (file)
index d3a97e8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main() {
-    let unused = ();
-
-    #![allow(unused_variables)] //~ ERROR not permitted in this context
-    fn foo() {}
-}
diff --git a/src/test/ui/parser/issue-45296.stderr b/src/test/ui/parser/issue-45296.stderr
deleted file mode 100644 (file)
index 6abe266..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-error: an inner attribute is not permitted in this context
-  --> $DIR/issue-45296.rs:4:5
-   |
-LL |     #![allow(unused_variables)]
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-LL |     fn foo() {}
-   |     ----------- the inner attribute doesn't annotate this function
-   |
-   = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
-help: to annotate the function, change the attribute from inner to outer style
-   |
-LL -     #![allow(unused_variables)]
-LL +     #[allow(unused_variables)]
-   | 
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-46186.fixed b/src/test/ui/parser/issue-46186.fixed
deleted file mode 100644 (file)
index 2cb5a49..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-rustfix
-
-pub struct Struct {
-    pub a: usize,
-}
-//~^ ERROR expected item, found `;`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-46186.rs b/src/test/ui/parser/issue-46186.rs
deleted file mode 100644 (file)
index 84cad38..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-rustfix
-
-pub struct Struct {
-    pub a: usize,
-};
-//~^ ERROR expected item, found `;`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-46186.stderr b/src/test/ui/parser/issue-46186.stderr
deleted file mode 100644 (file)
index 0766c8a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: expected item, found `;`
-  --> $DIR/issue-46186.rs:5:2
-   |
-LL | };
-   |  ^ help: remove this semicolon
-   |
-   = help: braced struct declarations are not followed by a semicolon
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs b/src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs
deleted file mode 100644 (file)
index 48a679b..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-fn main() {}
-
-macro_rules! expand_to_enum {
-    () => {
-        enum BadE {}
-        //~^ ERROR enum is not supported in `trait`s or `impl`s
-        //~| ERROR enum is not supported in `trait`s or `impl`s
-        //~| ERROR enum is not supported in `extern` blocks
-    };
-}
-
-macro_rules! mac_impl {
-    ($($i:item)*) => {
-        struct S;
-        impl S { $($i)* }
-    }
-}
-
-mac_impl! {
-    struct BadS; //~ ERROR struct is not supported in `trait`s or `impl`s
-    expand_to_enum!();
-}
-
-macro_rules! mac_trait {
-    ($($i:item)*) => {
-        trait T { $($i)* }
-    }
-}
-
-mac_trait! {
-    struct BadS; //~ ERROR struct is not supported in `trait`s or `impl`s
-    expand_to_enum!();
-}
-
-macro_rules! mac_extern {
-    ($($i:item)*) => {
-        extern "C" { $($i)* }
-    }
-}
-
-mac_extern! {
-    struct BadS; //~ ERROR struct is not supported in `extern` blocks
-    expand_to_enum!();
-}
diff --git a/src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr b/src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr
deleted file mode 100644 (file)
index fdef8ff..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-error: struct is not supported in `trait`s or `impl`s
-  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:20:5
-   |
-LL |     struct BadS;
-   |     ^^^^^^^^^^^^
-   |
-   = help: consider moving the struct out to a nearby module scope
-
-error: enum is not supported in `trait`s or `impl`s
-  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:5:9
-   |
-LL |         enum BadE {}
-   |         ^^^^^^^^^
-...
-LL |     expand_to_enum!();
-   |     ----------------- in this macro invocation
-   |
-   = help: consider moving the enum out to a nearby module scope
-   = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: struct is not supported in `trait`s or `impl`s
-  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:31:5
-   |
-LL |     struct BadS;
-   |     ^^^^^^^^^^^^
-   |
-   = help: consider moving the struct out to a nearby module scope
-
-error: enum is not supported in `trait`s or `impl`s
-  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:5:9
-   |
-LL |         enum BadE {}
-   |         ^^^^^^^^^
-...
-LL |     expand_to_enum!();
-   |     ----------------- in this macro invocation
-   |
-   = help: consider moving the enum out to a nearby module scope
-   = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: struct is not supported in `extern` blocks
-  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:42:5
-   |
-LL |     struct BadS;
-   |     ^^^^^^^^^^^^
-   |
-   = help: consider moving the struct out to a nearby module scope
-
-error: enum is not supported in `extern` blocks
-  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:5:9
-   |
-LL |         enum BadE {}
-   |         ^^^^^^^^^
-...
-LL |     expand_to_enum!();
-   |     ----------------- in this macro invocation
-   |
-   = help: consider moving the enum out to a nearby module scope
-   = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 6 previous errors
-
diff --git a/src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items.rs b/src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items.rs
deleted file mode 100644 (file)
index 8592f8a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// check-pass
-
-fn main() {}
-
-macro_rules! mac_impl {
-    ($i:item) => {
-        struct S;
-        impl S { $i }
-    }
-}
-
-mac_impl! {
-    fn foo() {}
-}
-
-macro_rules! mac_trait {
-    ($i:item) => {
-        trait T { $i }
-    }
-}
-
-mac_trait! {
-    fn foo() {}
-}
-
-macro_rules! mac_extern {
-    ($i:item) => {
-        extern "C" { $i }
-    }
-}
-
-mac_extern! {
-    fn foo();
-}
diff --git a/src/test/ui/parser/issue-48508-aux.rs b/src/test/ui/parser/issue-48508-aux.rs
deleted file mode 100644 (file)
index ebdc70a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-pass
-// ignore-test Not a test. Used by issue-48508.rs
-
-pub fn other() -> f64 {
-    let µ = 1.0;
-    µ
-}
diff --git a/src/test/ui/parser/issue-48508.rs b/src/test/ui/parser/issue-48508.rs
deleted file mode 100644 (file)
index 37d04c5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-pass
-// Regression test for issue #48508:
-//
-// Confusion between global and local file offsets caused incorrect handling of multibyte character
-// spans when compiling multiple files. One visible effect was an ICE generating debug information
-// when a multibyte character is at the end of a scope. The problematic code is actually in
-// issue-48508-aux.rs
-
-// compile-flags:-g
-// ignore-pretty issue #37195
-// ignore-asmjs wasm2js does not support source maps yet
-
-#![allow(uncommon_codepoints)]
-
-#[path = "issue-48508-aux.rs"]
-mod other_file;
-
-fn main() {
-    other_file::other();
-}
diff --git a/src/test/ui/parser/issue-48636.fixed b/src/test/ui/parser/issue-48636.fixed
deleted file mode 100644 (file)
index 87c19a3..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-rustfix
-
-#![allow(dead_code)]
-
-struct S {
-    x: u8,
-    /// The ID of the parent core
-    y: u8,
-}
-//~^^^ ERROR found a documentation comment that doesn't document anything
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-48636.rs b/src/test/ui/parser/issue-48636.rs
deleted file mode 100644 (file)
index 8610dc2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-rustfix
-
-#![allow(dead_code)]
-
-struct S {
-    x: u8
-    /// The ID of the parent core
-    y: u8,
-}
-//~^^^ ERROR found a documentation comment that doesn't document anything
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-48636.stderr b/src/test/ui/parser/issue-48636.stderr
deleted file mode 100644 (file)
index 462723d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0585]: found a documentation comment that doesn't document anything
-  --> $DIR/issue-48636.rs:7:5
-   |
-LL |     x: u8
-   |          - help: missing comma here: `,`
-LL |     /// The ID of the parent core
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: doc comments must come before what they document, maybe a comment was intended with `//`?
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0585`.
diff --git a/src/test/ui/parser/issue-49040.rs b/src/test/ui/parser/issue-49040.rs
deleted file mode 100644 (file)
index b7a541d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#![allow(unused_variables)]; //~ ERROR expected item, found `;`
-//~^ ERROR `main` function
-fn foo() {}
diff --git a/src/test/ui/parser/issue-49040.stderr b/src/test/ui/parser/issue-49040.stderr
deleted file mode 100644 (file)
index 56befe3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-error: expected item, found `;`
-  --> $DIR/issue-49040.rs:1:28
-   |
-LL | #![allow(unused_variables)];
-   |                            ^ help: remove this semicolon
-
-error[E0601]: `main` function not found in crate `issue_49040`
-  --> $DIR/issue-49040.rs:1:1
-   |
-LL | #![allow(unused_variables)];
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider adding a `main` function to `$DIR/issue-49040.rs`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/ui/parser/issue-51602.rs b/src/test/ui/parser/issue-51602.rs
deleted file mode 100644 (file)
index 0e96ca9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main(){
-    if i in 1..10 {
-//~^ ERROR expected `{`, found keyword `in`
-        break;
-    }
-}
diff --git a/src/test/ui/parser/issue-51602.stderr b/src/test/ui/parser/issue-51602.stderr
deleted file mode 100644 (file)
index d800890..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: expected `{`, found keyword `in`
-  --> $DIR/issue-51602.rs:2:10
-   |
-LL |     if i in 1..10 {
-   |     --   ^^ expected `{`
-   |     |
-   |     this `if` expression has a condition, but no block
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-52496.rs b/src/test/ui/parser/issue-52496.rs
deleted file mode 100644 (file)
index 05461f8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-struct Foo { bar: f64, baz: i64, bat: i64 }
-
-fn main() {
-    let _ = Foo { bar: .5, baz: 42 };
-    //~^ ERROR float literals must have an integer part
-    //~| ERROR missing field `bat` in initializer of `Foo`
-    let bar = 1.5f32;
-    let _ = Foo { bar.into(), bat: -1, . };
-    //~^ ERROR expected one of
-    //~| ERROR missing fields `bar` and `baz` in initializer of `Foo`
-    //~| ERROR expected identifier, found `.`
-}
diff --git a/src/test/ui/parser/issue-52496.stderr b/src/test/ui/parser/issue-52496.stderr
deleted file mode 100644 (file)
index 9dbf26e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-error: float literals must have an integer part
-  --> $DIR/issue-52496.rs:4:24
-   |
-LL |     let _ = Foo { bar: .5, baz: 42 };
-   |                        ^^ help: must have an integer part: `0.5`
-
-error: expected one of `,` or `}`, found `.`
-  --> $DIR/issue-52496.rs:8:22
-   |
-LL |     let _ = Foo { bar.into(), bat: -1, . };
-   |             ---      ^ expected one of `,` or `}`
-   |             |
-   |             while parsing this struct
-
-error: expected identifier, found `.`
-  --> $DIR/issue-52496.rs:8:40
-   |
-LL |     let _ = Foo { bar.into(), bat: -1, . };
-   |             ---                        ^ expected identifier
-   |             |
-   |             while parsing this struct
-
-error[E0063]: missing field `bat` in initializer of `Foo`
-  --> $DIR/issue-52496.rs:4:13
-   |
-LL |     let _ = Foo { bar: .5, baz: 42 };
-   |             ^^^ missing `bat`
-
-error[E0063]: missing fields `bar` and `baz` in initializer of `Foo`
-  --> $DIR/issue-52496.rs:8:13
-   |
-LL |     let _ = Foo { bar.into(), bat: -1, . };
-   |             ^^^ missing `bar` and `baz`
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0063`.
diff --git a/src/test/ui/parser/issue-54521-1.rs b/src/test/ui/parser/issue-54521-1.rs
deleted file mode 100644 (file)
index 8a682ef..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// check-pass
-
-// This test checks that the `remove extra angle brackets` error doesn't happen for some
-// potential edge-cases..
-
-struct X {
-    len: u32,
-}
-
-fn main() {
-    let x = X { len: 3 };
-
-    let _ = x.len > (3);
-
-    let _ = x.len >> (3);
-}
diff --git a/src/test/ui/parser/issue-54521-2.fixed b/src/test/ui/parser/issue-54521-2.fixed
deleted file mode 100644 (file)
index a91c4fe..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-rustfix
-
-// This test checks that the following error is emitted and the suggestion works:
-//
-// ```
-// let _ = Vec::<usize>>>::new();
-//                     ^^ help: remove extra angle brackets
-// ```
-
-fn main() {
-    let _ = Vec::<usize>::new();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = Vec::<usize>::new();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = Vec::<usize>::new();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = Vec::<usize>::new();
-    //~^ ERROR unmatched angle bracket
-}
diff --git a/src/test/ui/parser/issue-54521-2.rs b/src/test/ui/parser/issue-54521-2.rs
deleted file mode 100644 (file)
index 3639aac..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-rustfix
-
-// This test checks that the following error is emitted and the suggestion works:
-//
-// ```
-// let _ = Vec::<usize>>>::new();
-//                     ^^ help: remove extra angle brackets
-// ```
-
-fn main() {
-    let _ = Vec::<usize>>>>>::new();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = Vec::<usize>>>>::new();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = Vec::<usize>>>::new();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = Vec::<usize>>::new();
-    //~^ ERROR unmatched angle bracket
-}
diff --git a/src/test/ui/parser/issue-54521-2.stderr b/src/test/ui/parser/issue-54521-2.stderr
deleted file mode 100644 (file)
index 9556b83..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-error: unmatched angle brackets
-  --> $DIR/issue-54521-2.rs:11:25
-   |
-LL |     let _ = Vec::<usize>>>>>::new();
-   |                         ^^^^ help: remove extra angle brackets
-
-error: unmatched angle brackets
-  --> $DIR/issue-54521-2.rs:14:25
-   |
-LL |     let _ = Vec::<usize>>>>::new();
-   |                         ^^^ help: remove extra angle brackets
-
-error: unmatched angle brackets
-  --> $DIR/issue-54521-2.rs:17:25
-   |
-LL |     let _ = Vec::<usize>>>::new();
-   |                         ^^ help: remove extra angle brackets
-
-error: unmatched angle bracket
-  --> $DIR/issue-54521-2.rs:20:25
-   |
-LL |     let _ = Vec::<usize>>::new();
-   |                         ^ help: remove extra angle bracket
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/parser/issue-54521-3.fixed b/src/test/ui/parser/issue-54521-3.fixed
deleted file mode 100644 (file)
index 84ab686..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-rustfix
-
-// This test checks that the following error is emitted and the suggestion works:
-//
-// ```
-// let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>();
-//                                                        ^^ help: remove extra angle brackets
-// ```
-
-fn main() {
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-}
diff --git a/src/test/ui/parser/issue-54521-3.rs b/src/test/ui/parser/issue-54521-3.rs
deleted file mode 100644 (file)
index f1d6850..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-rustfix
-
-// This test checks that the following error is emitted and the suggestion works:
-//
-// ```
-// let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>();
-//                                                        ^^ help: remove extra angle brackets
-// ```
-
-fn main() {
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>();
-    //~^ ERROR unmatched angle bracket
-}
diff --git a/src/test/ui/parser/issue-54521-3.stderr b/src/test/ui/parser/issue-54521-3.stderr
deleted file mode 100644 (file)
index 0f23dd6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-error: unmatched angle brackets
-  --> $DIR/issue-54521-3.rs:11:60
-   |
-LL |     let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>>();
-   |                                                            ^^^^ help: remove extra angle brackets
-
-error: unmatched angle brackets
-  --> $DIR/issue-54521-3.rs:14:60
-   |
-LL |     let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>();
-   |                                                            ^^^ help: remove extra angle brackets
-
-error: unmatched angle brackets
-  --> $DIR/issue-54521-3.rs:17:60
-   |
-LL |     let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>();
-   |                                                            ^^ help: remove extra angle brackets
-
-error: unmatched angle bracket
-  --> $DIR/issue-54521-3.rs:20:60
-   |
-LL |     let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>();
-   |                                                            ^ help: remove extra angle bracket
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/parser/issue-5544-a.rs b/src/test/ui/parser/issue-5544-a.rs
deleted file mode 100644 (file)
index 3c239c7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {
-    let __isize = 340282366920938463463374607431768211456; // 2^128
-    //~^ ERROR integer literal is too large
-}
diff --git a/src/test/ui/parser/issue-5544-a.stderr b/src/test/ui/parser/issue-5544-a.stderr
deleted file mode 100644 (file)
index de579c3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: integer literal is too large
-  --> $DIR/issue-5544-a.rs:2:19
-   |
-LL |     let __isize = 340282366920938463463374607431768211456; // 2^128
-   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-5544-b.rs b/src/test/ui/parser/issue-5544-b.rs
deleted file mode 100644 (file)
index 93f2ff2..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {
-    let __isize = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ff;
-    //~^ ERROR integer literal is too large
-}
diff --git a/src/test/ui/parser/issue-5544-b.stderr b/src/test/ui/parser/issue-5544-b.stderr
deleted file mode 100644 (file)
index 7df212d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: integer literal is too large
-  --> $DIR/issue-5544-b.rs:2:19
-   |
-LL |     let __isize = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ff;
-   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-56031.rs b/src/test/ui/parser/issue-56031.rs
deleted file mode 100644 (file)
index b68f568..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-struct T;
-
-impl for T {}
-//~^ ERROR missing trait in a trait impl
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-56031.stderr b/src/test/ui/parser/issue-56031.stderr
deleted file mode 100644 (file)
index 7ee5bc6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error: missing trait in a trait impl
-  --> $DIR/issue-56031.rs:3:5
-   |
-LL | impl for T {}
-   |     ^
-   |
-help: add a trait here
-   |
-LL | impl Trait for T {}
-   |      +++++
-help: for an inherent impl, drop this `for`
-   |
-LL - impl for T {}
-LL + impl T {}
-   | 
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-57198.rs b/src/test/ui/parser/issue-57198.rs
deleted file mode 100644 (file)
index 714a46c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-mod m {
-    pub fn r#for() {}
-}
-
-fn main() {
-    m::for();
-    //~^ ERROR expected identifier, found keyword `for`
-}
diff --git a/src/test/ui/parser/issue-57198.stderr b/src/test/ui/parser/issue-57198.stderr
deleted file mode 100644 (file)
index 5a56d80..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected identifier, found keyword `for`
-  --> $DIR/issue-57198.rs:6:8
-   |
-LL |     m::for();
-   |        ^^^ expected identifier, found keyword
-   |
-help: you can escape reserved keywords to use them as identifiers
-   |
-LL |     m::r#for();
-   |        ~~~~~
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-57684.fixed b/src/test/ui/parser/issue-57684.fixed
deleted file mode 100644 (file)
index 4a43220..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// run-rustfix
-
-#![allow(warnings)]
-
-// This test checks that the following error is emitted when a `=` character is used to initialize
-// a struct field when a `:` is expected.
-//
-// ```
-// error: struct fields are initialized with a colon
-//   --> $DIR/issue-57684.rs:12:20
-//    |
-// LL |     let _ = X { f1 = 5 };
-//    |                    ^ help: replace equals symbol with a colon: `:`
-// ```
-
-struct X {
-    f1: i32,
-}
-
-struct Y {
-    f1: i32,
-    f2: i32,
-    f3: i32,
-}
-
-fn main() {
-    let _ = X { f1: 5 };
-    //~^ ERROR expected `:`, found `=`
-
-    let f3 = 3;
-    let _ = Y {
-        f1: 5,
-        //~^ ERROR expected `:`, found `=`
-        f2: 4,
-        f3,
-    };
-}
diff --git a/src/test/ui/parser/issue-57684.rs b/src/test/ui/parser/issue-57684.rs
deleted file mode 100644 (file)
index 7a62785..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// run-rustfix
-
-#![allow(warnings)]
-
-// This test checks that the following error is emitted when a `=` character is used to initialize
-// a struct field when a `:` is expected.
-//
-// ```
-// error: struct fields are initialized with a colon
-//   --> $DIR/issue-57684.rs:12:20
-//    |
-// LL |     let _ = X { f1 = 5 };
-//    |                    ^ help: replace equals symbol with a colon: `:`
-// ```
-
-struct X {
-    f1: i32,
-}
-
-struct Y {
-    f1: i32,
-    f2: i32,
-    f3: i32,
-}
-
-fn main() {
-    let _ = X { f1 = 5 };
-    //~^ ERROR expected `:`, found `=`
-
-    let f3 = 3;
-    let _ = Y {
-        f1 = 5,
-        //~^ ERROR expected `:`, found `=`
-        f2: 4,
-        f3,
-    };
-}
diff --git a/src/test/ui/parser/issue-57684.stderr b/src/test/ui/parser/issue-57684.stderr
deleted file mode 100644 (file)
index 514bbff..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error: expected `:`, found `=`
-  --> $DIR/issue-57684.rs:27:20
-   |
-LL |     let _ = X { f1 = 5 };
-   |                   -^
-   |                   |
-   |                   help: replace equals symbol with a colon: `:`
-
-error: expected `:`, found `=`
-  --> $DIR/issue-57684.rs:32:12
-   |
-LL |         f1 = 5,
-   |           -^
-   |           |
-   |           help: replace equals symbol with a colon: `:`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-57819.fixed b/src/test/ui/parser/issue-57819.fixed
deleted file mode 100644 (file)
index 3fab21d..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// run-rustfix
-
-#![allow(warnings)]
-
-// This test checks that the following error is emitted and the suggestion works:
-//
-// ```
-// let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
-//                                            ^^ help: remove extra angle brackets
-// ```
-
-trait Foo {
-    type Output;
-}
-
-fn foo<T: Foo>() {
-    // More complex cases with more than one correct leading `<` character:
-
-    bar::<<T as Foo>::Output>();
-    //~^ ERROR unmatched angle bracket
-
-    bar::<<T as Foo>::Output>();
-    //~^ ERROR unmatched angle bracket
-
-    bar::<<T as Foo>::Output>();
-    //~^ ERROR unmatched angle bracket
-
-    bar::<<T as Foo>::Output>();
-}
-
-fn bar<T>() {}
-
-fn main() {
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-}
diff --git a/src/test/ui/parser/issue-57819.rs b/src/test/ui/parser/issue-57819.rs
deleted file mode 100644 (file)
index 5cafbf4..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// run-rustfix
-
-#![allow(warnings)]
-
-// This test checks that the following error is emitted and the suggestion works:
-//
-// ```
-// let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
-//                                            ^^ help: remove extra angle brackets
-// ```
-
-trait Foo {
-    type Output;
-}
-
-fn foo<T: Foo>() {
-    // More complex cases with more than one correct leading `<` character:
-
-    bar::<<<<<T as Foo>::Output>();
-    //~^ ERROR unmatched angle bracket
-
-    bar::<<<<T as Foo>::Output>();
-    //~^ ERROR unmatched angle bracket
-
-    bar::<<<T as Foo>::Output>();
-    //~^ ERROR unmatched angle bracket
-
-    bar::<<T as Foo>::Output>();
-}
-
-fn bar<T>() {}
-
-fn main() {
-    let _ = vec![1, 2, 3].into_iter().collect::<<<<<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<<<<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<<Vec<usize>>();
-    //~^ ERROR unmatched angle bracket
-
-    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
-}
diff --git a/src/test/ui/parser/issue-57819.stderr b/src/test/ui/parser/issue-57819.stderr
deleted file mode 100644 (file)
index 493e983..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-error: unmatched angle brackets
-  --> $DIR/issue-57819.rs:19:10
-   |
-LL |     bar::<<<<<T as Foo>::Output>();
-   |          ^^^ help: remove extra angle brackets
-
-error: unmatched angle brackets
-  --> $DIR/issue-57819.rs:22:10
-   |
-LL |     bar::<<<<T as Foo>::Output>();
-   |          ^^ help: remove extra angle brackets
-
-error: unmatched angle bracket
-  --> $DIR/issue-57819.rs:25:10
-   |
-LL |     bar::<<<T as Foo>::Output>();
-   |          ^ help: remove extra angle bracket
-
-error: unmatched angle brackets
-  --> $DIR/issue-57819.rs:34:48
-   |
-LL |     let _ = vec![1, 2, 3].into_iter().collect::<<<<<Vec<usize>>();
-   |                                                ^^^^ help: remove extra angle brackets
-
-error: unmatched angle brackets
-  --> $DIR/issue-57819.rs:37:48
-   |
-LL |     let _ = vec![1, 2, 3].into_iter().collect::<<<<Vec<usize>>();
-   |                                                ^^^ help: remove extra angle brackets
-
-error: unmatched angle brackets
-  --> $DIR/issue-57819.rs:40:48
-   |
-LL |     let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
-   |                                                ^^ help: remove extra angle brackets
-
-error: unmatched angle bracket
-  --> $DIR/issue-57819.rs:43:48
-   |
-LL |     let _ = vec![1, 2, 3].into_iter().collect::<<Vec<usize>>();
-   |                                                ^ help: remove extra angle bracket
-
-error: aborting due to 7 previous errors
-
diff --git a/src/test/ui/parser/issue-5806.rs b/src/test/ui/parser/issue-5806.rs
deleted file mode 100644 (file)
index b694642..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// normalize-stderr-test: "parser:.*\(" -> "parser: $$ACCESS_DENIED_MSG ("
-// normalize-stderr-test: "os error \d+" -> "os error $$ACCESS_DENIED_CODE"
-
-#[path = "../parser"]
-mod foo; //~ ERROR couldn't read
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-5806.stderr b/src/test/ui/parser/issue-5806.stderr
deleted file mode 100644 (file)
index bdb5c91..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: couldn't read $DIR/../parser: $ACCESS_DENIED_MSG (os error $ACCESS_DENIED_CODE)
-  --> $DIR/issue-5806.rs:5:1
-   |
-LL | mod foo;
-   | ^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-58094-missing-right-square-bracket.rs b/src/test/ui/parser/issue-58094-missing-right-square-bracket.rs
deleted file mode 100644 (file)
index 25699f9..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// Fixed in #66054.
-// ignore-tidy-trailing-newlines
-// error-pattern: aborting due to 2 previous errors
-#[Ѕ
\ No newline at end of file
diff --git a/src/test/ui/parser/issue-58094-missing-right-square-bracket.stderr b/src/test/ui/parser/issue-58094-missing-right-square-bracket.stderr
deleted file mode 100644 (file)
index 8a44ee7..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4
-   |
-LL | #[Ѕ
-   |  - ^
-   |  |
-   |  unclosed delimiter
-
-error: expected item after attributes
-  --> $DIR/issue-58094-missing-right-square-bracket.rs:4:1
-   |
-LL | #[Ѕ
-   | ^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-58856-1.rs b/src/test/ui/parser/issue-58856-1.rs
deleted file mode 100644 (file)
index 332a301..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-impl A {
-    //~^ ERROR cannot find type `A` in this scope
-    fn b(self>
-    //~^ ERROR expected one of `)`, `,`, or `:`, found `>`
-    //~| ERROR expected one of `->`, `;`, `where`, or `{`, found `>`
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-58856-1.stderr b/src/test/ui/parser/issue-58856-1.stderr
deleted file mode 100644 (file)
index 2afb26d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-error: expected one of `)`, `,`, or `:`, found `>`
-  --> $DIR/issue-58856-1.rs:3:9
-   |
-LL |     fn b(self>
-   |         ^    ^ help: `)` may belong here
-   |         |
-   |         unclosed delimiter
-
-error: expected one of `->`, `;`, `where`, or `{`, found `>`
-  --> $DIR/issue-58856-1.rs:3:14
-   |
-LL | impl A {
-   |        - while parsing this item list starting here
-LL |
-LL |     fn b(self>
-   |              ^ expected one of `->`, `;`, `where`, or `{`
-...
-LL | }
-   | - the item list ends here
-
-error[E0412]: cannot find type `A` in this scope
-  --> $DIR/issue-58856-1.rs:1:6
-   |
-LL | impl A {
-   |      ^ not found in this scope
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/parser/issue-58856-2.rs b/src/test/ui/parser/issue-58856-2.rs
deleted file mode 100644 (file)
index 9356d57..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-struct Empty;
-
-trait Howness {}
-
-impl Howness for () {
-    fn how_are_you(&self -> Empty {
-    //~^ ERROR expected one of `)` or `,`, found `->`
-    //~| ERROR method `how_are_you` is not a member of trait `Howness`
-        Empty
-    }
-}
-//~^ ERROR non-item in item list
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-58856-2.stderr b/src/test/ui/parser/issue-58856-2.stderr
deleted file mode 100644 (file)
index 627dd38..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-error: expected one of `)` or `,`, found `->`
-  --> $DIR/issue-58856-2.rs:6:19
-   |
-LL |     fn how_are_you(&self -> Empty {
-   |                   ^     -^^
-   |                   |     |
-   |                   |     help: `)` may belong here
-   |                   unclosed delimiter
-
-error: non-item in item list
-  --> $DIR/issue-58856-2.rs:11:1
-   |
-LL | impl Howness for () {
-   |                     - item list starts here
-...
-LL | }
-   | ^
-   | |
-   | non-item starts here
-   | item list ends here
-
-error[E0407]: method `how_are_you` is not a member of trait `Howness`
-  --> $DIR/issue-58856-2.rs:6:5
-   |
-LL | /     fn how_are_you(&self -> Empty {
-LL | |
-LL | |
-LL | |         Empty
-LL | |     }
-   | |_____^ not a member of trait `Howness`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0407`.
diff --git a/src/test/ui/parser/issue-59418.rs b/src/test/ui/parser/issue-59418.rs
deleted file mode 100644 (file)
index 0fa191d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-struct X(i32,i32,i32);
-
-fn main() {
-    let a = X(1, 2, 3);
-    let b = a.1suffix;
-    //~^ ERROR suffixes on a tuple index are invalid
-    println!("{}", b);
-    let c = (1, 2, 3);
-    let d = c.1suffix;
-    //~^ ERROR suffixes on a tuple index are invalid
-    println!("{}", d);
-    let s = X { 0suffix: 0, 1: 1, 2: 2 };
-    //~^ ERROR suffixes on a tuple index are invalid
-    match s {
-        X { 0suffix: _, .. } => {}
-        //~^ ERROR suffixes on a tuple index are invalid
-    }
-}
diff --git a/src/test/ui/parser/issue-59418.stderr b/src/test/ui/parser/issue-59418.stderr
deleted file mode 100644 (file)
index 347051e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-error: suffixes on a tuple index are invalid
-  --> $DIR/issue-59418.rs:5:15
-   |
-LL |     let b = a.1suffix;
-   |               ^^^^^^^ invalid suffix `suffix`
-
-error: suffixes on a tuple index are invalid
-  --> $DIR/issue-59418.rs:9:15
-   |
-LL |     let d = c.1suffix;
-   |               ^^^^^^^ invalid suffix `suffix`
-
-error: suffixes on a tuple index are invalid
-  --> $DIR/issue-59418.rs:12:17
-   |
-LL |     let s = X { 0suffix: 0, 1: 1, 2: 2 };
-   |                 ^^^^^^^ invalid suffix `suffix`
-
-error: suffixes on a tuple index are invalid
-  --> $DIR/issue-59418.rs:15:13
-   |
-LL |         X { 0suffix: _, .. } => {}
-   |             ^^^^^^^ invalid suffix `suffix`
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/parser/issue-60075.rs b/src/test/ui/parser/issue-60075.rs
deleted file mode 100644 (file)
index e89d78e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-fn main() {}
-
-trait T {
-    fn qux() -> Option<usize> {
-        let _ = if true {
-        });
-//~^ ERROR non-item in item list
-//~| ERROR mismatched closing delimiter: `)`
-//~| ERROR expected one of `.`, `;`
-        Some(4)
-    }
diff --git a/src/test/ui/parser/issue-60075.stderr b/src/test/ui/parser/issue-60075.stderr
deleted file mode 100644 (file)
index 210ef70..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-error: expected one of `.`, `;`, `?`, `else`, or an operator, found `}`
-  --> $DIR/issue-60075.rs:6:10
-   |
-LL |         });
-   |          ^ expected one of `.`, `;`, `?`, `else`, or an operator
-
-error: non-item in item list
-  --> $DIR/issue-60075.rs:6:11
-   |
-LL | trait T {
-   |         - item list starts here
-...
-LL |         });
-   |           ^ non-item starts here
-...
-LL |     }
-   |     - item list ends here
-
-error: mismatched closing delimiter: `)`
-  --> $DIR/issue-60075.rs:4:31
-   |
-LL |     fn qux() -> Option<usize> {
-   |                               ^ unclosed delimiter
-LL |         let _ = if true {
-LL |         });
-   |          ^ mismatched closing delimiter
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/parser/issue-62524.rs b/src/test/ui/parser/issue-62524.rs
deleted file mode 100644 (file)
index 5259dfe..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// ignore-tidy-trailing-newlines
-// error-pattern: aborting due to 3 previous errors
-#![allow(uncommon_codepoints)]
-
-y![
-Ϥ,
\ No newline at end of file
diff --git a/src/test/ui/parser/issue-62524.stderr b/src/test/ui/parser/issue-62524.stderr
deleted file mode 100644 (file)
index 55eed04..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62524.rs:6:3
-   |
-LL | y![
-   |   - unclosed delimiter
-LL | Ϥ,
-   |   ^
-
-error: macros that expand to items must be delimited with braces or followed by a semicolon
-  --> $DIR/issue-62524.rs:5:3
-   |
-LL |   y![
-   |  ___^
-LL | | Ϥ,
-   | |__^
-   |
-help: change the delimiters to curly braces
-   |
-LL | y! { /* items */ }
-   |    ~~~~~~~~~~~~~~~
-help: add a semicolon
-   |
-LL | Ϥ,;
-   |   +
-
-error: cannot find macro `y` in this scope
-  --> $DIR/issue-62524.rs:5:1
-   |
-LL | y![
-   | ^
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/parser/issue-62546.rs b/src/test/ui/parser/issue-62546.rs
deleted file mode 100644 (file)
index f06b650..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-pub t(#
-//~^ ERROR missing `fn` or `struct` for function or struct definition
-//~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/issue-62546.stderr b/src/test/ui/parser/issue-62546.stderr
deleted file mode 100644 (file)
index 32c6139..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62546.rs:3:52
-   |
-LL | pub t(#
-   |      - unclosed delimiter
-LL |
-LL |
-   |                                                    ^
-
-error: missing `fn` or `struct` for function or struct definition
-  --> $DIR/issue-62546.rs:1:4
-   |
-LL | pub t(#
-   | ---^- help: if you meant to call a macro, try: `t!`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-62554.rs b/src/test/ui/parser/issue-62554.rs
deleted file mode 100644 (file)
index cfd0218..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// error-pattern:this file contains an unclosed delimiter
-// error-pattern:xpected `{`, found `macro_rules`
-
-fn main() {}
-
-fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
diff --git a/src/test/ui/parser/issue-62554.stderr b/src/test/ui/parser/issue-62554.stderr
deleted file mode 100644 (file)
index 5dc9a96..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62554.rs:6:89
-   |
-LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
-   |               -                       -         -                  -                  - ^
-   |               |                       |         |                  |                  |
-   |               |                       |         |                  |                  unclosed delimiter
-   |               |                       |         |                  unclosed delimiter
-   |               |                       |         unclosed delimiter
-   |               unclosed delimiter      unclosed delimiter
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62554.rs:6:89
-   |
-LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
-   |               -                       -         -                  -                  - ^
-   |               |                       |         |                  |                  |
-   |               |                       |         |                  |                  unclosed delimiter
-   |               |                       |         |                  unclosed delimiter
-   |               |                       |         unclosed delimiter
-   |               unclosed delimiter      unclosed delimiter
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62554.rs:6:89
-   |
-LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
-   |               -                       -         -                  -                  - ^
-   |               |                       |         |                  |                  |
-   |               |                       |         |                  |                  unclosed delimiter
-   |               |                       |         |                  unclosed delimiter
-   |               |                       |         unclosed delimiter
-   |               unclosed delimiter      unclosed delimiter
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62554.rs:6:89
-   |
-LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
-   |               -                       -         -                  -                  - ^
-   |               |                       |         |                  |                  |
-   |               |                       |         |                  |                  unclosed delimiter
-   |               |                       |         |                  unclosed delimiter
-   |               |                       |         unclosed delimiter
-   |               unclosed delimiter      unclosed delimiter
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62554.rs:6:89
-   |
-LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
-   |               -                       -         -                  -                  - ^
-   |               |                       |         |                  |                  |
-   |               |                       |         |                  |                  unclosed delimiter
-   |               |                       |         |                  unclosed delimiter
-   |               |                       |         unclosed delimiter
-   |               unclosed delimiter      unclosed delimiter
-
-error: expected `{`, found `macro_rules`
-  --> $DIR/issue-62554.rs:6:23
-   |
-LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
-   |                 --    ^^^^^^^^^^^ expected `{`
-   |                 |
-   |                 this `if` expression has a condition, but no block
-   |
-help: try placing this code inside a block
-   |
-LL ~ fn foo(u: u8) { if u8 { macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
-LL +  }
-   |
-
-error: aborting due to 6 previous errors
-
diff --git a/src/test/ui/parser/issue-62660.rs b/src/test/ui/parser/issue-62660.rs
deleted file mode 100644 (file)
index 4f866b7..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// Regression test for issue #62660: if a receiver's type does not
-// successfully parse, emit the correct error instead of ICE-ing the compiler.
-
-struct Foo;
-
-impl Foo {
-    pub fn foo(_: i32, self: Box<Self) {}
-    //~^ ERROR expected one of `!`, `(`, `+`, `,`, `::`, `:`, `<`, `=`, or `>`, found `)`
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-62660.stderr b/src/test/ui/parser/issue-62660.stderr
deleted file mode 100644 (file)
index a50ada9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `!`, `(`, `+`, `,`, `::`, `:`, `<`, `=`, or `>`, found `)`
-  --> $DIR/issue-62660.rs:7:38
-   |
-LL |     pub fn foo(_: i32, self: Box<Self) {}
-   |                                      ^ expected one of 9 possible tokens
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-62881.rs b/src/test/ui/parser/issue-62881.rs
deleted file mode 100644 (file)
index b920459..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main() {}
-
-fn f() -> isize { fn f() -> isize {} pub f<
-//~^ ERROR missing `fn` or `struct` for function or struct definition
-//~| ERROR mismatched types
-//~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/issue-62881.stderr b/src/test/ui/parser/issue-62881.stderr
deleted file mode 100644 (file)
index 87be69b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62881.rs:6:52
-   |
-LL | fn f() -> isize { fn f() -> isize {} pub f<
-   |                 - unclosed delimiter
-...
-LL |
-   |                                                    ^
-
-error: missing `fn` or `struct` for function or struct definition
-  --> $DIR/issue-62881.rs:3:41
-   |
-LL | fn f() -> isize { fn f() -> isize {} pub f<
-   |                                         ^
-
-error[E0308]: mismatched types
-  --> $DIR/issue-62881.rs:3:29
-   |
-LL | fn f() -> isize { fn f() -> isize {} pub f<
-   |                      -      ^^^^^ expected `isize`, found `()`
-   |                      |
-   |                      implicitly returns `()` as its body has no tail or `return` expression
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issue-62894.rs b/src/test/ui/parser/issue-62894.rs
deleted file mode 100644 (file)
index b9c0bf8..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// Regression test for #62894, shouldn't crash.
-// error-pattern: this file contains an unclosed delimiter
-// error-pattern: expected one of `(`, `[`, or `{`, found keyword `fn`
-
-fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-62894.stderr b/src/test/ui/parser/issue-62894.stderr
deleted file mode 100644 (file)
index 9b7bd15..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62894.rs:7:14
-   |
-LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
-   |        -           -                   - unclosed delimiter
-   |        |           |
-   |        |           unclosed delimiter
-   |        unclosed delimiter
-LL | 
-LL | fn main() {}
-   |              ^
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62894.rs:7:14
-   |
-LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
-   |        -           -                   - unclosed delimiter
-   |        |           |
-   |        |           unclosed delimiter
-   |        unclosed delimiter
-LL | 
-LL | fn main() {}
-   |              ^
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62894.rs:7:14
-   |
-LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
-   |        -           -                   - unclosed delimiter
-   |        |           |
-   |        |           unclosed delimiter
-   |        unclosed delimiter
-LL | 
-LL | fn main() {}
-   |              ^
-
-error: expected one of `(`, `[`, or `{`, found keyword `fn`
-  --> $DIR/issue-62894.rs:7:1
-   |
-LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
-   |                                                   - expected one of `(`, `[`, or `{`
-LL | 
-LL | fn main() {}
-   | ^^ unexpected token
-   |
-  ::: $SRC_DIR/core/src/macros/mod.rs:LL:COL
-   |
-LL |     ($left:expr, $right:expr $(,)?) => ({
-   |      ---------- while parsing argument for this `expr` macro fragment
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/parser/issue-62895.rs b/src/test/ui/parser/issue-62895.rs
deleted file mode 100644 (file)
index 53f1740..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-fn main() {}
-
-fn v() -> isize { //~ ERROR mismatched types
-mod _ { //~ ERROR expected identifier
-pub fn g() -> isizee { //~ ERROR cannot find type `isizee` in this scope
-mod _ { //~ ERROR expected identifier
-pub    g() -> is //~ ERROR missing `fn` for function definition
-(), w20);
-}
-(), w20); //~ ERROR expected item, found `;`
-}
diff --git a/src/test/ui/parser/issue-62895.stderr b/src/test/ui/parser/issue-62895.stderr
deleted file mode 100644 (file)
index 2e7e500..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-error: expected identifier, found reserved identifier `_`
-  --> $DIR/issue-62895.rs:4:5
-   |
-LL | mod _ {
-   |     ^ expected identifier, found reserved identifier
-
-error: expected identifier, found reserved identifier `_`
-  --> $DIR/issue-62895.rs:6:5
-   |
-LL | mod _ {
-   |     ^ expected identifier, found reserved identifier
-
-error: missing `fn` for function definition
-  --> $DIR/issue-62895.rs:7:4
-   |
-LL | pub    g() -> is
-   |    ^^^^
-   |
-help: add `fn` here to parse `g` as a public function
-   |
-LL | pub fn g() -> is
-   |     ++
-
-error: expected item, found `;`
-  --> $DIR/issue-62895.rs:10:9
-   |
-LL | (), w20);
-   |         ^ help: remove this semicolon
-
-error[E0412]: cannot find type `isizee` in this scope
-  --> $DIR/issue-62895.rs:5:15
-   |
-LL | pub fn g() -> isizee {
-   |               ^^^^^^ help: a builtin type with a similar name exists: `isize`
-
-error[E0308]: mismatched types
-  --> $DIR/issue-62895.rs:3:11
-   |
-LL | fn v() -> isize {
-   |    -      ^^^^^ expected `isize`, found `()`
-   |    |
-   |    implicitly returns `()` as its body has no tail or `return` expression
-
-error: aborting due to 6 previous errors
-
-Some errors have detailed explanations: E0308, E0412.
-For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issue-62913.rs b/src/test/ui/parser/issue-62913.rs
deleted file mode 100644 (file)
index 0db06f6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-"\u\\"
-//~^ ERROR incorrect unicode escape sequence
-//~| ERROR invalid trailing slash in literal
-//~| ERROR expected item, found `"\u\\"`
diff --git a/src/test/ui/parser/issue-62913.stderr b/src/test/ui/parser/issue-62913.stderr
deleted file mode 100644 (file)
index 6f385e8..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-error: incorrect unicode escape sequence
-  --> $DIR/issue-62913.rs:1:2
-   |
-LL | "\u\"
-   |  ^^^ incorrect unicode escape sequence
-   |
-   = help: format of unicode escape sequences is `\u{...}`
-
-error: invalid trailing slash in literal
-  --> $DIR/issue-62913.rs:1:5
-   |
-LL | "\u\"
-   |     ^ invalid trailing slash in literal
-
-error: expected item, found `"\u\"`
-  --> $DIR/issue-62913.rs:1:1
-   |
-LL | "\u\"
-   | ^^^^^^ expected item
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/parser/issue-62973.rs b/src/test/ui/parser/issue-62973.rs
deleted file mode 100644 (file)
index 1c5d0c6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// ignore-tidy-trailing-newlines
-// error-pattern: aborting due to 7 previous errors
-
-fn main() {}
-
-fn p() { match s { v, E { [) {) }
-
-
diff --git a/src/test/ui/parser/issue-62973.stderr b/src/test/ui/parser/issue-62973.stderr
deleted file mode 100644 (file)
index 51d835e..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62973.rs:8:2
-   |
-LL | fn p() { match s { v, E { [) {) }
-   |        -         - unclosed delimiter
-   |        |
-   |        unclosed delimiter
-LL | 
-LL | 
-   |  ^
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-62973.rs:8:2
-   |
-LL | fn p() { match s { v, E { [) {) }
-   |        -         - unclosed delimiter
-   |        |
-   |        unclosed delimiter
-LL | 
-LL | 
-   |  ^
-
-error: expected one of `,` or `}`, found `{`
-  --> $DIR/issue-62973.rs:6:8
-   |
-LL | fn p() { match s { v, E { [) {) }
-   |        ^       -       -^ expected one of `,` or `}`
-   |        |       |       |
-   |        |       |       help: `}` may belong here
-   |        |       while parsing this struct
-   |        unclosed delimiter
-
-error: struct literals are not allowed here
-  --> $DIR/issue-62973.rs:6:16
-   |
-LL |   fn p() { match s { v, E { [) {) }
-   |  ________________^
-LL | |
-LL | |
-   | |_^
-   |
-help: surround the struct literal with parentheses
-   |
-LL ~ fn p() { match (s { v, E { [) {) }
-LL | 
-LL ~ )
-   |
-
-error: expected one of `.`, `?`, `{`, or an operator, found `}`
-  --> $DIR/issue-62973.rs:8:2
-   |
-LL | fn p() { match s { v, E { [) {) }
-   |          ----- while parsing this match expression
-LL | 
-LL | 
-   |  ^ expected one of `.`, `?`, `{`, or an operator
-
-error: mismatched closing delimiter: `)`
-  --> $DIR/issue-62973.rs:6:27
-   |
-LL | fn p() { match s { v, E { [) {) }
-   |                           ^^ mismatched closing delimiter
-   |                           |
-   |                           unclosed delimiter
-
-error: mismatched closing delimiter: `)`
-  --> $DIR/issue-62973.rs:6:30
-   |
-LL | fn p() { match s { v, E { [) {) }
-   |                              ^^ mismatched closing delimiter
-   |                              |
-   |                              unclosed delimiter
-
-error: aborting due to 7 previous errors
-
diff --git a/src/test/ui/parser/issue-63115-range-pat-interpolated.rs b/src/test/ui/parser/issue-63115-range-pat-interpolated.rs
deleted file mode 100644 (file)
index 8efb3c7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// check-pass
-
-#![feature(exclusive_range_pattern)]
-#![feature(half_open_range_patterns)]
-
-#![allow(ellipsis_inclusive_range_patterns)]
-
-fn main() {
-    macro_rules! mac_expr {
-        ($e:expr) => {
-            if let 2...$e = 3 {}
-            if let 2..=$e = 3 {}
-            if let 2..$e = 3 {}
-            if let ..$e = 3 {}
-            if let ..=$e = 3 {}
-            if let $e.. = 5 {}
-            if let $e..5 = 4 {}
-            if let $e..=5 = 4 {}
-        }
-    }
-    mac_expr!(4);
-}
diff --git a/src/test/ui/parser/issue-63116.rs b/src/test/ui/parser/issue-63116.rs
deleted file mode 100644 (file)
index 430bc1d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// fixed by #66361
-// error-pattern: aborting due to 3 previous errors
-impl W <s(f;Y(;]
diff --git a/src/test/ui/parser/issue-63116.stderr b/src/test/ui/parser/issue-63116.stderr
deleted file mode 100644 (file)
index cfdd99d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-63116.rs:3:18
-   |
-LL | impl W <s(f;Y(;]
-   |          -       ^
-   |          |
-   |          unclosed delimiter
-
-error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `;`
-  --> $DIR/issue-63116.rs:3:12
-   |
-LL | impl W <s(f;Y(;]
-   |            ^ expected one of 7 possible tokens
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-63116.rs:3:14
-   |
-LL | impl W <s(f;Y(;]
-   |              ^ ^ mismatched closing delimiter
-   |              |
-   |              unclosed delimiter
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/parser/issue-63135.rs b/src/test/ui/parser/issue-63135.rs
deleted file mode 100644 (file)
index a5a8de8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// error-pattern: aborting due to 5 previous errors
-
-fn i(n{...,f #
diff --git a/src/test/ui/parser/issue-63135.stderr b/src/test/ui/parser/issue-63135.stderr
deleted file mode 100644 (file)
index 80e9ac5..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-63135.rs:3:16
-   |
-LL | fn i(n{...,f #
-   |     - -        ^
-   |     | |
-   |     | unclosed delimiter
-   |     unclosed delimiter
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-63135.rs:3:16
-   |
-LL | fn i(n{...,f #
-   |     - -        ^
-   |     | |
-   |     | unclosed delimiter
-   |     unclosed delimiter
-
-error: expected field pattern, found `...`
-  --> $DIR/issue-63135.rs:3:8
-   |
-LL | fn i(n{...,f #
-   |        ^^^ help: to omit remaining fields, use one fewer `.`: `..`
-
-error: expected `}`, found `,`
-  --> $DIR/issue-63135.rs:3:11
-   |
-LL | fn i(n{...,f #
-   |        ---^
-   |        |  |
-   |        |  expected `}`
-   |        `..` must be at the end and cannot have a trailing comma
-
-error: expected one of `!` or `[`, found `}`
-  --> $DIR/issue-63135.rs:3:16
-   |
-LL | fn i(n{...,f #
-   |      -         ^ expected one of `!` or `[`
-   |      |
-   |      while parsing the fields for this pattern
-
-error: aborting due to 5 previous errors
-
diff --git a/src/test/ui/parser/issue-64732.rs b/src/test/ui/parser/issue-64732.rs
deleted file mode 100644 (file)
index 2db51ea..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#![allow(unused)]
-fn main() {
-    let _foo = b'hello\0';
-    //~^ ERROR character literal may only contain one codepoint
-    //~| HELP if you meant to write a byte string literal, use double quotes
-    let _bar = 'hello';
-    //~^ ERROR character literal may only contain one codepoint
-    //~| HELP if you meant to write a `str` literal, use double quotes
-}
diff --git a/src/test/ui/parser/issue-64732.stderr b/src/test/ui/parser/issue-64732.stderr
deleted file mode 100644 (file)
index 8046254..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-error: character literal may only contain one codepoint
-  --> $DIR/issue-64732.rs:3:16
-   |
-LL |     let _foo = b'hello\0';
-   |                ^^^^^^^^^^
-   |
-help: if you meant to write a byte string literal, use double quotes
-   |
-LL |     let _foo = b"hello\0";
-   |                ~~~~~~~~~~
-
-error: character literal may only contain one codepoint
-  --> $DIR/issue-64732.rs:6:16
-   |
-LL |     let _bar = 'hello';
-   |                ^^^^^^^
-   |
-help: if you meant to write a `str` literal, use double quotes
-   |
-LL |     let _bar = "hello";
-   |                ~~~~~~~
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-65041-empty-vis-matcher-in-enum.rs b/src/test/ui/parser/issue-65041-empty-vis-matcher-in-enum.rs
deleted file mode 100644 (file)
index ef89e31..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// check-pass
-
-// Here we check that a `:vis` macro matcher subsititued for the empty visibility
-// (`VisibilityKind::Inherited`) is accepted when used before an enum variant.
-
-fn main() {}
-
-macro_rules! mac_variant {
-    ($vis:vis MARKER) => {
-        enum Enum {
-            $vis Unit,
-
-            $vis Tuple(u8, u16),
-
-            $vis Struct { f: u8 },
-        }
-    }
-}
-
-mac_variant!(MARKER);
-
-// We also accept visibilities on variants syntactically but not semantically.
-#[cfg(FALSE)]
-enum E {
-    pub U,
-    pub(crate) T(u8),
-    pub(super) T { f: String }
-}
diff --git a/src/test/ui/parser/issue-65041-empty-vis-matcher-in-trait.rs b/src/test/ui/parser/issue-65041-empty-vis-matcher-in-trait.rs
deleted file mode 100644 (file)
index b08767b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// check-pass
-
-// Here we check that a `:vis` macro matcher subsititued for the empty visibility
-// (`VisibilityKind::Inherited`) is accepted when used before an item in a trait.
-
-fn main() {}
-
-macro_rules! mac_in_trait {
-    ($vis:vis MARKER) => {
-        $vis fn beta() {}
-
-        $vis const GAMMA: u8;
-
-        $vis type Delta;
-    }
-}
-
-trait Alpha {
-    mac_in_trait!(MARKER);
-}
-
-// We also accept visibilities on items in traits syntactically but not semantically.
-#[cfg(FALSE)]
-trait Foo {
-    pub fn bar();
-    pub(crate) type baz;
-    pub(super) const QUUX: u8;
-}
diff --git a/src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.rs b/src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.rs
deleted file mode 100644 (file)
index 30f3781..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Regression test; used to ICE with 'visit_mac_call disabled by default' due to a
-// `MutVisitor` in `fn make_all_value_bindings_mutable` (`parse/parser/pat.rs`).
-
-macro_rules! mac1 {
-    ($eval:expr) => {
-        let mut $eval = ();
-        //~^ ERROR `mut` must be followed by a named binding
-    };
-}
-
-macro_rules! mac2 {
-    ($eval:pat) => {
-        let mut $eval = ();
-        //~^ ERROR `mut` must be followed by a named binding
-        //~| ERROR expected identifier, found `does_not_exist!()`
-    };
-}
-
-fn foo() {
-    mac1! { does_not_exist!() }
-    //~^ ERROR cannot find macro `does_not_exist` in this scope
-    mac2! { does_not_exist!() }
-    //~^ ERROR cannot find macro `does_not_exist` in this scope
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.stderr b/src/test/ui/parser/issue-65122-mac-invoc-in-mut-patterns.stderr
deleted file mode 100644 (file)
index 8c032e5..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-error: `mut` must be followed by a named binding
-  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:6:13
-   |
-LL |         let mut $eval = ();
-   |             ^^^^^^^^^ help: remove the `mut` prefix: `does_not_exist!()`
-...
-LL |     mac1! { does_not_exist!() }
-   |     --------------------------- in this macro invocation
-   |
-   = note: `mut` may be followed by `variable` and `variable @ pattern`
-   = note: this error originates in the macro `mac1` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: expected identifier, found `does_not_exist!()`
-  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:17
-   |
-LL |         let mut $eval = ();
-   |                 ^^^^^ expected identifier
-...
-LL |     mac2! { does_not_exist!() }
-   |     --------------------------- in this macro invocation
-   |
-   = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: `mut` must be followed by a named binding
-  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:13
-   |
-LL |         let mut $eval = ();
-   |             ^^^ help: remove the `mut` prefix: `does_not_exist!()`
-...
-LL |     mac2! { does_not_exist!() }
-   |     --------------------------- in this macro invocation
-   |
-   = note: `mut` may be followed by `variable` and `variable @ pattern`
-   = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: cannot find macro `does_not_exist` in this scope
-  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:22:13
-   |
-LL |     mac2! { does_not_exist!() }
-   |             ^^^^^^^^^^^^^^
-
-error: cannot find macro `does_not_exist` in this scope
-  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:20:13
-   |
-LL |     mac1! { does_not_exist!() }
-   |             ^^^^^^^^^^^^^^
-
-error: aborting due to 5 previous errors
-
diff --git a/src/test/ui/parser/issue-65257-invalid-var-decl-recovery.rs b/src/test/ui/parser/issue-65257-invalid-var-decl-recovery.rs
deleted file mode 100644 (file)
index c1826f8..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-fn main() {
-    auto n = 0;//~ ERROR invalid variable declaration
-    //~^ HELP write `let` instead of `auto` to introduce a new variable
-    auto m;//~ ERROR invalid variable declaration
-    //~^ HELP write `let` instead of `auto` to introduce a new variable
-    m = 0;
-
-    var n = 0;//~ ERROR invalid variable declaration
-    //~^ HELP write `let` instead of `var` to introduce a new variable
-    var m;//~ ERROR invalid variable declaration
-    //~^ HELP write `let` instead of `var` to introduce a new variable
-    m = 0;
-
-    mut n = 0;//~ ERROR invalid variable declaration
-    //~^ HELP missing keyword
-    mut var;//~ ERROR invalid variable declaration
-    //~^ HELP missing keyword
-    var = 0;
-
-    let _recovery_witness: () = 0; //~ ERROR mismatched types
-}
diff --git a/src/test/ui/parser/issue-65257-invalid-var-decl-recovery.stderr b/src/test/ui/parser/issue-65257-invalid-var-decl-recovery.stderr
deleted file mode 100644 (file)
index 0a88dd2..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-error: invalid variable declaration
-  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:2:5
-   |
-LL |     auto n = 0;
-   |     ^^^^
-   |
-help: write `let` instead of `auto` to introduce a new variable
-   |
-LL |     let n = 0;
-   |     ~~~
-
-error: invalid variable declaration
-  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:4:5
-   |
-LL |     auto m;
-   |     ^^^^
-   |
-help: write `let` instead of `auto` to introduce a new variable
-   |
-LL |     let m;
-   |     ~~~
-
-error: invalid variable declaration
-  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:8:5
-   |
-LL |     var n = 0;
-   |     ^^^
-   |
-help: write `let` instead of `var` to introduce a new variable
-   |
-LL |     let n = 0;
-   |     ~~~
-
-error: invalid variable declaration
-  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:10:5
-   |
-LL |     var m;
-   |     ^^^
-   |
-help: write `let` instead of `var` to introduce a new variable
-   |
-LL |     let m;
-   |     ~~~
-
-error: invalid variable declaration
-  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:14:5
-   |
-LL |     mut n = 0;
-   |     ^^^ help: missing keyword: `let mut`
-
-error: invalid variable declaration
-  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5
-   |
-LL |     mut var;
-   |     ^^^ help: missing keyword: `let mut`
-
-error[E0308]: mismatched types
-  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33
-   |
-LL |     let _recovery_witness: () = 0;
-   |                            --   ^ expected `()`, found integer
-   |                            |
-   |                            expected due to this
-
-error: aborting due to 7 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issue-65846-rollback-gating-failing-matcher.rs b/src/test/ui/parser/issue-65846-rollback-gating-failing-matcher.rs
deleted file mode 100644 (file)
index 9d68a7b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-pass
-
-// Test that failing macro matchers will not cause pre-expansion errors
-// even though they use a feature that is pre-expansion gated.
-
-macro_rules! m {
-    ($e:expr) => { 0 }; // This fails on the input below due to `, foo`.
-    ($e:expr,) => { 1 }; // This also fails to match due to `foo`.
-    (box $e:expr, foo) => { 2 }; // Successful matcher, we should get `2`.
-}
-
-fn main() {
-    assert_eq!(2, m!(box 42, foo));
-}
diff --git a/src/test/ui/parser/issue-6610.rs b/src/test/ui/parser/issue-6610.rs
deleted file mode 100644 (file)
index 9ed5a61..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-trait Foo { fn a() } //~ ERROR expected one of `->`, `;`, `where`, or `{`, found `}`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-6610.stderr b/src/test/ui/parser/issue-6610.stderr
deleted file mode 100644 (file)
index 4a3bc75..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: expected one of `->`, `;`, `where`, or `{`, found `}`
-  --> $DIR/issue-6610.rs:1:20
-   |
-LL | trait Foo { fn a() }
-   |                -   ^ expected one of `->`, `;`, `where`, or `{`
-   |                |
-   |                while parsing this `fn`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-66357-unexpected-unreachable.rs b/src/test/ui/parser/issue-66357-unexpected-unreachable.rs
deleted file mode 100644 (file)
index aed428b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// The problem in #66357 was that the call trace:
-//
-// - parse_fn_block_decl
-// - expect_or
-// - unexpected
-// - expect_one_of
-// - expected_one_of_not_found
-// - recover_closing_delimiter
-//
-// ended up bubbling up `Ok(true)` to `unexpected` which then used `unreachable!()`.
-
-fn f() { |[](* }
-//~^ ERROR expected one of `,` or `:`, found `(`
-//~| ERROR expected one of `&`, `(`, `)`, `-`, `...`, `..=`, `..`, `[`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*`
diff --git a/src/test/ui/parser/issue-66357-unexpected-unreachable.stderr b/src/test/ui/parser/issue-66357-unexpected-unreachable.stderr
deleted file mode 100644 (file)
index 6cbab85..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-error: expected one of `,` or `:`, found `(`
-  --> $DIR/issue-66357-unexpected-unreachable.rs:12:13
-   |
-LL | fn f() { |[](* }
-   |             ^ expected one of `,` or `:`
-
-error: expected one of `&`, `(`, `)`, `-`, `...`, `..=`, `..`, `[`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*`
-  --> $DIR/issue-66357-unexpected-unreachable.rs:12:13
-   |
-LL | fn f() { |[](* }
-   |             ^^ help: `)` may belong here
-   |             |
-   |             unclosed delimiter
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-66473.rs b/src/test/ui/parser/issue-66473.rs
deleted file mode 100644 (file)
index 9db4521..0000000
Binary files a/src/test/ui/parser/issue-66473.rs and /dev/null differ
diff --git a/src/test/ui/parser/issue-66473.stderr b/src/test/ui/parser/issue-66473.stderr
deleted file mode 100644 (file)
index 8a16d7f..0000000
Binary files a/src/test/ui/parser/issue-66473.stderr and /dev/null differ
diff --git a/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.fixed b/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.fixed
deleted file mode 100644 (file)
index 95019b2..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-rustfix
-
-// In this regression test for #67146, we check that the
-// negative outlives bound `!'a` is rejected by the parser.
-// This regression was first introduced in PR #57364.
-
-fn main() {}
-
-pub fn f1<T>() {}
-//~^ ERROR negative bounds are not supported
-pub fn f2<'a, T: Ord>() {}
-//~^ ERROR negative bounds are not supported
-pub fn f3<'a, T: Ord>() {}
-//~^ ERROR negative bounds are not supported
diff --git a/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.rs b/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.rs
deleted file mode 100644 (file)
index 82f54f8..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-rustfix
-
-// In this regression test for #67146, we check that the
-// negative outlives bound `!'a` is rejected by the parser.
-// This regression was first introduced in PR #57364.
-
-fn main() {}
-
-pub fn f1<T: !'static>() {}
-//~^ ERROR negative bounds are not supported
-pub fn f2<'a, T: Ord + !'a>() {}
-//~^ ERROR negative bounds are not supported
-pub fn f3<'a, T: !'a + Ord>() {}
-//~^ ERROR negative bounds are not supported
diff --git a/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.stderr b/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.stderr
deleted file mode 100644 (file)
index a4a4229..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error: negative bounds are not supported
-  --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:12
-   |
-LL | pub fn f1<T: !'static>() {}
-   |            ^^^^^^^^^^ negative bounds are not supported
-
-error: negative bounds are not supported
-  --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:11:22
-   |
-LL | pub fn f2<'a, T: Ord + !'a>() {}
-   |                      ^^^^^ negative bounds are not supported
-
-error: negative bounds are not supported
-  --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:13:16
-   |
-LL | pub fn f3<'a, T: !'a + Ord>() {}
-   |                ^^^^^ negative bounds are not supported
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.rs b/src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.rs
deleted file mode 100644 (file)
index 87222ef..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-mod a {
-    use std::marker::PhantomData;
-
-    enum Bug {
-        V = [PhantomData; { [ () ].len() ].len() as isize,
-        //~^ ERROR mismatched closing delimiter: `]`
-        //~| ERROR mismatched closing delimiter: `]`
-        //~| ERROR mismatched closing delimiter: `]`
-        //~| ERROR mismatched closing delimiter: `]`
-    }
-}
-
-mod b {
-    enum Bug {
-        V = [Vec::new; { [].len()  ].len() as isize,
-        //~^ ERROR mismatched closing delimiter: `]`
-        //~| ERROR mismatched closing delimiter: `]`
-        //~| ERROR mismatched closing delimiter: `]`
-        //~| ERROR mismatched closing delimiter: `]`
-        //~| ERROR type annotations needed
-    }
-}
-
-mod c {
-    enum Bug {
-        V = [Vec::new; { [0].len() ].len() as isize,
-        //~^ ERROR mismatched closing delimiter: `]`
-        //~| ERROR mismatched closing delimiter: `]`
-        //~| ERROR mismatched closing delimiter: `]`
-        //~| ERROR mismatched closing delimiter: `]`
-        //~| ERROR type annotations needed
-    }
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.stderr
deleted file mode 100644 (file)
index 34f1397..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27
-   |
-LL |         V = [PhantomData; { [ () ].len() ].len() as isize,
-   |             -             ^              ^ mismatched closing delimiter
-   |             |             |
-   |             |             unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24
-   |
-LL |         V = [Vec::new; { [].len()  ].len() as isize,
-   |             -          ^           ^ mismatched closing delimiter
-   |             |          |
-   |             |          unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24
-   |
-LL |         V = [Vec::new; { [0].len() ].len() as isize,
-   |             -          ^           ^ mismatched closing delimiter
-   |             |          |
-   |             |          unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27
-   |
-LL |         V = [PhantomData; { [ () ].len() ].len() as isize,
-   |             -             ^              ^ mismatched closing delimiter
-   |             |             |
-   |             |             unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24
-   |
-LL |         V = [Vec::new; { [].len()  ].len() as isize,
-   |             -          ^           ^ mismatched closing delimiter
-   |             |          |
-   |             |          unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24
-   |
-LL |         V = [Vec::new; { [0].len() ].len() as isize,
-   |             -          ^           ^ mismatched closing delimiter
-   |             |          |
-   |             |          unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27
-   |
-LL |         V = [PhantomData; { [ () ].len() ].len() as isize,
-   |             -             ^              ^ mismatched closing delimiter
-   |             |             |
-   |             |             unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24
-   |
-LL |         V = [Vec::new; { [].len()  ].len() as isize,
-   |             -          ^           ^ mismatched closing delimiter
-   |             |          |
-   |             |          unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24
-   |
-LL |         V = [Vec::new; { [0].len() ].len() as isize,
-   |             -          ^           ^ mismatched closing delimiter
-   |             |          |
-   |             |          unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27
-   |
-LL |         V = [PhantomData; { [ () ].len() ].len() as isize,
-   |             -             ^              ^ mismatched closing delimiter
-   |             |             |
-   |             |             unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24
-   |
-LL |         V = [Vec::new; { [].len()  ].len() as isize,
-   |             -          ^           ^ mismatched closing delimiter
-   |             |          |
-   |             |          unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error: mismatched closing delimiter: `]`
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24
-   |
-LL |         V = [Vec::new; { [0].len() ].len() as isize,
-   |             -          ^           ^ mismatched closing delimiter
-   |             |          |
-   |             |          unclosed delimiter
-   |             closing delimiter possibly meant for this
-
-error[E0282]: type annotations needed
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:29
-   |
-LL |         V = [Vec::new; { [].len()  ].len() as isize,
-   |                             ^^^ cannot infer type for type parameter `T`
-
-error[E0282]: type annotations needed
-  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14
-   |
-LL |         V = [Vec::new; { [0].len() ].len() as isize,
-   |              ^^^^^^^^ cannot infer type for type parameter `T`
-
-error: aborting due to 14 previous errors
-
-For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.rs b/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.rs
deleted file mode 100644 (file)
index 3c49a5a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-pub struct Foo {
-    pub bar: Vec<i32>ö
-    //~^ ERROR expected `,`, or `}`, found `ö`
-} //~ ERROR expected `:`, found `}`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.stderr b/src/test/ui/parser/issue-68000-unicode-ident-after-missing-comma.stderr
deleted file mode 100644 (file)
index ef365a6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-error: expected `,`, or `}`, found `ö`
-  --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:2:22
-   |
-LL |     pub bar: Vec<i32>ö
-   |                      ^ help: try adding a comma: `,`
-
-error: expected `:`, found `}`
-  --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:4:1
-   |
-LL |     pub bar: Vec<i32>ö
-   |                       - expected `:`
-LL |
-LL | }
-   | ^ unexpected token
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-68629.rs b/src/test/ui/parser/issue-68629.rs
deleted file mode 100644 (file)
index 672a31f..0000000
Binary files a/src/test/ui/parser/issue-68629.rs and /dev/null differ
diff --git a/src/test/ui/parser/issue-68629.stderr b/src/test/ui/parser/issue-68629.stderr
deleted file mode 100644 (file)
index b2c7ddd..0000000
Binary files a/src/test/ui/parser/issue-68629.stderr and /dev/null differ
diff --git a/src/test/ui/parser/issue-68730.rs b/src/test/ui/parser/issue-68730.rs
deleted file mode 100644 (file)
index 20e18b4..0000000
Binary files a/src/test/ui/parser/issue-68730.rs and /dev/null differ
diff --git a/src/test/ui/parser/issue-68730.stderr b/src/test/ui/parser/issue-68730.stderr
deleted file mode 100644 (file)
index 6585a19..0000000
Binary files a/src/test/ui/parser/issue-68730.stderr and /dev/null differ
diff --git a/src/test/ui/parser/issue-68788-in-trait-item-propagation.rs b/src/test/ui/parser/issue-68788-in-trait-item-propagation.rs
deleted file mode 100644 (file)
index 7c3dd1d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Make sure we don't propagate restrictions on trait impl items to items inside them.
-
-// check-pass
-// edition:2018
-
-fn main() {}
-
-trait X {
-    fn foo();
-}
-
-impl X for () {
-    fn foo() {
-        struct S;
-        impl S {
-            pub const X: u8 = 0;
-            pub const fn bar() {}
-            async fn qux() {}
-        }
-    }
-}
diff --git a/src/test/ui/parser/issue-68890-2.rs b/src/test/ui/parser/issue-68890-2.rs
deleted file mode 100644 (file)
index 0a6e26a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() {}
-
-type X<'a> = (?'a) +;
-//~^ ERROR `?` may only modify trait bounds, not lifetime bounds
-//~| ERROR at least one trait is required for an object type
-//~| WARN trait objects without an explicit `dyn` are deprecated
-//~| WARN this is accepted in the current edition
diff --git a/src/test/ui/parser/issue-68890-2.stderr b/src/test/ui/parser/issue-68890-2.stderr
deleted file mode 100644 (file)
index 1a64b9a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-error: `?` may only modify trait bounds, not lifetime bounds
-  --> $DIR/issue-68890-2.rs:3:15
-   |
-LL | type X<'a> = (?'a) +;
-   |               ^
-
-warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/issue-68890-2.rs:3:14
-   |
-LL | type X<'a> = (?'a) +;
-   |              ^^^^^^^ help: use `dyn`: `dyn (?'a) +`
-   |
-   = note: `#[warn(bare_trait_objects)]` on by default
-   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
-   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
-
-error[E0224]: at least one trait is required for an object type
-  --> $DIR/issue-68890-2.rs:3:14
-   |
-LL | type X<'a> = (?'a) +;
-   |              ^^^^^^^
-
-error: aborting due to 2 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0224`.
diff --git a/src/test/ui/parser/issue-68890.rs b/src/test/ui/parser/issue-68890.rs
deleted file mode 100644 (file)
index bab4ed7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-enum e{A((?'a a+?+l))}
-//~^ ERROR `?` may only modify trait bounds, not lifetime bounds
-//~| ERROR expected one of `)`, `+`, or `,`
-//~| ERROR expected item, found `)`
diff --git a/src/test/ui/parser/issue-68890.stderr b/src/test/ui/parser/issue-68890.stderr
deleted file mode 100644 (file)
index 2a3bf6b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error: `?` may only modify trait bounds, not lifetime bounds
-  --> $DIR/issue-68890.rs:1:11
-   |
-LL | enum e{A((?'a a+?+l))}
-   |           ^
-
-error: expected one of `)`, `+`, or `,`, found `a`
-  --> $DIR/issue-68890.rs:1:15
-   |
-LL | enum e{A((?'a a+?+l))}
-   |               ^ expected one of `)`, `+`, or `,`
-
-error: expected item, found `)`
-  --> $DIR/issue-68890.rs:1:21
-   |
-LL | enum e{A((?'a a+?+l))}
-   |                     ^ expected item
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/parser/issue-70050-ntliteral-accepts-negated-lit.rs b/src/test/ui/parser/issue-70050-ntliteral-accepts-negated-lit.rs
deleted file mode 100644 (file)
index aca9d9e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// check-pass
-
-macro_rules! foo {
-    ($a:literal) => {
-        bar!($a)
-    };
-}
-
-macro_rules! bar {
-    ($b:literal) => {};
-}
-
-fn main() {
-    foo!(-2);
-    bar!(-2);
-}
diff --git a/src/test/ui/parser/issue-70388-recover-dotdotdot-rest-pat.rs b/src/test/ui/parser/issue-70388-recover-dotdotdot-rest-pat.rs
deleted file mode 100644 (file)
index ca8abd7..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-struct Foo(i32);
-
-fn main() {
-    let Foo(...) = Foo(0); //~ ERROR unexpected `...`
-    let [_, ..., _] = [0, 1]; //~ ERROR unexpected `...`
-    let _recovery_witness: () = 0; //~ ERROR mismatched types
-}
diff --git a/src/test/ui/parser/issue-70388-recover-dotdotdot-rest-pat.stderr b/src/test/ui/parser/issue-70388-recover-dotdotdot-rest-pat.stderr
deleted file mode 100644 (file)
index 4961e8f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-error: unexpected `...`
-  --> $DIR/issue-70388-recover-dotdotdot-rest-pat.rs:4:13
-   |
-LL |     let Foo(...) = Foo(0);
-   |             ^^^
-   |             |
-   |             not a valid pattern
-   |             help: for a rest pattern, use `..` instead of `...`
-
-error: unexpected `...`
-  --> $DIR/issue-70388-recover-dotdotdot-rest-pat.rs:5:13
-   |
-LL |     let [_, ..., _] = [0, 1];
-   |             ^^^
-   |             |
-   |             not a valid pattern
-   |             help: for a rest pattern, use `..` instead of `...`
-
-error[E0308]: mismatched types
-  --> $DIR/issue-70388-recover-dotdotdot-rest-pat.rs:6:33
-   |
-LL |     let _recovery_witness: () = 0;
-   |                            --   ^ expected `()`, found integer
-   |                            |
-   |                            expected due to this
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issue-70388-without-witness.fixed b/src/test/ui/parser/issue-70388-without-witness.fixed
deleted file mode 100644 (file)
index 464e78f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-rustfix
-// This is for checking if we can apply suggestions as-is.
-
-pub struct Foo(i32);
-
-fn main() {
-    let Foo(..) = Foo(0); //~ ERROR unexpected `...`
-    let [_, .., _] = [0, 1]; //~ ERROR unexpected `...`
-}
diff --git a/src/test/ui/parser/issue-70388-without-witness.rs b/src/test/ui/parser/issue-70388-without-witness.rs
deleted file mode 100644 (file)
index 9e35e4c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-rustfix
-// This is for checking if we can apply suggestions as-is.
-
-pub struct Foo(i32);
-
-fn main() {
-    let Foo(...) = Foo(0); //~ ERROR unexpected `...`
-    let [_, ..., _] = [0, 1]; //~ ERROR unexpected `...`
-}
diff --git a/src/test/ui/parser/issue-70388-without-witness.stderr b/src/test/ui/parser/issue-70388-without-witness.stderr
deleted file mode 100644 (file)
index b750ad4..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error: unexpected `...`
-  --> $DIR/issue-70388-without-witness.rs:7:13
-   |
-LL |     let Foo(...) = Foo(0);
-   |             ^^^
-   |             |
-   |             not a valid pattern
-   |             help: for a rest pattern, use `..` instead of `...`
-
-error: unexpected `...`
-  --> $DIR/issue-70388-without-witness.rs:8:13
-   |
-LL |     let [_, ..., _] = [0, 1];
-   |             ^^^
-   |             |
-   |             not a valid pattern
-   |             help: for a rest pattern, use `..` instead of `...`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-70549-resolve-after-recovered-self-ctor.rs b/src/test/ui/parser/issue-70549-resolve-after-recovered-self-ctor.rs
deleted file mode 100644 (file)
index aeccd0d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-struct S {}
-
-impl S {
-    fn foo(&mur Self) {}
-    //~^ ERROR expected identifier, found keyword `Self`
-    //~| ERROR expected one of `:`, `@`
-    //~| ERROR the `Self` constructor can only be used with
-    fn bar(&'static mur Self) {}
-    //~^ ERROR unexpected lifetime
-    //~| ERROR expected identifier, found keyword `Self`
-    //~| ERROR expected one of `:`, `@`
-    //~| ERROR the `Self` constructor can only be used with
-
-    fn baz(&mur Self @ _) {}
-    //~^ ERROR expected one of `:`, `@`
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-70549-resolve-after-recovered-self-ctor.stderr b/src/test/ui/parser/issue-70549-resolve-after-recovered-self-ctor.stderr
deleted file mode 100644 (file)
index 421f145..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-error: expected identifier, found keyword `Self`
-  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17
-   |
-LL |     fn foo(&mur Self) {}
-   |                 ^^^^ expected identifier, found keyword
-
-error: expected one of `:`, `@`, or `|`, found keyword `Self`
-  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17
-   |
-LL |     fn foo(&mur Self) {}
-   |            -----^^^^
-   |            |    |
-   |            |    expected one of `:`, `@`, or `|`
-   |            help: declare the type after the parameter binding: `<identifier>: <type>`
-
-error: unexpected lifetime `'static` in pattern
-  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:13
-   |
-LL |     fn bar(&'static mur Self) {}
-   |             ^^^^^^^ help: remove the lifetime
-
-error: expected identifier, found keyword `Self`
-  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25
-   |
-LL |     fn bar(&'static mur Self) {}
-   |                         ^^^^ expected identifier, found keyword
-
-error: expected one of `:`, `@`, or `|`, found keyword `Self`
-  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25
-   |
-LL |     fn bar(&'static mur Self) {}
-   |            -------------^^^^
-   |            |            |
-   |            |            expected one of `:`, `@`, or `|`
-   |            help: declare the type after the parameter binding: `<identifier>: <type>`
-
-error: expected one of `:`, `@`, or `|`, found keyword `Self`
-  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:14:17
-   |
-LL |     fn baz(&mur Self @ _) {}
-   |                 ^^^^ expected one of `:`, `@`, or `|`
-
-error: the `Self` constructor can only be used with tuple or unit structs
-  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17
-   |
-LL |     fn foo(&mur Self) {}
-   |                 ^^^^ help: use curly brackets: `Self { /* fields */ }`
-
-error: the `Self` constructor can only be used with tuple or unit structs
-  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25
-   |
-LL |     fn bar(&'static mur Self) {}
-   |                         ^^^^ help: use curly brackets: `Self { /* fields */ }`
-
-error: aborting due to 8 previous errors
-
diff --git a/src/test/ui/parser/issue-70552-ascription-in-parens-after-call.rs b/src/test/ui/parser/issue-70552-ascription-in-parens-after-call.rs
deleted file mode 100644 (file)
index 9b6dd7d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() {
-    expr as fun()(:); //~ ERROR expected expression
-}
diff --git a/src/test/ui/parser/issue-70552-ascription-in-parens-after-call.stderr b/src/test/ui/parser/issue-70552-ascription-in-parens-after-call.stderr
deleted file mode 100644 (file)
index f03c92e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected expression, found `:`
-  --> $DIR/issue-70552-ascription-in-parens-after-call.rs:2:19
-   |
-LL |     expr as fun()(:);
-   |                   ^ expected expression
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-70583-block-is-empty-1.rs b/src/test/ui/parser/issue-70583-block-is-empty-1.rs
deleted file mode 100644 (file)
index f560f68..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-pub enum ErrorHandled {
-    Reported,
-    TooGeneric,
-}
-
-impl ErrorHandled {
-    pub fn assert_reported(self) {
-        match self {
-            ErrorHandled::Reported => {}
-            ErrorHandled::TooGeneric => panic!(),
-        }
-    }
-}
-
-fn struct_generic(x: Vec<i32>) {
-    for v in x {
-        println!("{}", v);
-    }
-    }
-} //~ ERROR unexpected closing delimiter: `}`
diff --git a/src/test/ui/parser/issue-70583-block-is-empty-1.stderr b/src/test/ui/parser/issue-70583-block-is-empty-1.stderr
deleted file mode 100644 (file)
index 39bf113..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: unexpected closing delimiter: `}`
-  --> $DIR/issue-70583-block-is-empty-1.rs:20:1
-   |
-LL | fn struct_generic(x: Vec<i32>) {
-   |                                - this opening brace...
-...
-LL |     }
-   |     - ...matches this closing brace
-LL | }
-   | ^ unexpected closing delimiter
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-70583-block-is-empty-2.rs b/src/test/ui/parser/issue-70583-block-is-empty-2.rs
deleted file mode 100644 (file)
index 80f5333..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-pub enum ErrorHandled {
-    Reported,
-    TooGeneric,
-}
-
-impl ErrorHandled {
-    pub fn assert_reported(self) {
-        match self {
-            ErrorHandled::Reported => {}}
-                                     //^~ ERROR block is empty, you might have not meant to close it
-            ErrorHandled::TooGeneric => panic!(),
-        }
-    }
-} //~ ERROR unexpected closing delimiter: `}`
diff --git a/src/test/ui/parser/issue-70583-block-is-empty-2.stderr b/src/test/ui/parser/issue-70583-block-is-empty-2.stderr
deleted file mode 100644 (file)
index 5d37b21..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: unexpected closing delimiter: `}`
-  --> $DIR/issue-70583-block-is-empty-2.rs:14:1
-   |
-LL |             ErrorHandled::Reported => {}}
-   |                                       -- block is empty, you might have not meant to close it
-...
-LL | }
-   | ^ unexpected closing delimiter
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-7222.rs b/src/test/ui/parser/issue-7222.rs
deleted file mode 100644 (file)
index 6490731..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620
-
-pub fn main() {
-    const FOO: f64 = 10.0;
-
-    match 0.0 {
-        0.0 ..= FOO => (),
-        _ => ()
-    }
-}
diff --git a/src/test/ui/parser/issue-72253.rs b/src/test/ui/parser/issue-72253.rs
deleted file mode 100644 (file)
index 1446a79..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main() {
-    let a = std::process::Command::new("echo")
-        .arg("1")
-        ,arg("2") //~ ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `,`
-        .output();
-}
diff --git a/src/test/ui/parser/issue-72253.stderr b/src/test/ui/parser/issue-72253.stderr
deleted file mode 100644 (file)
index 477fa09..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: expected one of `.`, `;`, `?`, `else`, or an operator, found `,`
-  --> $DIR/issue-72253.rs:4:9
-   |
-LL |         .arg("1")
-   |                  - expected one of `.`, `;`, `?`, `else`, or an operator
-LL |         ,arg("2")
-   |         ^ unexpected token
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-72373.rs b/src/test/ui/parser/issue-72373.rs
deleted file mode 100644 (file)
index 4da6061..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-fn foo(c: &[u32], n: u32) -> u32 {
-    match *c {
-        [h, ..] if h > n => 0,
-        [h, ..] if h == n => 1,
-        [h, ref ts..] => foo(c, n - h) + foo(ts, n),
-        //~^ ERROR expected one of `,`, `@`, `]`, or `|`, found `..`
-        [] => 0,
-    }
-}
diff --git a/src/test/ui/parser/issue-72373.stderr b/src/test/ui/parser/issue-72373.stderr
deleted file mode 100644 (file)
index 0bb99a0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected one of `,`, `@`, `]`, or `|`, found `..`
-  --> $DIR/issue-72373.rs:5:19
-   |
-LL |         [h, ref ts..] => foo(c, n - h) + foo(ts, n),
-   |                   ^^ expected one of `,`, `@`, `]`, or `|`
-   |
-help: if you meant to bind the contents of the rest of the array pattern into `ts`, use `@`
-   |
-LL |         [h, ref ts @ ..] => foo(c, n - h) + foo(ts, n),
-   |                    +
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-73568-lifetime-after-mut.rs b/src/test/ui/parser/issue-73568-lifetime-after-mut.rs
deleted file mode 100644 (file)
index e68ee74..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#![crate_type="lib"]
-fn x<'a>(x: &mut 'a i32){} //~ ERROR lifetime must precede `mut`
-
-macro_rules! mac {
-    ($lt:lifetime) => {
-        fn w<$lt>(w: &mut $lt i32) {}
-        //~^ ERROR lifetime must precede `mut`
-    }
-}
-
-mac!('a);
-
-// avoid false positives
-fn y<'a>(y: &mut 'a + Send) {
-    //~^ ERROR expected a path on the left-hand side of `+`, not `&mut 'a`
-    //~| WARNING trait objects without an explicit `dyn` are deprecated
-    //~| WARN this is accepted in the current edition
-    //~| ERROR at least one trait is required for an object type
-    let z = y as &mut 'a + Send;
-    //~^ ERROR expected value, found trait `Send`
-    //~| WARNING trait objects without an explicit `dyn` are deprecated
-    //~| WARN this is accepted in the current edition
-}
diff --git a/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr b/src/test/ui/parser/issue-73568-lifetime-after-mut.stderr
deleted file mode 100644 (file)
index 48c2b2a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-error: lifetime must precede `mut`
-  --> $DIR/issue-73568-lifetime-after-mut.rs:2:13
-   |
-LL | fn x<'a>(x: &mut 'a i32){}
-   |             ^^^^^^^ help: place the lifetime before `mut`: `&'a mut`
-
-error[E0178]: expected a path on the left-hand side of `+`, not `&mut 'a`
-  --> $DIR/issue-73568-lifetime-after-mut.rs:14:13
-   |
-LL | fn y<'a>(y: &mut 'a + Send) {
-   |             ^^^^^^^^^^^^^^ help: try adding parentheses: `&mut ('a + Send)`
-
-error: lifetime must precede `mut`
-  --> $DIR/issue-73568-lifetime-after-mut.rs:6:22
-   |
-LL |         fn w<$lt>(w: &mut $lt i32) {}
-   |                      ^^^^^^^^ help: place the lifetime before `mut`: `&$lt mut`
-...
-LL | mac!('a);
-   | -------- in this macro invocation
-   |
-   = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0423]: expected value, found trait `Send`
-  --> $DIR/issue-73568-lifetime-after-mut.rs:19:28
-   |
-LL |     let z = y as &mut 'a + Send;
-   |                            ^^^^ not a value
-
-warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/issue-73568-lifetime-after-mut.rs:14:18
-   |
-LL | fn y<'a>(y: &mut 'a + Send) {
-   |                  ^^ help: use `dyn`: `dyn 'a`
-   |
-   = note: `#[warn(bare_trait_objects)]` on by default
-   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
-   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
-
-warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/issue-73568-lifetime-after-mut.rs:19:23
-   |
-LL |     let z = y as &mut 'a + Send;
-   |                       ^^ help: use `dyn`: `dyn 'a`
-   |
-   = 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>
-
-error[E0224]: at least one trait is required for an object type
-  --> $DIR/issue-73568-lifetime-after-mut.rs:14:18
-   |
-LL | fn y<'a>(y: &mut 'a + Send) {
-   |                  ^^
-
-error: aborting due to 5 previous errors; 2 warnings emitted
-
-Some errors have detailed explanations: E0178, E0224, E0423.
-For more information about an error, try `rustc --explain E0178`.
diff --git a/src/test/ui/parser/issue-75599.rs b/src/test/ui/parser/issue-75599.rs
deleted file mode 100644 (file)
index 0857676..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// check-pass
-#![allow(non_upper_case_globals)]
-
-const or: usize = 1;
-const and: usize = 2;
-
-mod or {
-    pub const X: usize = 3;
-}
-
-mod and {
-    pub const X: usize = 4;
-}
-
-fn main() {
-    match 0 {
-        0 => {}
-        or => {}
-        and => {}
-        or::X => {}
-        and::X => {}
-        _ => {}
-    }
-}
diff --git a/src/test/ui/parser/issue-76437-async.rs b/src/test/ui/parser/issue-76437-async.rs
deleted file mode 100644 (file)
index 84ee3dd..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// edition:2018
-
-mod t {
-    async pub fn t() {}
-    //~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `pub`
-    //~| HELP visibility `pub` must come before `async`
-}
diff --git a/src/test/ui/parser/issue-76437-async.stderr b/src/test/ui/parser/issue-76437-async.stderr
deleted file mode 100644 (file)
index 2c9c2a8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: expected one of `extern`, `fn`, or `unsafe`, found keyword `pub`
-  --> $DIR/issue-76437-async.rs:4:11
-   |
-LL |     async pub fn t() {}
-   |     ------^^^
-   |     |     |
-   |     |     expected one of `extern`, `fn`, or `unsafe`
-   |     help: visibility `pub` must come before `async`: `pub async`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-76437-const-async-unsafe.rs b/src/test/ui/parser/issue-76437-const-async-unsafe.rs
deleted file mode 100644 (file)
index f1e06e4..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// edition:2018
-
-mod t {
-    const async unsafe pub fn t() {}
-    //~^ ERROR expected one of `extern` or `fn`, found keyword `pub`
-    //~| HELP visibility `pub` must come before `const async unsafe`
-}
diff --git a/src/test/ui/parser/issue-76437-const-async-unsafe.stderr b/src/test/ui/parser/issue-76437-const-async-unsafe.stderr
deleted file mode 100644 (file)
index 2e91bed..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: expected one of `extern` or `fn`, found keyword `pub`
-  --> $DIR/issue-76437-const-async-unsafe.rs:4:24
-   |
-LL |     const async unsafe pub fn t() {}
-   |     -------------------^^^
-   |     |                  |
-   |     |                  expected one of `extern` or `fn`
-   |     help: visibility `pub` must come before `const async unsafe`: `pub const async unsafe`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-76437-const-async.rs b/src/test/ui/parser/issue-76437-const-async.rs
deleted file mode 100644 (file)
index 3c789fd..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// edition:2018
-
-mod t {
-    const async pub fn t() {}
-    //~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `pub`
-    //~| HELP visibility `pub` must come before `const async`
-}
diff --git a/src/test/ui/parser/issue-76437-const-async.stderr b/src/test/ui/parser/issue-76437-const-async.stderr
deleted file mode 100644 (file)
index 21b96c1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: expected one of `extern`, `fn`, or `unsafe`, found keyword `pub`
-  --> $DIR/issue-76437-const-async.rs:4:17
-   |
-LL |     const async pub fn t() {}
-   |     ------------^^^
-   |     |           |
-   |     |           expected one of `extern`, `fn`, or `unsafe`
-   |     help: visibility `pub` must come before `const async`: `pub const async`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-76437-const.rs b/src/test/ui/parser/issue-76437-const.rs
deleted file mode 100644 (file)
index d3815a5..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// edition:2018
-
-mod t {
-    const pub fn t() {}
-    //~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
-    //~| HELP visibility `pub` must come before `const`
-}
diff --git a/src/test/ui/parser/issue-76437-const.stderr b/src/test/ui/parser/issue-76437-const.stderr
deleted file mode 100644 (file)
index cf80d9a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
-  --> $DIR/issue-76437-const.rs:4:11
-   |
-LL |     const pub fn t() {}
-   |     ------^^^
-   |     |     |
-   |     |     expected one of `async`, `extern`, `fn`, or `unsafe`
-   |     help: visibility `pub` must come before `const`: `pub const`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-76437-pub-crate-unsafe.rs b/src/test/ui/parser/issue-76437-pub-crate-unsafe.rs
deleted file mode 100644 (file)
index daa1d12..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// edition:2018
-
-mod t {
-    unsafe pub(crate) fn t() {}
-    //~^ ERROR expected one of `extern` or `fn`, found keyword `pub`
-    //~| HELP visibility `pub(crate)` must come before `unsafe`
-}
diff --git a/src/test/ui/parser/issue-76437-pub-crate-unsafe.stderr b/src/test/ui/parser/issue-76437-pub-crate-unsafe.stderr
deleted file mode 100644 (file)
index fa8f137..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: expected one of `extern` or `fn`, found keyword `pub`
-  --> $DIR/issue-76437-pub-crate-unsafe.rs:4:12
-   |
-LL |     unsafe pub(crate) fn t() {}
-   |     -------^^^-------
-   |     |      |
-   |     |      expected one of `extern` or `fn`
-   |     help: visibility `pub(crate)` must come before `unsafe`: `pub(crate) unsafe`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-76437-unsafe.rs b/src/test/ui/parser/issue-76437-unsafe.rs
deleted file mode 100644 (file)
index 785a79a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// edition:2018
-
-mod t {
-    unsafe pub fn t() {}
-    //~^ ERROR expected one of `extern` or `fn`, found keyword `pub`
-    //~| HELP visibility `pub` must come before `unsafe`
-}
diff --git a/src/test/ui/parser/issue-76437-unsafe.stderr b/src/test/ui/parser/issue-76437-unsafe.stderr
deleted file mode 100644 (file)
index c63292e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error: expected one of `extern` or `fn`, found keyword `pub`
-  --> $DIR/issue-76437-unsafe.rs:4:12
-   |
-LL |     unsafe pub fn t() {}
-   |     -------^^^
-   |     |      |
-   |     |      expected one of `extern` or `fn`
-   |     help: visibility `pub` must come before `unsafe`: `pub unsafe`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-76597.fixed b/src/test/ui/parser/issue-76597.fixed
deleted file mode 100644 (file)
index 2d7a30b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-rustfix
-
-#![allow(dead_code)]
-#![allow(unused_variables)]
-fn f(
-                                     x: u8,
-                                     y: u8,
-) {}
-//~^^ ERROR: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `y`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-76597.rs b/src/test/ui/parser/issue-76597.rs
deleted file mode 100644 (file)
index 521b9c6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-rustfix
-
-#![allow(dead_code)]
-#![allow(unused_variables)]
-fn f(
-                                     x: u8
-                                     y: u8,
-) {}
-//~^^ ERROR: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `y`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-76597.stderr b/src/test/ui/parser/issue-76597.stderr
deleted file mode 100644 (file)
index 50b2332..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `y`
-  --> $DIR/issue-76597.rs:7:38
-   |
-LL | ...                   x: u8
-   |                            -
-   |                            |
-   |                            expected one of 7 possible tokens
-   |                            help: missing `,`
-LL | ...                   y: u8,
-   |                       ^ unexpected token
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-7970b.rs b/src/test/ui/parser/issue-7970b.rs
deleted file mode 100644 (file)
index 1c4abce..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {}
-
-macro_rules! test {}
-//~^ ERROR unexpected end of macro invocation
diff --git a/src/test/ui/parser/issue-7970b.stderr b/src/test/ui/parser/issue-7970b.stderr
deleted file mode 100644 (file)
index a62226a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: unexpected end of macro invocation
-  --> $DIR/issue-7970b.rs:3:1
-   |
-LL | macro_rules! test {}
-   | ^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-81806.rs b/src/test/ui/parser/issue-81806.rs
deleted file mode 100644 (file)
index ca86788..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-trait T { const
-impl //~ ERROR: expected identifier, found keyword `impl`
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-81806.stderr b/src/test/ui/parser/issue-81806.stderr
deleted file mode 100644 (file)
index a62c9b0..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-error: expected identifier, found keyword `impl`
-  --> $DIR/issue-81806.rs:2:1
-   |
-LL | trait T { const
-   |         - while parsing this item list starting here
-LL | impl
-   | ^^^^ expected identifier, found keyword
-LL | }
-   | - the item list ends here
-   |
-help: you can escape reserved keywords to use them as identifiers
-   |
-LL | r#impl
-   | ~~~~~~
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-83639.rs b/src/test/ui/parser/issue-83639.rs
deleted file mode 100644 (file)
index 6ddbedf..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// check-fail
-// ignore-tidy-tab
-
-fn main() {
-    """        " //~ ERROR
-}
diff --git a/src/test/ui/parser/issue-83639.stderr b/src/test/ui/parser/issue-83639.stderr
deleted file mode 100644 (file)
index 4c10df1..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `.`, `;`, `?`, `}`, or an operator, found `"    "`
-  --> $DIR/issue-83639.rs:5:7
-   |
-LL |     """    "
-   |       ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-84104.rs b/src/test/ui/parser/issue-84104.rs
deleted file mode 100644 (file)
index 998949b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// error-pattern: this file contains an unclosed delimiter
-// error-pattern: expected one of
-#[i=i::<ښܖ<
diff --git a/src/test/ui/parser/issue-84104.stderr b/src/test/ui/parser/issue-84104.stderr
deleted file mode 100644 (file)
index aff31f2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-84104.rs:3:13
-   |
-LL | #[i=i::<ښܖ<
-   |  -          ^
-   |  |
-   |  unclosed delimiter
-
-error: expected one of `>`, a const expression, lifetime, or type, found `]`
-  --> $DIR/issue-84104.rs:3:13
-   |
-LL | #[i=i::<ښܖ<
-   |             ^ expected one of `>`, a const expression, lifetime, or type
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-84117.rs b/src/test/ui/parser/issue-84117.rs
deleted file mode 100644 (file)
index 9195858..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-fn main() {
-    let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
-    //~^ ERROR expected one of `>`, a const expression
-    //~| ERROR expected one of `>`, a const expression, lifetime, or type, found `}`
-    //~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
-    //~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
-    //~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
-}
-//~^ ERROR expected one of `,`, `:`, `=`, or `>`, found `}`
diff --git a/src/test/ui/parser/issue-84117.stderr b/src/test/ui/parser/issue-84117.stderr
deleted file mode 100644 (file)
index 5b9cc53..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-error: expected one of `>`, a const expression, lifetime, or type, found `}`
-  --> $DIR/issue-84117.rs:2:67
-   |
-LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
-   |                                         ------------              ^ expected one of `>`, a const expression, lifetime, or type
-   |                                         |          |
-   |                                         |          help: use `=` if you meant to assign
-   |                                         while parsing the type for `inner_local`
-
-error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
-  --> $DIR/issue-84117.rs:2:65
-   |
-LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
-   |                                                                 ^ expected one of 8 possible tokens
-
-error: expected one of `,`, `:`, `=`, or `>`, found `}`
-  --> $DIR/issue-84117.rs:8:1
-   |
-LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
-   |         ------------ help: use `=` if you meant to assign          - expected one of `,`, `:`, `=`, or `>`
-   |         |
-   |         while parsing the type for `outer_local`
-...
-LL | }
-   | ^ unexpected token
-
-error: expected one of `>`, a const expression, lifetime, or type, found `}`
-  --> $DIR/issue-84117.rs:2:67
-   |
-LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
-   |                                         ------------              ^ expected one of `>`, a const expression, lifetime, or type
-   |                                         |          |
-   |                                         |          help: use `=` if you meant to assign
-   |                                         while parsing the type for `inner_local`
-
-error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
-  --> $DIR/issue-84117.rs:2:65
-   |
-LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
-   |                                                                 ^ expected one of 8 possible tokens
-
-error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
-  --> $DIR/issue-84117.rs:2:33
-   |
-LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
-   |                                 ^ expected one of 8 possible tokens
-
-error: aborting due to 6 previous errors
-
diff --git a/src/test/ui/parser/issue-84148-1.rs b/src/test/ui/parser/issue-84148-1.rs
deleted file mode 100644 (file)
index 25f7ba4..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn f(t:for<>t?)
-//~^ ERROR: expected parameter name
-//~| ERROR: expected one of
-//~| ERROR: expected one of
diff --git a/src/test/ui/parser/issue-84148-1.stderr b/src/test/ui/parser/issue-84148-1.stderr
deleted file mode 100644 (file)
index 9850656..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-error: expected parameter name, found `?`
-  --> $DIR/issue-84148-1.rs:1:14
-   |
-LL | fn f(t:for<>t?)
-   |              ^ expected parameter name
-
-error: expected one of `(`, `)`, `+`, `,`, `::`, or `<`, found `?`
-  --> $DIR/issue-84148-1.rs:1:14
-   |
-LL | fn f(t:for<>t?)
-   |              ^
-   |              |
-   |              expected one of `(`, `)`, `+`, `,`, `::`, or `<`
-   |              help: missing `,`
-
-error: expected one of `->`, `;`, `where`, or `{`, found `<eof>`
-  --> $DIR/issue-84148-1.rs:1:15
-   |
-LL | fn f(t:for<>t?)
-   |               ^ expected one of `->`, `;`, `where`, or `{`
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/parser/issue-84148-2.rs b/src/test/ui/parser/issue-84148-2.rs
deleted file mode 100644 (file)
index 257a3fd..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// error-pattern: this file contains an unclosed delimiter
-// error-pattern: expected parameter name
-// error-pattern: expected one of
-fn f(t:for<>t?
diff --git a/src/test/ui/parser/issue-84148-2.stderr b/src/test/ui/parser/issue-84148-2.stderr
deleted file mode 100644 (file)
index 6f314da..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-84148-2.rs:4:16
-   |
-LL | fn f(t:for<>t?
-   |     -          ^
-   |     |
-   |     unclosed delimiter
-
-error: expected parameter name, found `?`
-  --> $DIR/issue-84148-2.rs:4:14
-   |
-LL | fn f(t:for<>t?
-   |              ^ expected parameter name
-
-error: expected one of `(`, `)`, `+`, `,`, `::`, or `<`, found `?`
-  --> $DIR/issue-84148-2.rs:4:14
-   |
-LL | fn f(t:for<>t?
-   |              ^
-   |              |
-   |              expected one of `(`, `)`, `+`, `,`, `::`, or `<`
-   |              help: missing `,`
-
-error: expected one of `->`, `;`, `where`, or `{`, found `<eof>`
-  --> $DIR/issue-84148-2.rs:4:16
-   |
-LL | fn f(t:for<>t?
-   |                ^ expected one of `->`, `;`, `where`, or `{`
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/parser/issue-8537.rs b/src/test/ui/parser/issue-8537.rs
deleted file mode 100644 (file)
index 9d0cbce..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-pub extern
-  "invalid-ab_isize" //~ ERROR invalid ABI
-fn foo() {}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-8537.stderr b/src/test/ui/parser/issue-8537.stderr
deleted file mode 100644 (file)
index 5a29ce2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0703]: invalid ABI: found `invalid-ab_isize`
-  --> $DIR/issue-8537.rs:2:3
-   |
-LL |   "invalid-ab_isize"
-   |   ^^^^^^^^^^^^^^^^^^ invalid ABI
-   |
-   = help: valid ABIs: Rust, C, C-unwind, cdecl, stdcall, stdcall-unwind, fastcall, vectorcall, thiscall, thiscall-unwind, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, efiapi, avr-interrupt, avr-non-blocking-interrupt, C-cmse-nonsecure-call, wasm, system, system-unwind, rust-intrinsic, rust-call, platform-intrinsic, unadjusted
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0703`.
diff --git a/src/test/ui/parser/issue-86895.rs b/src/test/ui/parser/issue-86895.rs
deleted file mode 100644 (file)
index 4cd0984..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-const pub () {}
-//~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`
-pub fn main() {}
diff --git a/src/test/ui/parser/issue-86895.stderr b/src/test/ui/parser/issue-86895.stderr
deleted file mode 100644 (file)
index 575d857..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
-  --> $DIR/issue-86895.rs:1:7
-   |
-LL | const pub () {}
-   |       ^^^ expected one of `async`, `extern`, `fn`, or `unsafe`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-87086-colon-path-sep.rs b/src/test/ui/parser/issue-87086-colon-path-sep.rs
deleted file mode 100644 (file)
index 4ee0b20..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// Tests that a suggestion is issued if the user wrote a colon instead of
-// a path separator in a match arm.
-
-enum Foo {
-    Bar,
-    Baz,
-}
-
-fn f() -> Foo { Foo::Bar }
-
-fn g1() {
-    match f() {
-        Foo:Bar => {}
-        //~^ ERROR: expected one of
-        //~| HELP: maybe write a path separator here
-        _ => {}
-    }
-    match f() {
-        Foo::Bar:Baz => {}
-        //~^ ERROR: expected one of
-        //~| HELP: maybe write a path separator here
-        _ => {}
-    }
-    match f() {
-        Foo:Bar::Baz => {}
-        //~^ ERROR: expected one of
-        //~| HELP: maybe write a path separator here
-        _ => {}
-    }
-    match f() {
-        Foo: Bar::Baz if true => {}
-        //~^ ERROR: expected one of
-        //~| HELP: maybe write a path separator here
-        _ => {}
-    }
-    if let Bar:Baz = f() {
-    //~^ ERROR: expected one of
-    //~| HELP: maybe write a path separator here
-    }
-}
-
-fn g1_neg() {
-    match f() {
-        ref Foo: Bar::Baz => {}
-        //~^ ERROR: expected one of
-        _ => {}
-    }
-}
-
-fn g2_neg() {
-    match f() {
-        mut Foo: Bar::Baz => {}
-        //~^ ERROR: expected one of
-        _ => {}
-    }
-}
-
-fn main() {
-    let myfoo = Foo::Bar;
-    match myfoo {
-        Foo::Bar => {}
-        Foo:Bar::Baz => {}
-        //~^ ERROR: expected one of
-        //~| HELP: maybe write a path separator here
-    }
-}
diff --git a/src/test/ui/parser/issue-87086-colon-path-sep.stderr b/src/test/ui/parser/issue-87086-colon-path-sep.stderr
deleted file mode 100644 (file)
index 8f93661..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-error: expected one of `@` or `|`, found `:`
-  --> $DIR/issue-87086-colon-path-sep.rs:13:12
-   |
-LL |         Foo:Bar => {}
-   |            ^
-   |            |
-   |            expected one of `@` or `|`
-   |            help: maybe write a path separator here: `::`
-
-error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:`
-  --> $DIR/issue-87086-colon-path-sep.rs:19:17
-   |
-LL |         Foo::Bar:Baz => {}
-   |                 ^
-   |                 |
-   |                 expected one of 8 possible tokens
-   |                 help: maybe write a path separator here: `::`
-
-error: expected one of `@` or `|`, found `:`
-  --> $DIR/issue-87086-colon-path-sep.rs:25:12
-   |
-LL |         Foo:Bar::Baz => {}
-   |            ^
-   |            |
-   |            expected one of `@` or `|`
-   |            help: maybe write a path separator here: `::`
-
-error: expected one of `@` or `|`, found `:`
-  --> $DIR/issue-87086-colon-path-sep.rs:31:12
-   |
-LL |         Foo: Bar::Baz if true => {}
-   |            ^
-   |            |
-   |            expected one of `@` or `|`
-   |            help: maybe write a path separator here: `::`
-
-error: expected one of `@` or `|`, found `:`
-  --> $DIR/issue-87086-colon-path-sep.rs:36:15
-   |
-LL |     if let Bar:Baz = f() {
-   |               ^
-   |               |
-   |               expected one of `@` or `|`
-   |               help: maybe write a path separator here: `::`
-
-error: expected one of `=>`, `@`, `if`, or `|`, found `:`
-  --> $DIR/issue-87086-colon-path-sep.rs:44:16
-   |
-LL |         ref Foo: Bar::Baz => {}
-   |                ^ expected one of `=>`, `@`, `if`, or `|`
-
-error: expected one of `=>`, `@`, `if`, or `|`, found `:`
-  --> $DIR/issue-87086-colon-path-sep.rs:52:16
-   |
-LL |         mut Foo: Bar::Baz => {}
-   |                ^ expected one of `=>`, `@`, `if`, or `|`
-
-error: expected one of `@` or `|`, found `:`
-  --> $DIR/issue-87086-colon-path-sep.rs:62:12
-   |
-LL |         Foo:Bar::Baz => {}
-   |            ^
-   |            |
-   |            expected one of `@` or `|`
-   |            help: maybe write a path separator here: `::`
-
-error: aborting due to 8 previous errors
-
diff --git a/src/test/ui/parser/issue-87197-missing-semicolon.fixed b/src/test/ui/parser/issue-87197-missing-semicolon.fixed
deleted file mode 100644 (file)
index 53f071d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-rustfix
-// Parser should know when a semicolon is missing.
-// https://github.com/rust-lang/rust/issues/87197
-
-fn main() {
-    let x = 100; //~ ERROR: expected `;`
-    println!("{}", x); //~ ERROR: expected `;`
-    let y = 200; //~ ERROR: expected `;`
-    println!("{}", y);
-}
diff --git a/src/test/ui/parser/issue-87197-missing-semicolon.rs b/src/test/ui/parser/issue-87197-missing-semicolon.rs
deleted file mode 100644 (file)
index db0edf4..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-rustfix
-// Parser should know when a semicolon is missing.
-// https://github.com/rust-lang/rust/issues/87197
-
-fn main() {
-    let x = 100 //~ ERROR: expected `;`
-    println!("{}", x) //~ ERROR: expected `;`
-    let y = 200 //~ ERROR: expected `;`
-    println!("{}", y);
-}
diff --git a/src/test/ui/parser/issue-87197-missing-semicolon.stderr b/src/test/ui/parser/issue-87197-missing-semicolon.stderr
deleted file mode 100644 (file)
index 57772de..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-error: expected `;`, found `println`
-  --> $DIR/issue-87197-missing-semicolon.rs:6:16
-   |
-LL |     let x = 100
-   |                ^ help: add `;` here
-LL |     println!("{}", x)
-   |     ------- unexpected token
-
-error: expected `;`, found keyword `let`
-  --> $DIR/issue-87197-missing-semicolon.rs:7:22
-   |
-LL |     println!("{}", x)
-   |                      ^ help: add `;` here
-LL |     let y = 200
-   |     --- unexpected token
-
-error: expected `;`, found `println`
-  --> $DIR/issue-87197-missing-semicolon.rs:8:16
-   |
-LL |     let y = 200
-   |                ^ help: add `;` here
-LL |     println!("{}", y);
-   |     ------- unexpected token
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/parser/issue-87217-keyword-order/const-async-const.rs b/src/test/ui/parser/issue-87217-keyword-order/const-async-const.rs
deleted file mode 100644 (file)
index 7c3d915..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// edition:2018
-
-// Test that even when `const` is already present, the proposed fix is `const const async`,
-// like for `pub pub`.
-
-const async const fn test() {}
-//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
-//~| NOTE expected one of `extern`, `fn`, or `unsafe`
-//~| HELP `const` must come before `async`
-//~| SUGGESTION const async
-//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issue-87217-keyword-order/const-async-const.stderr b/src/test/ui/parser/issue-87217-keyword-order/const-async-const.stderr
deleted file mode 100644 (file)
index 5628091..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
-  --> $DIR/const-async-const.rs:6:13
-   |
-LL | const async const fn test() {}
-   |       ------^^^^^
-   |       |     |
-   |       |     expected one of `extern`, `fn`, or `unsafe`
-   |       help: `const` must come before `async`: `const async`
-   |
-   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-87217-keyword-order/several-kw-jump.rs b/src/test/ui/parser/issue-87217-keyword-order/several-kw-jump.rs
deleted file mode 100644 (file)
index 86fdb78..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// edition:2018
-
-// There is an order to respect for keywords before a function:
-// `<visibility>, const, async, unsafe, extern, "<ABI>"`
-//
-// This test ensures the compiler is helpful about them being misplaced.
-// Visibilities are tested elsewhere.
-
-async unsafe const fn test() {}
-//~^ ERROR expected one of `extern` or `fn`, found keyword `const`
-//~| NOTE expected one of `extern` or `fn`
-//~| HELP `const` must come before `async unsafe`
-//~| SUGGESTION const async unsafe
-//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issue-87217-keyword-order/several-kw-jump.stderr b/src/test/ui/parser/issue-87217-keyword-order/several-kw-jump.stderr
deleted file mode 100644 (file)
index 65cce77..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected one of `extern` or `fn`, found keyword `const`
-  --> $DIR/several-kw-jump.rs:9:14
-   |
-LL | async unsafe const fn test() {}
-   | -------------^^^^^
-   | |            |
-   | |            expected one of `extern` or `fn`
-   | help: `const` must come before `async unsafe`: `const async unsafe`
-   |
-   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-87217-keyword-order/wrong-async.rs b/src/test/ui/parser/issue-87217-keyword-order/wrong-async.rs
deleted file mode 100644 (file)
index edfb330..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// edition:2018
-
-// There is an order to respect for keywords before a function:
-// `<visibility>, const, async, unsafe, extern, "<ABI>"`
-//
-// This test ensures the compiler is helpful about them being misplaced.
-// Visibilities are tested elsewhere.
-
-unsafe async fn test() {}
-//~^ ERROR expected one of `extern` or `fn`, found keyword `async`
-//~| NOTE expected one of `extern` or `fn`
-//~| HELP `async` must come before `unsafe`
-//~| SUGGESTION async unsafe
-//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issue-87217-keyword-order/wrong-async.stderr b/src/test/ui/parser/issue-87217-keyword-order/wrong-async.stderr
deleted file mode 100644 (file)
index 3acd9e4..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected one of `extern` or `fn`, found keyword `async`
-  --> $DIR/wrong-async.rs:9:8
-   |
-LL | unsafe async fn test() {}
-   | -------^^^^^
-   | |      |
-   | |      expected one of `extern` or `fn`
-   | help: `async` must come before `unsafe`: `async unsafe`
-   |
-   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-87217-keyword-order/wrong-const.rs b/src/test/ui/parser/issue-87217-keyword-order/wrong-const.rs
deleted file mode 100644 (file)
index abd692b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// edition:2018
-
-// There is an order to respect for keywords before a function:
-// `<visibility>, const, async, unsafe, extern, "<ABI>"`
-//
-// This test ensures the compiler is helpful about them being misplaced.
-// Visibilities are tested elsewhere.
-
-unsafe const fn test() {}
-//~^ ERROR expected one of `extern` or `fn`, found keyword `const`
-//~| NOTE expected one of `extern` or `fn`
-//~| HELP `const` must come before `unsafe`
-//~| SUGGESTION const unsafe
-//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issue-87217-keyword-order/wrong-const.stderr b/src/test/ui/parser/issue-87217-keyword-order/wrong-const.stderr
deleted file mode 100644 (file)
index 9a3e07b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected one of `extern` or `fn`, found keyword `const`
-  --> $DIR/wrong-const.rs:9:8
-   |
-LL | unsafe const fn test() {}
-   | -------^^^^^
-   | |      |
-   | |      expected one of `extern` or `fn`
-   | help: `const` must come before `unsafe`: `const unsafe`
-   |
-   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-87217-keyword-order/wrong-unsafe.rs b/src/test/ui/parser/issue-87217-keyword-order/wrong-unsafe.rs
deleted file mode 100644 (file)
index 7f0761e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// edition:2018
-
-// There is an order to respect for keywords before a function:
-// `<visibility>, const, async, unsafe, extern, "<ABI>"`
-//
-// This test ensures the compiler is helpful about them being misplaced.
-// Visibilities are tested elsewhere.
-
-extern unsafe fn test() {}
-//~^ ERROR expected `fn`, found keyword `unsafe`
-//~| NOTE expected `fn`
-//~| HELP `unsafe` must come before `extern`
-//~| SUGGESTION unsafe extern
-//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issue-87217-keyword-order/wrong-unsafe.stderr b/src/test/ui/parser/issue-87217-keyword-order/wrong-unsafe.stderr
deleted file mode 100644 (file)
index 395ee9f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: expected `fn`, found keyword `unsafe`
-  --> $DIR/wrong-unsafe.rs:9:8
-   |
-LL | extern unsafe fn test() {}
-   | -------^^^^^^
-   | |      |
-   | |      expected `fn`
-   | help: `unsafe` must come before `extern`: `unsafe extern`
-   |
-   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-87635.rs b/src/test/ui/parser/issue-87635.rs
deleted file mode 100644 (file)
index da74c18..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-struct Foo {}
-
-impl Foo {
-    pub fn bar()
-    //~^ ERROR: expected `;`, found `}`
-    //~| ERROR: associated function in `impl` without body
-}
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-87635.stderr b/src/test/ui/parser/issue-87635.stderr
deleted file mode 100644 (file)
index 920a9f9..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-error: expected `;`, found `}`
-  --> $DIR/issue-87635.rs:4:17
-   |
-LL |     pub fn bar()
-   |                 ^ help: add `;` here
-...
-LL | }
-   | - unexpected token
-
-error: associated function in `impl` without body
-  --> $DIR/issue-87635.rs:4:5
-   |
-LL |     pub fn bar()
-   |     ^^^^^^^^^^^-
-   |                |
-   |                help: provide a definition for the function: `{ <body> }`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-87812-path.rs b/src/test/ui/parser/issue-87812-path.rs
deleted file mode 100644 (file)
index b887808..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-macro_rules! foo {
-    ( $f:path ) => {{
-        let _: usize = $f; //~ERROR
-    }};
-}
-
-struct Baz;
-
-fn main() {
-    foo!(Baz);
-}
diff --git a/src/test/ui/parser/issue-87812-path.stderr b/src/test/ui/parser/issue-87812-path.stderr
deleted file mode 100644 (file)
index f8ee051..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-87812-path.rs:3:24
-   |
-LL |         let _: usize = $f;
-   |                -----   ^^ expected `usize`, found struct `Baz`
-   |                |
-   |                expected due to this
-...
-LL |     foo!(Baz);
-   |     --------- 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 previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issue-87812.rs b/src/test/ui/parser/issue-87812.rs
deleted file mode 100644 (file)
index 0ba87b9..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#![deny(break_with_label_and_loop)]
-
-macro_rules! foo {
-    ( $f:block ) => {
-        '_l: loop {
-            break '_l $f; //~ERROR
-        }
-    };
-}
-
-fn main() {
-    let x = foo!({ 3 });
-}
diff --git a/src/test/ui/parser/issue-87812.stderr b/src/test/ui/parser/issue-87812.stderr
deleted file mode 100644 (file)
index d61ee23..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-error: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression
-  --> $DIR/issue-87812.rs:6:13
-   |
-LL |             break '_l $f;
-   |             ^^^^^^^^^^^^
-...
-LL |     let x = foo!({ 3 });
-   |             ----------- in this macro invocation
-   |
-note: the lint level is defined here
-  --> $DIR/issue-87812.rs:1:9
-   |
-LL | #![deny(break_with_label_and_loop)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: wrap this expression in parentheses
-   |
-LL |             break '_l ($f);
-   |                       +  +
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-88276-unary-plus.fixed b/src/test/ui/parser/issue-88276-unary-plus.fixed
deleted file mode 100644 (file)
index 25b7c34..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-rustfix
-#[allow(unused_parens)]
-fn main() {
-    let _ = 1; //~ ERROR leading `+` is not supported
-    let _ = (1.0 + 2.0) * 3.0; //~ ERROR leading `+` is not supported
-                           //~| ERROR leading `+` is not supported
-    let _ = [3, 4+6]; //~ ERROR leading `+` is not supported
-}
diff --git a/src/test/ui/parser/issue-88276-unary-plus.rs b/src/test/ui/parser/issue-88276-unary-plus.rs
deleted file mode 100644 (file)
index 11b2e9d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-rustfix
-#[allow(unused_parens)]
-fn main() {
-    let _ = +1; //~ ERROR leading `+` is not supported
-    let _ = (1.0 + +2.0) * +3.0; //~ ERROR leading `+` is not supported
-                           //~| ERROR leading `+` is not supported
-    let _ = [+3, 4+6]; //~ ERROR leading `+` is not supported
-}
diff --git a/src/test/ui/parser/issue-88276-unary-plus.stderr b/src/test/ui/parser/issue-88276-unary-plus.stderr
deleted file mode 100644 (file)
index b267617..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-error: leading `+` is not supported
-  --> $DIR/issue-88276-unary-plus.rs:4:13
-   |
-LL |     let _ = +1;
-   |             ^ unexpected `+`
-   |
-help: try removing the `+`
-   |
-LL -     let _ = +1;
-LL +     let _ = 1;
-   | 
-
-error: leading `+` is not supported
-  --> $DIR/issue-88276-unary-plus.rs:5:20
-   |
-LL |     let _ = (1.0 + +2.0) * +3.0;
-   |                    ^ unexpected `+`
-   |
-help: try removing the `+`
-   |
-LL -     let _ = (1.0 + +2.0) * +3.0;
-LL +     let _ = (1.0 + 2.0) * +3.0;
-   | 
-
-error: leading `+` is not supported
-  --> $DIR/issue-88276-unary-plus.rs:5:28
-   |
-LL |     let _ = (1.0 + +2.0) * +3.0;
-   |                            ^ unexpected `+`
-   |
-help: try removing the `+`
-   |
-LL -     let _ = (1.0 + +2.0) * +3.0;
-LL +     let _ = (1.0 + +2.0) * 3.0;
-   | 
-
-error: leading `+` is not supported
-  --> $DIR/issue-88276-unary-plus.rs:7:14
-   |
-LL |     let _ = [+3, 4+6];
-   |              ^ unexpected `+`
-   |
-help: try removing the `+`
-   |
-LL -     let _ = [+3, 4+6];
-LL +     let _ = [3, 4+6];
-   | 
-
-error: aborting due to 4 previous errors
-
diff --git a/src/test/ui/parser/issue-88583-union-as-ident.rs b/src/test/ui/parser/issue-88583-union-as-ident.rs
deleted file mode 100644 (file)
index b3d66d4..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// check-pass
-
-#![allow(non_camel_case_types)]
-
-struct union;
-
-impl union {
-    pub fn new() -> Self {
-        union { }
-    }
-}
-
-fn main() {
-    let _u = union::new();
-}
diff --git a/src/test/ui/parser/issue-88770.rs b/src/test/ui/parser/issue-88770.rs
deleted file mode 100644 (file)
index bf89033..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// Regression test for the ICE described in #88770.
-
-// error-pattern:this file contains an unclosed delimiter
-// error-pattern:expected one of
-// error-pattern:missing `in` in `for` loop
-// error-pattern:expected `;`, found `e`
-
-fn m(){print!("",(c for&g
-u
-e
-e
diff --git a/src/test/ui/parser/issue-88770.stderr b/src/test/ui/parser/issue-88770.stderr
deleted file mode 100644 (file)
index c7e2415..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-88770.rs:11:3
-   |
-LL | fn m(){print!("",(c for&g
-   |       -      -   - unclosed delimiter
-   |       |      |
-   |       |      unclosed delimiter
-   |       unclosed delimiter
-...
-LL | e
-   |   ^
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-88770.rs:11:3
-   |
-LL | fn m(){print!("",(c for&g
-   |       -      -   - unclosed delimiter
-   |       |      |
-   |       |      unclosed delimiter
-   |       unclosed delimiter
-...
-LL | e
-   |   ^
-
-error: this file contains an unclosed delimiter
-  --> $DIR/issue-88770.rs:11:3
-   |
-LL | fn m(){print!("",(c for&g
-   |       -      -   - unclosed delimiter
-   |       |      |
-   |       |      unclosed delimiter
-   |       unclosed delimiter
-...
-LL | e
-   |   ^
-
-error: missing `in` in `for` loop
-  --> $DIR/issue-88770.rs:8:26
-   |
-LL |   fn m(){print!("",(c for&g
-   |  __________________________^
-LL | | u
-   | |_ help: try adding `in` here
-
-error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found keyword `for`
-  --> $DIR/issue-88770.rs:8:21
-   |
-LL | fn m(){print!("",(c for&g
-   |                     ^^^ expected one of 8 possible tokens
-
-error: expected `;`, found `e`
-  --> $DIR/issue-88770.rs:10:2
-   |
-LL | e
-   |  ^ help: add `;` here
-LL | e
-   | - unexpected token
-
-error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `)`
-  --> $DIR/issue-88770.rs:11:3
-   |
-LL | e
-   |   ^ expected one of 7 possible tokens
-
-error: aborting due to 7 previous errors
-
diff --git a/src/test/ui/parser/issue-88818.rs b/src/test/ui/parser/issue-88818.rs
deleted file mode 100644 (file)
index b9233ca..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// Regression test for #88818 (improve error message for missing trait
-// in `impl for X`).
-
-struct S { }
-impl for S { }
-//~^ ERROR: missing trait in a trait impl
-//~| HELP: add a trait here
-//~| HELP: for an inherent impl, drop this `for`
-
-fn main() {}
diff --git a/src/test/ui/parser/issue-88818.stderr b/src/test/ui/parser/issue-88818.stderr
deleted file mode 100644 (file)
index d30990a..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error: missing trait in a trait impl
-  --> $DIR/issue-88818.rs:5:5
-   |
-LL | impl for S { }
-   |     ^
-   |
-help: add a trait here
-   |
-LL | impl Trait for S { }
-   |      +++++
-help: for an inherent impl, drop this `for`
-   |
-LL - impl for S { }
-LL + impl S { }
-   | 
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-89388.rs b/src/test/ui/parser/issue-89388.rs
deleted file mode 100644 (file)
index 9153c07..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// Regression test for #89388.
-
-fn main() {
-    let option: Option<&[u8]> = Some(b"...");
-    let _ = option.map([_]::to_vec);
-    //~^ ERROR: missing angle brackets in associated item path
-}
diff --git a/src/test/ui/parser/issue-89388.stderr b/src/test/ui/parser/issue-89388.stderr
deleted file mode 100644 (file)
index cf28bef..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: missing angle brackets in associated item path
-  --> $DIR/issue-89388.rs:5:24
-   |
-LL |     let _ = option.map([_]::to_vec);
-   |                        ^^^^^^^^^^^ help: try: `<[_]>::to_vec`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-89396.fixed b/src/test/ui/parser/issue-89396.fixed
deleted file mode 100644 (file)
index 823ad8c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Regression test for issue #89396: Try to recover from a
-// `=>` -> `=` or `->` typo in a match arm.
-
-// run-rustfix
-
-fn main() {
-    let opt = Some(42);
-    let _ = match opt {
-        Some(_) => true,
-        //~^ ERROR: expected one of
-        //~| HELP: try using a fat arrow here
-        None => false,
-        //~^ ERROR: expected one of
-        //~| HELP: try using a fat arrow here
-    };
-}
diff --git a/src/test/ui/parser/issue-89396.rs b/src/test/ui/parser/issue-89396.rs
deleted file mode 100644 (file)
index f1d9efa..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Regression test for issue #89396: Try to recover from a
-// `=>` -> `=` or `->` typo in a match arm.
-
-// run-rustfix
-
-fn main() {
-    let opt = Some(42);
-    let _ = match opt {
-        Some(_) = true,
-        //~^ ERROR: expected one of
-        //~| HELP: try using a fat arrow here
-        None -> false,
-        //~^ ERROR: expected one of
-        //~| HELP: try using a fat arrow here
-    };
-}
diff --git a/src/test/ui/parser/issue-89396.stderr b/src/test/ui/parser/issue-89396.stderr
deleted file mode 100644 (file)
index 5044205..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error: expected one of `=>`, `if`, or `|`, found `=`
-  --> $DIR/issue-89396.rs:9:17
-   |
-LL |         Some(_) = true,
-   |                 ^
-   |                 |
-   |                 expected one of `=>`, `if`, or `|`
-   |                 help: try using a fat arrow here: `=>`
-
-error: expected one of `=>`, `@`, `if`, or `|`, found `->`
-  --> $DIR/issue-89396.rs:12:14
-   |
-LL |         None -> false,
-   |              ^^
-   |              |
-   |              expected one of `=>`, `@`, `if`, or `|`
-   |              help: try using a fat arrow here: `=>`
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/parser/issue-89574.rs b/src/test/ui/parser/issue-89574.rs
deleted file mode 100644 (file)
index 0a477f1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {
-    const EMPTY_ARRAY = [];
-    //~^ missing type for `const` item
-}
diff --git a/src/test/ui/parser/issue-89574.stderr b/src/test/ui/parser/issue-89574.stderr
deleted file mode 100644 (file)
index cbee3d3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: missing type for `const` item
-  --> $DIR/issue-89574.rs:2:11
-   |
-LL |     const EMPTY_ARRAY = [];
-   |           ^^^^^^^^^^^ help: provide a type for the item: `EMPTY_ARRAY: <type>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.rs b/src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.rs
deleted file mode 100644 (file)
index fe67d98..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// aux-build:issue-89971-outer-attr-following-inner-attr-ice.rs
-
-#[macro_use]
-extern crate issue_89971_outer_attr_following_inner_attr_ice;
-
-fn main() {
-    Mew();
-    X {};
-}
-
-#![deny(missing_docs)]
-//~^ ERROR an inner attribute is not permitted in this context
-#[derive(ICE)]
-#[deny(missing_docs)]
-struct Mew();
diff --git a/src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.stderr b/src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.stderr
deleted file mode 100644 (file)
index 34a6ab0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error: an inner attribute is not permitted in this context
-  --> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:11:1
-   |
-LL | #![deny(missing_docs)]
-   | ^^^^^^^^^^^^^^^^^^^^^^
-...
-LL | struct Mew();
-   | ------------- the inner attribute doesn't annotate this struct
-   |
-   = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
-help: to annotate the struct, change the attribute from inner to outer style
-   |
-LL - #![deny(missing_docs)]
-LL + #[deny(missing_docs)]
-   | 
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/parser/issue-90728.rs b/src/test/ui/parser/issue-90728.rs
new file mode 100644 (file)
index 0000000..d6a8983
--- /dev/null
@@ -0,0 +1,6 @@
+fn main() {
+    a.5.2E+
+    //~^ ERROR: unexpected token: `5.2E+`
+    //~| ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `5.2E+`
+    //~| ERROR: expected at least one digit in exponent
+}
diff --git a/src/test/ui/parser/issue-90728.stderr b/src/test/ui/parser/issue-90728.stderr
new file mode 100644 (file)
index 0000000..b55c460
--- /dev/null
@@ -0,0 +1,20 @@
+error: expected at least one digit in exponent
+  --> $DIR/issue-90728.rs:2:7
+   |
+LL |     a.5.2E+
+   |       ^^^^^
+
+error: unexpected token: `5.2E+`
+  --> $DIR/issue-90728.rs:2:7
+   |
+LL |     a.5.2E+
+   |       ^^^^^
+
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `5.2E+`
+  --> $DIR/issue-90728.rs:2:7
+   |
+LL |     a.5.2E+
+   |       ^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/auxiliary/issue-21146-inc.rs b/src/test/ui/parser/issues/auxiliary/issue-21146-inc.rs
new file mode 100644 (file)
index 0000000..32a3b9d
--- /dev/null
@@ -0,0 +1,3 @@
+// include file for issue-21146.rs
+
+parse_error
diff --git a/src/test/ui/parser/issues/auxiliary/issue-89971-outer-attr-following-inner-attr-ice.rs b/src/test/ui/parser/issues/auxiliary/issue-89971-outer-attr-following-inner-attr-ice.rs
new file mode 100644 (file)
index 0000000..e5604b8
--- /dev/null
@@ -0,0 +1,13 @@
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(ICE)]
+pub fn derive(_: TokenStream) -> TokenStream {
+    r#"#[allow(missing_docs)] struct X { }"#.parse().unwrap()
+}
diff --git a/src/test/ui/parser/issues/issue-10392-2.fixed b/src/test/ui/parser/issues/issue-10392-2.fixed
new file mode 100644 (file)
index 0000000..3386fac
--- /dev/null
@@ -0,0 +1,9 @@
+// run-rustfix
+
+pub struct A { pub foo: isize }
+
+fn a() -> A { panic!() }
+
+fn main() {
+    let A { .. } = a(); //~ ERROR: expected `}`
+}
diff --git a/src/test/ui/parser/issues/issue-10392-2.rs b/src/test/ui/parser/issues/issue-10392-2.rs
new file mode 100644 (file)
index 0000000..30628ae
--- /dev/null
@@ -0,0 +1,9 @@
+// run-rustfix
+
+pub struct A { pub foo: isize }
+
+fn a() -> A { panic!() }
+
+fn main() {
+    let A { .., } = a(); //~ ERROR: expected `}`
+}
diff --git a/src/test/ui/parser/issues/issue-10392-2.stderr b/src/test/ui/parser/issues/issue-10392-2.stderr
new file mode 100644 (file)
index 0000000..4154ecf
--- /dev/null
@@ -0,0 +1,12 @@
+error: expected `}`, found `,`
+  --> $DIR/issue-10392-2.rs:8:15
+   |
+LL |     let A { .., } = a();
+   |             --^
+   |             | |
+   |             | expected `}`
+   |             | help: remove this comma
+   |             `..` must be at the end and cannot have a trailing comma
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-10392.rs b/src/test/ui/parser/issues/issue-10392.rs
new file mode 100644 (file)
index 0000000..5b0c2fc
--- /dev/null
@@ -0,0 +1,7 @@
+struct A { foo: isize }
+
+fn a() -> A { panic!() }
+
+fn main() {
+    let A { , } = a(); //~ ERROR expected ident
+}
diff --git a/src/test/ui/parser/issues/issue-10392.stderr b/src/test/ui/parser/issues/issue-10392.stderr
new file mode 100644 (file)
index 0000000..438ea67
--- /dev/null
@@ -0,0 +1,10 @@
+error: expected identifier, found `,`
+  --> $DIR/issue-10392.rs:6:13
+   |
+LL |     let A { , } = a();
+   |         -   ^ expected identifier
+   |         |
+   |         while parsing the fields for this pattern
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-10636-1.rs b/src/test/ui/parser/issues/issue-10636-1.rs
new file mode 100644 (file)
index 0000000..77c6072
--- /dev/null
@@ -0,0 +1,8 @@
+struct Obj {
+    //~^ NOTE: unclosed delimiter
+    member: usize
+)
+//~^ ERROR mismatched closing delimiter
+//~| NOTE mismatched closing delimiter
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-10636-1.stderr b/src/test/ui/parser/issues/issue-10636-1.stderr
new file mode 100644 (file)
index 0000000..1e6294e
--- /dev/null
@@ -0,0 +1,11 @@
+error: mismatched closing delimiter: `)`
+  --> $DIR/issue-10636-1.rs:1:12
+   |
+LL | struct Obj {
+   |            ^ unclosed delimiter
+...
+LL | )
+   | ^ mismatched closing delimiter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-10636-2.rs b/src/test/ui/parser/issues/issue-10636-2.rs
new file mode 100644 (file)
index 0000000..6fb6363
--- /dev/null
@@ -0,0 +1,11 @@
+// FIXME(31528) we emit a bunch of silly errors here due to continuing past the
+// first one. This would be easy-ish to address by better recovery in tokenisation.
+
+pub fn trace_option(option: Option<isize>) {
+    option.map(|some| 42;
+                          //~^ ERROR: expected one of
+
+}
+//~^ ERROR: expected expression, found `)`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-10636-2.stderr b/src/test/ui/parser/issues/issue-10636-2.stderr
new file mode 100644 (file)
index 0000000..d4f2da9
--- /dev/null
@@ -0,0 +1,16 @@
+error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;`
+  --> $DIR/issue-10636-2.rs:5:15
+   |
+LL |     option.map(|some| 42;
+   |               ^         ^ help: `)` may belong here
+   |               |
+   |               unclosed delimiter
+
+error: expected expression, found `)`
+  --> $DIR/issue-10636-2.rs:8:1
+   |
+LL | }
+   | ^ expected expression
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-13483.rs b/src/test/ui/parser/issues/issue-13483.rs
new file mode 100644 (file)
index 0000000..a2fd926
--- /dev/null
@@ -0,0 +1,17 @@
+fn main() {
+    if true {
+    } else if { //~ ERROR missing condition
+    //~^ ERROR mismatched types
+    } else {
+    }
+}
+
+fn foo() {
+    if true {
+    } else if { //~ ERROR missing condition
+    //~^ ERROR mismatched types
+    }
+    bar();
+}
+
+fn bar() {}
diff --git a/src/test/ui/parser/issues/issue-13483.stderr b/src/test/ui/parser/issues/issue-13483.stderr
new file mode 100644 (file)
index 0000000..5fd05b1
--- /dev/null
@@ -0,0 +1,33 @@
+error: missing condition for `if` expression
+  --> $DIR/issue-13483.rs:3:14
+   |
+LL |     } else if {
+   |              ^ expected if condition here
+
+error: missing condition for `if` expression
+  --> $DIR/issue-13483.rs:11:14
+   |
+LL |     } else if {
+   |              ^ expected if condition here
+
+error[E0308]: mismatched types
+  --> $DIR/issue-13483.rs:3:15
+   |
+LL |       } else if {
+   |  _______________^
+LL | |
+LL | |     } else {
+   | |_____^ expected `bool`, found `()`
+
+error[E0308]: mismatched types
+  --> $DIR/issue-13483.rs:11:15
+   |
+LL |       } else if {
+   |  _______________^
+LL | |
+LL | |     }
+   | |_____^ expected `bool`, found `()`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issues/issue-14303-enum.rs b/src/test/ui/parser/issues/issue-14303-enum.rs
new file mode 100644 (file)
index 0000000..a610615
--- /dev/null
@@ -0,0 +1,6 @@
+enum X<'a, T, 'b> {
+//~^ ERROR lifetime parameters must be declared prior to type parameters
+    A(&'a &'b T)
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-enum.stderr b/src/test/ui/parser/issues/issue-14303-enum.stderr
new file mode 100644 (file)
index 0000000..bcecd75
--- /dev/null
@@ -0,0 +1,8 @@
+error: lifetime parameters must be declared prior to type parameters
+  --> $DIR/issue-14303-enum.rs:1:15
+   |
+LL | enum X<'a, T, 'b> {
+   |       --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-14303-fn-def.rs b/src/test/ui/parser/issues/issue-14303-fn-def.rs
new file mode 100644 (file)
index 0000000..221bd31
--- /dev/null
@@ -0,0 +1,4 @@
+fn foo<'a, T, 'b>(x: &'a T) {}
+//~^ ERROR lifetime parameters must be declared prior to type parameters
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-fn-def.stderr b/src/test/ui/parser/issues/issue-14303-fn-def.stderr
new file mode 100644 (file)
index 0000000..082c37e
--- /dev/null
@@ -0,0 +1,8 @@
+error: lifetime parameters must be declared prior to type parameters
+  --> $DIR/issue-14303-fn-def.rs:1:15
+   |
+LL | fn foo<'a, T, 'b>(x: &'a T) {}
+   |       --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-14303-fncall.full.stderr b/src/test/ui/parser/issues/issue-14303-fncall.full.stderr
new file mode 100644 (file)
index 0000000..02af61e
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0747]: type provided when a lifetime was expected
+  --> $DIR/issue-14303-fncall.rs:16:26
+   |
+LL |         .collect::<Vec<S<_, 'a>>>();
+   |                          ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/parser/issues/issue-14303-fncall.generic_arg.stderr b/src/test/ui/parser/issues/issue-14303-fncall.generic_arg.stderr
new file mode 100644 (file)
index 0000000..9f3359b
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0747]: inferred provided when a lifetime was expected
+  --> $DIR/issue-14303-fncall.rs:16:26
+   |
+LL |         .collect::<Vec<S<_, 'a>>>();
+   |                          ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/parser/issues/issue-14303-fncall.rs b/src/test/ui/parser/issues/issue-14303-fncall.rs
new file mode 100644 (file)
index 0000000..976a79a
--- /dev/null
@@ -0,0 +1,21 @@
+// revisions: full generic_arg
+// compile-flags: -Zborrowck=mir
+// can't run rustfix because it doesn't handle multipart suggestions correctly
+// we need the above to avoid ast borrowck failure in recovered code
+#![cfg_attr(generic_arg, feature(generic_arg_infer))]
+
+
+struct S<'a, T> {
+    a: &'a T,
+    b: &'a T,
+}
+
+fn foo<'a, 'b>(start: &'a usize, end: &'a usize) {
+    let _x = (*start..*end)
+        .map(|x| S { a: start, b: end })
+        .collect::<Vec<S<_, 'a>>>();
+        //[generic_arg]~^ ERROR inferred provided when a lifetime was expected
+        //[full]~^^ ERROR type provided when a lifetime was expected
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-impl.rs b/src/test/ui/parser/issues/issue-14303-impl.rs
new file mode 100644 (file)
index 0000000..4dc2c66
--- /dev/null
@@ -0,0 +1,6 @@
+struct X<T>(T);
+
+impl<'a, T, 'b> X<T> {}
+//~^ ERROR lifetime parameters must be declared prior to type parameters
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-impl.stderr b/src/test/ui/parser/issues/issue-14303-impl.stderr
new file mode 100644 (file)
index 0000000..3b5615d
--- /dev/null
@@ -0,0 +1,8 @@
+error: lifetime parameters must be declared prior to type parameters
+  --> $DIR/issue-14303-impl.rs:3:13
+   |
+LL | impl<'a, T, 'b> X<T> {}
+   |     --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-14303-path.rs b/src/test/ui/parser/issues/issue-14303-path.rs
new file mode 100644 (file)
index 0000000..89ef914
--- /dev/null
@@ -0,0 +1,13 @@
+mod foo {
+    pub struct X<'a, 'b, 'c, T> {
+        a: &'a str,
+        b: &'b str,
+        c: &'c str,
+        t: T,
+    }
+}
+
+fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
+//~^ ERROR type provided when a lifetime was expected
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-path.stderr b/src/test/ui/parser/issues/issue-14303-path.stderr
new file mode 100644 (file)
index 0000000..841e63e
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0747]: type provided when a lifetime was expected
+  --> $DIR/issue-14303-path.rs:10:37
+   |
+LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
+   |                                     ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/parser/issues/issue-14303-struct.rs b/src/test/ui/parser/issues/issue-14303-struct.rs
new file mode 100644 (file)
index 0000000..0bd10b4
--- /dev/null
@@ -0,0 +1,6 @@
+struct X<'a, T, 'b> {
+//~^ ERROR lifetime parameters must be declared prior to type parameters
+    x: &'a &'b T
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-struct.stderr b/src/test/ui/parser/issues/issue-14303-struct.stderr
new file mode 100644 (file)
index 0000000..dbd0b98
--- /dev/null
@@ -0,0 +1,8 @@
+error: lifetime parameters must be declared prior to type parameters
+  --> $DIR/issue-14303-struct.rs:1:17
+   |
+LL | struct X<'a, T, 'b> {
+   |         --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-14303-trait.rs b/src/test/ui/parser/issues/issue-14303-trait.rs
new file mode 100644 (file)
index 0000000..f253de9
--- /dev/null
@@ -0,0 +1,4 @@
+trait Foo<'a, T, 'b> {}
+//~^ ERROR lifetime parameters must be declared prior to type parameters
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-14303-trait.stderr b/src/test/ui/parser/issues/issue-14303-trait.stderr
new file mode 100644 (file)
index 0000000..7dfa62d
--- /dev/null
@@ -0,0 +1,8 @@
+error: lifetime parameters must be declared prior to type parameters
+  --> $DIR/issue-14303-trait.rs:1:18
+   |
+LL | trait Foo<'a, T, 'b> {}
+   |          --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-15914.rs b/src/test/ui/parser/issues/issue-15914.rs
new file mode 100644 (file)
index 0000000..4a5606a
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {
+    let ref
+        (); //~ ERROR expected identifier, found `(`
+}
diff --git a/src/test/ui/parser/issues/issue-15914.stderr b/src/test/ui/parser/issues/issue-15914.stderr
new file mode 100644 (file)
index 0000000..ea26453
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected identifier, found `(`
+  --> $DIR/issue-15914.rs:3:9
+   |
+LL |         ();
+   |         ^ expected identifier
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-15980.rs b/src/test/ui/parser/issues/issue-15980.rs
new file mode 100644 (file)
index 0000000..87faa7d
--- /dev/null
@@ -0,0 +1,17 @@
+use std::io;
+
+fn main(){
+    let x: io::Result<()> = Ok(());
+    match x {
+        Err(ref e) if e.kind == io::EndOfFile {
+            //~^ NOTE while parsing this struct
+            return
+            //~^ ERROR expected identifier, found keyword `return`
+            //~| NOTE expected identifier, found keyword
+        }
+        //~^ NOTE expected one of `.`, `=>`, `?`, or an operator
+        _ => {}
+        //~^ ERROR expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
+        //~| NOTE unexpected token
+    }
+}
diff --git a/src/test/ui/parser/issues/issue-15980.stderr b/src/test/ui/parser/issues/issue-15980.stderr
new file mode 100644 (file)
index 0000000..5cefead
--- /dev/null
@@ -0,0 +1,25 @@
+error: expected identifier, found keyword `return`
+  --> $DIR/issue-15980.rs:8:13
+   |
+LL |         Err(ref e) if e.kind == io::EndOfFile {
+   |                                 ------------- while parsing this struct
+LL |
+LL |             return
+   |             ^^^^^^ expected identifier, found keyword
+   |
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |             r#return
+   |
+
+error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
+  --> $DIR/issue-15980.rs:13:9
+   |
+LL |         }
+   |          - expected one of `.`, `=>`, `?`, or an operator
+LL |
+LL |         _ => {}
+   |         ^ unexpected token
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-1655.rs b/src/test/ui/parser/issues/issue-1655.rs
new file mode 100644 (file)
index 0000000..e9fc6f1
--- /dev/null
@@ -0,0 +1,10 @@
+mod blade_runner {
+    #vec[doc( //~ ERROR expected one of `!` or `[`, found `vec`
+        brief = "Blade Runner is probably the best movie ever",
+        desc = "I like that in the world of Blade Runner it is always
+                raining, and that it's always night time. And Aliens
+                was also a really good movie.
+
+                Alien 3 was crap though."
+    )]
+}
diff --git a/src/test/ui/parser/issues/issue-1655.stderr b/src/test/ui/parser/issues/issue-1655.stderr
new file mode 100644 (file)
index 0000000..0c390a0
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `!` or `[`, found `vec`
+  --> $DIR/issue-1655.rs:2:6
+   |
+LL |     #vec[doc(
+   |      ^^^ expected one of `!` or `[`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-17383.rs b/src/test/ui/parser/issues/issue-17383.rs
new file mode 100644 (file)
index 0000000..7bf0e64
--- /dev/null
@@ -0,0 +1,7 @@
+enum X {
+    A = 3,
+    //~^ ERROR custom discriminant values are not allowed in enums with tuple or struct variants
+    B(usize)
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-17383.stderr b/src/test/ui/parser/issues/issue-17383.stderr
new file mode 100644 (file)
index 0000000..265d6e1
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants
+  --> $DIR/issue-17383.rs:2:9
+   |
+LL |     A = 3,
+   |         ^ disallowed custom discriminant
+LL |
+LL |     B(usize)
+   |     -------- tuple variant defined here
+   |
+   = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information
+   = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/parser/issues/issue-17718-const-mut.rs b/src/test/ui/parser/issues/issue-17718-const-mut.rs
new file mode 100644 (file)
index 0000000..795a8c7
--- /dev/null
@@ -0,0 +1,7 @@
+const
+mut //~ ERROR: const globals cannot be mutable
+//~^^ HELP you might want to declare a static instead
+FOO: usize = 3;
+
+fn main() {
+}
diff --git a/src/test/ui/parser/issues/issue-17718-const-mut.stderr b/src/test/ui/parser/issues/issue-17718-const-mut.stderr
new file mode 100644 (file)
index 0000000..8251ce9
--- /dev/null
@@ -0,0 +1,10 @@
+error: const globals cannot be mutable
+  --> $DIR/issue-17718-const-mut.rs:2:1
+   |
+LL | const
+   | ----- help: you might want to declare a static instead: `static`
+LL | mut
+   | ^^^ cannot be mutable
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-17904-2.rs b/src/test/ui/parser/issues/issue-17904-2.rs
new file mode 100644 (file)
index 0000000..186a955
--- /dev/null
@@ -0,0 +1,3 @@
+struct Bar<T> { x: T } where T: Copy //~ ERROR expected item, found keyword `where`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-17904-2.stderr b/src/test/ui/parser/issues/issue-17904-2.stderr
new file mode 100644 (file)
index 0000000..9c7fdf6
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected item, found keyword `where`
+  --> $DIR/issue-17904-2.rs:1:24
+   |
+LL | struct Bar<T> { x: T } where T: Copy
+   |                        ^^^^^ expected item
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-17904.rs b/src/test/ui/parser/issues/issue-17904.rs
new file mode 100644 (file)
index 0000000..7d6a54f
--- /dev/null
@@ -0,0 +1,6 @@
+struct Baz<U> where U: Eq(U); //This is parsed as the new Fn* style parenthesis syntax.
+struct Baz<U> where U: Eq(U) -> R; // Notice this parses as well.
+struct Baz<U>(U) where U: Eq; // This rightfully signals no error as well.
+struct Foo<T> where T: Copy, (T); //~ ERROR expected one of `:`, `==`, or `=`, found `;`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-17904.stderr b/src/test/ui/parser/issues/issue-17904.stderr
new file mode 100644 (file)
index 0000000..a3cac67
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `:`, `==`, or `=`, found `;`
+  --> $DIR/issue-17904.rs:4:33
+   |
+LL | struct Foo<T> where T: Copy, (T);
+   |                                 ^ expected one of `:`, `==`, or `=`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-1802-1.rs b/src/test/ui/parser/issues/issue-1802-1.rs
new file mode 100644 (file)
index 0000000..3c34b0d
--- /dev/null
@@ -0,0 +1,7 @@
+fn log(a: i32, b: i32) {}
+
+fn main() {
+    let error = 42;
+    log(error, 0b);
+    //~^ ERROR no valid digits found for number
+}
diff --git a/src/test/ui/parser/issues/issue-1802-1.stderr b/src/test/ui/parser/issues/issue-1802-1.stderr
new file mode 100644 (file)
index 0000000..954cc0b
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0768]: no valid digits found for number
+  --> $DIR/issue-1802-1.rs:5:16
+   |
+LL |     log(error, 0b);
+   |                ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0768`.
diff --git a/src/test/ui/parser/issues/issue-1802-2.rs b/src/test/ui/parser/issues/issue-1802-2.rs
new file mode 100644 (file)
index 0000000..3c34b0d
--- /dev/null
@@ -0,0 +1,7 @@
+fn log(a: i32, b: i32) {}
+
+fn main() {
+    let error = 42;
+    log(error, 0b);
+    //~^ ERROR no valid digits found for number
+}
diff --git a/src/test/ui/parser/issues/issue-1802-2.stderr b/src/test/ui/parser/issues/issue-1802-2.stderr
new file mode 100644 (file)
index 0000000..49043d0
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0768]: no valid digits found for number
+  --> $DIR/issue-1802-2.rs:5:16
+   |
+LL |     log(error, 0b);
+   |                ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0768`.
diff --git a/src/test/ui/parser/issues/issue-19096.rs b/src/test/ui/parser/issues/issue-19096.rs
new file mode 100644 (file)
index 0000000..c5bfd10
--- /dev/null
@@ -0,0 +1,10 @@
+fn main() { // we don't complain about the return type being `{integer}`
+    let t = (42, 42);
+    t.0::<isize>; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::`
+}
+
+fn foo() -> usize { // we don't complain about the return type being unit
+    let t = (42, 42);
+    t.0::<isize>; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::`
+    42;
+}
diff --git a/src/test/ui/parser/issues/issue-19096.stderr b/src/test/ui/parser/issues/issue-19096.stderr
new file mode 100644 (file)
index 0000000..4df7f87
--- /dev/null
@@ -0,0 +1,14 @@
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `::`
+  --> $DIR/issue-19096.rs:3:8
+   |
+LL |     t.0::<isize>;
+   |        ^^ expected one of `.`, `;`, `?`, `}`, or an operator
+
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `::`
+  --> $DIR/issue-19096.rs:8:8
+   |
+LL |     t.0::<isize>;
+   |        ^^ expected one of `.`, `;`, `?`, `}`, or an operator
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-19398.rs b/src/test/ui/parser/issues/issue-19398.rs
new file mode 100644 (file)
index 0000000..46eb320
--- /dev/null
@@ -0,0 +1,6 @@
+trait T {
+    extern "Rust" unsafe fn foo();
+    //~^ ERROR expected `{`, found keyword `unsafe`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-19398.stderr b/src/test/ui/parser/issues/issue-19398.stderr
new file mode 100644 (file)
index 0000000..1da0096
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected `{`, found keyword `unsafe`
+  --> $DIR/issue-19398.rs:2:19
+   |
+LL | trait T {
+   |         - while parsing this item list starting here
+LL |     extern "Rust" unsafe fn foo();
+   |                   ^^^^^^ expected `{`
+LL |
+LL | }
+   | - the item list ends here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20616-1.rs b/src/test/ui/parser/issues/issue-20616-1.rs
new file mode 100644 (file)
index 0000000..49e9cb3
--- /dev/null
@@ -0,0 +1,36 @@
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+type Type_1<'a T> = &'a T; //~ error: expected one of `,`, `:`, or `>`, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issues/issue-20616-1.stderr b/src/test/ui/parser/issues/issue-20616-1.stderr
new file mode 100644 (file)
index 0000000..8160462
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `,`, `:`, or `>`, found `T`
+  --> $DIR/issue-20616-1.rs:9:16
+   |
+LL | type Type_1<'a T> = &'a T;
+   |                ^ expected one of `,`, `:`, or `>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20616-2.rs b/src/test/ui/parser/issues/issue-20616-2.rs
new file mode 100644 (file)
index 0000000..f108ae5
--- /dev/null
@@ -0,0 +1,36 @@
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,`, `:`, `=`, or `>`, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issues/issue-20616-2.stderr b/src/test/ui/parser/issues/issue-20616-2.stderr
new file mode 100644 (file)
index 0000000..01e3d3d
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `,`, `:`, `=`, or `>`, found `(`
+  --> $DIR/issue-20616-2.rs:12:31
+   |
+LL | type Type_2 = Type_1_<'static ()>;
+   |                               ^ expected one of `,`, `:`, `=`, or `>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20616-3.rs b/src/test/ui/parser/issues/issue-20616-3.rs
new file mode 100644 (file)
index 0000000..b237105
--- /dev/null
@@ -0,0 +1,35 @@
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+type Type_3<T> = Box<T,,>;
+//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issues/issue-20616-3.stderr b/src/test/ui/parser/issues/issue-20616-3.stderr
new file mode 100644 (file)
index 0000000..b535c7a
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `>`, a const expression, lifetime, or type, found `,`
+  --> $DIR/issue-20616-3.rs:13:24
+   |
+LL | type Type_3<T> = Box<T,,>;
+   |                        ^ expected one of `>`, a const expression, lifetime, or type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20616-4.rs b/src/test/ui/parser/issues/issue-20616-4.rs
new file mode 100644 (file)
index 0000000..a71f47c
--- /dev/null
@@ -0,0 +1,35 @@
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+type Type_4<T> = Type_1_<'static,, T>;
+//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issues/issue-20616-4.stderr b/src/test/ui/parser/issues/issue-20616-4.stderr
new file mode 100644 (file)
index 0000000..2b3b75f
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `>`, a const expression, lifetime, or type, found `,`
+  --> $DIR/issue-20616-4.rs:16:34
+   |
+LL | type Type_4<T> = Type_1_<'static,, T>;
+   |                                  ^ expected one of `>`, a const expression, lifetime, or type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20616-5.rs b/src/test/ui/parser/issues/issue-20616-5.rs
new file mode 100644 (file)
index 0000000..b96d09d
--- /dev/null
@@ -0,0 +1,35 @@
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+type Type_5<'a> = Type_1_<'a, (),,>;
+//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issues/issue-20616-5.stderr b/src/test/ui/parser/issues/issue-20616-5.stderr
new file mode 100644 (file)
index 0000000..1ec1dbd
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `>`, a const expression, lifetime, or type, found `,`
+  --> $DIR/issue-20616-5.rs:22:34
+   |
+LL | type Type_5<'a> = Type_1_<'a, (),,>;
+   |                                  ^ expected one of `>`, a const expression, lifetime, or type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20616-6.rs b/src/test/ui/parser/issues/issue-20616-6.rs
new file mode 100644 (file)
index 0000000..a2c45ec
--- /dev/null
@@ -0,0 +1,35 @@
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+type Type_6 = Type_5_<'a,,>;
+//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issues/issue-20616-6.stderr b/src/test/ui/parser/issues/issue-20616-6.stderr
new file mode 100644 (file)
index 0000000..7401abd
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `>`, a const expression, lifetime, or type, found `,`
+  --> $DIR/issue-20616-6.rs:25:26
+   |
+LL | type Type_6 = Type_5_<'a,,>;
+   |                          ^ expected one of `>`, a const expression, lifetime, or type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20616-7.rs b/src/test/ui/parser/issues/issue-20616-7.rs
new file mode 100644 (file)
index 0000000..67209c0
--- /dev/null
@@ -0,0 +1,35 @@
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+type Type_7 = Box<(),,>;
+//~^ error: expected one of `>`, a const expression, lifetime, or type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
diff --git a/src/test/ui/parser/issues/issue-20616-7.stderr b/src/test/ui/parser/issues/issue-20616-7.stderr
new file mode 100644 (file)
index 0000000..e2c3efe
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `>`, a const expression, lifetime, or type, found `,`
+  --> $DIR/issue-20616-7.rs:28:22
+   |
+LL | type Type_7 = Box<(),,>;
+   |                      ^ expected one of `>`, a const expression, lifetime, or type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20616-8.rs b/src/test/ui/parser/issues/issue-20616-8.rs
new file mode 100644 (file)
index 0000000..3ceb58d
--- /dev/null
@@ -0,0 +1,35 @@
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+type Type_8<'a,,> = &'a ();
+//~^ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected identifier, found `,`
diff --git a/src/test/ui/parser/issues/issue-20616-8.stderr b/src/test/ui/parser/issues/issue-20616-8.stderr
new file mode 100644 (file)
index 0000000..e9f37e5
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
+  --> $DIR/issue-20616-8.rs:31:16
+   |
+LL | type Type_8<'a,,> = &'a ();
+   |                ^ expected one of `#`, `>`, `const`, identifier, or lifetime
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20616-9.rs b/src/test/ui/parser/issues/issue-20616-9.rs
new file mode 100644 (file)
index 0000000..7f84284
--- /dev/null
@@ -0,0 +1,35 @@
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected identifier, found `,`
+
+
+type Type_9<T,,> = Box<T>;
+//~^ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
diff --git a/src/test/ui/parser/issues/issue-20616-9.stderr b/src/test/ui/parser/issues/issue-20616-9.stderr
new file mode 100644 (file)
index 0000000..dc309d1
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,`
+  --> $DIR/issue-20616-9.rs:34:15
+   |
+LL | type Type_9<T,,> = Box<T>;
+   |               ^ expected one of `#`, `>`, `const`, identifier, or lifetime
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20711-2.rs b/src/test/ui/parser/issues/issue-20711-2.rs
new file mode 100644 (file)
index 0000000..168c7e7
--- /dev/null
@@ -0,0 +1,10 @@
+struct Foo;
+
+impl Foo {
+    fn foo() {}
+
+    #[stable(feature = "rust1", since = "1.0.0")]
+    //~^ ERROR expected item after attributes
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-20711-2.stderr b/src/test/ui/parser/issues/issue-20711-2.stderr
new file mode 100644 (file)
index 0000000..12b18bb
--- /dev/null
@@ -0,0 +1,14 @@
+error: expected item after attributes
+  --> $DIR/issue-20711-2.rs:6:5
+   |
+LL | impl Foo {
+   |          - while parsing this item list starting here
+...
+LL |     #[stable(feature = "rust1", since = "1.0.0")]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | }
+   | - the item list ends here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-20711.rs b/src/test/ui/parser/issues/issue-20711.rs
new file mode 100644 (file)
index 0000000..020bb79
--- /dev/null
@@ -0,0 +1,8 @@
+struct Foo;
+
+impl Foo {
+    #[stable(feature = "rust1", since = "1.0.0")]
+    //~^ ERROR expected item after attributes
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-20711.stderr b/src/test/ui/parser/issues/issue-20711.stderr
new file mode 100644 (file)
index 0000000..4af4b22
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected item after attributes
+  --> $DIR/issue-20711.rs:4:5
+   |
+LL | impl Foo {
+   |          - while parsing this item list starting here
+LL |     #[stable(feature = "rust1", since = "1.0.0")]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | }
+   | - the item list ends here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-21146.rs b/src/test/ui/parser/issues/issue-21146.rs
new file mode 100644 (file)
index 0000000..19eaffc
--- /dev/null
@@ -0,0 +1,3 @@
+// error-pattern: expected one of `!` or `::`, found `<eof>`
+include!("auxiliary/issue-21146-inc.rs");
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-21146.stderr b/src/test/ui/parser/issues/issue-21146.stderr
new file mode 100644 (file)
index 0000000..c71fda3
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `!` or `::`, found `<eof>`
+  --> $DIR/auxiliary/issue-21146-inc.rs:3:1
+   |
+LL | parse_error
+   | ^^^^^^^^^^^ expected one of `!` or `::`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-21153.rs b/src/test/ui/parser/issues/issue-21153.rs
new file mode 100644 (file)
index 0000000..bf5fdb1
--- /dev/null
@@ -0,0 +1,6 @@
+trait MyTrait<T>: Iterator {
+    Item = T;
+    //~^ ERROR expected one of `!` or `::`, found `=`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-21153.stderr b/src/test/ui/parser/issues/issue-21153.stderr
new file mode 100644 (file)
index 0000000..cbfa9de
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected one of `!` or `::`, found `=`
+  --> $DIR/issue-21153.rs:2:10
+   |
+LL | trait MyTrait<T>: Iterator {
+   |                            - while parsing this item list starting here
+LL |     Item = T;
+   |          ^ expected one of `!` or `::`
+LL |
+LL | }
+   | - the item list ends here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-21475.rs b/src/test/ui/parser/issues/issue-21475.rs
new file mode 100644 (file)
index 0000000..b028fca
--- /dev/null
@@ -0,0 +1,19 @@
+// run-pass
+#![allow(unused_imports, overlapping_range_endpoints)]
+// pretty-expanded FIXME #23616
+
+use m::{START, END};
+
+fn main() {
+    match 42 {
+        m::START..=m::END => {},
+        0..=m::END => {},
+        m::START..=59 => {},
+        _  => {},
+    }
+}
+
+mod m {
+  pub const START: u32 = 4;
+  pub const END:   u32 = 14;
+}
diff --git a/src/test/ui/parser/issues/issue-22647.rs b/src/test/ui/parser/issues/issue-22647.rs
new file mode 100644 (file)
index 0000000..a686141
--- /dev/null
@@ -0,0 +1,15 @@
+fn main() {
+    let caller<F> = |f: F|  //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+    where F: Fn() -> i32
+    {
+        let x = f();
+        println!("Y {}",x);
+        return x;
+    };
+
+    caller(bar_handler);
+}
+
+fn bar_handler() -> i32 {
+    5
+}
diff --git a/src/test/ui/parser/issues/issue-22647.stderr b/src/test/ui/parser/issues/issue-22647.stderr
new file mode 100644 (file)
index 0000000..89b454d
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+  --> $DIR/issue-22647.rs:2:15
+   |
+LL |     let caller<F> = |f: F|
+   |               ^ expected one of `:`, `;`, `=`, `@`, or `|`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-22712.rs b/src/test/ui/parser/issues/issue-22712.rs
new file mode 100644 (file)
index 0000000..774de9c
--- /dev/null
@@ -0,0 +1,9 @@
+struct Foo<B> {
+    buffer: B
+}
+
+fn bar() {
+    let Foo<Vec<u8>>  //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-22712.stderr b/src/test/ui/parser/issues/issue-22712.stderr
new file mode 100644 (file)
index 0000000..30fabac
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+  --> $DIR/issue-22712.rs:6:12
+   |
+LL |     let Foo<Vec<u8>>
+   |            ^ expected one of `:`, `;`, `=`, `@`, or `|`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-2354-1.rs b/src/test/ui/parser/issues/issue-2354-1.rs
new file mode 100644 (file)
index 0000000..996cf1b
--- /dev/null
@@ -0,0 +1 @@
+static foo: isize = 2; } //~ ERROR unexpected closing delimiter:
diff --git a/src/test/ui/parser/issues/issue-2354-1.stderr b/src/test/ui/parser/issues/issue-2354-1.stderr
new file mode 100644 (file)
index 0000000..7ea0f2a
--- /dev/null
@@ -0,0 +1,8 @@
+error: unexpected closing delimiter: `}`
+  --> $DIR/issue-2354-1.rs:1:24
+   |
+LL | static foo: isize = 2; }
+   |                        ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-2354.rs b/src/test/ui/parser/issues/issue-2354.rs
new file mode 100644 (file)
index 0000000..c422040
--- /dev/null
@@ -0,0 +1,15 @@
+fn foo() { //~ NOTE unclosed delimiter
+  match Some(10) {
+  //~^ NOTE this delimiter might not be properly closed...
+      Some(y) => { panic!(); }
+      None => { panic!(); }
+}
+//~^ NOTE ...as it matches this but it has different indentation
+
+fn bar() {
+    let mut i = 0;
+    while (i < 1000) {}
+}
+
+fn main() {}
+//~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/issues/issue-2354.stderr b/src/test/ui/parser/issues/issue-2354.stderr
new file mode 100644 (file)
index 0000000..b89ed39
--- /dev/null
@@ -0,0 +1,16 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-2354.rs:15:52
+   |
+LL | fn foo() {
+   |          - unclosed delimiter
+LL |   match Some(10) {
+   |                  - this delimiter might not be properly closed...
+...
+LL | }
+   | - ...as it matches this but it has different indentation
+...
+LL |
+   |                                                    ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-23620-invalid-escapes.rs b/src/test/ui/parser/issues/issue-23620-invalid-escapes.rs
new file mode 100644 (file)
index 0000000..c1355f0
--- /dev/null
@@ -0,0 +1,34 @@
+fn main() {
+    let _ = b"\u{a66e}";
+    //~^ ERROR unicode escape in byte string
+
+    let _ = b'\u{a66e}';
+    //~^ ERROR unicode escape in byte string
+
+    let _ = b'\u';
+    //~^ ERROR incorrect unicode escape sequence
+
+    let _ = b'\x5';
+    //~^ ERROR numeric character escape is too short
+
+    let _ = b'\xxy';
+    //~^ ERROR invalid character in numeric character escape: `x`
+
+    let _ = '\x5';
+    //~^ ERROR numeric character escape is too short
+
+    let _ = '\xxy';
+    //~^ ERROR invalid character in numeric character escape: `x`
+
+    let _ = b"\u{a4a4} \xf \u";
+    //~^ ERROR unicode escape in byte string
+    //~^^ ERROR invalid character in numeric character escape: ` `
+    //~^^^ ERROR incorrect unicode escape sequence
+
+    let _ = "\xf \u";
+    //~^ ERROR invalid character in numeric character escape: ` `
+    //~^^ ERROR incorrect unicode escape sequence
+
+    let _ = "\u8f";
+    //~^ ERROR incorrect unicode escape sequence
+}
diff --git a/src/test/ui/parser/issues/issue-23620-invalid-escapes.stderr b/src/test/ui/parser/issues/issue-23620-invalid-escapes.stderr
new file mode 100644 (file)
index 0000000..88d97c7
--- /dev/null
@@ -0,0 +1,94 @@
+error: unicode escape in byte string
+  --> $DIR/issue-23620-invalid-escapes.rs:2:15
+   |
+LL |     let _ = b"\u{a66e}";
+   |               ^^^^^^^^ unicode escape in byte string
+   |
+   = help: unicode escape sequences cannot be used as a byte or in a byte string
+
+error: unicode escape in byte string
+  --> $DIR/issue-23620-invalid-escapes.rs:5:15
+   |
+LL |     let _ = b'\u{a66e}';
+   |               ^^^^^^^^ unicode escape in byte string
+   |
+   = help: unicode escape sequences cannot be used as a byte or in a byte string
+
+error: incorrect unicode escape sequence
+  --> $DIR/issue-23620-invalid-escapes.rs:8:15
+   |
+LL |     let _ = b'\u';
+   |               ^^ incorrect unicode escape sequence
+   |
+   = help: format of unicode escape sequences is `\u{...}`
+
+error: numeric character escape is too short
+  --> $DIR/issue-23620-invalid-escapes.rs:11:15
+   |
+LL |     let _ = b'\x5';
+   |               ^^^
+
+error: invalid character in numeric character escape: `x`
+  --> $DIR/issue-23620-invalid-escapes.rs:14:17
+   |
+LL |     let _ = b'\xxy';
+   |                 ^ invalid character in numeric character escape
+
+error: numeric character escape is too short
+  --> $DIR/issue-23620-invalid-escapes.rs:17:14
+   |
+LL |     let _ = '\x5';
+   |              ^^^
+
+error: invalid character in numeric character escape: `x`
+  --> $DIR/issue-23620-invalid-escapes.rs:20:16
+   |
+LL |     let _ = '\xxy';
+   |                ^ invalid character in numeric character escape
+
+error: unicode escape in byte string
+  --> $DIR/issue-23620-invalid-escapes.rs:23:15
+   |
+LL |     let _ = b"\u{a4a4} \xf \u";
+   |               ^^^^^^^^ unicode escape in byte string
+   |
+   = help: unicode escape sequences cannot be used as a byte or in a byte string
+
+error: invalid character in numeric character escape: ` `
+  --> $DIR/issue-23620-invalid-escapes.rs:23:27
+   |
+LL |     let _ = b"\u{a4a4} \xf \u";
+   |                           ^ invalid character in numeric character escape
+
+error: incorrect unicode escape sequence
+  --> $DIR/issue-23620-invalid-escapes.rs:23:28
+   |
+LL |     let _ = b"\u{a4a4} \xf \u";
+   |                            ^^ incorrect unicode escape sequence
+   |
+   = help: format of unicode escape sequences is `\u{...}`
+
+error: invalid character in numeric character escape: ` `
+  --> $DIR/issue-23620-invalid-escapes.rs:28:17
+   |
+LL |     let _ = "\xf \u";
+   |                 ^ invalid character in numeric character escape
+
+error: incorrect unicode escape sequence
+  --> $DIR/issue-23620-invalid-escapes.rs:28:18
+   |
+LL |     let _ = "\xf \u";
+   |                  ^^ incorrect unicode escape sequence
+   |
+   = help: format of unicode escape sequences is `\u{...}`
+
+error: incorrect unicode escape sequence
+  --> $DIR/issue-23620-invalid-escapes.rs:32:14
+   |
+LL |     let _ = "\u8f";
+   |              ^^^-
+   |              |
+   |              help: format of unicode escape sequences uses braces: `\u{8f}`
+
+error: aborting due to 13 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-24197.rs b/src/test/ui/parser/issues/issue-24197.rs
new file mode 100644 (file)
index 0000000..aaf5137
--- /dev/null
@@ -0,0 +1,3 @@
+fn main() {
+    let buf[0] = 0; //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
+}
diff --git a/src/test/ui/parser/issues/issue-24197.stderr b/src/test/ui/parser/issues/issue-24197.stderr
new file mode 100644 (file)
index 0000000..fd7015c
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[`
+  --> $DIR/issue-24197.rs:2:12
+   |
+LL |     let buf[0] = 0;
+   |            ^ expected one of `:`, `;`, `=`, `@`, or `|`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-24375.rs b/src/test/ui/parser/issues/issue-24375.rs
new file mode 100644 (file)
index 0000000..1d128d3
--- /dev/null
@@ -0,0 +1,9 @@
+static tmp : [&'static str; 2]  = ["hello", "he"];
+
+fn main() {
+    let z = "hello";
+    match z {
+        tmp[0] => {} //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `[`
+        _ => {}
+    }
+}
diff --git a/src/test/ui/parser/issues/issue-24375.stderr b/src/test/ui/parser/issues/issue-24375.stderr
new file mode 100644 (file)
index 0000000..7aed887
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `=>`, `@`, `if`, or `|`, found `[`
+  --> $DIR/issue-24375.rs:6:12
+   |
+LL |         tmp[0] => {}
+   |            ^ expected one of `=>`, `@`, `if`, or `|`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-24780.rs b/src/test/ui/parser/issues/issue-24780.rs
new file mode 100644 (file)
index 0000000..480d9bc
--- /dev/null
@@ -0,0 +1,9 @@
+// Verify that '>' is not both expected and found at the same time, as it used
+// to happen in #24780. For example, following should be an error:
+// expected one of ..., `>`, ... found `>`.
+
+fn foo() -> Vec<usize>> { //~ ERROR expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>`
+    Vec::new()
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-24780.stderr b/src/test/ui/parser/issues/issue-24780.stderr
new file mode 100644 (file)
index 0000000..bdd089b
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>`
+  --> $DIR/issue-24780.rs:5:23
+   |
+LL | fn foo() -> Vec<usize>> {
+   |                       ^ expected one of `!`, `+`, `::`, `;`, `where`, or `{`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-27255.rs b/src/test/ui/parser/issues/issue-27255.rs
new file mode 100644 (file)
index 0000000..d619688
--- /dev/null
@@ -0,0 +1,10 @@
+trait A {}
+
+impl A .. {}
+//~^ ERROR missing `for` in a trait impl
+//~| ERROR `impl Trait for .. {}` is an obsolete syntax
+
+impl A      usize {}
+//~^ ERROR missing `for` in a trait impl
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-27255.stderr b/src/test/ui/parser/issues/issue-27255.stderr
new file mode 100644 (file)
index 0000000..391a235
--- /dev/null
@@ -0,0 +1,22 @@
+error: missing `for` in a trait impl
+  --> $DIR/issue-27255.rs:3:7
+   |
+LL | impl A .. {}
+   |       ^ help: add `for` here
+
+error: missing `for` in a trait impl
+  --> $DIR/issue-27255.rs:7:7
+   |
+LL | impl A      usize {}
+   |       ^^^^^^ help: add `for` here
+
+error: `impl Trait for .. {}` is an obsolete syntax
+  --> $DIR/issue-27255.rs:3:1
+   |
+LL | impl A .. {}
+   | ^^^^^^^^^^^^
+   |
+   = help: use `auto trait Trait {}` instead
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-30318.fixed b/src/test/ui/parser/issues/issue-30318.fixed
new file mode 100644 (file)
index 0000000..71fc821
--- /dev/null
@@ -0,0 +1,27 @@
+// run-rustfix
+#![allow(unused)]
+fn foo() { }
+
+/// Misplaced comment...
+//~^ ERROR expected outer doc comment
+fn bar() { } //~ NOTE the inner doc comment doesn't annotate this function
+
+#[test] //~ ERROR an inner attribute is not permitted in this context
+fn baz() { } //~ NOTE the inner attribute doesn't annotate this function
+//~^^ NOTE inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually
+
+/** Misplaced comment... */
+//~^ ERROR expected outer doc comment
+fn bat() { } //~ NOTE the inner doc comment doesn't annotate this function
+
+fn main() { }
+
+// Misplaced comment...
+//~^ ERROR expected outer doc comment
+//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
+//~| NOTE other attributes here
+/* Misplaced comment... */
+//~^ ERROR expected outer doc comment
+//~| NOTE this doc comment doesn't document anything
+//~| ERROR expected item after doc comment
+//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
diff --git a/src/test/ui/parser/issues/issue-30318.rs b/src/test/ui/parser/issues/issue-30318.rs
new file mode 100644 (file)
index 0000000..465dca2
--- /dev/null
@@ -0,0 +1,27 @@
+// run-rustfix
+#![allow(unused)]
+fn foo() { }
+
+//! Misplaced comment...
+//~^ ERROR expected outer doc comment
+fn bar() { } //~ NOTE the inner doc comment doesn't annotate this function
+
+#![test] //~ ERROR an inner attribute is not permitted in this context
+fn baz() { } //~ NOTE the inner attribute doesn't annotate this function
+//~^^ NOTE inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually
+
+/*! Misplaced comment... */
+//~^ ERROR expected outer doc comment
+fn bat() { } //~ NOTE the inner doc comment doesn't annotate this function
+
+fn main() { }
+
+//! Misplaced comment...
+//~^ ERROR expected outer doc comment
+//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
+//~| NOTE other attributes here
+/*! Misplaced comment... */
+//~^ ERROR expected outer doc comment
+//~| NOTE this doc comment doesn't document anything
+//~| ERROR expected item after doc comment
+//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
diff --git a/src/test/ui/parser/issues/issue-30318.stderr b/src/test/ui/parser/issues/issue-30318.stderr
new file mode 100644 (file)
index 0000000..7e71088
--- /dev/null
@@ -0,0 +1,81 @@
+error[E0753]: expected outer doc comment
+  --> $DIR/issue-30318.rs:5:1
+   |
+LL | //! Misplaced comment...
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | fn bar() { }
+   | ------------ the inner doc comment doesn't annotate this function
+   |
+help: to annotate the function, change the doc comment from inner to outer style
+   |
+LL | /// Misplaced comment...
+   |   ~
+
+error: an inner attribute is not permitted in this context
+  --> $DIR/issue-30318.rs:9:1
+   |
+LL | #![test]
+   | ^^^^^^^^
+LL | fn baz() { }
+   | ------------ the inner attribute doesn't annotate this function
+   |
+   = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
+help: to annotate the function, change the attribute from inner to outer style
+   |
+LL - #![test]
+LL + #[test]
+   | 
+
+error[E0753]: expected outer doc comment
+  --> $DIR/issue-30318.rs:13:1
+   |
+LL | /*! Misplaced comment... */
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | fn bat() { }
+   | ------------ the inner doc comment doesn't annotate this function
+   |
+help: to annotate the function, change the doc comment from inner to outer style
+   |
+LL | /** Misplaced comment... */
+   |   ~
+
+error[E0753]: expected outer doc comment
+  --> $DIR/issue-30318.rs:19:1
+   |
+LL | //! Misplaced comment...
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
+help: you might have meant to write a regular comment
+   |
+LL - //! Misplaced comment...
+LL + // Misplaced comment...
+   | 
+
+error[E0753]: expected outer doc comment
+  --> $DIR/issue-30318.rs:23:1
+   |
+LL | /*! Misplaced comment... */
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items
+help: you might have meant to write a regular comment
+   |
+LL - /*! Misplaced comment... */
+LL + /* Misplaced comment... */
+   | 
+
+error: expected item after doc comment
+  --> $DIR/issue-30318.rs:23:1
+   |
+LL | //! Misplaced comment...
+   | ------------------------ other attributes here
+...
+LL | /*! Misplaced comment... */
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment doesn't document anything
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0753`.
diff --git a/src/test/ui/parser/issues/issue-3036.fixed b/src/test/ui/parser/issues/issue-3036.fixed
new file mode 100644 (file)
index 0000000..e5d5622
--- /dev/null
@@ -0,0 +1,7 @@
+// run-rustfix
+
+// Testing that semicolon tokens are printed correctly in errors
+
+fn main() {
+    let _x = 3; //~ ERROR: expected `;`
+}
diff --git a/src/test/ui/parser/issues/issue-3036.rs b/src/test/ui/parser/issues/issue-3036.rs
new file mode 100644 (file)
index 0000000..2f76fb9
--- /dev/null
@@ -0,0 +1,7 @@
+// run-rustfix
+
+// Testing that semicolon tokens are printed correctly in errors
+
+fn main() {
+    let _x = 3 //~ ERROR: expected `;`
+}
diff --git a/src/test/ui/parser/issues/issue-3036.stderr b/src/test/ui/parser/issues/issue-3036.stderr
new file mode 100644 (file)
index 0000000..e022239
--- /dev/null
@@ -0,0 +1,10 @@
+error: expected `;`, found `}`
+  --> $DIR/issue-3036.rs:6:15
+   |
+LL |     let _x = 3
+   |               ^ help: add `;` here
+LL | }
+   | - unexpected token
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-31804.rs b/src/test/ui/parser/issues/issue-31804.rs
new file mode 100644 (file)
index 0000000..d056b77
--- /dev/null
@@ -0,0 +1,6 @@
+// Test that error recovery in the parser to an EOF does not give an infinite
+// spew of errors.
+
+fn main() {
+    let
+} //~ ERROR expected pattern, found `}`
diff --git a/src/test/ui/parser/issues/issue-31804.stderr b/src/test/ui/parser/issues/issue-31804.stderr
new file mode 100644 (file)
index 0000000..76e68b0
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected pattern, found `}`
+  --> $DIR/issue-31804.rs:6:1
+   |
+LL | }
+   | ^ expected pattern
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-32214.rs b/src/test/ui/parser/issues/issue-32214.rs
new file mode 100644 (file)
index 0000000..1379eeb
--- /dev/null
@@ -0,0 +1,6 @@
+trait Trait<T> { type Item; }
+
+pub fn test<W, I: Trait<Item=(), W> >() {}
+//~^ ERROR generic arguments must come before the first constraint
+
+fn main() { }
diff --git a/src/test/ui/parser/issues/issue-32214.stderr b/src/test/ui/parser/issues/issue-32214.stderr
new file mode 100644 (file)
index 0000000..d0a9b52
--- /dev/null
@@ -0,0 +1,15 @@
+error: generic arguments must come before the first constraint
+  --> $DIR/issue-32214.rs:3:34
+   |
+LL | pub fn test<W, I: Trait<Item=(), W> >() {}
+   |                         -------  ^ generic argument
+   |                         |
+   |                         constraint
+   |
+help: move the constraint after the generic argument
+   |
+LL | pub fn test<W, I: Trait<W, Item = ()> >() {}
+   |                        ~~~~~~~~~~~~~~
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-32446.rs b/src/test/ui/parser/issues/issue-32446.rs
new file mode 100644 (file)
index 0000000..53e519a
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {}
+
+// This used to end up in an infite loop trying to bump past EOF.
+trait T { ... } //~ ERROR
diff --git a/src/test/ui/parser/issues/issue-32446.stderr b/src/test/ui/parser/issues/issue-32446.stderr
new file mode 100644 (file)
index 0000000..7515369
--- /dev/null
@@ -0,0 +1,11 @@
+error: non-item in item list
+  --> $DIR/issue-32446.rs:4:11
+   |
+LL | trait T { ... }
+   |         - ^^^ - item list ends here
+   |         | |
+   |         | non-item starts here
+   |         item list starts here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-32501.rs b/src/test/ui/parser/issues/issue-32501.rs
new file mode 100644 (file)
index 0000000..5002420
--- /dev/null
@@ -0,0 +1,9 @@
+fn main() {
+    let a = 0;
+    let _b = 0;
+    let _ = 0;
+    let mut b = 0;
+    let mut _b = 0;
+    let mut _ = 0;
+    //~^ ERROR `mut` must be followed by a named binding
+}
diff --git a/src/test/ui/parser/issues/issue-32501.stderr b/src/test/ui/parser/issues/issue-32501.stderr
new file mode 100644 (file)
index 0000000..d533024
--- /dev/null
@@ -0,0 +1,10 @@
+error: `mut` must be followed by a named binding
+  --> $DIR/issue-32501.rs:7:9
+   |
+LL |     let mut _ = 0;
+   |         ^^^^^ help: remove the `mut` prefix: `_`
+   |
+   = note: `mut` may be followed by `variable` and `variable @ pattern`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-32505.rs b/src/test/ui/parser/issues/issue-32505.rs
new file mode 100644 (file)
index 0000000..f31c00e
--- /dev/null
@@ -0,0 +1,5 @@
+pub fn test() {
+    foo(|_|) //~ ERROR expected expression, found `)`
+}
+
+fn main() { }
diff --git a/src/test/ui/parser/issues/issue-32505.stderr b/src/test/ui/parser/issues/issue-32505.stderr
new file mode 100644 (file)
index 0000000..cdd779a
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected expression, found `)`
+  --> $DIR/issue-32505.rs:2:12
+   |
+LL |     foo(|_|)
+   |            ^ expected expression
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-33262.rs b/src/test/ui/parser/issues/issue-33262.rs
new file mode 100644 (file)
index 0000000..3a612f9
--- /dev/null
@@ -0,0 +1,6 @@
+// Issue #33262
+
+pub fn main() {
+    for i in 0..a as { }
+    //~^ ERROR expected type, found `{`
+}
diff --git a/src/test/ui/parser/issues/issue-33262.stderr b/src/test/ui/parser/issues/issue-33262.stderr
new file mode 100644 (file)
index 0000000..2aff328
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected type, found `{`
+  --> $DIR/issue-33262.rs:4:22
+   |
+LL |     for i in 0..a as { }
+   |                      ^ expected type
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-33413.rs b/src/test/ui/parser/issues/issue-33413.rs
new file mode 100644 (file)
index 0000000..7291732
--- /dev/null
@@ -0,0 +1,9 @@
+struct S;
+
+impl S {
+    fn f(*, a: u8) -> u8 {}
+    //~^ ERROR expected parameter name, found `*`
+    //~| ERROR mismatched types
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-33413.stderr b/src/test/ui/parser/issues/issue-33413.stderr
new file mode 100644 (file)
index 0000000..ac320f0
--- /dev/null
@@ -0,0 +1,17 @@
+error: expected parameter name, found `*`
+  --> $DIR/issue-33413.rs:4:10
+   |
+LL |     fn f(*, a: u8) -> u8 {}
+   |          ^ expected parameter name
+
+error[E0308]: mismatched types
+  --> $DIR/issue-33413.rs:4:23
+   |
+LL |     fn f(*, a: u8) -> u8 {}
+   |        -              ^^ expected `u8`, found `()`
+   |        |
+   |        implicitly returns `()` as its body has no tail or `return` expression
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issues/issue-33418.fixed b/src/test/ui/parser/issues/issue-33418.fixed
new file mode 100644 (file)
index 0000000..ed885ae
--- /dev/null
@@ -0,0 +1,19 @@
+// run-rustfix
+
+trait Tr {}
+//~^ ERROR negative bounds are not supported
+trait Tr2: SuperA {}
+//~^ ERROR negative bounds are not supported
+trait Tr3: SuperB {}
+//~^ ERROR negative bounds are not supported
+trait Tr4: SuperB + SuperD {}
+//~^ ERROR negative bounds are not supported
+trait Tr5 {}
+//~^ ERROR negative bounds are not supported
+
+trait SuperA {}
+trait SuperB {}
+trait SuperC {}
+trait SuperD {}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-33418.rs b/src/test/ui/parser/issues/issue-33418.rs
new file mode 100644 (file)
index 0000000..9934284
--- /dev/null
@@ -0,0 +1,21 @@
+// run-rustfix
+
+trait Tr: !SuperA {}
+//~^ ERROR negative bounds are not supported
+trait Tr2: SuperA + !SuperB {}
+//~^ ERROR negative bounds are not supported
+trait Tr3: !SuperA + SuperB {}
+//~^ ERROR negative bounds are not supported
+trait Tr4: !SuperA + SuperB
+    + !SuperC + SuperD {}
+//~^ ERROR negative bounds are not supported
+trait Tr5: !SuperA
+    + !SuperB {}
+//~^ ERROR negative bounds are not supported
+
+trait SuperA {}
+trait SuperB {}
+trait SuperC {}
+trait SuperD {}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-33418.stderr b/src/test/ui/parser/issues/issue-33418.stderr
new file mode 100644 (file)
index 0000000..9a8733e
--- /dev/null
@@ -0,0 +1,36 @@
+error: negative bounds are not supported
+  --> $DIR/issue-33418.rs:3:9
+   |
+LL | trait Tr: !SuperA {}
+   |         ^^^^^^^^^ negative bounds are not supported
+
+error: negative bounds are not supported
+  --> $DIR/issue-33418.rs:5:19
+   |
+LL | trait Tr2: SuperA + !SuperB {}
+   |                   ^^^^^^^^^ negative bounds are not supported
+
+error: negative bounds are not supported
+  --> $DIR/issue-33418.rs:7:10
+   |
+LL | trait Tr3: !SuperA + SuperB {}
+   |          ^^^^^^^^^ negative bounds are not supported
+
+error: negative bounds are not supported
+  --> $DIR/issue-33418.rs:9:10
+   |
+LL | trait Tr4: !SuperA + SuperB
+   |          ^^^^^^^^^
+LL |     + !SuperC + SuperD {}
+   |     ^^^^^^^^^ negative bounds are not supported
+
+error: negative bounds are not supported
+  --> $DIR/issue-33418.rs:12:10
+   |
+LL | trait Tr5: !SuperA
+   |          ^^^^^^^^^
+LL |     + !SuperB {}
+   |     ^^^^^^^^^ negative bounds are not supported
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-33455.rs b/src/test/ui/parser/issues/issue-33455.rs
new file mode 100644 (file)
index 0000000..6dff63f
--- /dev/null
@@ -0,0 +1 @@
+use foo.bar; //~ ERROR expected one of `::`, `;`, or `as`, found `.`
diff --git a/src/test/ui/parser/issues/issue-33455.stderr b/src/test/ui/parser/issues/issue-33455.stderr
new file mode 100644 (file)
index 0000000..c535ef2
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `::`, `;`, or `as`, found `.`
+  --> $DIR/issue-33455.rs:1:8
+   |
+LL | use foo.bar;
+   |        ^ expected one of `::`, `;`, or `as`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-34222-1.rs b/src/test/ui/parser/issues/issue-34222-1.rs
new file mode 100644 (file)
index 0000000..d36dddc
--- /dev/null
@@ -0,0 +1,3 @@
+fn main() {
+    /// comment //~ ERROR found a documentation comment that doesn't document anything
+}
diff --git a/src/test/ui/parser/issues/issue-34222-1.stderr b/src/test/ui/parser/issues/issue-34222-1.stderr
new file mode 100644 (file)
index 0000000..0799656
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0585]: found a documentation comment that doesn't document anything
+  --> $DIR/issue-34222-1.rs:2:5
+   |
+LL |     /// comment
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: doc comments must come before what they document, maybe a comment was intended with `//`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0585`.
diff --git a/src/test/ui/parser/issues/issue-34255-1.rs b/src/test/ui/parser/issues/issue-34255-1.rs
new file mode 100644 (file)
index 0000000..c70cd8b
--- /dev/null
@@ -0,0 +1,10 @@
+enum Test {
+    Drill {
+        field: i32,
+    }
+}
+
+fn main() {
+    Test::Drill(field: 42);
+    //~^ ERROR invalid `struct` delimiters or `fn` call arguments
+}
diff --git a/src/test/ui/parser/issues/issue-34255-1.stderr b/src/test/ui/parser/issues/issue-34255-1.stderr
new file mode 100644 (file)
index 0000000..fbff75e
--- /dev/null
@@ -0,0 +1,18 @@
+error: invalid `struct` delimiters or `fn` call arguments
+  --> $DIR/issue-34255-1.rs:8:5
+   |
+LL |     Test::Drill(field: 42);
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: if `Test::Drill` is a struct, use braces as delimiters
+   |
+LL |     Test::Drill { field: 42 };
+   |                 ~           ~
+help: if `Test::Drill` is a function, use the arguments directly
+   |
+LL -     Test::Drill(field: 42);
+LL +     Test::Drill(42);
+   | 
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.rs b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.rs
new file mode 100644 (file)
index 0000000..e725aa5
--- /dev/null
@@ -0,0 +1,171 @@
+// edition:2018
+#![crate_type = "lib"]
+#![feature(type_ascription)]
+use std::future::Future;
+use std::pin::Pin;
+
+// This tests the parser for "x as Y[z]". It errors, but we want to give useful
+// errors and parse such that further code gives useful errors.
+pub fn index_after_as_cast() {
+    vec![1, 2, 3] as Vec<i32>[0];
+    //~^ ERROR: casts cannot be followed by indexing
+    vec![1, 2, 3]: Vec<i32>[0];
+    //~^ ERROR: casts cannot be followed by indexing
+}
+
+pub fn index_after_cast_to_index() {
+    (&[0]) as &[i32][0];
+    //~^ ERROR: casts cannot be followed by indexing
+    (&[0i32]): &[i32; 1][0];
+    //~^ ERROR: casts cannot be followed by indexing
+}
+
+pub fn cast_after_cast() {
+    if 5u64 as i32 as u16 == 0u16 {
+
+    }
+    if 5u64: u64: u64 == 0u64 {
+
+    }
+    let _ = 5u64: u64: u64 as u8 as i8 == 9i8;
+    let _ = 0i32: i32: i32;
+    let _ = 0 as i32: i32;
+    let _ = 0i32: i32 as i32;
+    let _ = 0 as i32 as i32;
+    let _ = 0i32: i32: i32 as u32 as i32;
+}
+
+pub fn cast_cast_method_call() {
+    let _ = 0i32: i32: i32.count_ones();
+    //~^ ERROR: casts cannot be followed by a method call
+    let _ = 0 as i32: i32.count_ones();
+    //~^ ERROR: casts cannot be followed by a method call
+    let _ = 0i32: i32 as i32.count_ones();
+    //~^ ERROR: casts cannot be followed by a method call
+    let _ = 0 as i32 as i32.count_ones();
+    //~^ ERROR: casts cannot be followed by a method call
+    let _ = 0i32: i32: i32 as u32 as i32.count_ones();
+    //~^ ERROR: casts cannot be followed by a method call
+    let _ = 0i32: i32.count_ones(): u32;
+    //~^ ERROR: casts cannot be followed by a method call
+    let _ = 0 as i32.count_ones(): u32;
+    //~^ ERROR: casts cannot be followed by a method call
+    let _ = 0i32: i32.count_ones() as u32;
+    //~^ ERROR: casts cannot be followed by a method call
+    let _ = 0 as i32.count_ones() as u32;
+    //~^ ERROR: casts cannot be followed by a method call
+    let _ = 0i32: i32: i32.count_ones() as u32 as i32;
+    //~^ ERROR: casts cannot be followed by a method call
+}
+
+pub fn multiline_error() {
+    let _ = 0
+        as i32
+        .count_ones();
+    //~^^^ ERROR: casts cannot be followed by a method call
+}
+
+// this tests that the precedence for `!x as Y.Z` is still what we expect
+pub fn precedence() {
+    let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0];
+    //~^ ERROR: casts cannot be followed by indexing
+}
+
+pub fn method_calls() {
+    0 as i32.max(0);
+    //~^ ERROR: casts cannot be followed by a method call
+    0: i32.max(0);
+    //~^ ERROR: casts cannot be followed by a method call
+}
+
+pub fn complex() {
+    let _ = format!(
+        "{} and {}",
+        if true { 33 } else { 44 } as i32.max(0),
+        //~^ ERROR: casts cannot be followed by a method call
+        if true { 33 } else { 44 }: i32.max(0)
+        //~^ ERROR: casts cannot be followed by a method call
+    );
+}
+
+pub fn in_condition() {
+    if 5u64 as i32.max(0) == 0 {
+        //~^ ERROR: casts cannot be followed by a method call
+    }
+    if 5u64: u64.max(0) == 0 {
+        //~^ ERROR: casts cannot be followed by a method call
+    }
+}
+
+pub fn inside_block() {
+    let _ = if true {
+        5u64 as u32.max(0) == 0
+        //~^ ERROR: casts cannot be followed by a method call
+    } else { false };
+    let _ = if true {
+        5u64: u64.max(0) == 0
+        //~^ ERROR: casts cannot be followed by a method call
+    } else { false };
+}
+
+static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]);
+//~^ ERROR: casts cannot be followed by indexing
+
+static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
+//~^ ERROR: casts cannot be followed by indexing
+
+
+pub fn cast_then_try() -> Result<u64,u64> {
+    Err(0u64) as Result<u64,u64>?;
+    //~^ ERROR: casts cannot be followed by ?
+    Err(0u64): Result<u64,u64>?;
+    //~^ ERROR: casts cannot be followed by ?
+    Ok(1)
+}
+
+
+pub fn cast_then_call() {
+    type F = fn(u8);
+    // type ascription won't actually do [unique drop fn type] -> fn(u8) casts.
+    let drop_ptr = drop as fn(u8);
+    drop as F();
+    //~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214]
+    drop_ptr: F();
+    //~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214]
+}
+
+pub fn cast_to_fn_should_work() {
+    let drop_ptr = drop as fn(u8);
+    drop as fn(u8);
+    drop_ptr: fn(u8);
+}
+
+pub fn parens_after_cast_error() {
+    let drop_ptr = drop as fn(u8);
+    drop as fn(u8)(0);
+    //~^ ERROR: casts cannot be followed by a function call
+    drop_ptr: fn(u8)(0);
+    //~^ ERROR: casts cannot be followed by a function call
+}
+
+pub async fn cast_then_await() {
+    Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await;
+    //~^ ERROR: casts cannot be followed by `.await`
+
+    Box::pin(noop()): Pin<Box<_>>.await;
+    //~^ ERROR: casts cannot be followed by `.await`
+}
+
+pub async fn noop() {}
+
+#[derive(Default)]
+pub struct Foo {
+    pub bar: u32,
+}
+
+pub fn struct_field() {
+    Foo::default() as Foo.bar;
+    //~^ ERROR: cannot be followed by a field access
+    Foo::default(): Foo.bar;
+    //~^ ERROR: cannot be followed by a field access
+}
diff --git a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr
new file mode 100644 (file)
index 0000000..19b6855
--- /dev/null
@@ -0,0 +1,392 @@
+error: casts cannot be followed by indexing
+  --> $DIR/issue-35813-postfix-after-cast.rs:10:5
+   |
+LL |     vec![1, 2, 3] as Vec<i32>[0];
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (vec![1, 2, 3] as Vec<i32>)[0];
+   |     +                         +
+
+error: casts cannot be followed by indexing
+  --> $DIR/issue-35813-postfix-after-cast.rs:12:5
+   |
+LL |     vec![1, 2, 3]: Vec<i32>[0];
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (vec![1, 2, 3]: Vec<i32>)[0];
+   |     +                       +
+
+error: casts cannot be followed by indexing
+  --> $DIR/issue-35813-postfix-after-cast.rs:17:5
+   |
+LL |     (&[0]) as &[i32][0];
+   |     ^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     ((&[0]) as &[i32])[0];
+   |     +                +
+
+error: casts cannot be followed by indexing
+  --> $DIR/issue-35813-postfix-after-cast.rs:19:5
+   |
+LL |     (&[0i32]): &[i32; 1][0];
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     ((&[0i32]): &[i32; 1])[0];
+   |     +                    +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:39:13
+   |
+LL |     let _ = 0i32: i32: i32.count_ones();
+   |             ^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0i32: i32: i32).count_ones();
+   |             +              +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:41:13
+   |
+LL |     let _ = 0 as i32: i32.count_ones();
+   |             ^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0 as i32: i32).count_ones();
+   |             +             +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:43:13
+   |
+LL |     let _ = 0i32: i32 as i32.count_ones();
+   |             ^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0i32: i32 as i32).count_ones();
+   |             +                +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:45:13
+   |
+LL |     let _ = 0 as i32 as i32.count_ones();
+   |             ^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0 as i32 as i32).count_ones();
+   |             +               +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:47:13
+   |
+LL |     let _ = 0i32: i32: i32 as u32 as i32.count_ones();
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0i32: i32: i32 as u32 as i32).count_ones();
+   |             +                            +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:49:13
+   |
+LL |     let _ = 0i32: i32.count_ones(): u32;
+   |             ^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0i32: i32).count_ones(): u32;
+   |             +         +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:51:13
+   |
+LL |     let _ = 0 as i32.count_ones(): u32;
+   |             ^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0 as i32).count_ones(): u32;
+   |             +        +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:53:13
+   |
+LL |     let _ = 0i32: i32.count_ones() as u32;
+   |             ^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0i32: i32).count_ones() as u32;
+   |             +         +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:55:13
+   |
+LL |     let _ = 0 as i32.count_ones() as u32;
+   |             ^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0 as i32).count_ones() as u32;
+   |             +        +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:57:13
+   |
+LL |     let _ = 0i32: i32: i32.count_ones() as u32 as i32;
+   |             ^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let _ = (0i32: i32: i32).count_ones() as u32 as i32;
+   |             +              +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:62:13
+   |
+LL |       let _ = 0
+   |  _____________^
+LL | |         as i32
+   | |______________^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL ~     let _ = (0
+LL ~         as i32)
+   |
+
+error: casts cannot be followed by indexing
+  --> $DIR/issue-35813-postfix-after-cast.rs:70:18
+   |
+LL |     let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0];
+   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     let x: i32 = (&vec![1, 2, 3] as &Vec<i32>)[0];
+   |                  +                           +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:75:5
+   |
+LL |     0 as i32.max(0);
+   |     ^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (0 as i32).max(0);
+   |     +        +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:77:5
+   |
+LL |     0: i32.max(0);
+   |     ^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (0: i32).max(0);
+   |     +      +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:92:8
+   |
+LL |     if 5u64 as i32.max(0) == 0 {
+   |        ^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     if (5u64 as i32).max(0) == 0 {
+   |        +           +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:95:8
+   |
+LL |     if 5u64: u64.max(0) == 0 {
+   |        ^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     if (5u64: u64).max(0) == 0 {
+   |        +         +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:102:9
+   |
+LL |         5u64 as u32.max(0) == 0
+   |         ^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |         (5u64 as u32).max(0) == 0
+   |         +           +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:106:9
+   |
+LL |         5u64: u64.max(0) == 0
+   |         ^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |         (5u64: u64).max(0) == 0
+   |         +         +
+
+error: casts cannot be followed by indexing
+  --> $DIR/issue-35813-postfix-after-cast.rs:111:24
+   |
+LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]);
+   |                        ^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL | static bar: &[i32] = &((&[1,2,3] as &[i32])[0..1]);
+   |                        +                  +
+
+error: casts cannot be followed by indexing
+  --> $DIR/issue-35813-postfix-after-cast.rs:114:25
+   |
+LL | static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
+   |                         ^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL | static bar2: &[i32] = &((&[1i32,2,3]: &[i32; 3])[0..1]);
+   |                         +                      +
+
+error: casts cannot be followed by ?
+  --> $DIR/issue-35813-postfix-after-cast.rs:119:5
+   |
+LL |     Err(0u64) as Result<u64,u64>?;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (Err(0u64) as Result<u64,u64>)?;
+   |     +                            +
+
+error: casts cannot be followed by ?
+  --> $DIR/issue-35813-postfix-after-cast.rs:121:5
+   |
+LL |     Err(0u64): Result<u64,u64>?;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (Err(0u64): Result<u64,u64>)?;
+   |     +                          +
+
+error: casts cannot be followed by a function call
+  --> $DIR/issue-35813-postfix-after-cast.rs:145:5
+   |
+LL |     drop as fn(u8)(0);
+   |     ^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (drop as fn(u8))(0);
+   |     +              +
+
+error: casts cannot be followed by a function call
+  --> $DIR/issue-35813-postfix-after-cast.rs:147:5
+   |
+LL |     drop_ptr: fn(u8)(0);
+   |     ^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (drop_ptr: fn(u8))(0);
+   |     +                +
+
+error: casts cannot be followed by `.await`
+  --> $DIR/issue-35813-postfix-after-cast.rs:152:5
+   |
+LL |     Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>).await;
+   |     +                                                     +
+
+error: casts cannot be followed by `.await`
+  --> $DIR/issue-35813-postfix-after-cast.rs:155:5
+   |
+LL |     Box::pin(noop()): Pin<Box<_>>.await;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (Box::pin(noop()): Pin<Box<_>>).await;
+   |     +                             +
+
+error: casts cannot be followed by a field access
+  --> $DIR/issue-35813-postfix-after-cast.rs:167:5
+   |
+LL |     Foo::default() as Foo.bar;
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (Foo::default() as Foo).bar;
+   |     +                     +
+
+error: casts cannot be followed by a field access
+  --> $DIR/issue-35813-postfix-after-cast.rs:169:5
+   |
+LL |     Foo::default(): Foo.bar;
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |     (Foo::default(): Foo).bar;
+   |     +                   +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:84:9
+   |
+LL |         if true { 33 } else { 44 } as i32.max(0),
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |         (if true { 33 } else { 44 } as i32).max(0),
+   |         +                                 +
+
+error: casts cannot be followed by a method call
+  --> $DIR/issue-35813-postfix-after-cast.rs:86:9
+   |
+LL |         if true { 33 } else { 44 }: i32.max(0)
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try surrounding the expression in parentheses
+   |
+LL |         (if true { 33 } else { 44 }: i32).max(0)
+   |         +                               +
+
+error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
+  --> $DIR/issue-35813-postfix-after-cast.rs:131:13
+   |
+LL |     drop as F();
+   |             ^^^ only `Fn` traits may use parentheses
+
+error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
+  --> $DIR/issue-35813-postfix-after-cast.rs:133:15
+   |
+LL |     drop_ptr: F();
+   |               ^^^ only `Fn` traits may use parentheses
+
+error: aborting due to 36 previous errors
+
+For more information about this error, try `rustc --explain E0214`.
diff --git a/src/test/ui/parser/issues/issue-41155.rs b/src/test/ui/parser/issues/issue-41155.rs
new file mode 100644 (file)
index 0000000..5a7488e
--- /dev/null
@@ -0,0 +1,7 @@
+struct S;
+
+impl S {
+    pub //~ ERROR visibility `pub` is not followed by an item
+} //~ ERROR non-item in item list
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-41155.stderr b/src/test/ui/parser/issues/issue-41155.stderr
new file mode 100644 (file)
index 0000000..8491afa
--- /dev/null
@@ -0,0 +1,22 @@
+error: visibility `pub` is not followed by an item
+  --> $DIR/issue-41155.rs:4:5
+   |
+LL |     pub
+   |     ^^^ the visibility
+   |
+   = help: you likely meant to define an item, e.g., `pub fn foo() {}`
+
+error: non-item in item list
+  --> $DIR/issue-41155.rs:5:1
+   |
+LL | impl S {
+   |        - item list starts here
+LL |     pub
+LL | }
+   | ^
+   | |
+   | non-item starts here
+   | item list ends here
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-43196.rs b/src/test/ui/parser/issues/issue-43196.rs
new file mode 100644 (file)
index 0000000..0eefa01
--- /dev/null
@@ -0,0 +1,6 @@
+fn main() {
+    |
+}
+//~^ ERROR expected `|`, found `}`
+|
+//~^ ERROR expected item, found `|`
diff --git a/src/test/ui/parser/issues/issue-43196.stderr b/src/test/ui/parser/issues/issue-43196.stderr
new file mode 100644 (file)
index 0000000..4f7ed5c
--- /dev/null
@@ -0,0 +1,16 @@
+error: expected `|`, found `}`
+  --> $DIR/issue-43196.rs:3:1
+   |
+LL |     |
+   |      - expected `|`
+LL | }
+   | ^ unexpected token
+
+error: expected item, found `|`
+  --> $DIR/issue-43196.rs:5:1
+   |
+LL | |
+   | ^ expected item
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-43692.rs b/src/test/ui/parser/issues/issue-43692.rs
new file mode 100644 (file)
index 0000000..baf8baf
--- /dev/null
@@ -0,0 +1,3 @@
+fn main() {
+    '\u{_10FFFF}'; //~ ERROR invalid start of unicode escape
+}
diff --git a/src/test/ui/parser/issues/issue-43692.stderr b/src/test/ui/parser/issues/issue-43692.stderr
new file mode 100644 (file)
index 0000000..baf9980
--- /dev/null
@@ -0,0 +1,8 @@
+error: invalid start of unicode escape: `_`
+  --> $DIR/issue-43692.rs:2:9
+   |
+LL |     '\u{_10FFFF}';
+   |         ^ invalid start of unicode escape
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-44021.rs b/src/test/ui/parser/issues/issue-44021.rs
new file mode 100644 (file)
index 0000000..0b9558c
--- /dev/null
@@ -0,0 +1,6 @@
+struct MyStruct;
+impl MyStruct {
+    fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-44021.stderr b/src/test/ui/parser/issues/issue-44021.stderr
new file mode 100644 (file)
index 0000000..b888cd9
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `:`, `@`, or `|`, found `}`
+  --> $DIR/issue-44021.rs:3:18
+   |
+LL |     fn f() {|x, y}
+   |                  ^ expected one of `:`, `@`, or `|`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-44406.rs b/src/test/ui/parser/issues/issue-44406.rs
new file mode 100644 (file)
index 0000000..a5b7e83
--- /dev/null
@@ -0,0 +1,10 @@
+macro_rules! foo {
+    ($rest: tt) => {
+        bar(baz: $rest) //~ ERROR invalid `struct` delimiters or `fn` call arguments
+    }
+}
+
+fn main() {
+    foo!(true);
+    //~^ ERROR expected identifier, found keyword
+}
diff --git a/src/test/ui/parser/issues/issue-44406.stderr b/src/test/ui/parser/issues/issue-44406.stderr
new file mode 100644 (file)
index 0000000..6141904
--- /dev/null
@@ -0,0 +1,33 @@
+error: expected identifier, found keyword `true`
+  --> $DIR/issue-44406.rs:8:10
+   |
+LL |     foo!(true);
+   |          ^^^^ expected identifier, found keyword
+   |
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     foo!(r#true);
+   |          ~~~~~~
+
+error: invalid `struct` delimiters or `fn` call arguments
+  --> $DIR/issue-44406.rs:3:9
+   |
+LL |         bar(baz: $rest)
+   |         ^^^^^^^^^^^^^^^
+...
+LL |     foo!(true);
+   |     ---------- in this macro invocation
+   |
+   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: if `bar` is a struct, use braces as delimiters
+   |
+LL |         bar {  }
+   |             ~
+help: if `bar` is a function, use the arguments directly
+   |
+LL -         bar(baz: $rest)
+LL +         bar(: $rest)
+   | 
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-45296.rs b/src/test/ui/parser/issues/issue-45296.rs
new file mode 100644 (file)
index 0000000..d3a97e8
--- /dev/null
@@ -0,0 +1,6 @@
+fn main() {
+    let unused = ();
+
+    #![allow(unused_variables)] //~ ERROR not permitted in this context
+    fn foo() {}
+}
diff --git a/src/test/ui/parser/issues/issue-45296.stderr b/src/test/ui/parser/issues/issue-45296.stderr
new file mode 100644 (file)
index 0000000..6abe266
--- /dev/null
@@ -0,0 +1,17 @@
+error: an inner attribute is not permitted in this context
+  --> $DIR/issue-45296.rs:4:5
+   |
+LL |     #![allow(unused_variables)]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     fn foo() {}
+   |     ----------- the inner attribute doesn't annotate this function
+   |
+   = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
+help: to annotate the function, change the attribute from inner to outer style
+   |
+LL -     #![allow(unused_variables)]
+LL +     #[allow(unused_variables)]
+   | 
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-46186.fixed b/src/test/ui/parser/issues/issue-46186.fixed
new file mode 100644 (file)
index 0000000..2cb5a49
--- /dev/null
@@ -0,0 +1,8 @@
+// run-rustfix
+
+pub struct Struct {
+    pub a: usize,
+}
+//~^ ERROR expected item, found `;`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-46186.rs b/src/test/ui/parser/issues/issue-46186.rs
new file mode 100644 (file)
index 0000000..84cad38
--- /dev/null
@@ -0,0 +1,8 @@
+// run-rustfix
+
+pub struct Struct {
+    pub a: usize,
+};
+//~^ ERROR expected item, found `;`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-46186.stderr b/src/test/ui/parser/issues/issue-46186.stderr
new file mode 100644 (file)
index 0000000..0766c8a
--- /dev/null
@@ -0,0 +1,10 @@
+error: expected item, found `;`
+  --> $DIR/issue-46186.rs:5:2
+   |
+LL | };
+   |  ^ help: remove this semicolon
+   |
+   = help: braced struct declarations are not followed by a semicolon
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs b/src/test/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs
new file mode 100644 (file)
index 0000000..48a679b
--- /dev/null
@@ -0,0 +1,44 @@
+fn main() {}
+
+macro_rules! expand_to_enum {
+    () => {
+        enum BadE {}
+        //~^ ERROR enum is not supported in `trait`s or `impl`s
+        //~| ERROR enum is not supported in `trait`s or `impl`s
+        //~| ERROR enum is not supported in `extern` blocks
+    };
+}
+
+macro_rules! mac_impl {
+    ($($i:item)*) => {
+        struct S;
+        impl S { $($i)* }
+    }
+}
+
+mac_impl! {
+    struct BadS; //~ ERROR struct is not supported in `trait`s or `impl`s
+    expand_to_enum!();
+}
+
+macro_rules! mac_trait {
+    ($($i:item)*) => {
+        trait T { $($i)* }
+    }
+}
+
+mac_trait! {
+    struct BadS; //~ ERROR struct is not supported in `trait`s or `impl`s
+    expand_to_enum!();
+}
+
+macro_rules! mac_extern {
+    ($($i:item)*) => {
+        extern "C" { $($i)* }
+    }
+}
+
+mac_extern! {
+    struct BadS; //~ ERROR struct is not supported in `extern` blocks
+    expand_to_enum!();
+}
diff --git a/src/test/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr b/src/test/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.stderr
new file mode 100644 (file)
index 0000000..fdef8ff
--- /dev/null
@@ -0,0 +1,62 @@
+error: struct is not supported in `trait`s or `impl`s
+  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:20:5
+   |
+LL |     struct BadS;
+   |     ^^^^^^^^^^^^
+   |
+   = help: consider moving the struct out to a nearby module scope
+
+error: enum is not supported in `trait`s or `impl`s
+  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:5:9
+   |
+LL |         enum BadE {}
+   |         ^^^^^^^^^
+...
+LL |     expand_to_enum!();
+   |     ----------------- in this macro invocation
+   |
+   = help: consider moving the enum out to a nearby module scope
+   = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: struct is not supported in `trait`s or `impl`s
+  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:31:5
+   |
+LL |     struct BadS;
+   |     ^^^^^^^^^^^^
+   |
+   = help: consider moving the struct out to a nearby module scope
+
+error: enum is not supported in `trait`s or `impl`s
+  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:5:9
+   |
+LL |         enum BadE {}
+   |         ^^^^^^^^^
+...
+LL |     expand_to_enum!();
+   |     ----------------- in this macro invocation
+   |
+   = help: consider moving the enum out to a nearby module scope
+   = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: struct is not supported in `extern` blocks
+  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:42:5
+   |
+LL |     struct BadS;
+   |     ^^^^^^^^^^^^
+   |
+   = help: consider moving the struct out to a nearby module scope
+
+error: enum is not supported in `extern` blocks
+  --> $DIR/issue-48137-macros-cannot-interpolate-impl-items-bad-variants.rs:5:9
+   |
+LL |         enum BadE {}
+   |         ^^^^^^^^^
+...
+LL |     expand_to_enum!();
+   |     ----------------- in this macro invocation
+   |
+   = help: consider moving the enum out to a nearby module scope
+   = note: this error originates in the macro `expand_to_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items.rs b/src/test/ui/parser/issues/issue-48137-macros-cannot-interpolate-impl-items.rs
new file mode 100644 (file)
index 0000000..8592f8a
--- /dev/null
@@ -0,0 +1,34 @@
+// check-pass
+
+fn main() {}
+
+macro_rules! mac_impl {
+    ($i:item) => {
+        struct S;
+        impl S { $i }
+    }
+}
+
+mac_impl! {
+    fn foo() {}
+}
+
+macro_rules! mac_trait {
+    ($i:item) => {
+        trait T { $i }
+    }
+}
+
+mac_trait! {
+    fn foo() {}
+}
+
+macro_rules! mac_extern {
+    ($i:item) => {
+        extern "C" { $i }
+    }
+}
+
+mac_extern! {
+    fn foo();
+}
diff --git a/src/test/ui/parser/issues/issue-48508-aux.rs b/src/test/ui/parser/issues/issue-48508-aux.rs
new file mode 100644 (file)
index 0000000..ebdc70a
--- /dev/null
@@ -0,0 +1,7 @@
+// run-pass
+// ignore-test Not a test. Used by issue-48508.rs
+
+pub fn other() -> f64 {
+    let µ = 1.0;
+    µ
+}
diff --git a/src/test/ui/parser/issues/issue-48508.rs b/src/test/ui/parser/issues/issue-48508.rs
new file mode 100644 (file)
index 0000000..37d04c5
--- /dev/null
@@ -0,0 +1,20 @@
+// run-pass
+// Regression test for issue #48508:
+//
+// Confusion between global and local file offsets caused incorrect handling of multibyte character
+// spans when compiling multiple files. One visible effect was an ICE generating debug information
+// when a multibyte character is at the end of a scope. The problematic code is actually in
+// issue-48508-aux.rs
+
+// compile-flags:-g
+// ignore-pretty issue #37195
+// ignore-asmjs wasm2js does not support source maps yet
+
+#![allow(uncommon_codepoints)]
+
+#[path = "issue-48508-aux.rs"]
+mod other_file;
+
+fn main() {
+    other_file::other();
+}
diff --git a/src/test/ui/parser/issues/issue-48636.fixed b/src/test/ui/parser/issues/issue-48636.fixed
new file mode 100644 (file)
index 0000000..87c19a3
--- /dev/null
@@ -0,0 +1,12 @@
+// run-rustfix
+
+#![allow(dead_code)]
+
+struct S {
+    x: u8,
+    /// The ID of the parent core
+    y: u8,
+}
+//~^^^ ERROR found a documentation comment that doesn't document anything
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-48636.rs b/src/test/ui/parser/issues/issue-48636.rs
new file mode 100644 (file)
index 0000000..8610dc2
--- /dev/null
@@ -0,0 +1,12 @@
+// run-rustfix
+
+#![allow(dead_code)]
+
+struct S {
+    x: u8
+    /// The ID of the parent core
+    y: u8,
+}
+//~^^^ ERROR found a documentation comment that doesn't document anything
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-48636.stderr b/src/test/ui/parser/issues/issue-48636.stderr
new file mode 100644 (file)
index 0000000..462723d
--- /dev/null
@@ -0,0 +1,13 @@
+error[E0585]: found a documentation comment that doesn't document anything
+  --> $DIR/issue-48636.rs:7:5
+   |
+LL |     x: u8
+   |          - help: missing comma here: `,`
+LL |     /// The ID of the parent core
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: doc comments must come before what they document, maybe a comment was intended with `//`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0585`.
diff --git a/src/test/ui/parser/issues/issue-49040.rs b/src/test/ui/parser/issues/issue-49040.rs
new file mode 100644 (file)
index 0000000..b7a541d
--- /dev/null
@@ -0,0 +1,3 @@
+#![allow(unused_variables)]; //~ ERROR expected item, found `;`
+//~^ ERROR `main` function
+fn foo() {}
diff --git a/src/test/ui/parser/issues/issue-49040.stderr b/src/test/ui/parser/issues/issue-49040.stderr
new file mode 100644 (file)
index 0000000..56befe3
--- /dev/null
@@ -0,0 +1,15 @@
+error: expected item, found `;`
+  --> $DIR/issue-49040.rs:1:28
+   |
+LL | #![allow(unused_variables)];
+   |                            ^ help: remove this semicolon
+
+error[E0601]: `main` function not found in crate `issue_49040`
+  --> $DIR/issue-49040.rs:1:1
+   |
+LL | #![allow(unused_variables)];
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider adding a `main` function to `$DIR/issue-49040.rs`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/ui/parser/issues/issue-51602.rs b/src/test/ui/parser/issues/issue-51602.rs
new file mode 100644 (file)
index 0000000..0e96ca9
--- /dev/null
@@ -0,0 +1,6 @@
+fn main(){
+    if i in 1..10 {
+//~^ ERROR expected `{`, found keyword `in`
+        break;
+    }
+}
diff --git a/src/test/ui/parser/issues/issue-51602.stderr b/src/test/ui/parser/issues/issue-51602.stderr
new file mode 100644 (file)
index 0000000..d800890
--- /dev/null
@@ -0,0 +1,10 @@
+error: expected `{`, found keyword `in`
+  --> $DIR/issue-51602.rs:2:10
+   |
+LL |     if i in 1..10 {
+   |     --   ^^ expected `{`
+   |     |
+   |     this `if` expression has a condition, but no block
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-52496.rs b/src/test/ui/parser/issues/issue-52496.rs
new file mode 100644 (file)
index 0000000..05461f8
--- /dev/null
@@ -0,0 +1,12 @@
+struct Foo { bar: f64, baz: i64, bat: i64 }
+
+fn main() {
+    let _ = Foo { bar: .5, baz: 42 };
+    //~^ ERROR float literals must have an integer part
+    //~| ERROR missing field `bat` in initializer of `Foo`
+    let bar = 1.5f32;
+    let _ = Foo { bar.into(), bat: -1, . };
+    //~^ ERROR expected one of
+    //~| ERROR missing fields `bar` and `baz` in initializer of `Foo`
+    //~| ERROR expected identifier, found `.`
+}
diff --git a/src/test/ui/parser/issues/issue-52496.stderr b/src/test/ui/parser/issues/issue-52496.stderr
new file mode 100644 (file)
index 0000000..9dbf26e
--- /dev/null
@@ -0,0 +1,37 @@
+error: float literals must have an integer part
+  --> $DIR/issue-52496.rs:4:24
+   |
+LL |     let _ = Foo { bar: .5, baz: 42 };
+   |                        ^^ help: must have an integer part: `0.5`
+
+error: expected one of `,` or `}`, found `.`
+  --> $DIR/issue-52496.rs:8:22
+   |
+LL |     let _ = Foo { bar.into(), bat: -1, . };
+   |             ---      ^ expected one of `,` or `}`
+   |             |
+   |             while parsing this struct
+
+error: expected identifier, found `.`
+  --> $DIR/issue-52496.rs:8:40
+   |
+LL |     let _ = Foo { bar.into(), bat: -1, . };
+   |             ---                        ^ expected identifier
+   |             |
+   |             while parsing this struct
+
+error[E0063]: missing field `bat` in initializer of `Foo`
+  --> $DIR/issue-52496.rs:4:13
+   |
+LL |     let _ = Foo { bar: .5, baz: 42 };
+   |             ^^^ missing `bat`
+
+error[E0063]: missing fields `bar` and `baz` in initializer of `Foo`
+  --> $DIR/issue-52496.rs:8:13
+   |
+LL |     let _ = Foo { bar.into(), bat: -1, . };
+   |             ^^^ missing `bar` and `baz`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0063`.
diff --git a/src/test/ui/parser/issues/issue-54521-1.rs b/src/test/ui/parser/issues/issue-54521-1.rs
new file mode 100644 (file)
index 0000000..8a682ef
--- /dev/null
@@ -0,0 +1,16 @@
+// check-pass
+
+// This test checks that the `remove extra angle brackets` error doesn't happen for some
+// potential edge-cases..
+
+struct X {
+    len: u32,
+}
+
+fn main() {
+    let x = X { len: 3 };
+
+    let _ = x.len > (3);
+
+    let _ = x.len >> (3);
+}
diff --git a/src/test/ui/parser/issues/issue-54521-2.fixed b/src/test/ui/parser/issues/issue-54521-2.fixed
new file mode 100644 (file)
index 0000000..a91c4fe
--- /dev/null
@@ -0,0 +1,22 @@
+// run-rustfix
+
+// This test checks that the following error is emitted and the suggestion works:
+//
+// ```
+// let _ = Vec::<usize>>>::new();
+//                     ^^ help: remove extra angle brackets
+// ```
+
+fn main() {
+    let _ = Vec::<usize>::new();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = Vec::<usize>::new();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = Vec::<usize>::new();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = Vec::<usize>::new();
+    //~^ ERROR unmatched angle bracket
+}
diff --git a/src/test/ui/parser/issues/issue-54521-2.rs b/src/test/ui/parser/issues/issue-54521-2.rs
new file mode 100644 (file)
index 0000000..3639aac
--- /dev/null
@@ -0,0 +1,22 @@
+// run-rustfix
+
+// This test checks that the following error is emitted and the suggestion works:
+//
+// ```
+// let _ = Vec::<usize>>>::new();
+//                     ^^ help: remove extra angle brackets
+// ```
+
+fn main() {
+    let _ = Vec::<usize>>>>>::new();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = Vec::<usize>>>>::new();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = Vec::<usize>>>::new();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = Vec::<usize>>::new();
+    //~^ ERROR unmatched angle bracket
+}
diff --git a/src/test/ui/parser/issues/issue-54521-2.stderr b/src/test/ui/parser/issues/issue-54521-2.stderr
new file mode 100644 (file)
index 0000000..9556b83
--- /dev/null
@@ -0,0 +1,26 @@
+error: unmatched angle brackets
+  --> $DIR/issue-54521-2.rs:11:25
+   |
+LL |     let _ = Vec::<usize>>>>>::new();
+   |                         ^^^^ help: remove extra angle brackets
+
+error: unmatched angle brackets
+  --> $DIR/issue-54521-2.rs:14:25
+   |
+LL |     let _ = Vec::<usize>>>>::new();
+   |                         ^^^ help: remove extra angle brackets
+
+error: unmatched angle brackets
+  --> $DIR/issue-54521-2.rs:17:25
+   |
+LL |     let _ = Vec::<usize>>>::new();
+   |                         ^^ help: remove extra angle brackets
+
+error: unmatched angle bracket
+  --> $DIR/issue-54521-2.rs:20:25
+   |
+LL |     let _ = Vec::<usize>>::new();
+   |                         ^ help: remove extra angle bracket
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-54521-3.fixed b/src/test/ui/parser/issues/issue-54521-3.fixed
new file mode 100644 (file)
index 0000000..84ab686
--- /dev/null
@@ -0,0 +1,22 @@
+// run-rustfix
+
+// This test checks that the following error is emitted and the suggestion works:
+//
+// ```
+// let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>();
+//                                                        ^^ help: remove extra angle brackets
+// ```
+
+fn main() {
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+}
diff --git a/src/test/ui/parser/issues/issue-54521-3.rs b/src/test/ui/parser/issues/issue-54521-3.rs
new file mode 100644 (file)
index 0000000..f1d6850
--- /dev/null
@@ -0,0 +1,22 @@
+// run-rustfix
+
+// This test checks that the following error is emitted and the suggestion works:
+//
+// ```
+// let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>();
+//                                                        ^^ help: remove extra angle brackets
+// ```
+
+fn main() {
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>();
+    //~^ ERROR unmatched angle bracket
+}
diff --git a/src/test/ui/parser/issues/issue-54521-3.stderr b/src/test/ui/parser/issues/issue-54521-3.stderr
new file mode 100644 (file)
index 0000000..0f23dd6
--- /dev/null
@@ -0,0 +1,26 @@
+error: unmatched angle brackets
+  --> $DIR/issue-54521-3.rs:11:60
+   |
+LL |     let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>>();
+   |                                                            ^^^^ help: remove extra angle brackets
+
+error: unmatched angle brackets
+  --> $DIR/issue-54521-3.rs:14:60
+   |
+LL |     let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>>();
+   |                                                            ^^^ help: remove extra angle brackets
+
+error: unmatched angle brackets
+  --> $DIR/issue-54521-3.rs:17:60
+   |
+LL |     let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>>();
+   |                                                            ^^ help: remove extra angle brackets
+
+error: unmatched angle bracket
+  --> $DIR/issue-54521-3.rs:20:60
+   |
+LL |     let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>>();
+   |                                                            ^ help: remove extra angle bracket
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-5544-a.rs b/src/test/ui/parser/issues/issue-5544-a.rs
new file mode 100644 (file)
index 0000000..3c239c7
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {
+    let __isize = 340282366920938463463374607431768211456; // 2^128
+    //~^ ERROR integer literal is too large
+}
diff --git a/src/test/ui/parser/issues/issue-5544-a.stderr b/src/test/ui/parser/issues/issue-5544-a.stderr
new file mode 100644 (file)
index 0000000..de579c3
--- /dev/null
@@ -0,0 +1,8 @@
+error: integer literal is too large
+  --> $DIR/issue-5544-a.rs:2:19
+   |
+LL |     let __isize = 340282366920938463463374607431768211456; // 2^128
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-5544-b.rs b/src/test/ui/parser/issues/issue-5544-b.rs
new file mode 100644 (file)
index 0000000..93f2ff2
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {
+    let __isize = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ff;
+    //~^ ERROR integer literal is too large
+}
diff --git a/src/test/ui/parser/issues/issue-5544-b.stderr b/src/test/ui/parser/issues/issue-5544-b.stderr
new file mode 100644 (file)
index 0000000..7df212d
--- /dev/null
@@ -0,0 +1,8 @@
+error: integer literal is too large
+  --> $DIR/issue-5544-b.rs:2:19
+   |
+LL |     let __isize = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ff;
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-56031.rs b/src/test/ui/parser/issues/issue-56031.rs
new file mode 100644 (file)
index 0000000..b68f568
--- /dev/null
@@ -0,0 +1,6 @@
+struct T;
+
+impl for T {}
+//~^ ERROR missing trait in a trait impl
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-56031.stderr b/src/test/ui/parser/issues/issue-56031.stderr
new file mode 100644 (file)
index 0000000..7ee5bc6
--- /dev/null
@@ -0,0 +1,18 @@
+error: missing trait in a trait impl
+  --> $DIR/issue-56031.rs:3:5
+   |
+LL | impl for T {}
+   |     ^
+   |
+help: add a trait here
+   |
+LL | impl Trait for T {}
+   |      +++++
+help: for an inherent impl, drop this `for`
+   |
+LL - impl for T {}
+LL + impl T {}
+   | 
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-57198.rs b/src/test/ui/parser/issues/issue-57198.rs
new file mode 100644 (file)
index 0000000..714a46c
--- /dev/null
@@ -0,0 +1,8 @@
+mod m {
+    pub fn r#for() {}
+}
+
+fn main() {
+    m::for();
+    //~^ ERROR expected identifier, found keyword `for`
+}
diff --git a/src/test/ui/parser/issues/issue-57198.stderr b/src/test/ui/parser/issues/issue-57198.stderr
new file mode 100644 (file)
index 0000000..5a56d80
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected identifier, found keyword `for`
+  --> $DIR/issue-57198.rs:6:8
+   |
+LL |     m::for();
+   |        ^^^ expected identifier, found keyword
+   |
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL |     m::r#for();
+   |        ~~~~~
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-57684.fixed b/src/test/ui/parser/issues/issue-57684.fixed
new file mode 100644 (file)
index 0000000..4a43220
--- /dev/null
@@ -0,0 +1,37 @@
+// run-rustfix
+
+#![allow(warnings)]
+
+// This test checks that the following error is emitted when a `=` character is used to initialize
+// a struct field when a `:` is expected.
+//
+// ```
+// error: struct fields are initialized with a colon
+//   --> $DIR/issue-57684.rs:12:20
+//    |
+// LL |     let _ = X { f1 = 5 };
+//    |                    ^ help: replace equals symbol with a colon: `:`
+// ```
+
+struct X {
+    f1: i32,
+}
+
+struct Y {
+    f1: i32,
+    f2: i32,
+    f3: i32,
+}
+
+fn main() {
+    let _ = X { f1: 5 };
+    //~^ ERROR expected `:`, found `=`
+
+    let f3 = 3;
+    let _ = Y {
+        f1: 5,
+        //~^ ERROR expected `:`, found `=`
+        f2: 4,
+        f3,
+    };
+}
diff --git a/src/test/ui/parser/issues/issue-57684.rs b/src/test/ui/parser/issues/issue-57684.rs
new file mode 100644 (file)
index 0000000..7a62785
--- /dev/null
@@ -0,0 +1,37 @@
+// run-rustfix
+
+#![allow(warnings)]
+
+// This test checks that the following error is emitted when a `=` character is used to initialize
+// a struct field when a `:` is expected.
+//
+// ```
+// error: struct fields are initialized with a colon
+//   --> $DIR/issue-57684.rs:12:20
+//    |
+// LL |     let _ = X { f1 = 5 };
+//    |                    ^ help: replace equals symbol with a colon: `:`
+// ```
+
+struct X {
+    f1: i32,
+}
+
+struct Y {
+    f1: i32,
+    f2: i32,
+    f3: i32,
+}
+
+fn main() {
+    let _ = X { f1 = 5 };
+    //~^ ERROR expected `:`, found `=`
+
+    let f3 = 3;
+    let _ = Y {
+        f1 = 5,
+        //~^ ERROR expected `:`, found `=`
+        f2: 4,
+        f3,
+    };
+}
diff --git a/src/test/ui/parser/issues/issue-57684.stderr b/src/test/ui/parser/issues/issue-57684.stderr
new file mode 100644 (file)
index 0000000..514bbff
--- /dev/null
@@ -0,0 +1,18 @@
+error: expected `:`, found `=`
+  --> $DIR/issue-57684.rs:27:20
+   |
+LL |     let _ = X { f1 = 5 };
+   |                   -^
+   |                   |
+   |                   help: replace equals symbol with a colon: `:`
+
+error: expected `:`, found `=`
+  --> $DIR/issue-57684.rs:32:12
+   |
+LL |         f1 = 5,
+   |           -^
+   |           |
+   |           help: replace equals symbol with a colon: `:`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-57819.fixed b/src/test/ui/parser/issues/issue-57819.fixed
new file mode 100644 (file)
index 0000000..3fab21d
--- /dev/null
@@ -0,0 +1,47 @@
+// run-rustfix
+
+#![allow(warnings)]
+
+// This test checks that the following error is emitted and the suggestion works:
+//
+// ```
+// let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
+//                                            ^^ help: remove extra angle brackets
+// ```
+
+trait Foo {
+    type Output;
+}
+
+fn foo<T: Foo>() {
+    // More complex cases with more than one correct leading `<` character:
+
+    bar::<<T as Foo>::Output>();
+    //~^ ERROR unmatched angle bracket
+
+    bar::<<T as Foo>::Output>();
+    //~^ ERROR unmatched angle bracket
+
+    bar::<<T as Foo>::Output>();
+    //~^ ERROR unmatched angle bracket
+
+    bar::<<T as Foo>::Output>();
+}
+
+fn bar<T>() {}
+
+fn main() {
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+}
diff --git a/src/test/ui/parser/issues/issue-57819.rs b/src/test/ui/parser/issues/issue-57819.rs
new file mode 100644 (file)
index 0000000..5cafbf4
--- /dev/null
@@ -0,0 +1,47 @@
+// run-rustfix
+
+#![allow(warnings)]
+
+// This test checks that the following error is emitted and the suggestion works:
+//
+// ```
+// let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
+//                                            ^^ help: remove extra angle brackets
+// ```
+
+trait Foo {
+    type Output;
+}
+
+fn foo<T: Foo>() {
+    // More complex cases with more than one correct leading `<` character:
+
+    bar::<<<<<T as Foo>::Output>();
+    //~^ ERROR unmatched angle bracket
+
+    bar::<<<<T as Foo>::Output>();
+    //~^ ERROR unmatched angle bracket
+
+    bar::<<<T as Foo>::Output>();
+    //~^ ERROR unmatched angle bracket
+
+    bar::<<T as Foo>::Output>();
+}
+
+fn bar<T>() {}
+
+fn main() {
+    let _ = vec![1, 2, 3].into_iter().collect::<<<<<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<<<<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<<Vec<usize>>();
+    //~^ ERROR unmatched angle bracket
+
+    let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
+}
diff --git a/src/test/ui/parser/issues/issue-57819.stderr b/src/test/ui/parser/issues/issue-57819.stderr
new file mode 100644 (file)
index 0000000..493e983
--- /dev/null
@@ -0,0 +1,44 @@
+error: unmatched angle brackets
+  --> $DIR/issue-57819.rs:19:10
+   |
+LL |     bar::<<<<<T as Foo>::Output>();
+   |          ^^^ help: remove extra angle brackets
+
+error: unmatched angle brackets
+  --> $DIR/issue-57819.rs:22:10
+   |
+LL |     bar::<<<<T as Foo>::Output>();
+   |          ^^ help: remove extra angle brackets
+
+error: unmatched angle bracket
+  --> $DIR/issue-57819.rs:25:10
+   |
+LL |     bar::<<<T as Foo>::Output>();
+   |          ^ help: remove extra angle bracket
+
+error: unmatched angle brackets
+  --> $DIR/issue-57819.rs:34:48
+   |
+LL |     let _ = vec![1, 2, 3].into_iter().collect::<<<<<Vec<usize>>();
+   |                                                ^^^^ help: remove extra angle brackets
+
+error: unmatched angle brackets
+  --> $DIR/issue-57819.rs:37:48
+   |
+LL |     let _ = vec![1, 2, 3].into_iter().collect::<<<<Vec<usize>>();
+   |                                                ^^^ help: remove extra angle brackets
+
+error: unmatched angle brackets
+  --> $DIR/issue-57819.rs:40:48
+   |
+LL |     let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
+   |                                                ^^ help: remove extra angle brackets
+
+error: unmatched angle bracket
+  --> $DIR/issue-57819.rs:43:48
+   |
+LL |     let _ = vec![1, 2, 3].into_iter().collect::<<Vec<usize>>();
+   |                                                ^ help: remove extra angle bracket
+
+error: aborting due to 7 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-5806.rs b/src/test/ui/parser/issues/issue-5806.rs
new file mode 100644 (file)
index 0000000..b694642
--- /dev/null
@@ -0,0 +1,7 @@
+// normalize-stderr-test: "parser:.*\(" -> "parser: $$ACCESS_DENIED_MSG ("
+// normalize-stderr-test: "os error \d+" -> "os error $$ACCESS_DENIED_CODE"
+
+#[path = "../parser"]
+mod foo; //~ ERROR couldn't read
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-5806.stderr b/src/test/ui/parser/issues/issue-5806.stderr
new file mode 100644 (file)
index 0000000..bdb5c91
--- /dev/null
@@ -0,0 +1,8 @@
+error: couldn't read $DIR/../parser: $ACCESS_DENIED_MSG (os error $ACCESS_DENIED_CODE)
+  --> $DIR/issue-5806.rs:5:1
+   |
+LL | mod foo;
+   | ^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-58094-missing-right-square-bracket.rs b/src/test/ui/parser/issues/issue-58094-missing-right-square-bracket.rs
new file mode 100644 (file)
index 0000000..25699f9
--- /dev/null
@@ -0,0 +1,4 @@
+// Fixed in #66054.
+// ignore-tidy-trailing-newlines
+// error-pattern: aborting due to 2 previous errors
+#[Ѕ
\ No newline at end of file
diff --git a/src/test/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr b/src/test/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr
new file mode 100644 (file)
index 0000000..8a44ee7
--- /dev/null
@@ -0,0 +1,16 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4
+   |
+LL | #[Ѕ
+   |  - ^
+   |  |
+   |  unclosed delimiter
+
+error: expected item after attributes
+  --> $DIR/issue-58094-missing-right-square-bracket.rs:4:1
+   |
+LL | #[Ѕ
+   | ^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-58856-1.rs b/src/test/ui/parser/issues/issue-58856-1.rs
new file mode 100644 (file)
index 0000000..332a301
--- /dev/null
@@ -0,0 +1,8 @@
+impl A {
+    //~^ ERROR cannot find type `A` in this scope
+    fn b(self>
+    //~^ ERROR expected one of `)`, `,`, or `:`, found `>`
+    //~| ERROR expected one of `->`, `;`, `where`, or `{`, found `>`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-58856-1.stderr b/src/test/ui/parser/issues/issue-58856-1.stderr
new file mode 100644 (file)
index 0000000..2afb26d
--- /dev/null
@@ -0,0 +1,29 @@
+error: expected one of `)`, `,`, or `:`, found `>`
+  --> $DIR/issue-58856-1.rs:3:9
+   |
+LL |     fn b(self>
+   |         ^    ^ help: `)` may belong here
+   |         |
+   |         unclosed delimiter
+
+error: expected one of `->`, `;`, `where`, or `{`, found `>`
+  --> $DIR/issue-58856-1.rs:3:14
+   |
+LL | impl A {
+   |        - while parsing this item list starting here
+LL |
+LL |     fn b(self>
+   |              ^ expected one of `->`, `;`, `where`, or `{`
+...
+LL | }
+   | - the item list ends here
+
+error[E0412]: cannot find type `A` in this scope
+  --> $DIR/issue-58856-1.rs:1:6
+   |
+LL | impl A {
+   |      ^ not found in this scope
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/parser/issues/issue-58856-2.rs b/src/test/ui/parser/issues/issue-58856-2.rs
new file mode 100644 (file)
index 0000000..9356d57
--- /dev/null
@@ -0,0 +1,14 @@
+struct Empty;
+
+trait Howness {}
+
+impl Howness for () {
+    fn how_are_you(&self -> Empty {
+    //~^ ERROR expected one of `)` or `,`, found `->`
+    //~| ERROR method `how_are_you` is not a member of trait `Howness`
+        Empty
+    }
+}
+//~^ ERROR non-item in item list
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-58856-2.stderr b/src/test/ui/parser/issues/issue-58856-2.stderr
new file mode 100644 (file)
index 0000000..627dd38
--- /dev/null
@@ -0,0 +1,34 @@
+error: expected one of `)` or `,`, found `->`
+  --> $DIR/issue-58856-2.rs:6:19
+   |
+LL |     fn how_are_you(&self -> Empty {
+   |                   ^     -^^
+   |                   |     |
+   |                   |     help: `)` may belong here
+   |                   unclosed delimiter
+
+error: non-item in item list
+  --> $DIR/issue-58856-2.rs:11:1
+   |
+LL | impl Howness for () {
+   |                     - item list starts here
+...
+LL | }
+   | ^
+   | |
+   | non-item starts here
+   | item list ends here
+
+error[E0407]: method `how_are_you` is not a member of trait `Howness`
+  --> $DIR/issue-58856-2.rs:6:5
+   |
+LL | /     fn how_are_you(&self -> Empty {
+LL | |
+LL | |
+LL | |         Empty
+LL | |     }
+   | |_____^ not a member of trait `Howness`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0407`.
diff --git a/src/test/ui/parser/issues/issue-59418.rs b/src/test/ui/parser/issues/issue-59418.rs
new file mode 100644 (file)
index 0000000..0fa191d
--- /dev/null
@@ -0,0 +1,18 @@
+struct X(i32,i32,i32);
+
+fn main() {
+    let a = X(1, 2, 3);
+    let b = a.1suffix;
+    //~^ ERROR suffixes on a tuple index are invalid
+    println!("{}", b);
+    let c = (1, 2, 3);
+    let d = c.1suffix;
+    //~^ ERROR suffixes on a tuple index are invalid
+    println!("{}", d);
+    let s = X { 0suffix: 0, 1: 1, 2: 2 };
+    //~^ ERROR suffixes on a tuple index are invalid
+    match s {
+        X { 0suffix: _, .. } => {}
+        //~^ ERROR suffixes on a tuple index are invalid
+    }
+}
diff --git a/src/test/ui/parser/issues/issue-59418.stderr b/src/test/ui/parser/issues/issue-59418.stderr
new file mode 100644 (file)
index 0000000..347051e
--- /dev/null
@@ -0,0 +1,26 @@
+error: suffixes on a tuple index are invalid
+  --> $DIR/issue-59418.rs:5:15
+   |
+LL |     let b = a.1suffix;
+   |               ^^^^^^^ invalid suffix `suffix`
+
+error: suffixes on a tuple index are invalid
+  --> $DIR/issue-59418.rs:9:15
+   |
+LL |     let d = c.1suffix;
+   |               ^^^^^^^ invalid suffix `suffix`
+
+error: suffixes on a tuple index are invalid
+  --> $DIR/issue-59418.rs:12:17
+   |
+LL |     let s = X { 0suffix: 0, 1: 1, 2: 2 };
+   |                 ^^^^^^^ invalid suffix `suffix`
+
+error: suffixes on a tuple index are invalid
+  --> $DIR/issue-59418.rs:15:13
+   |
+LL |         X { 0suffix: _, .. } => {}
+   |             ^^^^^^^ invalid suffix `suffix`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-60075.rs b/src/test/ui/parser/issues/issue-60075.rs
new file mode 100644 (file)
index 0000000..e89d78e
--- /dev/null
@@ -0,0 +1,11 @@
+fn main() {}
+
+trait T {
+    fn qux() -> Option<usize> {
+        let _ = if true {
+        });
+//~^ ERROR non-item in item list
+//~| ERROR mismatched closing delimiter: `)`
+//~| ERROR expected one of `.`, `;`
+        Some(4)
+    }
diff --git a/src/test/ui/parser/issues/issue-60075.stderr b/src/test/ui/parser/issues/issue-60075.stderr
new file mode 100644 (file)
index 0000000..210ef70
--- /dev/null
@@ -0,0 +1,29 @@
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `}`
+  --> $DIR/issue-60075.rs:6:10
+   |
+LL |         });
+   |          ^ expected one of `.`, `;`, `?`, `else`, or an operator
+
+error: non-item in item list
+  --> $DIR/issue-60075.rs:6:11
+   |
+LL | trait T {
+   |         - item list starts here
+...
+LL |         });
+   |           ^ non-item starts here
+...
+LL |     }
+   |     - item list ends here
+
+error: mismatched closing delimiter: `)`
+  --> $DIR/issue-60075.rs:4:31
+   |
+LL |     fn qux() -> Option<usize> {
+   |                               ^ unclosed delimiter
+LL |         let _ = if true {
+LL |         });
+   |          ^ mismatched closing delimiter
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-62524.rs b/src/test/ui/parser/issues/issue-62524.rs
new file mode 100644 (file)
index 0000000..5259dfe
--- /dev/null
@@ -0,0 +1,6 @@
+// ignore-tidy-trailing-newlines
+// error-pattern: aborting due to 3 previous errors
+#![allow(uncommon_codepoints)]
+
+y![
+Ϥ,
\ No newline at end of file
diff --git a/src/test/ui/parser/issues/issue-62524.stderr b/src/test/ui/parser/issues/issue-62524.stderr
new file mode 100644 (file)
index 0000000..55eed04
--- /dev/null
@@ -0,0 +1,33 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62524.rs:6:3
+   |
+LL | y![
+   |   - unclosed delimiter
+LL | Ϥ,
+   |   ^
+
+error: macros that expand to items must be delimited with braces or followed by a semicolon
+  --> $DIR/issue-62524.rs:5:3
+   |
+LL |   y![
+   |  ___^
+LL | | Ϥ,
+   | |__^
+   |
+help: change the delimiters to curly braces
+   |
+LL | y! { /* items */ }
+   |    ~~~~~~~~~~~~~~~
+help: add a semicolon
+   |
+LL | Ϥ,;
+   |   +
+
+error: cannot find macro `y` in this scope
+  --> $DIR/issue-62524.rs:5:1
+   |
+LL | y![
+   | ^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-62546.rs b/src/test/ui/parser/issues/issue-62546.rs
new file mode 100644 (file)
index 0000000..f06b650
--- /dev/null
@@ -0,0 +1,3 @@
+pub t(#
+//~^ ERROR missing `fn` or `struct` for function or struct definition
+//~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/issues/issue-62546.stderr b/src/test/ui/parser/issues/issue-62546.stderr
new file mode 100644 (file)
index 0000000..32c6139
--- /dev/null
@@ -0,0 +1,17 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62546.rs:3:52
+   |
+LL | pub t(#
+   |      - unclosed delimiter
+LL |
+LL |
+   |                                                    ^
+
+error: missing `fn` or `struct` for function or struct definition
+  --> $DIR/issue-62546.rs:1:4
+   |
+LL | pub t(#
+   | ---^- help: if you meant to call a macro, try: `t!`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-62554.rs b/src/test/ui/parser/issues/issue-62554.rs
new file mode 100644 (file)
index 0000000..cfd0218
--- /dev/null
@@ -0,0 +1,6 @@
+// error-pattern:this file contains an unclosed delimiter
+// error-pattern:xpected `{`, found `macro_rules`
+
+fn main() {}
+
+fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
diff --git a/src/test/ui/parser/issues/issue-62554.stderr b/src/test/ui/parser/issues/issue-62554.stderr
new file mode 100644 (file)
index 0000000..5dc9a96
--- /dev/null
@@ -0,0 +1,71 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62554.rs:6:89
+   |
+LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
+   |               -                       -         -                  -                  - ^
+   |               |                       |         |                  |                  |
+   |               |                       |         |                  |                  unclosed delimiter
+   |               |                       |         |                  unclosed delimiter
+   |               |                       |         unclosed delimiter
+   |               unclosed delimiter      unclosed delimiter
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62554.rs:6:89
+   |
+LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
+   |               -                       -         -                  -                  - ^
+   |               |                       |         |                  |                  |
+   |               |                       |         |                  |                  unclosed delimiter
+   |               |                       |         |                  unclosed delimiter
+   |               |                       |         unclosed delimiter
+   |               unclosed delimiter      unclosed delimiter
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62554.rs:6:89
+   |
+LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
+   |               -                       -         -                  -                  - ^
+   |               |                       |         |                  |                  |
+   |               |                       |         |                  |                  unclosed delimiter
+   |               |                       |         |                  unclosed delimiter
+   |               |                       |         unclosed delimiter
+   |               unclosed delimiter      unclosed delimiter
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62554.rs:6:89
+   |
+LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
+   |               -                       -         -                  -                  - ^
+   |               |                       |         |                  |                  |
+   |               |                       |         |                  |                  unclosed delimiter
+   |               |                       |         |                  unclosed delimiter
+   |               |                       |         unclosed delimiter
+   |               unclosed delimiter      unclosed delimiter
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62554.rs:6:89
+   |
+LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
+   |               -                       -         -                  -                  - ^
+   |               |                       |         |                  |                  |
+   |               |                       |         |                  |                  unclosed delimiter
+   |               |                       |         |                  unclosed delimiter
+   |               |                       |         unclosed delimiter
+   |               unclosed delimiter      unclosed delimiter
+
+error: expected `{`, found `macro_rules`
+  --> $DIR/issue-62554.rs:6:23
+   |
+LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
+   |                 --    ^^^^^^^^^^^ expected `{`
+   |                 |
+   |                 this `if` expression has a condition, but no block
+   |
+help: try placing this code inside a block
+   |
+LL ~ fn foo(u: u8) { if u8 { macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
+LL +  }
+   |
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-62660.rs b/src/test/ui/parser/issues/issue-62660.rs
new file mode 100644 (file)
index 0000000..4f866b7
--- /dev/null
@@ -0,0 +1,11 @@
+// Regression test for issue #62660: if a receiver's type does not
+// successfully parse, emit the correct error instead of ICE-ing the compiler.
+
+struct Foo;
+
+impl Foo {
+    pub fn foo(_: i32, self: Box<Self) {}
+    //~^ ERROR expected one of `!`, `(`, `+`, `,`, `::`, `:`, `<`, `=`, or `>`, found `)`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-62660.stderr b/src/test/ui/parser/issues/issue-62660.stderr
new file mode 100644 (file)
index 0000000..a50ada9
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `!`, `(`, `+`, `,`, `::`, `:`, `<`, `=`, or `>`, found `)`
+  --> $DIR/issue-62660.rs:7:38
+   |
+LL |     pub fn foo(_: i32, self: Box<Self) {}
+   |                                      ^ expected one of 9 possible tokens
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-62881.rs b/src/test/ui/parser/issues/issue-62881.rs
new file mode 100644 (file)
index 0000000..b920459
--- /dev/null
@@ -0,0 +1,6 @@
+fn main() {}
+
+fn f() -> isize { fn f() -> isize {} pub f<
+//~^ ERROR missing `fn` or `struct` for function or struct definition
+//~| ERROR mismatched types
+//~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/issues/issue-62881.stderr b/src/test/ui/parser/issues/issue-62881.stderr
new file mode 100644 (file)
index 0000000..87be69b
--- /dev/null
@@ -0,0 +1,26 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62881.rs:6:52
+   |
+LL | fn f() -> isize { fn f() -> isize {} pub f<
+   |                 - unclosed delimiter
+...
+LL |
+   |                                                    ^
+
+error: missing `fn` or `struct` for function or struct definition
+  --> $DIR/issue-62881.rs:3:41
+   |
+LL | fn f() -> isize { fn f() -> isize {} pub f<
+   |                                         ^
+
+error[E0308]: mismatched types
+  --> $DIR/issue-62881.rs:3:29
+   |
+LL | fn f() -> isize { fn f() -> isize {} pub f<
+   |                      -      ^^^^^ expected `isize`, found `()`
+   |                      |
+   |                      implicitly returns `()` as its body has no tail or `return` expression
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issues/issue-62894.rs b/src/test/ui/parser/issues/issue-62894.rs
new file mode 100644 (file)
index 0000000..b9c0bf8
--- /dev/null
@@ -0,0 +1,7 @@
+// Regression test for #62894, shouldn't crash.
+// error-pattern: this file contains an unclosed delimiter
+// error-pattern: expected one of `(`, `[`, or `{`, found keyword `fn`
+
+fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-62894.stderr b/src/test/ui/parser/issues/issue-62894.stderr
new file mode 100644 (file)
index 0000000..9b7bd15
--- /dev/null
@@ -0,0 +1,52 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62894.rs:7:14
+   |
+LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
+   |        -           -                   - unclosed delimiter
+   |        |           |
+   |        |           unclosed delimiter
+   |        unclosed delimiter
+LL | 
+LL | fn main() {}
+   |              ^
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62894.rs:7:14
+   |
+LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
+   |        -           -                   - unclosed delimiter
+   |        |           |
+   |        |           unclosed delimiter
+   |        unclosed delimiter
+LL | 
+LL | fn main() {}
+   |              ^
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62894.rs:7:14
+   |
+LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
+   |        -           -                   - unclosed delimiter
+   |        |           |
+   |        |           unclosed delimiter
+   |        unclosed delimiter
+LL | 
+LL | fn main() {}
+   |              ^
+
+error: expected one of `(`, `[`, or `{`, found keyword `fn`
+  --> $DIR/issue-62894.rs:7:1
+   |
+LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
+   |                                                   - expected one of `(`, `[`, or `{`
+LL | 
+LL | fn main() {}
+   | ^^ unexpected token
+   |
+  ::: $SRC_DIR/core/src/macros/mod.rs:LL:COL
+   |
+LL |     ($left:expr, $right:expr $(,)?) => ({
+   |      ---------- while parsing argument for this `expr` macro fragment
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-62895.rs b/src/test/ui/parser/issues/issue-62895.rs
new file mode 100644 (file)
index 0000000..53f1740
--- /dev/null
@@ -0,0 +1,11 @@
+fn main() {}
+
+fn v() -> isize { //~ ERROR mismatched types
+mod _ { //~ ERROR expected identifier
+pub fn g() -> isizee { //~ ERROR cannot find type `isizee` in this scope
+mod _ { //~ ERROR expected identifier
+pub    g() -> is //~ ERROR missing `fn` for function definition
+(), w20);
+}
+(), w20); //~ ERROR expected item, found `;`
+}
diff --git a/src/test/ui/parser/issues/issue-62895.stderr b/src/test/ui/parser/issues/issue-62895.stderr
new file mode 100644 (file)
index 0000000..2e7e500
--- /dev/null
@@ -0,0 +1,47 @@
+error: expected identifier, found reserved identifier `_`
+  --> $DIR/issue-62895.rs:4:5
+   |
+LL | mod _ {
+   |     ^ expected identifier, found reserved identifier
+
+error: expected identifier, found reserved identifier `_`
+  --> $DIR/issue-62895.rs:6:5
+   |
+LL | mod _ {
+   |     ^ expected identifier, found reserved identifier
+
+error: missing `fn` for function definition
+  --> $DIR/issue-62895.rs:7:4
+   |
+LL | pub    g() -> is
+   |    ^^^^
+   |
+help: add `fn` here to parse `g` as a public function
+   |
+LL | pub fn g() -> is
+   |     ++
+
+error: expected item, found `;`
+  --> $DIR/issue-62895.rs:10:9
+   |
+LL | (), w20);
+   |         ^ help: remove this semicolon
+
+error[E0412]: cannot find type `isizee` in this scope
+  --> $DIR/issue-62895.rs:5:15
+   |
+LL | pub fn g() -> isizee {
+   |               ^^^^^^ help: a builtin type with a similar name exists: `isize`
+
+error[E0308]: mismatched types
+  --> $DIR/issue-62895.rs:3:11
+   |
+LL | fn v() -> isize {
+   |    -      ^^^^^ expected `isize`, found `()`
+   |    |
+   |    implicitly returns `()` as its body has no tail or `return` expression
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0308, E0412.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issues/issue-62913.rs b/src/test/ui/parser/issues/issue-62913.rs
new file mode 100644 (file)
index 0000000..0db06f6
--- /dev/null
@@ -0,0 +1,4 @@
+"\u\\"
+//~^ ERROR incorrect unicode escape sequence
+//~| ERROR invalid trailing slash in literal
+//~| ERROR expected item, found `"\u\\"`
diff --git a/src/test/ui/parser/issues/issue-62913.stderr b/src/test/ui/parser/issues/issue-62913.stderr
new file mode 100644 (file)
index 0000000..6f385e8
--- /dev/null
@@ -0,0 +1,22 @@
+error: incorrect unicode escape sequence
+  --> $DIR/issue-62913.rs:1:2
+   |
+LL | "\u\"
+   |  ^^^ incorrect unicode escape sequence
+   |
+   = help: format of unicode escape sequences is `\u{...}`
+
+error: invalid trailing slash in literal
+  --> $DIR/issue-62913.rs:1:5
+   |
+LL | "\u\"
+   |     ^ invalid trailing slash in literal
+
+error: expected item, found `"\u\"`
+  --> $DIR/issue-62913.rs:1:1
+   |
+LL | "\u\"
+   | ^^^^^^ expected item
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-62973.rs b/src/test/ui/parser/issues/issue-62973.rs
new file mode 100644 (file)
index 0000000..1c5d0c6
--- /dev/null
@@ -0,0 +1,8 @@
+// ignore-tidy-trailing-newlines
+// error-pattern: aborting due to 7 previous errors
+
+fn main() {}
+
+fn p() { match s { v, E { [) {) }
+
+
diff --git a/src/test/ui/parser/issues/issue-62973.stderr b/src/test/ui/parser/issues/issue-62973.stderr
new file mode 100644 (file)
index 0000000..51d835e
--- /dev/null
@@ -0,0 +1,75 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62973.rs:8:2
+   |
+LL | fn p() { match s { v, E { [) {) }
+   |        -         - unclosed delimiter
+   |        |
+   |        unclosed delimiter
+LL | 
+LL | 
+   |  ^
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-62973.rs:8:2
+   |
+LL | fn p() { match s { v, E { [) {) }
+   |        -         - unclosed delimiter
+   |        |
+   |        unclosed delimiter
+LL | 
+LL | 
+   |  ^
+
+error: expected one of `,` or `}`, found `{`
+  --> $DIR/issue-62973.rs:6:8
+   |
+LL | fn p() { match s { v, E { [) {) }
+   |        ^       -       -^ expected one of `,` or `}`
+   |        |       |       |
+   |        |       |       help: `}` may belong here
+   |        |       while parsing this struct
+   |        unclosed delimiter
+
+error: struct literals are not allowed here
+  --> $DIR/issue-62973.rs:6:16
+   |
+LL |   fn p() { match s { v, E { [) {) }
+   |  ________________^
+LL | |
+LL | |
+   | |_^
+   |
+help: surround the struct literal with parentheses
+   |
+LL ~ fn p() { match (s { v, E { [) {) }
+LL | 
+LL ~ )
+   |
+
+error: expected one of `.`, `?`, `{`, or an operator, found `}`
+  --> $DIR/issue-62973.rs:8:2
+   |
+LL | fn p() { match s { v, E { [) {) }
+   |          ----- while parsing this match expression
+LL | 
+LL | 
+   |  ^ expected one of `.`, `?`, `{`, or an operator
+
+error: mismatched closing delimiter: `)`
+  --> $DIR/issue-62973.rs:6:27
+   |
+LL | fn p() { match s { v, E { [) {) }
+   |                           ^^ mismatched closing delimiter
+   |                           |
+   |                           unclosed delimiter
+
+error: mismatched closing delimiter: `)`
+  --> $DIR/issue-62973.rs:6:30
+   |
+LL | fn p() { match s { v, E { [) {) }
+   |                              ^^ mismatched closing delimiter
+   |                              |
+   |                              unclosed delimiter
+
+error: aborting due to 7 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-63115-range-pat-interpolated.rs b/src/test/ui/parser/issues/issue-63115-range-pat-interpolated.rs
new file mode 100644 (file)
index 0000000..8efb3c7
--- /dev/null
@@ -0,0 +1,22 @@
+// check-pass
+
+#![feature(exclusive_range_pattern)]
+#![feature(half_open_range_patterns)]
+
+#![allow(ellipsis_inclusive_range_patterns)]
+
+fn main() {
+    macro_rules! mac_expr {
+        ($e:expr) => {
+            if let 2...$e = 3 {}
+            if let 2..=$e = 3 {}
+            if let 2..$e = 3 {}
+            if let ..$e = 3 {}
+            if let ..=$e = 3 {}
+            if let $e.. = 5 {}
+            if let $e..5 = 4 {}
+            if let $e..=5 = 4 {}
+        }
+    }
+    mac_expr!(4);
+}
diff --git a/src/test/ui/parser/issues/issue-63116.rs b/src/test/ui/parser/issues/issue-63116.rs
new file mode 100644 (file)
index 0000000..430bc1d
--- /dev/null
@@ -0,0 +1,3 @@
+// fixed by #66361
+// error-pattern: aborting due to 3 previous errors
+impl W <s(f;Y(;]
diff --git a/src/test/ui/parser/issues/issue-63116.stderr b/src/test/ui/parser/issues/issue-63116.stderr
new file mode 100644 (file)
index 0000000..cfdd99d
--- /dev/null
@@ -0,0 +1,24 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-63116.rs:3:18
+   |
+LL | impl W <s(f;Y(;]
+   |          -       ^
+   |          |
+   |          unclosed delimiter
+
+error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `;`
+  --> $DIR/issue-63116.rs:3:12
+   |
+LL | impl W <s(f;Y(;]
+   |            ^ expected one of 7 possible tokens
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-63116.rs:3:14
+   |
+LL | impl W <s(f;Y(;]
+   |              ^ ^ mismatched closing delimiter
+   |              |
+   |              unclosed delimiter
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-63135.rs b/src/test/ui/parser/issues/issue-63135.rs
new file mode 100644 (file)
index 0000000..a5a8de8
--- /dev/null
@@ -0,0 +1,3 @@
+// error-pattern: aborting due to 5 previous errors
+
+fn i(n{...,f #
diff --git a/src/test/ui/parser/issues/issue-63135.stderr b/src/test/ui/parser/issues/issue-63135.stderr
new file mode 100644 (file)
index 0000000..80e9ac5
--- /dev/null
@@ -0,0 +1,43 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-63135.rs:3:16
+   |
+LL | fn i(n{...,f #
+   |     - -        ^
+   |     | |
+   |     | unclosed delimiter
+   |     unclosed delimiter
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-63135.rs:3:16
+   |
+LL | fn i(n{...,f #
+   |     - -        ^
+   |     | |
+   |     | unclosed delimiter
+   |     unclosed delimiter
+
+error: expected field pattern, found `...`
+  --> $DIR/issue-63135.rs:3:8
+   |
+LL | fn i(n{...,f #
+   |        ^^^ help: to omit remaining fields, use one fewer `.`: `..`
+
+error: expected `}`, found `,`
+  --> $DIR/issue-63135.rs:3:11
+   |
+LL | fn i(n{...,f #
+   |        ---^
+   |        |  |
+   |        |  expected `}`
+   |        `..` must be at the end and cannot have a trailing comma
+
+error: expected one of `!` or `[`, found `}`
+  --> $DIR/issue-63135.rs:3:16
+   |
+LL | fn i(n{...,f #
+   |      -         ^ expected one of `!` or `[`
+   |      |
+   |      while parsing the fields for this pattern
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-64732.rs b/src/test/ui/parser/issues/issue-64732.rs
new file mode 100644 (file)
index 0000000..2db51ea
--- /dev/null
@@ -0,0 +1,9 @@
+#![allow(unused)]
+fn main() {
+    let _foo = b'hello\0';
+    //~^ ERROR character literal may only contain one codepoint
+    //~| HELP if you meant to write a byte string literal, use double quotes
+    let _bar = 'hello';
+    //~^ ERROR character literal may only contain one codepoint
+    //~| HELP if you meant to write a `str` literal, use double quotes
+}
diff --git a/src/test/ui/parser/issues/issue-64732.stderr b/src/test/ui/parser/issues/issue-64732.stderr
new file mode 100644 (file)
index 0000000..8046254
--- /dev/null
@@ -0,0 +1,24 @@
+error: character literal may only contain one codepoint
+  --> $DIR/issue-64732.rs:3:16
+   |
+LL |     let _foo = b'hello\0';
+   |                ^^^^^^^^^^
+   |
+help: if you meant to write a byte string literal, use double quotes
+   |
+LL |     let _foo = b"hello\0";
+   |                ~~~~~~~~~~
+
+error: character literal may only contain one codepoint
+  --> $DIR/issue-64732.rs:6:16
+   |
+LL |     let _bar = 'hello';
+   |                ^^^^^^^
+   |
+help: if you meant to write a `str` literal, use double quotes
+   |
+LL |     let _bar = "hello";
+   |                ~~~~~~~
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-65041-empty-vis-matcher-in-enum.rs b/src/test/ui/parser/issues/issue-65041-empty-vis-matcher-in-enum.rs
new file mode 100644 (file)
index 0000000..ef89e31
--- /dev/null
@@ -0,0 +1,28 @@
+// check-pass
+
+// Here we check that a `:vis` macro matcher subsititued for the empty visibility
+// (`VisibilityKind::Inherited`) is accepted when used before an enum variant.
+
+fn main() {}
+
+macro_rules! mac_variant {
+    ($vis:vis MARKER) => {
+        enum Enum {
+            $vis Unit,
+
+            $vis Tuple(u8, u16),
+
+            $vis Struct { f: u8 },
+        }
+    }
+}
+
+mac_variant!(MARKER);
+
+// We also accept visibilities on variants syntactically but not semantically.
+#[cfg(FALSE)]
+enum E {
+    pub U,
+    pub(crate) T(u8),
+    pub(super) T { f: String }
+}
diff --git a/src/test/ui/parser/issues/issue-65041-empty-vis-matcher-in-trait.rs b/src/test/ui/parser/issues/issue-65041-empty-vis-matcher-in-trait.rs
new file mode 100644 (file)
index 0000000..b08767b
--- /dev/null
@@ -0,0 +1,28 @@
+// check-pass
+
+// Here we check that a `:vis` macro matcher subsititued for the empty visibility
+// (`VisibilityKind::Inherited`) is accepted when used before an item in a trait.
+
+fn main() {}
+
+macro_rules! mac_in_trait {
+    ($vis:vis MARKER) => {
+        $vis fn beta() {}
+
+        $vis const GAMMA: u8;
+
+        $vis type Delta;
+    }
+}
+
+trait Alpha {
+    mac_in_trait!(MARKER);
+}
+
+// We also accept visibilities on items in traits syntactically but not semantically.
+#[cfg(FALSE)]
+trait Foo {
+    pub fn bar();
+    pub(crate) type baz;
+    pub(super) const QUUX: u8;
+}
diff --git a/src/test/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.rs b/src/test/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.rs
new file mode 100644 (file)
index 0000000..30f3781
--- /dev/null
@@ -0,0 +1,26 @@
+// Regression test; used to ICE with 'visit_mac_call disabled by default' due to a
+// `MutVisitor` in `fn make_all_value_bindings_mutable` (`parse/parser/pat.rs`).
+
+macro_rules! mac1 {
+    ($eval:expr) => {
+        let mut $eval = ();
+        //~^ ERROR `mut` must be followed by a named binding
+    };
+}
+
+macro_rules! mac2 {
+    ($eval:pat) => {
+        let mut $eval = ();
+        //~^ ERROR `mut` must be followed by a named binding
+        //~| ERROR expected identifier, found `does_not_exist!()`
+    };
+}
+
+fn foo() {
+    mac1! { does_not_exist!() }
+    //~^ ERROR cannot find macro `does_not_exist` in this scope
+    mac2! { does_not_exist!() }
+    //~^ ERROR cannot find macro `does_not_exist` in this scope
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr b/src/test/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr
new file mode 100644 (file)
index 0000000..8c032e5
--- /dev/null
@@ -0,0 +1,49 @@
+error: `mut` must be followed by a named binding
+  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:6:13
+   |
+LL |         let mut $eval = ();
+   |             ^^^^^^^^^ help: remove the `mut` prefix: `does_not_exist!()`
+...
+LL |     mac1! { does_not_exist!() }
+   |     --------------------------- in this macro invocation
+   |
+   = note: `mut` may be followed by `variable` and `variable @ pattern`
+   = note: this error originates in the macro `mac1` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected identifier, found `does_not_exist!()`
+  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:17
+   |
+LL |         let mut $eval = ();
+   |                 ^^^^^ expected identifier
+...
+LL |     mac2! { does_not_exist!() }
+   |     --------------------------- in this macro invocation
+   |
+   = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: `mut` must be followed by a named binding
+  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:13
+   |
+LL |         let mut $eval = ();
+   |             ^^^ help: remove the `mut` prefix: `does_not_exist!()`
+...
+LL |     mac2! { does_not_exist!() }
+   |     --------------------------- in this macro invocation
+   |
+   = note: `mut` may be followed by `variable` and `variable @ pattern`
+   = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: cannot find macro `does_not_exist` in this scope
+  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:22:13
+   |
+LL |     mac2! { does_not_exist!() }
+   |             ^^^^^^^^^^^^^^
+
+error: cannot find macro `does_not_exist` in this scope
+  --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:20:13
+   |
+LL |     mac1! { does_not_exist!() }
+   |             ^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs b/src/test/ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs
new file mode 100644 (file)
index 0000000..c1826f8
--- /dev/null
@@ -0,0 +1,21 @@
+fn main() {
+    auto n = 0;//~ ERROR invalid variable declaration
+    //~^ HELP write `let` instead of `auto` to introduce a new variable
+    auto m;//~ ERROR invalid variable declaration
+    //~^ HELP write `let` instead of `auto` to introduce a new variable
+    m = 0;
+
+    var n = 0;//~ ERROR invalid variable declaration
+    //~^ HELP write `let` instead of `var` to introduce a new variable
+    var m;//~ ERROR invalid variable declaration
+    //~^ HELP write `let` instead of `var` to introduce a new variable
+    m = 0;
+
+    mut n = 0;//~ ERROR invalid variable declaration
+    //~^ HELP missing keyword
+    mut var;//~ ERROR invalid variable declaration
+    //~^ HELP missing keyword
+    var = 0;
+
+    let _recovery_witness: () = 0; //~ ERROR mismatched types
+}
diff --git a/src/test/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/src/test/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr
new file mode 100644 (file)
index 0000000..0a88dd2
--- /dev/null
@@ -0,0 +1,67 @@
+error: invalid variable declaration
+  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:2:5
+   |
+LL |     auto n = 0;
+   |     ^^^^
+   |
+help: write `let` instead of `auto` to introduce a new variable
+   |
+LL |     let n = 0;
+   |     ~~~
+
+error: invalid variable declaration
+  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:4:5
+   |
+LL |     auto m;
+   |     ^^^^
+   |
+help: write `let` instead of `auto` to introduce a new variable
+   |
+LL |     let m;
+   |     ~~~
+
+error: invalid variable declaration
+  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:8:5
+   |
+LL |     var n = 0;
+   |     ^^^
+   |
+help: write `let` instead of `var` to introduce a new variable
+   |
+LL |     let n = 0;
+   |     ~~~
+
+error: invalid variable declaration
+  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:10:5
+   |
+LL |     var m;
+   |     ^^^
+   |
+help: write `let` instead of `var` to introduce a new variable
+   |
+LL |     let m;
+   |     ~~~
+
+error: invalid variable declaration
+  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:14:5
+   |
+LL |     mut n = 0;
+   |     ^^^ help: missing keyword: `let mut`
+
+error: invalid variable declaration
+  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5
+   |
+LL |     mut var;
+   |     ^^^ help: missing keyword: `let mut`
+
+error[E0308]: mismatched types
+  --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33
+   |
+LL |     let _recovery_witness: () = 0;
+   |                            --   ^ expected `()`, found integer
+   |                            |
+   |                            expected due to this
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issues/issue-65846-rollback-gating-failing-matcher.rs b/src/test/ui/parser/issues/issue-65846-rollback-gating-failing-matcher.rs
new file mode 100644 (file)
index 0000000..9d68a7b
--- /dev/null
@@ -0,0 +1,14 @@
+// run-pass
+
+// Test that failing macro matchers will not cause pre-expansion errors
+// even though they use a feature that is pre-expansion gated.
+
+macro_rules! m {
+    ($e:expr) => { 0 }; // This fails on the input below due to `, foo`.
+    ($e:expr,) => { 1 }; // This also fails to match due to `foo`.
+    (box $e:expr, foo) => { 2 }; // Successful matcher, we should get `2`.
+}
+
+fn main() {
+    assert_eq!(2, m!(box 42, foo));
+}
diff --git a/src/test/ui/parser/issues/issue-6610.rs b/src/test/ui/parser/issues/issue-6610.rs
new file mode 100644 (file)
index 0000000..9ed5a61
--- /dev/null
@@ -0,0 +1,3 @@
+trait Foo { fn a() } //~ ERROR expected one of `->`, `;`, `where`, or `{`, found `}`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-6610.stderr b/src/test/ui/parser/issues/issue-6610.stderr
new file mode 100644 (file)
index 0000000..4a3bc75
--- /dev/null
@@ -0,0 +1,10 @@
+error: expected one of `->`, `;`, `where`, or `{`, found `}`
+  --> $DIR/issue-6610.rs:1:20
+   |
+LL | trait Foo { fn a() }
+   |                -   ^ expected one of `->`, `;`, `where`, or `{`
+   |                |
+   |                while parsing this `fn`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-66357-unexpected-unreachable.rs b/src/test/ui/parser/issues/issue-66357-unexpected-unreachable.rs
new file mode 100644 (file)
index 0000000..aed428b
--- /dev/null
@@ -0,0 +1,14 @@
+// The problem in #66357 was that the call trace:
+//
+// - parse_fn_block_decl
+// - expect_or
+// - unexpected
+// - expect_one_of
+// - expected_one_of_not_found
+// - recover_closing_delimiter
+//
+// ended up bubbling up `Ok(true)` to `unexpected` which then used `unreachable!()`.
+
+fn f() { |[](* }
+//~^ ERROR expected one of `,` or `:`, found `(`
+//~| ERROR expected one of `&`, `(`, `)`, `-`, `...`, `..=`, `..`, `[`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*`
diff --git a/src/test/ui/parser/issues/issue-66357-unexpected-unreachable.stderr b/src/test/ui/parser/issues/issue-66357-unexpected-unreachable.stderr
new file mode 100644 (file)
index 0000000..6cbab85
--- /dev/null
@@ -0,0 +1,16 @@
+error: expected one of `,` or `:`, found `(`
+  --> $DIR/issue-66357-unexpected-unreachable.rs:12:13
+   |
+LL | fn f() { |[](* }
+   |             ^ expected one of `,` or `:`
+
+error: expected one of `&`, `(`, `)`, `-`, `...`, `..=`, `..`, `[`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*`
+  --> $DIR/issue-66357-unexpected-unreachable.rs:12:13
+   |
+LL | fn f() { |[](* }
+   |             ^^ help: `)` may belong here
+   |             |
+   |             unclosed delimiter
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-66473.rs b/src/test/ui/parser/issues/issue-66473.rs
new file mode 100644 (file)
index 0000000..9db4521
Binary files /dev/null and b/src/test/ui/parser/issues/issue-66473.rs differ
diff --git a/src/test/ui/parser/issues/issue-66473.stderr b/src/test/ui/parser/issues/issue-66473.stderr
new file mode 100644 (file)
index 0000000..8a16d7f
Binary files /dev/null and b/src/test/ui/parser/issues/issue-66473.stderr differ
diff --git a/src/test/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed b/src/test/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed
new file mode 100644 (file)
index 0000000..95019b2
--- /dev/null
@@ -0,0 +1,14 @@
+// run-rustfix
+
+// In this regression test for #67146, we check that the
+// negative outlives bound `!'a` is rejected by the parser.
+// This regression was first introduced in PR #57364.
+
+fn main() {}
+
+pub fn f1<T>() {}
+//~^ ERROR negative bounds are not supported
+pub fn f2<'a, T: Ord>() {}
+//~^ ERROR negative bounds are not supported
+pub fn f3<'a, T: Ord>() {}
+//~^ ERROR negative bounds are not supported
diff --git a/src/test/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs b/src/test/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs
new file mode 100644 (file)
index 0000000..82f54f8
--- /dev/null
@@ -0,0 +1,14 @@
+// run-rustfix
+
+// In this regression test for #67146, we check that the
+// negative outlives bound `!'a` is rejected by the parser.
+// This regression was first introduced in PR #57364.
+
+fn main() {}
+
+pub fn f1<T: !'static>() {}
+//~^ ERROR negative bounds are not supported
+pub fn f2<'a, T: Ord + !'a>() {}
+//~^ ERROR negative bounds are not supported
+pub fn f3<'a, T: !'a + Ord>() {}
+//~^ ERROR negative bounds are not supported
diff --git a/src/test/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr b/src/test/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr
new file mode 100644 (file)
index 0000000..a4a4229
--- /dev/null
@@ -0,0 +1,20 @@
+error: negative bounds are not supported
+  --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:12
+   |
+LL | pub fn f1<T: !'static>() {}
+   |            ^^^^^^^^^^ negative bounds are not supported
+
+error: negative bounds are not supported
+  --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:11:22
+   |
+LL | pub fn f2<'a, T: Ord + !'a>() {}
+   |                      ^^^^^ negative bounds are not supported
+
+error: negative bounds are not supported
+  --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:13:16
+   |
+LL | pub fn f3<'a, T: !'a + Ord>() {}
+   |                ^^^^^ negative bounds are not supported
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs
new file mode 100644 (file)
index 0000000..87222ef
--- /dev/null
@@ -0,0 +1,35 @@
+mod a {
+    use std::marker::PhantomData;
+
+    enum Bug {
+        V = [PhantomData; { [ () ].len() ].len() as isize,
+        //~^ ERROR mismatched closing delimiter: `]`
+        //~| ERROR mismatched closing delimiter: `]`
+        //~| ERROR mismatched closing delimiter: `]`
+        //~| ERROR mismatched closing delimiter: `]`
+    }
+}
+
+mod b {
+    enum Bug {
+        V = [Vec::new; { [].len()  ].len() as isize,
+        //~^ ERROR mismatched closing delimiter: `]`
+        //~| ERROR mismatched closing delimiter: `]`
+        //~| ERROR mismatched closing delimiter: `]`
+        //~| ERROR mismatched closing delimiter: `]`
+        //~| ERROR type annotations needed
+    }
+}
+
+mod c {
+    enum Bug {
+        V = [Vec::new; { [0].len() ].len() as isize,
+        //~^ ERROR mismatched closing delimiter: `]`
+        //~| ERROR mismatched closing delimiter: `]`
+        //~| ERROR mismatched closing delimiter: `]`
+        //~| ERROR mismatched closing delimiter: `]`
+        //~| ERROR type annotations needed
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
new file mode 100644 (file)
index 0000000..34f1397
--- /dev/null
@@ -0,0 +1,123 @@
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27
+   |
+LL |         V = [PhantomData; { [ () ].len() ].len() as isize,
+   |             -             ^              ^ mismatched closing delimiter
+   |             |             |
+   |             |             unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24
+   |
+LL |         V = [Vec::new; { [].len()  ].len() as isize,
+   |             -          ^           ^ mismatched closing delimiter
+   |             |          |
+   |             |          unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24
+   |
+LL |         V = [Vec::new; { [0].len() ].len() as isize,
+   |             -          ^           ^ mismatched closing delimiter
+   |             |          |
+   |             |          unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27
+   |
+LL |         V = [PhantomData; { [ () ].len() ].len() as isize,
+   |             -             ^              ^ mismatched closing delimiter
+   |             |             |
+   |             |             unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24
+   |
+LL |         V = [Vec::new; { [].len()  ].len() as isize,
+   |             -          ^           ^ mismatched closing delimiter
+   |             |          |
+   |             |          unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24
+   |
+LL |         V = [Vec::new; { [0].len() ].len() as isize,
+   |             -          ^           ^ mismatched closing delimiter
+   |             |          |
+   |             |          unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27
+   |
+LL |         V = [PhantomData; { [ () ].len() ].len() as isize,
+   |             -             ^              ^ mismatched closing delimiter
+   |             |             |
+   |             |             unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24
+   |
+LL |         V = [Vec::new; { [].len()  ].len() as isize,
+   |             -          ^           ^ mismatched closing delimiter
+   |             |          |
+   |             |          unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24
+   |
+LL |         V = [Vec::new; { [0].len() ].len() as isize,
+   |             -          ^           ^ mismatched closing delimiter
+   |             |          |
+   |             |          unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27
+   |
+LL |         V = [PhantomData; { [ () ].len() ].len() as isize,
+   |             -             ^              ^ mismatched closing delimiter
+   |             |             |
+   |             |             unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24
+   |
+LL |         V = [Vec::new; { [].len()  ].len() as isize,
+   |             -          ^           ^ mismatched closing delimiter
+   |             |          |
+   |             |          unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error: mismatched closing delimiter: `]`
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24
+   |
+LL |         V = [Vec::new; { [0].len() ].len() as isize,
+   |             -          ^           ^ mismatched closing delimiter
+   |             |          |
+   |             |          unclosed delimiter
+   |             closing delimiter possibly meant for this
+
+error[E0282]: type annotations needed
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:29
+   |
+LL |         V = [Vec::new; { [].len()  ].len() as isize,
+   |                             ^^^ cannot infer type for type parameter `T`
+
+error[E0282]: type annotations needed
+  --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14
+   |
+LL |         V = [Vec::new; { [0].len() ].len() as isize,
+   |              ^^^^^^^^ cannot infer type for type parameter `T`
+
+error: aborting due to 14 previous errors
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.rs b/src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.rs
new file mode 100644 (file)
index 0000000..3c49a5a
--- /dev/null
@@ -0,0 +1,6 @@
+pub struct Foo {
+    pub bar: Vec<i32>ö
+    //~^ ERROR expected `,`, or `}`, found `ö`
+} //~ ERROR expected `:`, found `}`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr b/src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr
new file mode 100644 (file)
index 0000000..ef365a6
--- /dev/null
@@ -0,0 +1,17 @@
+error: expected `,`, or `}`, found `ö`
+  --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:2:22
+   |
+LL |     pub bar: Vec<i32>ö
+   |                      ^ help: try adding a comma: `,`
+
+error: expected `:`, found `}`
+  --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:4:1
+   |
+LL |     pub bar: Vec<i32>ö
+   |                       - expected `:`
+LL |
+LL | }
+   | ^ unexpected token
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-68629.rs b/src/test/ui/parser/issues/issue-68629.rs
new file mode 100644 (file)
index 0000000..672a31f
Binary files /dev/null and b/src/test/ui/parser/issues/issue-68629.rs differ
diff --git a/src/test/ui/parser/issues/issue-68629.stderr b/src/test/ui/parser/issues/issue-68629.stderr
new file mode 100644 (file)
index 0000000..b2c7ddd
Binary files /dev/null and b/src/test/ui/parser/issues/issue-68629.stderr differ
diff --git a/src/test/ui/parser/issues/issue-68730.rs b/src/test/ui/parser/issues/issue-68730.rs
new file mode 100644 (file)
index 0000000..20e18b4
Binary files /dev/null and b/src/test/ui/parser/issues/issue-68730.rs differ
diff --git a/src/test/ui/parser/issues/issue-68730.stderr b/src/test/ui/parser/issues/issue-68730.stderr
new file mode 100644 (file)
index 0000000..6585a19
Binary files /dev/null and b/src/test/ui/parser/issues/issue-68730.stderr differ
diff --git a/src/test/ui/parser/issues/issue-68788-in-trait-item-propagation.rs b/src/test/ui/parser/issues/issue-68788-in-trait-item-propagation.rs
new file mode 100644 (file)
index 0000000..7c3dd1d
--- /dev/null
@@ -0,0 +1,21 @@
+// Make sure we don't propagate restrictions on trait impl items to items inside them.
+
+// check-pass
+// edition:2018
+
+fn main() {}
+
+trait X {
+    fn foo();
+}
+
+impl X for () {
+    fn foo() {
+        struct S;
+        impl S {
+            pub const X: u8 = 0;
+            pub const fn bar() {}
+            async fn qux() {}
+        }
+    }
+}
diff --git a/src/test/ui/parser/issues/issue-68890-2.rs b/src/test/ui/parser/issues/issue-68890-2.rs
new file mode 100644 (file)
index 0000000..0a6e26a
--- /dev/null
@@ -0,0 +1,7 @@
+fn main() {}
+
+type X<'a> = (?'a) +;
+//~^ ERROR `?` may only modify trait bounds, not lifetime bounds
+//~| ERROR at least one trait is required for an object type
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition
diff --git a/src/test/ui/parser/issues/issue-68890-2.stderr b/src/test/ui/parser/issues/issue-68890-2.stderr
new file mode 100644 (file)
index 0000000..1a64b9a
--- /dev/null
@@ -0,0 +1,25 @@
+error: `?` may only modify trait bounds, not lifetime bounds
+  --> $DIR/issue-68890-2.rs:3:15
+   |
+LL | type X<'a> = (?'a) +;
+   |               ^
+
+warning: trait objects without an explicit `dyn` are deprecated
+  --> $DIR/issue-68890-2.rs:3:14
+   |
+LL | type X<'a> = (?'a) +;
+   |              ^^^^^^^ help: use `dyn`: `dyn (?'a) +`
+   |
+   = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+
+error[E0224]: at least one trait is required for an object type
+  --> $DIR/issue-68890-2.rs:3:14
+   |
+LL | type X<'a> = (?'a) +;
+   |              ^^^^^^^
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0224`.
diff --git a/src/test/ui/parser/issues/issue-68890.rs b/src/test/ui/parser/issues/issue-68890.rs
new file mode 100644 (file)
index 0000000..bab4ed7
--- /dev/null
@@ -0,0 +1,4 @@
+enum e{A((?'a a+?+l))}
+//~^ ERROR `?` may only modify trait bounds, not lifetime bounds
+//~| ERROR expected one of `)`, `+`, or `,`
+//~| ERROR expected item, found `)`
diff --git a/src/test/ui/parser/issues/issue-68890.stderr b/src/test/ui/parser/issues/issue-68890.stderr
new file mode 100644 (file)
index 0000000..2a3bf6b
--- /dev/null
@@ -0,0 +1,20 @@
+error: `?` may only modify trait bounds, not lifetime bounds
+  --> $DIR/issue-68890.rs:1:11
+   |
+LL | enum e{A((?'a a+?+l))}
+   |           ^
+
+error: expected one of `)`, `+`, or `,`, found `a`
+  --> $DIR/issue-68890.rs:1:15
+   |
+LL | enum e{A((?'a a+?+l))}
+   |               ^ expected one of `)`, `+`, or `,`
+
+error: expected item, found `)`
+  --> $DIR/issue-68890.rs:1:21
+   |
+LL | enum e{A((?'a a+?+l))}
+   |                     ^ expected item
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-70050-ntliteral-accepts-negated-lit.rs b/src/test/ui/parser/issues/issue-70050-ntliteral-accepts-negated-lit.rs
new file mode 100644 (file)
index 0000000..aca9d9e
--- /dev/null
@@ -0,0 +1,16 @@
+// check-pass
+
+macro_rules! foo {
+    ($a:literal) => {
+        bar!($a)
+    };
+}
+
+macro_rules! bar {
+    ($b:literal) => {};
+}
+
+fn main() {
+    foo!(-2);
+    bar!(-2);
+}
diff --git a/src/test/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.rs b/src/test/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.rs
new file mode 100644 (file)
index 0000000..ca8abd7
--- /dev/null
@@ -0,0 +1,7 @@
+struct Foo(i32);
+
+fn main() {
+    let Foo(...) = Foo(0); //~ ERROR unexpected `...`
+    let [_, ..., _] = [0, 1]; //~ ERROR unexpected `...`
+    let _recovery_witness: () = 0; //~ ERROR mismatched types
+}
diff --git a/src/test/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.stderr b/src/test/ui/parser/issues/issue-70388-recover-dotdotdot-rest-pat.stderr
new file mode 100644 (file)
index 0000000..4961e8f
--- /dev/null
@@ -0,0 +1,29 @@
+error: unexpected `...`
+  --> $DIR/issue-70388-recover-dotdotdot-rest-pat.rs:4:13
+   |
+LL |     let Foo(...) = Foo(0);
+   |             ^^^
+   |             |
+   |             not a valid pattern
+   |             help: for a rest pattern, use `..` instead of `...`
+
+error: unexpected `...`
+  --> $DIR/issue-70388-recover-dotdotdot-rest-pat.rs:5:13
+   |
+LL |     let [_, ..., _] = [0, 1];
+   |             ^^^
+   |             |
+   |             not a valid pattern
+   |             help: for a rest pattern, use `..` instead of `...`
+
+error[E0308]: mismatched types
+  --> $DIR/issue-70388-recover-dotdotdot-rest-pat.rs:6:33
+   |
+LL |     let _recovery_witness: () = 0;
+   |                            --   ^ expected `()`, found integer
+   |                            |
+   |                            expected due to this
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issues/issue-70388-without-witness.fixed b/src/test/ui/parser/issues/issue-70388-without-witness.fixed
new file mode 100644 (file)
index 0000000..464e78f
--- /dev/null
@@ -0,0 +1,9 @@
+// run-rustfix
+// This is for checking if we can apply suggestions as-is.
+
+pub struct Foo(i32);
+
+fn main() {
+    let Foo(..) = Foo(0); //~ ERROR unexpected `...`
+    let [_, .., _] = [0, 1]; //~ ERROR unexpected `...`
+}
diff --git a/src/test/ui/parser/issues/issue-70388-without-witness.rs b/src/test/ui/parser/issues/issue-70388-without-witness.rs
new file mode 100644 (file)
index 0000000..9e35e4c
--- /dev/null
@@ -0,0 +1,9 @@
+// run-rustfix
+// This is for checking if we can apply suggestions as-is.
+
+pub struct Foo(i32);
+
+fn main() {
+    let Foo(...) = Foo(0); //~ ERROR unexpected `...`
+    let [_, ..., _] = [0, 1]; //~ ERROR unexpected `...`
+}
diff --git a/src/test/ui/parser/issues/issue-70388-without-witness.stderr b/src/test/ui/parser/issues/issue-70388-without-witness.stderr
new file mode 100644 (file)
index 0000000..b750ad4
--- /dev/null
@@ -0,0 +1,20 @@
+error: unexpected `...`
+  --> $DIR/issue-70388-without-witness.rs:7:13
+   |
+LL |     let Foo(...) = Foo(0);
+   |             ^^^
+   |             |
+   |             not a valid pattern
+   |             help: for a rest pattern, use `..` instead of `...`
+
+error: unexpected `...`
+  --> $DIR/issue-70388-without-witness.rs:8:13
+   |
+LL |     let [_, ..., _] = [0, 1];
+   |             ^^^
+   |             |
+   |             not a valid pattern
+   |             help: for a rest pattern, use `..` instead of `...`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.rs b/src/test/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.rs
new file mode 100644 (file)
index 0000000..aeccd0d
--- /dev/null
@@ -0,0 +1,18 @@
+struct S {}
+
+impl S {
+    fn foo(&mur Self) {}
+    //~^ ERROR expected identifier, found keyword `Self`
+    //~| ERROR expected one of `:`, `@`
+    //~| ERROR the `Self` constructor can only be used with
+    fn bar(&'static mur Self) {}
+    //~^ ERROR unexpected lifetime
+    //~| ERROR expected identifier, found keyword `Self`
+    //~| ERROR expected one of `:`, `@`
+    //~| ERROR the `Self` constructor can only be used with
+
+    fn baz(&mur Self @ _) {}
+    //~^ ERROR expected one of `:`, `@`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr b/src/test/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr
new file mode 100644 (file)
index 0000000..421f145
--- /dev/null
@@ -0,0 +1,56 @@
+error: expected identifier, found keyword `Self`
+  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17
+   |
+LL |     fn foo(&mur Self) {}
+   |                 ^^^^ expected identifier, found keyword
+
+error: expected one of `:`, `@`, or `|`, found keyword `Self`
+  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17
+   |
+LL |     fn foo(&mur Self) {}
+   |            -----^^^^
+   |            |    |
+   |            |    expected one of `:`, `@`, or `|`
+   |            help: declare the type after the parameter binding: `<identifier>: <type>`
+
+error: unexpected lifetime `'static` in pattern
+  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:13
+   |
+LL |     fn bar(&'static mur Self) {}
+   |             ^^^^^^^ help: remove the lifetime
+
+error: expected identifier, found keyword `Self`
+  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25
+   |
+LL |     fn bar(&'static mur Self) {}
+   |                         ^^^^ expected identifier, found keyword
+
+error: expected one of `:`, `@`, or `|`, found keyword `Self`
+  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25
+   |
+LL |     fn bar(&'static mur Self) {}
+   |            -------------^^^^
+   |            |            |
+   |            |            expected one of `:`, `@`, or `|`
+   |            help: declare the type after the parameter binding: `<identifier>: <type>`
+
+error: expected one of `:`, `@`, or `|`, found keyword `Self`
+  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:14:17
+   |
+LL |     fn baz(&mur Self @ _) {}
+   |                 ^^^^ expected one of `:`, `@`, or `|`
+
+error: the `Self` constructor can only be used with tuple or unit structs
+  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17
+   |
+LL |     fn foo(&mur Self) {}
+   |                 ^^^^ help: use curly brackets: `Self { /* fields */ }`
+
+error: the `Self` constructor can only be used with tuple or unit structs
+  --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25
+   |
+LL |     fn bar(&'static mur Self) {}
+   |                         ^^^^ help: use curly brackets: `Self { /* fields */ }`
+
+error: aborting due to 8 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-70552-ascription-in-parens-after-call.rs b/src/test/ui/parser/issues/issue-70552-ascription-in-parens-after-call.rs
new file mode 100644 (file)
index 0000000..9b6dd7d
--- /dev/null
@@ -0,0 +1,3 @@
+fn main() {
+    expr as fun()(:); //~ ERROR expected expression
+}
diff --git a/src/test/ui/parser/issues/issue-70552-ascription-in-parens-after-call.stderr b/src/test/ui/parser/issues/issue-70552-ascription-in-parens-after-call.stderr
new file mode 100644 (file)
index 0000000..f03c92e
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected expression, found `:`
+  --> $DIR/issue-70552-ascription-in-parens-after-call.rs:2:19
+   |
+LL |     expr as fun()(:);
+   |                   ^ expected expression
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-70583-block-is-empty-1.rs b/src/test/ui/parser/issues/issue-70583-block-is-empty-1.rs
new file mode 100644 (file)
index 0000000..f560f68
--- /dev/null
@@ -0,0 +1,20 @@
+pub enum ErrorHandled {
+    Reported,
+    TooGeneric,
+}
+
+impl ErrorHandled {
+    pub fn assert_reported(self) {
+        match self {
+            ErrorHandled::Reported => {}
+            ErrorHandled::TooGeneric => panic!(),
+        }
+    }
+}
+
+fn struct_generic(x: Vec<i32>) {
+    for v in x {
+        println!("{}", v);
+    }
+    }
+} //~ ERROR unexpected closing delimiter: `}`
diff --git a/src/test/ui/parser/issues/issue-70583-block-is-empty-1.stderr b/src/test/ui/parser/issues/issue-70583-block-is-empty-1.stderr
new file mode 100644 (file)
index 0000000..39bf113
--- /dev/null
@@ -0,0 +1,13 @@
+error: unexpected closing delimiter: `}`
+  --> $DIR/issue-70583-block-is-empty-1.rs:20:1
+   |
+LL | fn struct_generic(x: Vec<i32>) {
+   |                                - this opening brace...
+...
+LL |     }
+   |     - ...matches this closing brace
+LL | }
+   | ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-70583-block-is-empty-2.rs b/src/test/ui/parser/issues/issue-70583-block-is-empty-2.rs
new file mode 100644 (file)
index 0000000..80f5333
--- /dev/null
@@ -0,0 +1,14 @@
+pub enum ErrorHandled {
+    Reported,
+    TooGeneric,
+}
+
+impl ErrorHandled {
+    pub fn assert_reported(self) {
+        match self {
+            ErrorHandled::Reported => {}}
+                                     //^~ ERROR block is empty, you might have not meant to close it
+            ErrorHandled::TooGeneric => panic!(),
+        }
+    }
+} //~ ERROR unexpected closing delimiter: `}`
diff --git a/src/test/ui/parser/issues/issue-70583-block-is-empty-2.stderr b/src/test/ui/parser/issues/issue-70583-block-is-empty-2.stderr
new file mode 100644 (file)
index 0000000..5d37b21
--- /dev/null
@@ -0,0 +1,11 @@
+error: unexpected closing delimiter: `}`
+  --> $DIR/issue-70583-block-is-empty-2.rs:14:1
+   |
+LL |             ErrorHandled::Reported => {}}
+   |                                       -- block is empty, you might have not meant to close it
+...
+LL | }
+   | ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-7222.rs b/src/test/ui/parser/issues/issue-7222.rs
new file mode 100644 (file)
index 0000000..6490731
--- /dev/null
@@ -0,0 +1,12 @@
+// run-pass
+// pretty-expanded FIXME #23616
+#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620
+
+pub fn main() {
+    const FOO: f64 = 10.0;
+
+    match 0.0 {
+        0.0 ..= FOO => (),
+        _ => ()
+    }
+}
diff --git a/src/test/ui/parser/issues/issue-72253.rs b/src/test/ui/parser/issues/issue-72253.rs
new file mode 100644 (file)
index 0000000..1446a79
--- /dev/null
@@ -0,0 +1,6 @@
+fn main() {
+    let a = std::process::Command::new("echo")
+        .arg("1")
+        ,arg("2") //~ ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `,`
+        .output();
+}
diff --git a/src/test/ui/parser/issues/issue-72253.stderr b/src/test/ui/parser/issues/issue-72253.stderr
new file mode 100644 (file)
index 0000000..477fa09
--- /dev/null
@@ -0,0 +1,10 @@
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `,`
+  --> $DIR/issue-72253.rs:4:9
+   |
+LL |         .arg("1")
+   |                  - expected one of `.`, `;`, `?`, `else`, or an operator
+LL |         ,arg("2")
+   |         ^ unexpected token
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-72373.rs b/src/test/ui/parser/issues/issue-72373.rs
new file mode 100644 (file)
index 0000000..4da6061
--- /dev/null
@@ -0,0 +1,9 @@
+fn foo(c: &[u32], n: u32) -> u32 {
+    match *c {
+        [h, ..] if h > n => 0,
+        [h, ..] if h == n => 1,
+        [h, ref ts..] => foo(c, n - h) + foo(ts, n),
+        //~^ ERROR expected one of `,`, `@`, `]`, or `|`, found `..`
+        [] => 0,
+    }
+}
diff --git a/src/test/ui/parser/issues/issue-72373.stderr b/src/test/ui/parser/issues/issue-72373.stderr
new file mode 100644 (file)
index 0000000..0bb99a0
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected one of `,`, `@`, `]`, or `|`, found `..`
+  --> $DIR/issue-72373.rs:5:19
+   |
+LL |         [h, ref ts..] => foo(c, n - h) + foo(ts, n),
+   |                   ^^ expected one of `,`, `@`, `]`, or `|`
+   |
+help: if you meant to bind the contents of the rest of the array pattern into `ts`, use `@`
+   |
+LL |         [h, ref ts @ ..] => foo(c, n - h) + foo(ts, n),
+   |                    +
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.rs b/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.rs
new file mode 100644 (file)
index 0000000..e68ee74
--- /dev/null
@@ -0,0 +1,23 @@
+#![crate_type="lib"]
+fn x<'a>(x: &mut 'a i32){} //~ ERROR lifetime must precede `mut`
+
+macro_rules! mac {
+    ($lt:lifetime) => {
+        fn w<$lt>(w: &mut $lt i32) {}
+        //~^ ERROR lifetime must precede `mut`
+    }
+}
+
+mac!('a);
+
+// avoid false positives
+fn y<'a>(y: &mut 'a + Send) {
+    //~^ ERROR expected a path on the left-hand side of `+`, not `&mut 'a`
+    //~| WARNING trait objects without an explicit `dyn` are deprecated
+    //~| WARN this is accepted in the current edition
+    //~| ERROR at least one trait is required for an object type
+    let z = y as &mut 'a + Send;
+    //~^ ERROR expected value, found trait `Send`
+    //~| WARNING trait objects without an explicit `dyn` are deprecated
+    //~| WARN this is accepted in the current edition
+}
diff --git a/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.stderr b/src/test/ui/parser/issues/issue-73568-lifetime-after-mut.stderr
new file mode 100644 (file)
index 0000000..48c2b2a
--- /dev/null
@@ -0,0 +1,58 @@
+error: lifetime must precede `mut`
+  --> $DIR/issue-73568-lifetime-after-mut.rs:2:13
+   |
+LL | fn x<'a>(x: &mut 'a i32){}
+   |             ^^^^^^^ help: place the lifetime before `mut`: `&'a mut`
+
+error[E0178]: expected a path on the left-hand side of `+`, not `&mut 'a`
+  --> $DIR/issue-73568-lifetime-after-mut.rs:14:13
+   |
+LL | fn y<'a>(y: &mut 'a + Send) {
+   |             ^^^^^^^^^^^^^^ help: try adding parentheses: `&mut ('a + Send)`
+
+error: lifetime must precede `mut`
+  --> $DIR/issue-73568-lifetime-after-mut.rs:6:22
+   |
+LL |         fn w<$lt>(w: &mut $lt i32) {}
+   |                      ^^^^^^^^ help: place the lifetime before `mut`: `&$lt mut`
+...
+LL | mac!('a);
+   | -------- in this macro invocation
+   |
+   = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0423]: expected value, found trait `Send`
+  --> $DIR/issue-73568-lifetime-after-mut.rs:19:28
+   |
+LL |     let z = y as &mut 'a + Send;
+   |                            ^^^^ not a value
+
+warning: trait objects without an explicit `dyn` are deprecated
+  --> $DIR/issue-73568-lifetime-after-mut.rs:14:18
+   |
+LL | fn y<'a>(y: &mut 'a + Send) {
+   |                  ^^ help: use `dyn`: `dyn 'a`
+   |
+   = note: `#[warn(bare_trait_objects)]` on by default
+   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+
+warning: trait objects without an explicit `dyn` are deprecated
+  --> $DIR/issue-73568-lifetime-after-mut.rs:19:23
+   |
+LL |     let z = y as &mut 'a + Send;
+   |                       ^^ help: use `dyn`: `dyn 'a`
+   |
+   = 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>
+
+error[E0224]: at least one trait is required for an object type
+  --> $DIR/issue-73568-lifetime-after-mut.rs:14:18
+   |
+LL | fn y<'a>(y: &mut 'a + Send) {
+   |                  ^^
+
+error: aborting due to 5 previous errors; 2 warnings emitted
+
+Some errors have detailed explanations: E0178, E0224, E0423.
+For more information about an error, try `rustc --explain E0178`.
diff --git a/src/test/ui/parser/issues/issue-75599.rs b/src/test/ui/parser/issues/issue-75599.rs
new file mode 100644 (file)
index 0000000..0857676
--- /dev/null
@@ -0,0 +1,24 @@
+// check-pass
+#![allow(non_upper_case_globals)]
+
+const or: usize = 1;
+const and: usize = 2;
+
+mod or {
+    pub const X: usize = 3;
+}
+
+mod and {
+    pub const X: usize = 4;
+}
+
+fn main() {
+    match 0 {
+        0 => {}
+        or => {}
+        and => {}
+        or::X => {}
+        and::X => {}
+        _ => {}
+    }
+}
diff --git a/src/test/ui/parser/issues/issue-76437-async.rs b/src/test/ui/parser/issues/issue-76437-async.rs
new file mode 100644 (file)
index 0000000..84ee3dd
--- /dev/null
@@ -0,0 +1,7 @@
+// edition:2018
+
+mod t {
+    async pub fn t() {}
+    //~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `pub`
+    //~| HELP visibility `pub` must come before `async`
+}
diff --git a/src/test/ui/parser/issues/issue-76437-async.stderr b/src/test/ui/parser/issues/issue-76437-async.stderr
new file mode 100644 (file)
index 0000000..2c9c2a8
--- /dev/null
@@ -0,0 +1,11 @@
+error: expected one of `extern`, `fn`, or `unsafe`, found keyword `pub`
+  --> $DIR/issue-76437-async.rs:4:11
+   |
+LL |     async pub fn t() {}
+   |     ------^^^
+   |     |     |
+   |     |     expected one of `extern`, `fn`, or `unsafe`
+   |     help: visibility `pub` must come before `async`: `pub async`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-76437-const-async-unsafe.rs b/src/test/ui/parser/issues/issue-76437-const-async-unsafe.rs
new file mode 100644 (file)
index 0000000..f1e06e4
--- /dev/null
@@ -0,0 +1,7 @@
+// edition:2018
+
+mod t {
+    const async unsafe pub fn t() {}
+    //~^ ERROR expected one of `extern` or `fn`, found keyword `pub`
+    //~| HELP visibility `pub` must come before `const async unsafe`
+}
diff --git a/src/test/ui/parser/issues/issue-76437-const-async-unsafe.stderr b/src/test/ui/parser/issues/issue-76437-const-async-unsafe.stderr
new file mode 100644 (file)
index 0000000..2e91bed
--- /dev/null
@@ -0,0 +1,11 @@
+error: expected one of `extern` or `fn`, found keyword `pub`
+  --> $DIR/issue-76437-const-async-unsafe.rs:4:24
+   |
+LL |     const async unsafe pub fn t() {}
+   |     -------------------^^^
+   |     |                  |
+   |     |                  expected one of `extern` or `fn`
+   |     help: visibility `pub` must come before `const async unsafe`: `pub const async unsafe`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-76437-const-async.rs b/src/test/ui/parser/issues/issue-76437-const-async.rs
new file mode 100644 (file)
index 0000000..3c789fd
--- /dev/null
@@ -0,0 +1,7 @@
+// edition:2018
+
+mod t {
+    const async pub fn t() {}
+    //~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `pub`
+    //~| HELP visibility `pub` must come before `const async`
+}
diff --git a/src/test/ui/parser/issues/issue-76437-const-async.stderr b/src/test/ui/parser/issues/issue-76437-const-async.stderr
new file mode 100644 (file)
index 0000000..21b96c1
--- /dev/null
@@ -0,0 +1,11 @@
+error: expected one of `extern`, `fn`, or `unsafe`, found keyword `pub`
+  --> $DIR/issue-76437-const-async.rs:4:17
+   |
+LL |     const async pub fn t() {}
+   |     ------------^^^
+   |     |           |
+   |     |           expected one of `extern`, `fn`, or `unsafe`
+   |     help: visibility `pub` must come before `const async`: `pub const async`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-76437-const.rs b/src/test/ui/parser/issues/issue-76437-const.rs
new file mode 100644 (file)
index 0000000..d3815a5
--- /dev/null
@@ -0,0 +1,7 @@
+// edition:2018
+
+mod t {
+    const pub fn t() {}
+    //~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+    //~| HELP visibility `pub` must come before `const`
+}
diff --git a/src/test/ui/parser/issues/issue-76437-const.stderr b/src/test/ui/parser/issues/issue-76437-const.stderr
new file mode 100644 (file)
index 0000000..cf80d9a
--- /dev/null
@@ -0,0 +1,11 @@
+error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+  --> $DIR/issue-76437-const.rs:4:11
+   |
+LL |     const pub fn t() {}
+   |     ------^^^
+   |     |     |
+   |     |     expected one of `async`, `extern`, `fn`, or `unsafe`
+   |     help: visibility `pub` must come before `const`: `pub const`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-76437-pub-crate-unsafe.rs b/src/test/ui/parser/issues/issue-76437-pub-crate-unsafe.rs
new file mode 100644 (file)
index 0000000..daa1d12
--- /dev/null
@@ -0,0 +1,7 @@
+// edition:2018
+
+mod t {
+    unsafe pub(crate) fn t() {}
+    //~^ ERROR expected one of `extern` or `fn`, found keyword `pub`
+    //~| HELP visibility `pub(crate)` must come before `unsafe`
+}
diff --git a/src/test/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr b/src/test/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr
new file mode 100644 (file)
index 0000000..fa8f137
--- /dev/null
@@ -0,0 +1,11 @@
+error: expected one of `extern` or `fn`, found keyword `pub`
+  --> $DIR/issue-76437-pub-crate-unsafe.rs:4:12
+   |
+LL |     unsafe pub(crate) fn t() {}
+   |     -------^^^-------
+   |     |      |
+   |     |      expected one of `extern` or `fn`
+   |     help: visibility `pub(crate)` must come before `unsafe`: `pub(crate) unsafe`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-76437-unsafe.rs b/src/test/ui/parser/issues/issue-76437-unsafe.rs
new file mode 100644 (file)
index 0000000..785a79a
--- /dev/null
@@ -0,0 +1,7 @@
+// edition:2018
+
+mod t {
+    unsafe pub fn t() {}
+    //~^ ERROR expected one of `extern` or `fn`, found keyword `pub`
+    //~| HELP visibility `pub` must come before `unsafe`
+}
diff --git a/src/test/ui/parser/issues/issue-76437-unsafe.stderr b/src/test/ui/parser/issues/issue-76437-unsafe.stderr
new file mode 100644 (file)
index 0000000..c63292e
--- /dev/null
@@ -0,0 +1,11 @@
+error: expected one of `extern` or `fn`, found keyword `pub`
+  --> $DIR/issue-76437-unsafe.rs:4:12
+   |
+LL |     unsafe pub fn t() {}
+   |     -------^^^
+   |     |      |
+   |     |      expected one of `extern` or `fn`
+   |     help: visibility `pub` must come before `unsafe`: `pub unsafe`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-76597.fixed b/src/test/ui/parser/issues/issue-76597.fixed
new file mode 100644 (file)
index 0000000..2d7a30b
--- /dev/null
@@ -0,0 +1,11 @@
+// run-rustfix
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+fn f(
+                                     x: u8,
+                                     y: u8,
+) {}
+//~^^ ERROR: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `y`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-76597.rs b/src/test/ui/parser/issues/issue-76597.rs
new file mode 100644 (file)
index 0000000..521b9c6
--- /dev/null
@@ -0,0 +1,11 @@
+// run-rustfix
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+fn f(
+                                     x: u8
+                                     y: u8,
+) {}
+//~^^ ERROR: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `y`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-76597.stderr b/src/test/ui/parser/issues/issue-76597.stderr
new file mode 100644 (file)
index 0000000..50b2332
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `y`
+  --> $DIR/issue-76597.rs:7:38
+   |
+LL | ...                   x: u8
+   |                            -
+   |                            |
+   |                            expected one of 7 possible tokens
+   |                            help: missing `,`
+LL | ...                   y: u8,
+   |                       ^ unexpected token
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-7970b.rs b/src/test/ui/parser/issues/issue-7970b.rs
new file mode 100644 (file)
index 0000000..1c4abce
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {}
+
+macro_rules! test {}
+//~^ ERROR unexpected end of macro invocation
diff --git a/src/test/ui/parser/issues/issue-7970b.stderr b/src/test/ui/parser/issues/issue-7970b.stderr
new file mode 100644 (file)
index 0000000..a62226a
--- /dev/null
@@ -0,0 +1,8 @@
+error: unexpected end of macro invocation
+  --> $DIR/issue-7970b.rs:3:1
+   |
+LL | macro_rules! test {}
+   | ^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-81806.rs b/src/test/ui/parser/issues/issue-81806.rs
new file mode 100644 (file)
index 0000000..ca86788
--- /dev/null
@@ -0,0 +1,5 @@
+trait T { const
+impl //~ ERROR: expected identifier, found keyword `impl`
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-81806.stderr b/src/test/ui/parser/issues/issue-81806.stderr
new file mode 100644 (file)
index 0000000..a62c9b0
--- /dev/null
@@ -0,0 +1,17 @@
+error: expected identifier, found keyword `impl`
+  --> $DIR/issue-81806.rs:2:1
+   |
+LL | trait T { const
+   |         - while parsing this item list starting here
+LL | impl
+   | ^^^^ expected identifier, found keyword
+LL | }
+   | - the item list ends here
+   |
+help: you can escape reserved keywords to use them as identifiers
+   |
+LL | r#impl
+   | ~~~~~~
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-83639.rs b/src/test/ui/parser/issues/issue-83639.rs
new file mode 100644 (file)
index 0000000..6ddbedf
--- /dev/null
@@ -0,0 +1,6 @@
+// check-fail
+// ignore-tidy-tab
+
+fn main() {
+    """        " //~ ERROR
+}
diff --git a/src/test/ui/parser/issues/issue-83639.stderr b/src/test/ui/parser/issues/issue-83639.stderr
new file mode 100644 (file)
index 0000000..4c10df1
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `"    "`
+  --> $DIR/issue-83639.rs:5:7
+   |
+LL |     """    "
+   |       ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-84104.rs b/src/test/ui/parser/issues/issue-84104.rs
new file mode 100644 (file)
index 0000000..998949b
--- /dev/null
@@ -0,0 +1,3 @@
+// error-pattern: this file contains an unclosed delimiter
+// error-pattern: expected one of
+#[i=i::<ښܖ<
diff --git a/src/test/ui/parser/issues/issue-84104.stderr b/src/test/ui/parser/issues/issue-84104.stderr
new file mode 100644 (file)
index 0000000..aff31f2
--- /dev/null
@@ -0,0 +1,16 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-84104.rs:3:13
+   |
+LL | #[i=i::<ښܖ<
+   |  -          ^
+   |  |
+   |  unclosed delimiter
+
+error: expected one of `>`, a const expression, lifetime, or type, found `]`
+  --> $DIR/issue-84104.rs:3:13
+   |
+LL | #[i=i::<ښܖ<
+   |             ^ expected one of `>`, a const expression, lifetime, or type
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-84117.rs b/src/test/ui/parser/issues/issue-84117.rs
new file mode 100644 (file)
index 0000000..9195858
--- /dev/null
@@ -0,0 +1,9 @@
+fn main() {
+    let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
+    //~^ ERROR expected one of `>`, a const expression
+    //~| ERROR expected one of `>`, a const expression, lifetime, or type, found `}`
+    //~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
+    //~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
+    //~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
+}
+//~^ ERROR expected one of `,`, `:`, `=`, or `>`, found `}`
diff --git a/src/test/ui/parser/issues/issue-84117.stderr b/src/test/ui/parser/issues/issue-84117.stderr
new file mode 100644 (file)
index 0000000..5b9cc53
--- /dev/null
@@ -0,0 +1,49 @@
+error: expected one of `>`, a const expression, lifetime, or type, found `}`
+  --> $DIR/issue-84117.rs:2:67
+   |
+LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
+   |                                         ------------              ^ expected one of `>`, a const expression, lifetime, or type
+   |                                         |          |
+   |                                         |          help: use `=` if you meant to assign
+   |                                         while parsing the type for `inner_local`
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
+  --> $DIR/issue-84117.rs:2:65
+   |
+LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
+   |                                                                 ^ expected one of 8 possible tokens
+
+error: expected one of `,`, `:`, `=`, or `>`, found `}`
+  --> $DIR/issue-84117.rs:8:1
+   |
+LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
+   |         ------------ help: use `=` if you meant to assign          - expected one of `,`, `:`, `=`, or `>`
+   |         |
+   |         while parsing the type for `outer_local`
+...
+LL | }
+   | ^ unexpected token
+
+error: expected one of `>`, a const expression, lifetime, or type, found `}`
+  --> $DIR/issue-84117.rs:2:67
+   |
+LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
+   |                                         ------------              ^ expected one of `>`, a const expression, lifetime, or type
+   |                                         |          |
+   |                                         |          help: use `=` if you meant to assign
+   |                                         while parsing the type for `inner_local`
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
+  --> $DIR/issue-84117.rs:2:65
+   |
+LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
+   |                                                                 ^ expected one of 8 possible tokens
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
+  --> $DIR/issue-84117.rs:2:33
+   |
+LL |     let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
+   |                                 ^ expected one of 8 possible tokens
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-84148-1.rs b/src/test/ui/parser/issues/issue-84148-1.rs
new file mode 100644 (file)
index 0000000..25f7ba4
--- /dev/null
@@ -0,0 +1,4 @@
+fn f(t:for<>t?)
+//~^ ERROR: expected parameter name
+//~| ERROR: expected one of
+//~| ERROR: expected one of
diff --git a/src/test/ui/parser/issues/issue-84148-1.stderr b/src/test/ui/parser/issues/issue-84148-1.stderr
new file mode 100644 (file)
index 0000000..9850656
--- /dev/null
@@ -0,0 +1,23 @@
+error: expected parameter name, found `?`
+  --> $DIR/issue-84148-1.rs:1:14
+   |
+LL | fn f(t:for<>t?)
+   |              ^ expected parameter name
+
+error: expected one of `(`, `)`, `+`, `,`, `::`, or `<`, found `?`
+  --> $DIR/issue-84148-1.rs:1:14
+   |
+LL | fn f(t:for<>t?)
+   |              ^
+   |              |
+   |              expected one of `(`, `)`, `+`, `,`, `::`, or `<`
+   |              help: missing `,`
+
+error: expected one of `->`, `;`, `where`, or `{`, found `<eof>`
+  --> $DIR/issue-84148-1.rs:1:15
+   |
+LL | fn f(t:for<>t?)
+   |               ^ expected one of `->`, `;`, `where`, or `{`
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-84148-2.rs b/src/test/ui/parser/issues/issue-84148-2.rs
new file mode 100644 (file)
index 0000000..257a3fd
--- /dev/null
@@ -0,0 +1,4 @@
+// error-pattern: this file contains an unclosed delimiter
+// error-pattern: expected parameter name
+// error-pattern: expected one of
+fn f(t:for<>t?
diff --git a/src/test/ui/parser/issues/issue-84148-2.stderr b/src/test/ui/parser/issues/issue-84148-2.stderr
new file mode 100644 (file)
index 0000000..6f314da
--- /dev/null
@@ -0,0 +1,31 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-84148-2.rs:4:16
+   |
+LL | fn f(t:for<>t?
+   |     -          ^
+   |     |
+   |     unclosed delimiter
+
+error: expected parameter name, found `?`
+  --> $DIR/issue-84148-2.rs:4:14
+   |
+LL | fn f(t:for<>t?
+   |              ^ expected parameter name
+
+error: expected one of `(`, `)`, `+`, `,`, `::`, or `<`, found `?`
+  --> $DIR/issue-84148-2.rs:4:14
+   |
+LL | fn f(t:for<>t?
+   |              ^
+   |              |
+   |              expected one of `(`, `)`, `+`, `,`, `::`, or `<`
+   |              help: missing `,`
+
+error: expected one of `->`, `;`, `where`, or `{`, found `<eof>`
+  --> $DIR/issue-84148-2.rs:4:16
+   |
+LL | fn f(t:for<>t?
+   |                ^ expected one of `->`, `;`, `where`, or `{`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-8537.rs b/src/test/ui/parser/issues/issue-8537.rs
new file mode 100644 (file)
index 0000000..9d0cbce
--- /dev/null
@@ -0,0 +1,5 @@
+pub extern
+  "invalid-ab_isize" //~ ERROR invalid ABI
+fn foo() {}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-8537.stderr b/src/test/ui/parser/issues/issue-8537.stderr
new file mode 100644 (file)
index 0000000..5a29ce2
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0703]: invalid ABI: found `invalid-ab_isize`
+  --> $DIR/issue-8537.rs:2:3
+   |
+LL |   "invalid-ab_isize"
+   |   ^^^^^^^^^^^^^^^^^^ invalid ABI
+   |
+   = help: valid ABIs: Rust, C, C-unwind, cdecl, stdcall, stdcall-unwind, fastcall, vectorcall, thiscall, thiscall-unwind, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, efiapi, avr-interrupt, avr-non-blocking-interrupt, C-cmse-nonsecure-call, wasm, system, system-unwind, rust-intrinsic, rust-call, platform-intrinsic, unadjusted
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0703`.
diff --git a/src/test/ui/parser/issues/issue-86895.rs b/src/test/ui/parser/issues/issue-86895.rs
new file mode 100644 (file)
index 0000000..4cd0984
--- /dev/null
@@ -0,0 +1,3 @@
+const pub () {}
+//~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`
+pub fn main() {}
diff --git a/src/test/ui/parser/issues/issue-86895.stderr b/src/test/ui/parser/issues/issue-86895.stderr
new file mode 100644 (file)
index 0000000..575d857
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+  --> $DIR/issue-86895.rs:1:7
+   |
+LL | const pub () {}
+   |       ^^^ expected one of `async`, `extern`, `fn`, or `unsafe`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-87086-colon-path-sep.rs b/src/test/ui/parser/issues/issue-87086-colon-path-sep.rs
new file mode 100644 (file)
index 0000000..4ee0b20
--- /dev/null
@@ -0,0 +1,66 @@
+// Tests that a suggestion is issued if the user wrote a colon instead of
+// a path separator in a match arm.
+
+enum Foo {
+    Bar,
+    Baz,
+}
+
+fn f() -> Foo { Foo::Bar }
+
+fn g1() {
+    match f() {
+        Foo:Bar => {}
+        //~^ ERROR: expected one of
+        //~| HELP: maybe write a path separator here
+        _ => {}
+    }
+    match f() {
+        Foo::Bar:Baz => {}
+        //~^ ERROR: expected one of
+        //~| HELP: maybe write a path separator here
+        _ => {}
+    }
+    match f() {
+        Foo:Bar::Baz => {}
+        //~^ ERROR: expected one of
+        //~| HELP: maybe write a path separator here
+        _ => {}
+    }
+    match f() {
+        Foo: Bar::Baz if true => {}
+        //~^ ERROR: expected one of
+        //~| HELP: maybe write a path separator here
+        _ => {}
+    }
+    if let Bar:Baz = f() {
+    //~^ ERROR: expected one of
+    //~| HELP: maybe write a path separator here
+    }
+}
+
+fn g1_neg() {
+    match f() {
+        ref Foo: Bar::Baz => {}
+        //~^ ERROR: expected one of
+        _ => {}
+    }
+}
+
+fn g2_neg() {
+    match f() {
+        mut Foo: Bar::Baz => {}
+        //~^ ERROR: expected one of
+        _ => {}
+    }
+}
+
+fn main() {
+    let myfoo = Foo::Bar;
+    match myfoo {
+        Foo::Bar => {}
+        Foo:Bar::Baz => {}
+        //~^ ERROR: expected one of
+        //~| HELP: maybe write a path separator here
+    }
+}
diff --git a/src/test/ui/parser/issues/issue-87086-colon-path-sep.stderr b/src/test/ui/parser/issues/issue-87086-colon-path-sep.stderr
new file mode 100644 (file)
index 0000000..8f93661
--- /dev/null
@@ -0,0 +1,68 @@
+error: expected one of `@` or `|`, found `:`
+  --> $DIR/issue-87086-colon-path-sep.rs:13:12
+   |
+LL |         Foo:Bar => {}
+   |            ^
+   |            |
+   |            expected one of `@` or `|`
+   |            help: maybe write a path separator here: `::`
+
+error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:`
+  --> $DIR/issue-87086-colon-path-sep.rs:19:17
+   |
+LL |         Foo::Bar:Baz => {}
+   |                 ^
+   |                 |
+   |                 expected one of 8 possible tokens
+   |                 help: maybe write a path separator here: `::`
+
+error: expected one of `@` or `|`, found `:`
+  --> $DIR/issue-87086-colon-path-sep.rs:25:12
+   |
+LL |         Foo:Bar::Baz => {}
+   |            ^
+   |            |
+   |            expected one of `@` or `|`
+   |            help: maybe write a path separator here: `::`
+
+error: expected one of `@` or `|`, found `:`
+  --> $DIR/issue-87086-colon-path-sep.rs:31:12
+   |
+LL |         Foo: Bar::Baz if true => {}
+   |            ^
+   |            |
+   |            expected one of `@` or `|`
+   |            help: maybe write a path separator here: `::`
+
+error: expected one of `@` or `|`, found `:`
+  --> $DIR/issue-87086-colon-path-sep.rs:36:15
+   |
+LL |     if let Bar:Baz = f() {
+   |               ^
+   |               |
+   |               expected one of `@` or `|`
+   |               help: maybe write a path separator here: `::`
+
+error: expected one of `=>`, `@`, `if`, or `|`, found `:`
+  --> $DIR/issue-87086-colon-path-sep.rs:44:16
+   |
+LL |         ref Foo: Bar::Baz => {}
+   |                ^ expected one of `=>`, `@`, `if`, or `|`
+
+error: expected one of `=>`, `@`, `if`, or `|`, found `:`
+  --> $DIR/issue-87086-colon-path-sep.rs:52:16
+   |
+LL |         mut Foo: Bar::Baz => {}
+   |                ^ expected one of `=>`, `@`, `if`, or `|`
+
+error: expected one of `@` or `|`, found `:`
+  --> $DIR/issue-87086-colon-path-sep.rs:62:12
+   |
+LL |         Foo:Bar::Baz => {}
+   |            ^
+   |            |
+   |            expected one of `@` or `|`
+   |            help: maybe write a path separator here: `::`
+
+error: aborting due to 8 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-87197-missing-semicolon.fixed b/src/test/ui/parser/issues/issue-87197-missing-semicolon.fixed
new file mode 100644 (file)
index 0000000..53f071d
--- /dev/null
@@ -0,0 +1,10 @@
+// run-rustfix
+// Parser should know when a semicolon is missing.
+// https://github.com/rust-lang/rust/issues/87197
+
+fn main() {
+    let x = 100; //~ ERROR: expected `;`
+    println!("{}", x); //~ ERROR: expected `;`
+    let y = 200; //~ ERROR: expected `;`
+    println!("{}", y);
+}
diff --git a/src/test/ui/parser/issues/issue-87197-missing-semicolon.rs b/src/test/ui/parser/issues/issue-87197-missing-semicolon.rs
new file mode 100644 (file)
index 0000000..db0edf4
--- /dev/null
@@ -0,0 +1,10 @@
+// run-rustfix
+// Parser should know when a semicolon is missing.
+// https://github.com/rust-lang/rust/issues/87197
+
+fn main() {
+    let x = 100 //~ ERROR: expected `;`
+    println!("{}", x) //~ ERROR: expected `;`
+    let y = 200 //~ ERROR: expected `;`
+    println!("{}", y);
+}
diff --git a/src/test/ui/parser/issues/issue-87197-missing-semicolon.stderr b/src/test/ui/parser/issues/issue-87197-missing-semicolon.stderr
new file mode 100644 (file)
index 0000000..57772de
--- /dev/null
@@ -0,0 +1,26 @@
+error: expected `;`, found `println`
+  --> $DIR/issue-87197-missing-semicolon.rs:6:16
+   |
+LL |     let x = 100
+   |                ^ help: add `;` here
+LL |     println!("{}", x)
+   |     ------- unexpected token
+
+error: expected `;`, found keyword `let`
+  --> $DIR/issue-87197-missing-semicolon.rs:7:22
+   |
+LL |     println!("{}", x)
+   |                      ^ help: add `;` here
+LL |     let y = 200
+   |     --- unexpected token
+
+error: expected `;`, found `println`
+  --> $DIR/issue-87197-missing-semicolon.rs:8:16
+   |
+LL |     let y = 200
+   |                ^ help: add `;` here
+LL |     println!("{}", y);
+   |     ------- unexpected token
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs b/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
new file mode 100644 (file)
index 0000000..7c3d915
--- /dev/null
@@ -0,0 +1,11 @@
+// edition:2018
+
+// Test that even when `const` is already present, the proposed fix is `const const async`,
+// like for `pub pub`.
+
+const async const fn test() {}
+//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
+//~| NOTE expected one of `extern`, `fn`, or `unsafe`
+//~| HELP `const` must come before `async`
+//~| SUGGESTION const async
+//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr b/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
new file mode 100644 (file)
index 0000000..5628091
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
+  --> $DIR/const-async-const.rs:6:13
+   |
+LL | const async const fn test() {}
+   |       ------^^^^^
+   |       |     |
+   |       |     expected one of `extern`, `fn`, or `unsafe`
+   |       help: `const` must come before `async`: `const async`
+   |
+   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs b/src/test/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
new file mode 100644 (file)
index 0000000..86fdb78
--- /dev/null
@@ -0,0 +1,14 @@
+// edition:2018
+
+// There is an order to respect for keywords before a function:
+// `<visibility>, const, async, unsafe, extern, "<ABI>"`
+//
+// This test ensures the compiler is helpful about them being misplaced.
+// Visibilities are tested elsewhere.
+
+async unsafe const fn test() {}
+//~^ ERROR expected one of `extern` or `fn`, found keyword `const`
+//~| NOTE expected one of `extern` or `fn`
+//~| HELP `const` must come before `async unsafe`
+//~| SUGGESTION const async unsafe
+//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr b/src/test/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
new file mode 100644 (file)
index 0000000..65cce77
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected one of `extern` or `fn`, found keyword `const`
+  --> $DIR/several-kw-jump.rs:9:14
+   |
+LL | async unsafe const fn test() {}
+   | -------------^^^^^
+   | |            |
+   | |            expected one of `extern` or `fn`
+   | help: `const` must come before `async unsafe`: `const async unsafe`
+   |
+   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs b/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
new file mode 100644 (file)
index 0000000..edfb330
--- /dev/null
@@ -0,0 +1,14 @@
+// edition:2018
+
+// There is an order to respect for keywords before a function:
+// `<visibility>, const, async, unsafe, extern, "<ABI>"`
+//
+// This test ensures the compiler is helpful about them being misplaced.
+// Visibilities are tested elsewhere.
+
+unsafe async fn test() {}
+//~^ ERROR expected one of `extern` or `fn`, found keyword `async`
+//~| NOTE expected one of `extern` or `fn`
+//~| HELP `async` must come before `unsafe`
+//~| SUGGESTION async unsafe
+//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr b/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr
new file mode 100644 (file)
index 0000000..3acd9e4
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected one of `extern` or `fn`, found keyword `async`
+  --> $DIR/wrong-async.rs:9:8
+   |
+LL | unsafe async fn test() {}
+   | -------^^^^^
+   | |      |
+   | |      expected one of `extern` or `fn`
+   | help: `async` must come before `unsafe`: `async unsafe`
+   |
+   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs b/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
new file mode 100644 (file)
index 0000000..abd692b
--- /dev/null
@@ -0,0 +1,14 @@
+// edition:2018
+
+// There is an order to respect for keywords before a function:
+// `<visibility>, const, async, unsafe, extern, "<ABI>"`
+//
+// This test ensures the compiler is helpful about them being misplaced.
+// Visibilities are tested elsewhere.
+
+unsafe const fn test() {}
+//~^ ERROR expected one of `extern` or `fn`, found keyword `const`
+//~| NOTE expected one of `extern` or `fn`
+//~| HELP `const` must come before `unsafe`
+//~| SUGGESTION const unsafe
+//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr b/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr
new file mode 100644 (file)
index 0000000..9a3e07b
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected one of `extern` or `fn`, found keyword `const`
+  --> $DIR/wrong-const.rs:9:8
+   |
+LL | unsafe const fn test() {}
+   | -------^^^^^
+   | |      |
+   | |      expected one of `extern` or `fn`
+   | help: `const` must come before `unsafe`: `const unsafe`
+   |
+   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs b/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
new file mode 100644 (file)
index 0000000..7f0761e
--- /dev/null
@@ -0,0 +1,14 @@
+// edition:2018
+
+// There is an order to respect for keywords before a function:
+// `<visibility>, const, async, unsafe, extern, "<ABI>"`
+//
+// This test ensures the compiler is helpful about them being misplaced.
+// Visibilities are tested elsewhere.
+
+extern unsafe fn test() {}
+//~^ ERROR expected `fn`, found keyword `unsafe`
+//~| NOTE expected `fn`
+//~| HELP `unsafe` must come before `extern`
+//~| SUGGESTION unsafe extern
+//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr b/src/test/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr
new file mode 100644 (file)
index 0000000..395ee9f
--- /dev/null
@@ -0,0 +1,13 @@
+error: expected `fn`, found keyword `unsafe`
+  --> $DIR/wrong-unsafe.rs:9:8
+   |
+LL | extern unsafe fn test() {}
+   | -------^^^^^^
+   | |      |
+   | |      expected `fn`
+   | help: `unsafe` must come before `extern`: `unsafe extern`
+   |
+   = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-87635.rs b/src/test/ui/parser/issues/issue-87635.rs
new file mode 100644 (file)
index 0000000..da74c18
--- /dev/null
@@ -0,0 +1,9 @@
+struct Foo {}
+
+impl Foo {
+    pub fn bar()
+    //~^ ERROR: expected `;`, found `}`
+    //~| ERROR: associated function in `impl` without body
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-87635.stderr b/src/test/ui/parser/issues/issue-87635.stderr
new file mode 100644 (file)
index 0000000..920a9f9
--- /dev/null
@@ -0,0 +1,19 @@
+error: expected `;`, found `}`
+  --> $DIR/issue-87635.rs:4:17
+   |
+LL |     pub fn bar()
+   |                 ^ help: add `;` here
+...
+LL | }
+   | - unexpected token
+
+error: associated function in `impl` without body
+  --> $DIR/issue-87635.rs:4:5
+   |
+LL |     pub fn bar()
+   |     ^^^^^^^^^^^-
+   |                |
+   |                help: provide a definition for the function: `{ <body> }`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-87812-path.rs b/src/test/ui/parser/issues/issue-87812-path.rs
new file mode 100644 (file)
index 0000000..b887808
--- /dev/null
@@ -0,0 +1,11 @@
+macro_rules! foo {
+    ( $f:path ) => {{
+        let _: usize = $f; //~ERROR
+    }};
+}
+
+struct Baz;
+
+fn main() {
+    foo!(Baz);
+}
diff --git a/src/test/ui/parser/issues/issue-87812-path.stderr b/src/test/ui/parser/issues/issue-87812-path.stderr
new file mode 100644 (file)
index 0000000..f8ee051
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-87812-path.rs:3:24
+   |
+LL |         let _: usize = $f;
+   |                -----   ^^ expected `usize`, found struct `Baz`
+   |                |
+   |                expected due to this
+...
+LL |     foo!(Baz);
+   |     --------- 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 previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/issues/issue-87812.rs b/src/test/ui/parser/issues/issue-87812.rs
new file mode 100644 (file)
index 0000000..0ba87b9
--- /dev/null
@@ -0,0 +1,13 @@
+#![deny(break_with_label_and_loop)]
+
+macro_rules! foo {
+    ( $f:block ) => {
+        '_l: loop {
+            break '_l $f; //~ERROR
+        }
+    };
+}
+
+fn main() {
+    let x = foo!({ 3 });
+}
diff --git a/src/test/ui/parser/issues/issue-87812.stderr b/src/test/ui/parser/issues/issue-87812.stderr
new file mode 100644 (file)
index 0000000..d61ee23
--- /dev/null
@@ -0,0 +1,22 @@
+error: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression
+  --> $DIR/issue-87812.rs:6:13
+   |
+LL |             break '_l $f;
+   |             ^^^^^^^^^^^^
+...
+LL |     let x = foo!({ 3 });
+   |             ----------- in this macro invocation
+   |
+note: the lint level is defined here
+  --> $DIR/issue-87812.rs:1:9
+   |
+LL | #![deny(break_with_label_and_loop)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: wrap this expression in parentheses
+   |
+LL |             break '_l ($f);
+   |                       +  +
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-88276-unary-plus.fixed b/src/test/ui/parser/issues/issue-88276-unary-plus.fixed
new file mode 100644 (file)
index 0000000..25b7c34
--- /dev/null
@@ -0,0 +1,8 @@
+// run-rustfix
+#[allow(unused_parens)]
+fn main() {
+    let _ = 1; //~ ERROR leading `+` is not supported
+    let _ = (1.0 + 2.0) * 3.0; //~ ERROR leading `+` is not supported
+                           //~| ERROR leading `+` is not supported
+    let _ = [3, 4+6]; //~ ERROR leading `+` is not supported
+}
diff --git a/src/test/ui/parser/issues/issue-88276-unary-plus.rs b/src/test/ui/parser/issues/issue-88276-unary-plus.rs
new file mode 100644 (file)
index 0000000..11b2e9d
--- /dev/null
@@ -0,0 +1,8 @@
+// run-rustfix
+#[allow(unused_parens)]
+fn main() {
+    let _ = +1; //~ ERROR leading `+` is not supported
+    let _ = (1.0 + +2.0) * +3.0; //~ ERROR leading `+` is not supported
+                           //~| ERROR leading `+` is not supported
+    let _ = [+3, 4+6]; //~ ERROR leading `+` is not supported
+}
diff --git a/src/test/ui/parser/issues/issue-88276-unary-plus.stderr b/src/test/ui/parser/issues/issue-88276-unary-plus.stderr
new file mode 100644 (file)
index 0000000..b267617
--- /dev/null
@@ -0,0 +1,50 @@
+error: leading `+` is not supported
+  --> $DIR/issue-88276-unary-plus.rs:4:13
+   |
+LL |     let _ = +1;
+   |             ^ unexpected `+`
+   |
+help: try removing the `+`
+   |
+LL -     let _ = +1;
+LL +     let _ = 1;
+   | 
+
+error: leading `+` is not supported
+  --> $DIR/issue-88276-unary-plus.rs:5:20
+   |
+LL |     let _ = (1.0 + +2.0) * +3.0;
+   |                    ^ unexpected `+`
+   |
+help: try removing the `+`
+   |
+LL -     let _ = (1.0 + +2.0) * +3.0;
+LL +     let _ = (1.0 + 2.0) * +3.0;
+   | 
+
+error: leading `+` is not supported
+  --> $DIR/issue-88276-unary-plus.rs:5:28
+   |
+LL |     let _ = (1.0 + +2.0) * +3.0;
+   |                            ^ unexpected `+`
+   |
+help: try removing the `+`
+   |
+LL -     let _ = (1.0 + +2.0) * +3.0;
+LL +     let _ = (1.0 + +2.0) * 3.0;
+   | 
+
+error: leading `+` is not supported
+  --> $DIR/issue-88276-unary-plus.rs:7:14
+   |
+LL |     let _ = [+3, 4+6];
+   |              ^ unexpected `+`
+   |
+help: try removing the `+`
+   |
+LL -     let _ = [+3, 4+6];
+LL +     let _ = [3, 4+6];
+   | 
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-88583-union-as-ident.rs b/src/test/ui/parser/issues/issue-88583-union-as-ident.rs
new file mode 100644 (file)
index 0000000..b3d66d4
--- /dev/null
@@ -0,0 +1,15 @@
+// check-pass
+
+#![allow(non_camel_case_types)]
+
+struct union;
+
+impl union {
+    pub fn new() -> Self {
+        union { }
+    }
+}
+
+fn main() {
+    let _u = union::new();
+}
diff --git a/src/test/ui/parser/issues/issue-88770.rs b/src/test/ui/parser/issues/issue-88770.rs
new file mode 100644 (file)
index 0000000..bf89033
--- /dev/null
@@ -0,0 +1,11 @@
+// Regression test for the ICE described in #88770.
+
+// error-pattern:this file contains an unclosed delimiter
+// error-pattern:expected one of
+// error-pattern:missing `in` in `for` loop
+// error-pattern:expected `;`, found `e`
+
+fn m(){print!("",(c for&g
+u
+e
+e
diff --git a/src/test/ui/parser/issues/issue-88770.stderr b/src/test/ui/parser/issues/issue-88770.stderr
new file mode 100644 (file)
index 0000000..c7e2415
--- /dev/null
@@ -0,0 +1,66 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-88770.rs:11:3
+   |
+LL | fn m(){print!("",(c for&g
+   |       -      -   - unclosed delimiter
+   |       |      |
+   |       |      unclosed delimiter
+   |       unclosed delimiter
+...
+LL | e
+   |   ^
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-88770.rs:11:3
+   |
+LL | fn m(){print!("",(c for&g
+   |       -      -   - unclosed delimiter
+   |       |      |
+   |       |      unclosed delimiter
+   |       unclosed delimiter
+...
+LL | e
+   |   ^
+
+error: this file contains an unclosed delimiter
+  --> $DIR/issue-88770.rs:11:3
+   |
+LL | fn m(){print!("",(c for&g
+   |       -      -   - unclosed delimiter
+   |       |      |
+   |       |      unclosed delimiter
+   |       unclosed delimiter
+...
+LL | e
+   |   ^
+
+error: missing `in` in `for` loop
+  --> $DIR/issue-88770.rs:8:26
+   |
+LL |   fn m(){print!("",(c for&g
+   |  __________________________^
+LL | | u
+   | |_ help: try adding `in` here
+
+error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found keyword `for`
+  --> $DIR/issue-88770.rs:8:21
+   |
+LL | fn m(){print!("",(c for&g
+   |                     ^^^ expected one of 8 possible tokens
+
+error: expected `;`, found `e`
+  --> $DIR/issue-88770.rs:10:2
+   |
+LL | e
+   |  ^ help: add `;` here
+LL | e
+   | - unexpected token
+
+error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `)`
+  --> $DIR/issue-88770.rs:11:3
+   |
+LL | e
+   |   ^ expected one of 7 possible tokens
+
+error: aborting due to 7 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-88818.rs b/src/test/ui/parser/issues/issue-88818.rs
new file mode 100644 (file)
index 0000000..b9233ca
--- /dev/null
@@ -0,0 +1,10 @@
+// Regression test for #88818 (improve error message for missing trait
+// in `impl for X`).
+
+struct S { }
+impl for S { }
+//~^ ERROR: missing trait in a trait impl
+//~| HELP: add a trait here
+//~| HELP: for an inherent impl, drop this `for`
+
+fn main() {}
diff --git a/src/test/ui/parser/issues/issue-88818.stderr b/src/test/ui/parser/issues/issue-88818.stderr
new file mode 100644 (file)
index 0000000..d30990a
--- /dev/null
@@ -0,0 +1,18 @@
+error: missing trait in a trait impl
+  --> $DIR/issue-88818.rs:5:5
+   |
+LL | impl for S { }
+   |     ^
+   |
+help: add a trait here
+   |
+LL | impl Trait for S { }
+   |      +++++
+help: for an inherent impl, drop this `for`
+   |
+LL - impl for S { }
+LL + impl S { }
+   | 
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-89388.rs b/src/test/ui/parser/issues/issue-89388.rs
new file mode 100644 (file)
index 0000000..9153c07
--- /dev/null
@@ -0,0 +1,7 @@
+// Regression test for #89388.
+
+fn main() {
+    let option: Option<&[u8]> = Some(b"...");
+    let _ = option.map([_]::to_vec);
+    //~^ ERROR: missing angle brackets in associated item path
+}
diff --git a/src/test/ui/parser/issues/issue-89388.stderr b/src/test/ui/parser/issues/issue-89388.stderr
new file mode 100644 (file)
index 0000000..cf28bef
--- /dev/null
@@ -0,0 +1,8 @@
+error: missing angle brackets in associated item path
+  --> $DIR/issue-89388.rs:5:24
+   |
+LL |     let _ = option.map([_]::to_vec);
+   |                        ^^^^^^^^^^^ help: try: `<[_]>::to_vec`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-89396.fixed b/src/test/ui/parser/issues/issue-89396.fixed
new file mode 100644 (file)
index 0000000..823ad8c
--- /dev/null
@@ -0,0 +1,16 @@
+// Regression test for issue #89396: Try to recover from a
+// `=>` -> `=` or `->` typo in a match arm.
+
+// run-rustfix
+
+fn main() {
+    let opt = Some(42);
+    let _ = match opt {
+        Some(_) => true,
+        //~^ ERROR: expected one of
+        //~| HELP: try using a fat arrow here
+        None => false,
+        //~^ ERROR: expected one of
+        //~| HELP: try using a fat arrow here
+    };
+}
diff --git a/src/test/ui/parser/issues/issue-89396.rs b/src/test/ui/parser/issues/issue-89396.rs
new file mode 100644 (file)
index 0000000..f1d9efa
--- /dev/null
@@ -0,0 +1,16 @@
+// Regression test for issue #89396: Try to recover from a
+// `=>` -> `=` or `->` typo in a match arm.
+
+// run-rustfix
+
+fn main() {
+    let opt = Some(42);
+    let _ = match opt {
+        Some(_) = true,
+        //~^ ERROR: expected one of
+        //~| HELP: try using a fat arrow here
+        None -> false,
+        //~^ ERROR: expected one of
+        //~| HELP: try using a fat arrow here
+    };
+}
diff --git a/src/test/ui/parser/issues/issue-89396.stderr b/src/test/ui/parser/issues/issue-89396.stderr
new file mode 100644 (file)
index 0000000..5044205
--- /dev/null
@@ -0,0 +1,20 @@
+error: expected one of `=>`, `if`, or `|`, found `=`
+  --> $DIR/issue-89396.rs:9:17
+   |
+LL |         Some(_) = true,
+   |                 ^
+   |                 |
+   |                 expected one of `=>`, `if`, or `|`
+   |                 help: try using a fat arrow here: `=>`
+
+error: expected one of `=>`, `@`, `if`, or `|`, found `->`
+  --> $DIR/issue-89396.rs:12:14
+   |
+LL |         None -> false,
+   |              ^^
+   |              |
+   |              expected one of `=>`, `@`, `if`, or `|`
+   |              help: try using a fat arrow here: `=>`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/issues/issue-89574.rs b/src/test/ui/parser/issues/issue-89574.rs
new file mode 100644 (file)
index 0000000..0a477f1
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {
+    const EMPTY_ARRAY = [];
+    //~^ missing type for `const` item
+}
diff --git a/src/test/ui/parser/issues/issue-89574.stderr b/src/test/ui/parser/issues/issue-89574.stderr
new file mode 100644 (file)
index 0000000..cbee3d3
--- /dev/null
@@ -0,0 +1,8 @@
+error: missing type for `const` item
+  --> $DIR/issue-89574.rs:2:11
+   |
+LL |     const EMPTY_ARRAY = [];
+   |           ^^^^^^^^^^^ help: provide a type for the item: `EMPTY_ARRAY: <type>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs b/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs
new file mode 100644 (file)
index 0000000..fe67d98
--- /dev/null
@@ -0,0 +1,15 @@
+// aux-build:issue-89971-outer-attr-following-inner-attr-ice.rs
+
+#[macro_use]
+extern crate issue_89971_outer_attr_following_inner_attr_ice;
+
+fn main() {
+    Mew();
+    X {};
+}
+
+#![deny(missing_docs)]
+//~^ ERROR an inner attribute is not permitted in this context
+#[derive(ICE)]
+#[deny(missing_docs)]
+struct Mew();
diff --git a/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr b/src/test/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr
new file mode 100644 (file)
index 0000000..34a6ab0
--- /dev/null
@@ -0,0 +1,18 @@
+error: an inner attribute is not permitted in this context
+  --> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:11:1
+   |
+LL | #![deny(missing_docs)]
+   | ^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | struct Mew();
+   | ------------- the inner attribute doesn't annotate this struct
+   |
+   = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
+help: to annotate the struct, change the attribute from inner to outer style
+   |
+LL - #![deny(missing_docs)]
+LL + #[deny(missing_docs)]
+   | 
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issues/issue-90993.rs b/src/test/ui/parser/issues/issue-90993.rs
new file mode 100644 (file)
index 0000000..40e6fc7
--- /dev/null
@@ -0,0 +1,6 @@
+fn main() {
+    ...=.
+    //~^ ERROR: unexpected token: `...`
+    //~| ERROR: unexpected `=` after inclusive range
+    //~| ERROR: expected one of `-`, `;`, `}`, or path, found `.`
+}
diff --git a/src/test/ui/parser/issues/issue-90993.stderr b/src/test/ui/parser/issues/issue-90993.stderr
new file mode 100644 (file)
index 0000000..ab6bce4
--- /dev/null
@@ -0,0 +1,31 @@
+error: unexpected token: `...`
+  --> $DIR/issue-90993.rs:2:5
+   |
+LL |     ...=.
+   |     ^^^
+   |
+help: use `..` for an exclusive range
+   |
+LL |     ..=.
+   |     ~~
+help: or `..=` for an inclusive range
+   |
+LL |     ..==.
+   |     ~~~
+
+error: unexpected `=` after inclusive range
+  --> $DIR/issue-90993.rs:2:5
+   |
+LL |     ...=.
+   |     ^^^^ help: use `..=` instead
+   |
+   = note: inclusive ranges end with a single equals sign (`..=`)
+
+error: expected one of `-`, `;`, `}`, or path, found `.`
+  --> $DIR/issue-90993.rs:2:9
+   |
+LL |     ...=.
+   |         ^ expected one of `-`, `;`, `}`, or path
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/operator-associativity.rs b/src/test/ui/parser/operator-associativity.rs
new file mode 100644 (file)
index 0000000..4f40c80
--- /dev/null
@@ -0,0 +1,4 @@
+// run-pass
+// Testcase for issue #130, operator associativity.
+
+pub fn main() { assert_eq!(3 * 5 / 2, 7); }
index feabd8f5813b87cb83b4344689b5b11723bb654b..4b191710c393ad141b0683173bc5f8b48a017146 100644 (file)
@@ -25,11 +25,6 @@ LL | |     }.hi() {
    |
    = help: the trait `Iterator` is not implemented for `bool`
    = note: required because of the requirements on the impl of `IntoIterator` for `bool`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/pathless-extern-ok.rs b/src/test/ui/pathless-extern-ok.rs
deleted file mode 100644 (file)
index 0ffa5eb..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// edition:2018
-// compile-flags:--extern alloc
-// build-pass
-
-// Test that `--extern alloc` will load from the sysroot without error.
-
-fn main() {
-    let _: Vec<i32> = alloc::vec::Vec::new();
-}
diff --git a/src/test/ui/pattern/ignore-all-the-things.rs b/src/test/ui/pattern/ignore-all-the-things.rs
new file mode 100644 (file)
index 0000000..5980e1a
--- /dev/null
@@ -0,0 +1,44 @@
+// run-pass
+
+#![allow(non_shorthand_field_patterns)]
+#![allow(dead_code)]
+#![allow(unused_variables)]
+
+struct Foo(isize, isize, isize, isize);
+struct Bar{a: isize, b: isize, c: isize, d: isize}
+
+pub fn main() {
+    let Foo(..) = Foo(5, 5, 5, 5);
+    let Foo(..) = Foo(5, 5, 5, 5);
+    let Bar{..} = Bar{a: 5, b: 5, c: 5, d: 5};
+    let (..) = (5, 5, 5, 5);
+    let Foo(a, b, ..) = Foo(5, 5, 5, 5);
+    let Foo(.., d) = Foo(5, 5, 5, 5);
+    let (a, b, ..) = (5, 5, 5, 5);
+    let (.., c, d) = (5, 5, 5, 5);
+    let Bar{b: b, ..} = Bar{a: 5, b: 5, c: 5, d: 5};
+    match [5, 5, 5, 5] {
+        [..] => { }
+    }
+    match [5, 5, 5, 5] {
+        [a, ..] => { }
+    }
+    match [5, 5, 5, 5] {
+        [.., b] => { }
+    }
+    match [5, 5, 5, 5] {
+        [a, .., b] => { }
+    }
+    match [5, 5, 5] {
+        [..] => { }
+    }
+    match [5, 5, 5] {
+        [a, ..] => { }
+    }
+    match [5, 5, 5] {
+        [.., a] => { }
+    }
+    match [5, 5, 5] {
+        [a, .., b] => { }
+    }
+}
index 713418fc5b29a6e5d87d4ec60d62d3129c2e1d87..5c33154736650b04f59982bbedd104f99bf75c2c 100644 (file)
@@ -2,7 +2,7 @@
 #![allow(incomplete_features)]
 #![allow(unreachable_code)]
 #![feature(const_async_blocks)]
-#![feature(inline_const)]
+#![feature(inline_const_pat)]
 
 fn main() {
     match loop {} {
index 4b4fb08928327db295296c80dd6abb811b36f9ac..090bd67117eab8cdad015950777c29ad481944e0 100644 (file)
@@ -2,14 +2,16 @@ error[E0308]: mismatched types
   --> $DIR/pat-type-err-let-stmt.rs:6:29
    |
 LL |     let Ok(0): Option<u8> = 42u8;
-   |                ----------   ^^^^
-   |                |            |
-   |                |            expected enum `Option`, found `u8`
-   |                |            help: try using a variant of the expected enum: `Some(42u8)`
+   |                ----------   ^^^^ expected enum `Option`, found `u8`
+   |                |
    |                expected due to this
    |
    = note: expected enum `Option<u8>`
               found type `u8`
+help: try wrapping the expression in `Some`
+   |
+LL |     let Ok(0): Option<u8> = Some(42u8);
+   |                             +++++    +
 
 error[E0308]: mismatched types
   --> $DIR/pat-type-err-let-stmt.rs:6:9
diff --git a/src/test/ui/placement-syntax.rs b/src/test/ui/placement-syntax.rs
deleted file mode 100644 (file)
index 4df96de..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main() {
-    let x = -5;
-    if x<-1 { //~ ERROR unexpected token: `<-`
-        println!("ok");
-    }
-}
diff --git a/src/test/ui/placement-syntax.stderr b/src/test/ui/placement-syntax.stderr
deleted file mode 100644 (file)
index 3fdaf4c..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-error: unexpected token: `<-`
-  --> $DIR/placement-syntax.rs:3:9
-   |
-LL |     if x<-1 {
-   |         ^^
-   |
-help: if you meant to write a comparison against a negative value, add a space in between `<` and `-`
-   |
-LL |     if x< -1 {
-   |         ~~~
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/privacy/auxiliary/impl_privacy_xc_2.rs b/src/test/ui/privacy/auxiliary/impl_privacy_xc_2.rs
new file mode 100644 (file)
index 0000000..5f9c226
--- /dev/null
@@ -0,0 +1,13 @@
+#![crate_type = "lib"]
+
+pub struct Fish {
+    pub x: isize
+}
+
+mod unexported {
+    use super::Fish;
+    impl PartialEq for Fish {
+        fn eq(&self, _: &Fish) -> bool { true }
+        fn ne(&self, _: &Fish) -> bool { false }
+    }
+}
diff --git a/src/test/ui/privacy/auxiliary/reachable-unnameable-items.rs b/src/test/ui/privacy/auxiliary/reachable-unnameable-items.rs
new file mode 100644 (file)
index 0000000..20f110b
--- /dev/null
@@ -0,0 +1,106 @@
+use inner_private_module::*;
+
+mod inner_private_module {
+    pub struct Unnameable1;
+    pub struct Unnameable2;
+    #[derive(Clone, Copy)]
+    pub struct Unnameable3;
+    pub struct Unnameable4;
+    pub struct Unnameable5;
+    pub struct Unnameable6;
+    pub struct Unnameable7;
+    #[derive(Default)]
+    pub struct Unnameable8;
+    pub enum UnnameableEnum {
+        NameableVariant
+    }
+    pub trait UnnameableTrait {
+        type Alias: Default;
+    }
+
+    impl Unnameable1 {
+        pub fn method_of_unnameable_type1(&self) -> &'static str {
+            "Hello1"
+        }
+    }
+    impl Unnameable2 {
+        pub fn method_of_unnameable_type2(&self) -> &'static str {
+            "Hello2"
+        }
+    }
+    impl Unnameable3 {
+        pub fn method_of_unnameable_type3(&self) -> &'static str {
+            "Hello3"
+        }
+    }
+    impl Unnameable4 {
+        pub fn method_of_unnameable_type4(&self) -> &'static str {
+            "Hello4"
+        }
+    }
+    impl Unnameable5 {
+        pub fn method_of_unnameable_type5(&self) -> &'static str {
+            "Hello5"
+        }
+    }
+    impl Unnameable6 {
+        pub fn method_of_unnameable_type6(&self) -> &'static str {
+            "Hello6"
+        }
+    }
+    impl Unnameable7 {
+        pub fn method_of_unnameable_type7(&self) -> &'static str {
+            "Hello7"
+        }
+    }
+    impl Unnameable8 {
+        pub fn method_of_unnameable_type8(&self) -> &'static str {
+            "Hello8"
+        }
+    }
+    impl UnnameableEnum {
+        pub fn method_of_unnameable_enum(&self) -> &'static str {
+            "HelloEnum"
+        }
+    }
+}
+
+pub fn function_returning_unnameable_type() -> Unnameable1 {
+    Unnameable1
+}
+
+pub const CONSTANT_OF_UNNAMEABLE_TYPE: Unnameable2 =
+                                            Unnameable2;
+
+pub fn function_accepting_unnameable_type(_: Option<Unnameable3>) {}
+
+pub type AliasOfUnnameableType = Unnameable4;
+
+impl Unnameable1 {
+    pub fn inherent_method_returning_unnameable_type(&self) -> Unnameable5 {
+        Unnameable5
+    }
+}
+
+pub trait Tr {
+    fn trait_method_returning_unnameable_type(&self) -> Unnameable6 {
+        Unnameable6
+    }
+}
+impl Tr for Unnameable1 {}
+
+pub use inner_private_module::UnnameableEnum::NameableVariant;
+
+pub struct Struct {
+    pub field_of_unnameable_type: Unnameable7
+}
+
+pub static STATIC: Struct = Struct { field_of_unnameable_type: Unnameable7 } ;
+
+impl UnnameableTrait for AliasOfUnnameableType {
+    type Alias = Unnameable8;
+}
+
+pub fn generic_function<T: UnnameableTrait>() -> T::Alias {
+    Default::default()
+}
diff --git a/src/test/ui/privacy/crate-private-reexport.rs b/src/test/ui/privacy/crate-private-reexport.rs
new file mode 100644 (file)
index 0000000..fa4f886
--- /dev/null
@@ -0,0 +1,66 @@
+fn f1() {}
+enum E1 { V }
+struct S1 {
+    #[rustfmt::skip]
+    bar: i32,
+}
+mod m1 {
+    pub use ::f1; //~ ERROR `f1` is only public within the crate, and cannot be re-exported outside
+    pub use ::S1; //~ ERROR `S1` is only public within the crate, and cannot be re-exported outside
+    pub use ::E1; //~ ERROR `E1` is only public within the crate, and cannot be re-exported outside
+    pub use ::E1::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
+}
+
+pub(crate) fn f2() {}
+pub(crate) enum E2 {
+    V
+}
+pub(crate) struct S2 {
+    #[rustfmt::skip]
+    bar: i32,
+}
+mod m2 {
+    pub use ::f2; //~ ERROR `f2` is only public within the crate, and cannot be re-exported outside
+    pub use ::S2; //~ ERROR `S2` is only public within the crate, and cannot be re-exported outside
+    pub use ::E2; //~ ERROR `E2` is only public within the crate, and cannot be re-exported outside
+    pub use ::E2::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
+}
+
+mod m3 {
+    pub(crate) fn f3() {}
+    pub(crate) enum E3 {
+        V
+    }
+    pub(crate) struct S3 {
+        #[rustfmt::skip]
+        bar: i32,
+    }
+}
+pub use m3::f3; //~ ERROR `f3` is only public within the crate, and cannot be re-exported outside
+pub use m3::S3; //~ ERROR `S3` is only public within the crate, and cannot be re-exported outside
+pub use m3::E3; //~ ERROR `E3` is only public within the crate, and cannot be re-exported outside
+pub use m3::E3::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
+
+pub(self) fn f4() {}
+pub use ::f4 as f5; //~ ERROR `f4` is only public within the crate, and cannot be re-exported outside
+
+pub mod m10 {
+    pub mod m {
+        pub(super) fn f6() {}
+        pub(crate) fn f7() {}
+        pub(in crate::m10) fn f8() {}
+    }
+    pub use self::m::f6; //~ ERROR `f6` is private, and cannot be re-exported
+    pub use self::m::f7; //~ ERROR `f7` is only public within the crate, and cannot be re-exported outside
+    pub use self::m::f8; //~ ERROR `f8` is private, and cannot be re-exported
+}
+pub use m10::m::f6; //~ ERROR function `f6` is private
+pub use m10::m::f7; //~ ERROR `f7` is only public within the crate, and cannot be re-exported outside
+pub use m10::m::f8; //~ ERROR function `f8` is private
+
+pub mod m11 {
+    pub(self) fn f9() {}
+}
+pub use m11::f9; //~ ERROR function `f9` is private
+
+fn main() {}
diff --git a/src/test/ui/privacy/crate-private-reexport.stderr b/src/test/ui/privacy/crate-private-reexport.stderr
new file mode 100644 (file)
index 0000000..66e11e8
--- /dev/null
@@ -0,0 +1,220 @@
+error[E0364]: `f1` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:8:13
+   |
+LL |     pub use ::f1;
+   |             ^^^^
+   |
+note: consider marking `f1` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:8:13
+   |
+LL |     pub use ::f1;
+   |             ^^^^
+
+error[E0365]: `S1` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:9:13
+   |
+LL |     pub use ::S1;
+   |             ^^^^ re-export of crate public `S1`
+   |
+   = note: consider declaring type or module `S1` with `pub`
+
+error[E0365]: `E1` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:10:13
+   |
+LL |     pub use ::E1;
+   |             ^^^^ re-export of crate public `E1`
+   |
+   = note: consider declaring type or module `E1` with `pub`
+
+error[E0364]: `V` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:11:13
+   |
+LL |     pub use ::E1::V;
+   |             ^^^^^^^
+   |
+note: consider marking `V` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:11:13
+   |
+LL |     pub use ::E1::V;
+   |             ^^^^^^^
+
+error[E0364]: `f2` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:23:13
+   |
+LL |     pub use ::f2;
+   |             ^^^^
+   |
+note: consider marking `f2` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:23:13
+   |
+LL |     pub use ::f2;
+   |             ^^^^
+
+error[E0365]: `S2` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:24:13
+   |
+LL |     pub use ::S2;
+   |             ^^^^ re-export of crate public `S2`
+   |
+   = note: consider declaring type or module `S2` with `pub`
+
+error[E0365]: `E2` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:25:13
+   |
+LL |     pub use ::E2;
+   |             ^^^^ re-export of crate public `E2`
+   |
+   = note: consider declaring type or module `E2` with `pub`
+
+error[E0364]: `V` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:26:13
+   |
+LL |     pub use ::E2::V;
+   |             ^^^^^^^
+   |
+note: consider marking `V` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:26:13
+   |
+LL |     pub use ::E2::V;
+   |             ^^^^^^^
+
+error[E0364]: `f3` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:39:9
+   |
+LL | pub use m3::f3;
+   |         ^^^^^^
+   |
+note: consider marking `f3` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:39:9
+   |
+LL | pub use m3::f3;
+   |         ^^^^^^
+
+error[E0365]: `S3` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:40:9
+   |
+LL | pub use m3::S3;
+   |         ^^^^^^ re-export of crate public `S3`
+   |
+   = note: consider declaring type or module `S3` with `pub`
+
+error[E0365]: `E3` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:41:9
+   |
+LL | pub use m3::E3;
+   |         ^^^^^^ re-export of crate public `E3`
+   |
+   = note: consider declaring type or module `E3` with `pub`
+
+error[E0364]: `V` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:42:9
+   |
+LL | pub use m3::E3::V;
+   |         ^^^^^^^^^
+   |
+note: consider marking `V` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:42:9
+   |
+LL | pub use m3::E3::V;
+   |         ^^^^^^^^^
+
+error[E0364]: `f4` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:45:9
+   |
+LL | pub use ::f4 as f5;
+   |         ^^^^^^^^^^
+   |
+note: consider marking `f4` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:45:9
+   |
+LL | pub use ::f4 as f5;
+   |         ^^^^^^^^^^
+
+error[E0364]: `f6` is private, and cannot be re-exported
+  --> $DIR/crate-private-reexport.rs:53:13
+   |
+LL |     pub use self::m::f6;
+   |             ^^^^^^^^^^^
+   |
+note: consider marking `f6` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:53:13
+   |
+LL |     pub use self::m::f6;
+   |             ^^^^^^^^^^^
+
+error[E0364]: `f7` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:54:13
+   |
+LL |     pub use self::m::f7;
+   |             ^^^^^^^^^^^
+   |
+note: consider marking `f7` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:54:13
+   |
+LL |     pub use self::m::f7;
+   |             ^^^^^^^^^^^
+
+error[E0364]: `f8` is private, and cannot be re-exported
+  --> $DIR/crate-private-reexport.rs:55:13
+   |
+LL |     pub use self::m::f8;
+   |             ^^^^^^^^^^^
+   |
+note: consider marking `f8` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:55:13
+   |
+LL |     pub use self::m::f8;
+   |             ^^^^^^^^^^^
+
+error[E0364]: `f7` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/crate-private-reexport.rs:58:9
+   |
+LL | pub use m10::m::f7;
+   |         ^^^^^^^^^^
+   |
+note: consider marking `f7` as `pub` in the imported module
+  --> $DIR/crate-private-reexport.rs:58:9
+   |
+LL | pub use m10::m::f7;
+   |         ^^^^^^^^^^
+
+error[E0603]: function `f6` is private
+  --> $DIR/crate-private-reexport.rs:57:17
+   |
+LL | pub use m10::m::f6;
+   |                 ^^ private function
+   |
+note: the function `f6` is defined here
+  --> $DIR/crate-private-reexport.rs:49:9
+   |
+LL |         pub(super) fn f6() {}
+   |         ^^^^^^^^^^^^^^^^^^
+
+error[E0603]: function `f8` is private
+  --> $DIR/crate-private-reexport.rs:59:17
+   |
+LL | pub use m10::m::f8;
+   |                 ^^ private function
+   |
+note: the function `f8` is defined here
+  --> $DIR/crate-private-reexport.rs:51:9
+   |
+LL |         pub(in crate::m10) fn f8() {}
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: function `f9` is private
+  --> $DIR/crate-private-reexport.rs:64:14
+   |
+LL | pub use m11::f9;
+   |              ^^ private function
+   |
+note: the function `f9` is defined here
+  --> $DIR/crate-private-reexport.rs:62:5
+   |
+LL |     pub(self) fn f9() {}
+   |     ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 20 previous errors
+
+Some errors have detailed explanations: E0364, E0365, E0603.
+For more information about an error, try `rustc --explain E0364`.
diff --git a/src/test/ui/privacy/export-tag-variant.rs b/src/test/ui/privacy/export-tag-variant.rs
new file mode 100644 (file)
index 0000000..46c1006
--- /dev/null
@@ -0,0 +1,7 @@
+mod foo {
+    pub fn x() { }
+
+    enum Y { Y1 }
+}
+
+fn main() { let z = foo::Y::Y1; } //~ ERROR: enum `Y` is private
diff --git a/src/test/ui/privacy/export-tag-variant.stderr b/src/test/ui/privacy/export-tag-variant.stderr
new file mode 100644 (file)
index 0000000..f73bd45
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0603]: enum `Y` is private
+  --> $DIR/export-tag-variant.rs:7:26
+   |
+LL | fn main() { let z = foo::Y::Y1; }
+   |                          ^ private enum
+   |
+note: the enum `Y` is defined here
+  --> $DIR/export-tag-variant.rs:4:5
+   |
+LL |     enum Y { Y1 }
+   |     ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/privacy/impl-privacy-xc-2.rs b/src/test/ui/privacy/impl-privacy-xc-2.rs
new file mode 100644 (file)
index 0000000..3907645
--- /dev/null
@@ -0,0 +1,10 @@
+// run-pass
+// aux-build:impl_privacy_xc_2.rs
+
+extern crate impl_privacy_xc_2;
+
+pub fn main() {
+    let fish1 = impl_privacy_xc_2::Fish { x: 1 };
+    let fish2 = impl_privacy_xc_2::Fish { x: 2 };
+    if fish1.eq(&fish2) { println!("yes") } else { println!("no") };
+}
index ce1b0d321ca5038b646884f5e9134a0577416274..6882844602286deef9c7eaa6f6f4bad96c60dc68 100644 (file)
@@ -1,13 +1,13 @@
 mod m1 {
-    pub use ::E::V; //~ ERROR `V` is private, and cannot be re-exported
+    pub use ::E::V; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
 }
 
 mod m2 {
-    pub use ::E::{V}; //~ ERROR `V` is private, and cannot be re-exported
+    pub use ::E::{V}; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
 }
 
 mod m3 {
-    pub use ::E::V::{self}; //~ ERROR `V` is private, and cannot be re-exported
+    pub use ::E::V::{self}; //~ ERROR `V` is only public within the crate, and cannot be re-exported outside
 }
 
 #[deny(unused_imports)]
index 7a4c3234dbe6fc490d151bfd9d182ac13d33a6f5..78771ee30d314a29c00d7a91d2d90bcbbfb78a69 100644 (file)
@@ -1,4 +1,4 @@
-error[E0364]: `V` is private, and cannot be re-exported
+error[E0364]: `V` is only public within the crate, and cannot be re-exported outside
   --> $DIR/private-variant-reexport.rs:2:13
    |
 LL |     pub use ::E::V;
@@ -10,7 +10,7 @@ note: consider marking `V` as `pub` in the imported module
 LL |     pub use ::E::V;
    |             ^^^^^^
 
-error[E0364]: `V` is private, and cannot be re-exported
+error[E0364]: `V` is only public within the crate, and cannot be re-exported outside
   --> $DIR/private-variant-reexport.rs:6:19
    |
 LL |     pub use ::E::{V};
@@ -22,11 +22,11 @@ note: consider marking `V` as `pub` in the imported module
 LL |     pub use ::E::{V};
    |                   ^
 
-error[E0365]: `V` is private, and cannot be re-exported
+error[E0365]: `V` is only public within the crate, and cannot be re-exported outside
   --> $DIR/private-variant-reexport.rs:10:22
    |
 LL |     pub use ::E::V::{self};
-   |                      ^^^^ re-export of private `V`
+   |                      ^^^^ re-export of crate public `V`
    |
    = note: consider declaring type or module `V` with `pub`
 
diff --git a/src/test/ui/privacy/reachable-unnameable-items.rs b/src/test/ui/privacy/reachable-unnameable-items.rs
new file mode 100644 (file)
index 0000000..f1e53a0
--- /dev/null
@@ -0,0 +1,31 @@
+// run-pass
+// ignore-wasm32-bare compiled with panic=abort by default
+// aux-build:reachable-unnameable-items.rs
+
+extern crate reachable_unnameable_items;
+use reachable_unnameable_items::*;
+
+fn main() {
+    let res1 = function_returning_unnameable_type().method_of_unnameable_type1();
+    let res2 = CONSTANT_OF_UNNAMEABLE_TYPE.method_of_unnameable_type2();
+    let res4 = AliasOfUnnameableType{}.method_of_unnameable_type4();
+    let res5 = function_returning_unnameable_type().inherent_method_returning_unnameable_type().
+                                                    method_of_unnameable_type5();
+    let res6 = function_returning_unnameable_type().trait_method_returning_unnameable_type().
+                                                    method_of_unnameable_type6();
+    let res7 = STATIC.field_of_unnameable_type.method_of_unnameable_type7();
+    let res8 = generic_function::<AliasOfUnnameableType>().method_of_unnameable_type8();
+    let res_enum = NameableVariant.method_of_unnameable_enum();
+    assert_eq!(res1, "Hello1");
+    assert_eq!(res2, "Hello2");
+    assert_eq!(res4, "Hello4");
+    assert_eq!(res5, "Hello5");
+    assert_eq!(res6, "Hello6");
+    assert_eq!(res7, "Hello7");
+    assert_eq!(res8, "Hello8");
+    assert_eq!(res_enum, "HelloEnum");
+
+    let none = None;
+    function_accepting_unnameable_type(none);
+    let _guard = std::panic::catch_unwind(|| none.unwrap().method_of_unnameable_type3());
+}
diff --git a/src/test/ui/process/core-run-destroy.rs b/src/test/ui/process/core-run-destroy.rs
new file mode 100644 (file)
index 0000000..5fd418e
--- /dev/null
@@ -0,0 +1,87 @@
+// run-pass
+
+#![allow(unused_must_use)]
+#![allow(stable_features)]
+#![allow(deprecated)]
+#![allow(unused_imports)]
+// compile-flags:--test
+// ignore-emscripten no processes
+// ignore-sgx no processes
+// ignore-vxworks no 'cat' and 'sleep'
+
+// N.B., these tests kill child processes. Valgrind sees these children as leaking
+// memory, which makes for some *confusing* logs. That's why these are here
+// instead of in std.
+
+#![feature(rustc_private, duration)]
+
+extern crate libc;
+
+use std::process::{self, Command, Child, Output, Stdio};
+use std::str;
+use std::sync::mpsc::channel;
+use std::thread;
+use std::time::Duration;
+
+macro_rules! t {
+    ($e:expr) => (match $e { Ok(e) => e, Err(e) => panic!("error: {}", e) })
+}
+
+#[test]
+fn test_destroy_once() {
+    let mut p = sleeper();
+    t!(p.kill());
+}
+
+#[cfg(unix)]
+pub fn sleeper() -> Child {
+    t!(Command::new("sleep").arg("1000").spawn())
+}
+#[cfg(windows)]
+pub fn sleeper() -> Child {
+    // There's a `timeout` command on windows, but it doesn't like having
+    // its output piped, so instead just ping ourselves a few times with
+    // gaps in between so we're sure this process is alive for awhile
+    t!(Command::new("ping").arg("127.0.0.1").arg("-n").arg("1000").spawn())
+}
+
+#[test]
+fn test_destroy_twice() {
+    let mut p = sleeper();
+    t!(p.kill()); // this shouldn't crash...
+    let _ = p.kill(); // ...and nor should this (and nor should the destructor)
+}
+
+#[test]
+fn test_destroy_actually_kills() {
+    let cmd = if cfg!(windows) {
+        "cmd"
+    } else if cfg!(target_os = "android") {
+        "/system/bin/cat"
+    } else {
+        "cat"
+    };
+
+    // this process will stay alive indefinitely trying to read from stdin
+    let mut p = t!(Command::new(cmd)
+                           .stdin(Stdio::piped())
+                           .spawn());
+
+    t!(p.kill());
+
+    // Don't let this test time out, this should be quick
+    let (tx, rx) = channel();
+    thread::spawn(move|| {
+        thread::sleep_ms(1000);
+        if rx.try_recv().is_err() {
+            process::exit(1);
+        }
+    });
+    let code = t!(p.wait()).code();
+    if cfg!(windows) {
+        assert!(code.is_some());
+    } else {
+        assert!(code.is_none());
+    }
+    tx.send(());
+}
diff --git a/src/test/ui/process/multi-panic.rs b/src/test/ui/process/multi-panic.rs
new file mode 100644 (file)
index 0000000..37e8b99
--- /dev/null
@@ -0,0 +1,37 @@
+// run-pass
+// ignore-emscripten no processes
+// ignore-sgx no processes
+
+fn check_for_no_backtrace(test: std::process::Output) {
+    assert!(!test.status.success());
+    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(), 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(), None);
+}
+
+fn main() {
+    let args: Vec<String> = std::env::args().collect();
+    if args.len() > 1 && args[1] == "run_test" {
+        let _ = std::thread::spawn(|| {
+            panic!();
+        }).join();
+
+        panic!();
+    } else {
+        let test = std::process::Command::new(&args[0]).arg("run_test")
+                                                       .env_remove("RUST_BACKTRACE")
+                                                       .output()
+                                                       .unwrap();
+        check_for_no_backtrace(test);
+        let test = std::process::Command::new(&args[0]).arg("run_test")
+                                                       .env("RUST_BACKTRACE","0")
+                                                       .output()
+                                                       .unwrap();
+        check_for_no_backtrace(test);
+    }
+}
diff --git a/src/test/ui/process/no-stdio.rs b/src/test/ui/process/no-stdio.rs
new file mode 100644 (file)
index 0000000..2498538
--- /dev/null
@@ -0,0 +1,139 @@
+// run-pass
+// ignore-android
+// ignore-emscripten no processes
+// ignore-sgx no processes
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
+
+#![feature(rustc_private)]
+
+extern crate libc;
+
+use std::process::{Command, Stdio};
+use std::env;
+use std::io::{self, Read, Write};
+
+#[cfg(unix)]
+unsafe fn without_stdio<R, F: FnOnce() -> R>(f: F) -> R {
+    let doit = |a| {
+        let r = libc::dup(a);
+        assert!(r >= 0);
+        return r
+    };
+    let a = doit(0);
+    let b = doit(1);
+    let c = doit(2);
+
+    assert!(libc::close(0) >= 0);
+    assert!(libc::close(1) >= 0);
+    assert!(libc::close(2) >= 0);
+
+    let r = f();
+
+    assert!(libc::dup2(a, 0) >= 0);
+    assert!(libc::dup2(b, 1) >= 0);
+    assert!(libc::dup2(c, 2) >= 0);
+
+    return r
+}
+
+#[cfg(unix)]
+fn assert_fd_is_valid(fd: libc::c_int) {
+    if unsafe { libc::fcntl(fd, libc::F_GETFD) == -1 } {
+        panic!("file descriptor {} is not valid: {}", fd, io::Error::last_os_error());
+    }
+}
+
+#[cfg(windows)]
+fn assert_fd_is_valid(_fd: libc::c_int) {}
+
+#[cfg(windows)]
+unsafe fn without_stdio<R, F: FnOnce() -> R>(f: F) -> R {
+    type DWORD = u32;
+    type HANDLE = *mut u8;
+    type BOOL = i32;
+
+    const STD_INPUT_HANDLE: DWORD = -10i32 as DWORD;
+    const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD;
+    const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
+    const INVALID_HANDLE_VALUE: HANDLE = !0 as HANDLE;
+
+    extern "system" {
+        fn GetStdHandle(which: DWORD) -> HANDLE;
+        fn SetStdHandle(which: DWORD, handle: HANDLE) -> BOOL;
+    }
+
+    let doit = |id| {
+        let handle = GetStdHandle(id);
+        assert!(handle != INVALID_HANDLE_VALUE);
+        assert!(SetStdHandle(id, INVALID_HANDLE_VALUE) != 0);
+        return handle
+    };
+
+    let a = doit(STD_INPUT_HANDLE);
+    let b = doit(STD_OUTPUT_HANDLE);
+    let c = doit(STD_ERROR_HANDLE);
+
+    let r = f();
+
+    let doit = |id, handle| {
+        assert!(SetStdHandle(id, handle) != 0);
+    };
+    doit(STD_INPUT_HANDLE, a);
+    doit(STD_OUTPUT_HANDLE, b);
+    doit(STD_ERROR_HANDLE, c);
+
+    return r
+}
+
+fn main() {
+    if env::args().len() > 1 {
+        // Writing to stdout & stderr should not panic.
+        println!("test");
+        assert!(io::stdout().write(b"test\n").is_ok());
+        assert!(io::stderr().write(b"test\n").is_ok());
+
+        // Stdin should be at EOF.
+        assert_eq!(io::stdin().read(&mut [0; 10]).unwrap(), 0);
+
+        // Standard file descriptors should be valid on UNIX:
+        assert_fd_is_valid(0);
+        assert_fd_is_valid(1);
+        assert_fd_is_valid(2);
+        return
+    }
+
+    // First, make sure reads/writes without stdio work if stdio itself is
+    // missing.
+    let (a, b, c) = unsafe {
+        without_stdio(|| {
+            let a = io::stdout().write(b"test\n");
+            let b = io::stderr().write(b"test\n");
+            let c = io::stdin().read(&mut [0; 10]);
+
+            (a, b, c)
+        })
+    };
+
+    assert_eq!(a.unwrap(), 5);
+    assert_eq!(b.unwrap(), 5);
+    assert_eq!(c.unwrap(), 0);
+
+    // Second, spawn a child and do some work with "null" descriptors to make
+    // sure it's ok
+    let me = env::current_exe().unwrap();
+    let status = Command::new(&me)
+                        .arg("next")
+                        .stdin(Stdio::null())
+                        .stdout(Stdio::null())
+                        .stderr(Stdio::null())
+                        .status().unwrap();
+    assert!(status.success(), "{} isn't a success", status);
+
+    // Finally, close everything then spawn a child to make sure everything is
+    // *still* ok.
+    let status = unsafe {
+        without_stdio(|| Command::new(&me).arg("next").status())
+    }.unwrap();
+    assert!(status.success(), "{} isn't a success", status);
+}
diff --git a/src/test/ui/process/try-wait.rs b/src/test/ui/process/try-wait.rs
new file mode 100644 (file)
index 0000000..6921972
--- /dev/null
@@ -0,0 +1,60 @@
+// run-pass
+
+#![allow(stable_features)]
+// ignore-emscripten no processes
+// ignore-sgx no processes
+
+#![feature(process_try_wait)]
+
+use std::env;
+use std::process::Command;
+use std::thread;
+use std::time::Duration;
+
+fn main() {
+    let args = env::args().collect::<Vec<_>>();
+    if args.len() != 1 {
+        match &args[1][..] {
+            "sleep" => thread::sleep(Duration::new(1_000, 0)),
+            _ => {}
+        }
+        return
+    }
+
+    let mut me = Command::new(env::current_exe().unwrap())
+                         .arg("sleep")
+                         .spawn()
+                         .unwrap();
+    let maybe_status = me.try_wait().unwrap();
+    assert!(maybe_status.is_none());
+    let maybe_status = me.try_wait().unwrap();
+    assert!(maybe_status.is_none());
+
+    me.kill().unwrap();
+    me.wait().unwrap();
+
+    let status = me.try_wait().unwrap().unwrap();
+    assert!(!status.success());
+    let status = me.try_wait().unwrap().unwrap();
+    assert!(!status.success());
+
+    let mut me = Command::new(env::current_exe().unwrap())
+                         .arg("return-quickly")
+                         .spawn()
+                         .unwrap();
+    loop {
+        match me.try_wait() {
+            Ok(Some(res)) => {
+                assert!(res.success());
+                break
+            }
+            Ok(None) => {
+                thread::sleep(Duration::from_millis(1));
+            }
+            Err(e) => panic!("error in try_wait: {}", e),
+        }
+    }
+
+    let status = me.try_wait().unwrap().unwrap();
+    assert!(status.success());
+}
diff --git a/src/test/ui/project-cache-issue-37154.rs b/src/test/ui/project-cache-issue-37154.rs
deleted file mode 100644 (file)
index b10239c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// run-pass
-
-#![allow(dead_code)]
-// Regression test for #37154: the problem here was that the cache
-// results in a false error because it was caching placeholder results
-// even after those placeholder regions had been popped.
-
-trait Foo {
-    fn method(&self) {}
-}
-
-struct Wrapper<T>(T);
-
-impl<T> Foo for Wrapper<T> where for<'a> &'a T: IntoIterator<Item=&'a ()> {}
-
-fn f(x: Wrapper<Vec<()>>) {
-    x.method(); // This works.
-    x.method(); // error: no method named `method`
-}
-
-fn main() { }
diff --git a/src/test/ui/pure-sum.rs b/src/test/ui/pure-sum.rs
deleted file mode 100644 (file)
index 2f2ece7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// run-pass
-
-#![allow(dead_code)]
-// Check that functions can modify local state.
-
-// pretty-expanded FIXME #23616
-
-fn sums_to(v: Vec<isize> , sum: isize) -> bool {
-    let mut i = 0;
-    let mut sum0 = 0;
-    while i < v.len() {
-        sum0 += v[i];
-        i += 1;
-    }
-    return sum0 == sum;
-}
-
-fn sums_to_using_uniq(v: Vec<isize> , sum: isize) -> bool {
-    let mut i = 0;
-    let mut sum0: Box<_> = 0.into();
-    while i < v.len() {
-        *sum0 += v[i];
-        i += 1;
-    }
-    return *sum0 == sum;
-}
-
-fn sums_to_using_rec(v: Vec<isize> , sum: isize) -> bool {
-    let mut i = 0;
-    let mut sum0 = F {f: 0};
-    while i < v.len() {
-        sum0.f += v[i];
-        i += 1;
-    }
-    return sum0.f == sum;
-}
-
-struct F<T> { f: T }
-
-fn sums_to_using_uniq_rec(v: Vec<isize> , sum: isize) -> bool {
-    let mut i = 0;
-    let mut sum0 = F::<Box<_>> {f: 0.into() };
-    while i < v.len() {
-        *sum0.f += v[i];
-        i += 1;
-    }
-    return *sum0.f == sum;
-}
-
-pub fn main() {
-}
diff --git a/src/test/ui/range-type-infer.rs b/src/test/ui/range-type-infer.rs
deleted file mode 100644 (file)
index f07c041..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-
-#![allow(unused_must_use)]
-// Make sure the type inference for the new range expression work as
-// good as the old one. Check out issue #21672, #21595 and #21649 for
-// more details.
-
-
-fn main() {
-    let xs = (0..8).map(|i| i == 1u64).collect::<Vec<_>>();
-    assert_eq!(xs[1], true);
-    let xs = (0..8).map(|i| 1u64 == i).collect::<Vec<_>>();
-    assert_eq!(xs[1], true);
-    let xs: Vec<u8> = (0..10).collect();
-    assert_eq!(xs.len(), 10);
-
-    for x in 0..10 { x % 2; }
-    for x in 0..100 { x as f32; }
-
-    let array = [true, false];
-    for i in 0..1 { array[i]; }
-}
index ff494d7d4b80632584f56787b464cbad908b1f2a..2ce4e1553d28e52b54e970a233bda9994bc3c53b 100644 (file)
@@ -12,11 +12,6 @@ LL |     for i in false..true {}
    |
    = note: required because of the requirements on the impl of `Iterator` for `std::ops::Range<bool>`
    = note: required because of the requirements on the impl of `IntoIterator` for `std::ops::Range<bool>`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
   --> $DIR/range-1.rs:14:17
index 34c59fcb318a99df40f6829fc7d5d2fdea7ea3b2..617afc995305e5956e7ce55582f718d7ae094991 100644 (file)
@@ -8,11 +8,6 @@ LL |     a: Range<usize>,
    |     ^^^^^^^^^^^^^^^ no implementation for `std::ops::Range<usize> < std::ops::Range<usize>` and `std::ops::Range<usize> > std::ops::Range<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::Range<usize>`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeTo<usize>` with `std::ops::RangeTo<usize>`
@@ -25,11 +20,6 @@ LL |     b: RangeTo<usize>,
    |     ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo<usize> < std::ops::RangeTo<usize>` and `std::ops::RangeTo<usize> > std::ops::RangeTo<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeTo<usize>`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFrom<usize>` with `std::ops::RangeFrom<usize>`
@@ -42,11 +32,6 @@ LL |     c: RangeFrom<usize>,
    |     ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom<usize> < std::ops::RangeFrom<usize>` and `std::ops::RangeFrom<usize> > std::ops::RangeFrom<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFrom<usize>`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull`
@@ -59,11 +44,6 @@ LL |     d: RangeFull,
    |     ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFull`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeInclusive<usize>` with `std::ops::RangeInclusive<usize>`
@@ -76,11 +56,6 @@ LL |     e: RangeInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive<usize> < std::ops::RangeInclusive<usize>` and `std::ops::RangeInclusive<usize> > std::ops::RangeInclusive<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeInclusive<usize>`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: can't compare `std::ops::RangeToInclusive<usize>` with `std::ops::RangeToInclusive<usize>`
@@ -93,11 +68,6 @@ LL |     f: RangeToInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive<usize> < std::ops::RangeToInclusive<usize>` and `std::ops::RangeToInclusive<usize> > std::ops::RangeToInclusive<usize>`
    |
    = help: the trait `PartialOrd` is not implemented for `std::ops::RangeToInclusive<usize>`
-note: required by `std::cmp::PartialOrd::partial_cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::Range<usize>: Ord` is not satisfied
@@ -109,11 +79,6 @@ LL | struct AllTheRanges {
 LL |     a: Range<usize>,
    |     ^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::Range<usize>`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeTo<usize>: Ord` is not satisfied
@@ -125,11 +90,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 LL |     b: RangeTo<usize>,
    |     ^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeTo<usize>`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeFrom<usize>: Ord` is not satisfied
@@ -141,11 +101,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 LL |     c: RangeFrom<usize>,
    |     ^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFrom<usize>`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeFull: Ord` is not satisfied
@@ -157,11 +112,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 LL |     d: RangeFull,
    |     ^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFull`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeInclusive<usize>: Ord` is not satisfied
@@ -173,11 +123,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 LL |     e: RangeInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeInclusive<usize>`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0277]: the trait bound `std::ops::RangeToInclusive<usize>: Ord` is not satisfied
@@ -189,11 +134,6 @@ LL | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 LL |     f: RangeToInclusive<usize>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeToInclusive<usize>`
    |
-note: required by `std::cmp::Ord::cmp`
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
-   |
-LL |     fn cmp(&self, other: &Self) -> Ordering;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 12 previous errors
diff --git a/src/test/ui/raw-fat-ptr.rs b/src/test/ui/raw-fat-ptr.rs
deleted file mode 100644 (file)
index 9f50659..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-// run-pass
-// check raw fat pointer ops
-
-use std::mem;
-
-fn assert_inorder<T: PartialEq + PartialOrd>(a: &[T]) {
-    for i in 0..a.len() {
-        for j in 0..a.len() {
-            if i < j {
-                assert!(a[i] < a[j]);
-                assert!(a[i] <= a[j]);
-                assert!(!(a[i] == a[j]));
-                assert!(a[i] != a[j]);
-                assert!(!(a[i] >= a[j]));
-                assert!(!(a[i] > a[j]));
-            } else if i == j {
-                assert!(!(a[i] < a[j]));
-                assert!(a[i] <= a[j]);
-                assert!(a[i] == a[j]);
-                assert!(!(a[i] != a[j]));
-                assert!(a[i] >= a[j]);
-                assert!(!(a[i] > a[j]));
-            } else {
-                assert!(!(a[i] < a[j]));
-                assert!(!(a[i] <= a[j]));
-                assert!(!(a[i] == a[j]));
-                assert!(a[i] != a[j]);
-                assert!(a[i] >= a[j]);
-                assert!(a[i] > a[j]);
-            }
-        }
-    }
-}
-
-trait Foo { fn foo(&self) -> usize; }
-impl<T> Foo for T {
-    fn foo(&self) -> usize {
-        mem::size_of::<T>()
-    }
-}
-
-struct S<T:?Sized>(u32, T);
-
-fn main() {
-    let mut array = [0,1,2,3,4];
-    let mut array2 = [5,6,7,8,9];
-
-    // fat ptr comparison: addr then extra
-
-    // check ordering for arrays
-    let mut ptrs: Vec<*const [u8]> = vec![
-        &array[0..0], &array[0..1], &array, &array[1..]
-    ];
-
-    let array_addr = &array as *const [u8] as *const u8 as usize;
-    let array2_addr = &array2 as *const [u8] as *const u8 as usize;
-    if array2_addr < array_addr {
-        ptrs.insert(0, &array2);
-    } else {
-        ptrs.push(&array2);
-    }
-    assert_inorder(&ptrs);
-
-    // check ordering for mut arrays
-    let mut ptrs: Vec<*mut [u8]> = vec![
-        &mut array[0..0], &mut array[0..1], &mut array, &mut array[1..]
-    ];
-
-    let array_addr = &mut array as *mut [u8] as *mut u8 as usize;
-    let array2_addr = &mut array2 as *mut [u8] as *mut u8 as usize;
-    if array2_addr < array_addr {
-        ptrs.insert(0, &mut array2);
-    } else {
-        ptrs.push(&mut array2);
-    }
-    assert_inorder(&ptrs);
-
-    let mut u8_ = (0u8, 1u8);
-    let mut u32_ = (4u32, 5u32);
-
-    // check ordering for ptrs
-    let buf: &mut [*const dyn Foo] = &mut [
-        &u8_, &u8_.0,
-        &u32_, &u32_.0,
-    ];
-    buf.sort_by(|u,v| {
-        let u : [*const (); 2] = unsafe { mem::transmute(*u) };
-        let v : [*const (); 2] = unsafe { mem::transmute(*v) };
-        u.cmp(&v)
-    });
-    assert_inorder(buf);
-
-    // check ordering for mut ptrs
-    let buf: &mut [*mut dyn Foo] = &mut [
-        &mut u8_, &mut u8_.0,
-        &mut u32_, &mut u32_.0,
-    ];
-    buf.sort_by(|u,v| {
-        let u : [*const (); 2] = unsafe { mem::transmute(*u) };
-        let v : [*const (); 2] = unsafe { mem::transmute(*v) };
-        u.cmp(&v)
-    });
-    assert_inorder(buf);
-
-    // check ordering for structs containing arrays
-    let ss: (S<[u8; 2]>,
-             S<[u8; 3]>,
-             S<[u8; 2]>) = (
-        S(7, [8, 9]),
-        S(10, [11, 12, 13]),
-        S(4, [5, 6])
-    );
-    assert_inorder(&[
-        &ss.0 as *const S<[u8]>,
-        &ss.1 as *const S<[u8]>,
-        &ss.2 as *const S<[u8]>
-    ]);
-}
diff --git a/src/test/ui/reachable-unnameable-items.rs b/src/test/ui/reachable-unnameable-items.rs
deleted file mode 100644 (file)
index f1e53a0..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// run-pass
-// ignore-wasm32-bare compiled with panic=abort by default
-// aux-build:reachable-unnameable-items.rs
-
-extern crate reachable_unnameable_items;
-use reachable_unnameable_items::*;
-
-fn main() {
-    let res1 = function_returning_unnameable_type().method_of_unnameable_type1();
-    let res2 = CONSTANT_OF_UNNAMEABLE_TYPE.method_of_unnameable_type2();
-    let res4 = AliasOfUnnameableType{}.method_of_unnameable_type4();
-    let res5 = function_returning_unnameable_type().inherent_method_returning_unnameable_type().
-                                                    method_of_unnameable_type5();
-    let res6 = function_returning_unnameable_type().trait_method_returning_unnameable_type().
-                                                    method_of_unnameable_type6();
-    let res7 = STATIC.field_of_unnameable_type.method_of_unnameable_type7();
-    let res8 = generic_function::<AliasOfUnnameableType>().method_of_unnameable_type8();
-    let res_enum = NameableVariant.method_of_unnameable_enum();
-    assert_eq!(res1, "Hello1");
-    assert_eq!(res2, "Hello2");
-    assert_eq!(res4, "Hello4");
-    assert_eq!(res5, "Hello5");
-    assert_eq!(res6, "Hello6");
-    assert_eq!(res7, "Hello7");
-    assert_eq!(res8, "Hello8");
-    assert_eq!(res_enum, "HelloEnum");
-
-    let none = None;
-    function_accepting_unnameable_type(none);
-    let _guard = std::panic::catch_unwind(|| none.unwrap().method_of_unnameable_type3());
-}
index 4de29c3c3d7616406daac5cf25fe7a81904e7928..e9cef5f47d4aa555e6c8e010c5f4c17cbfe8b858 100644 (file)
@@ -17,5 +17,4 @@ fn next(&mut self) -> Option<Void> {
 fn main() {
     for _ in unimplemented!() as Void {}
     //~^ ERROR unreachable pattern
-    //~^^ ERROR unreachable pattern
 }
index 680d22862d7fe32c168e710fc4ff236e6f371ed1..80ffa5d73f034224bf4ddef273c0038740735f45 100644 (file)
@@ -10,11 +10,5 @@ note: the lint level is defined here
 LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
-error: unreachable pattern
-  --> $DIR/unreachable-loop-patterns.rs:18:14
-   |
-LL |     for _ in unimplemented!() as Void {}
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
diff --git a/src/test/ui/reexport-star.rs b/src/test/ui/reexport-star.rs
deleted file mode 100644 (file)
index 639ab1a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-
-mod a {
-    pub fn f() {}
-    pub fn g() {}
-}
-
-mod b {
-    pub use a::*;
-}
-
-pub fn main() {
-    b::f();
-    b::g();
-}
index 66b61b1349d2b4745dce1dd34382c9616ee54549..318e9d006a1485c4e354b2ebcbdf70606aea0716 100644 (file)
@@ -4,7 +4,11 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime
 LL |     Foo.some_method::<&'a isize>();
    |         ^^^^^^^^^^^
    |
-   = note: type must satisfy the static lifetime
+note: type must satisfy the static lifetime as required by this binding
+  --> $DIR/regions-bounded-method-type-parameters.rs:8:22
+   |
+LL |     fn some_method<A:'static>(self) { }
+   |                      ^^^^^^^
 
 error: aborting due to previous error
 
index 83f8d20b9e1deaae136e32c6a2bdafef7b92c06b..512a7ab35fbfdead4e829465ae92baface621df9 100644 (file)
@@ -29,7 +29,13 @@ LL | fn f<'a, T, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
    |          - help: consider adding an explicit lifetime bound...: `T: 'static`
 LL |     // oh dear!
 LL |     Box::new(B(&*v)) as Box<dyn X>
-   |              ^ ...so that the type `T` will meet its required lifetime bounds
+   |              ^ ...so that the type `T` will meet its required lifetime bounds...
+   |
+note: ...that is required by this bound
+  --> $DIR/regions-close-object-into-object-5.rs:9:17
+   |
+LL | struct B<'a, T: 'a>(&'a (A<T> + 'a));
+   |                 ^^
 
 error[E0310]: the parameter type `T` may not live long enough
   --> $DIR/regions-close-object-into-object-5.rs:17:14
diff --git a/src/test/ui/regions/wf-bound-region-in-object-type.rs b/src/test/ui/regions/wf-bound-region-in-object-type.rs
new file mode 100644 (file)
index 0000000..7c4dd3e
--- /dev/null
@@ -0,0 +1,22 @@
+// run-pass
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+// Test that the `wf` checker properly handles bound regions in object
+// types. Compiling this code used to trigger an ICE.
+
+// pretty-expanded FIXME #23616
+
+pub struct Context<'tcx> {
+    vec: &'tcx Vec<isize>
+}
+
+pub type Cmd<'a> = &'a isize;
+
+pub type DecodeInlinedItem<'a> =
+    Box<dyn for<'tcx> FnMut(Cmd, &Context<'tcx>) -> Result<&'tcx isize, ()> + 'a>;
+
+fn foo(d: DecodeInlinedItem) {
+}
+
+fn main() { }
diff --git a/src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo.rs b/src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo.rs
new file mode 100644 (file)
index 0000000..cf769f3
--- /dev/null
@@ -0,0 +1,3 @@
+#![crate_type="lib"]
+
+pub const X: () = ();
diff --git a/src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo2.rs b/src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo2.rs
new file mode 100644 (file)
index 0000000..81c16ed
--- /dev/null
@@ -0,0 +1,3 @@
+#![crate_type="lib"]
+
+pub const Y: () = ();
diff --git a/src/test/ui/resolve/blind-item-mixed-crate-use-item.rs b/src/test/ui/resolve/blind-item-mixed-crate-use-item.rs
new file mode 100644 (file)
index 0000000..36d8ab1
--- /dev/null
@@ -0,0 +1,26 @@
+// run-pass
+// aux-build:blind-item-mixed-crate-use-item-foo.rs
+// aux-build:blind-item-mixed-crate-use-item-foo2.rs
+
+// pretty-expanded FIXME #23616
+
+mod m {
+    pub fn f<T>(_: T, _: (), _: ()) { }
+    pub fn g<T>(_: T, _: (), _: ()) { }
+}
+
+const BAR: () = ();
+struct Data;
+use m::f;
+extern crate blind_item_mixed_crate_use_item_foo as foo;
+
+fn main() {
+    const BAR2: () = ();
+    struct Data2;
+    use m::g;
+
+    extern crate blind_item_mixed_crate_use_item_foo2 as foo2;
+
+    f(Data, BAR, foo::X);
+    g(Data2, BAR2, foo2::Y);
+}
diff --git a/src/test/ui/resolve/blind-item-mixed-use-item.rs b/src/test/ui/resolve/blind-item-mixed-use-item.rs
new file mode 100644 (file)
index 0000000..4a39054
--- /dev/null
@@ -0,0 +1,20 @@
+// run-pass
+// pretty-expanded FIXME #23616
+
+mod m {
+    pub fn f<T>(_: T, _: ()) { }
+    pub fn g<T>(_: T, _: ()) { }
+}
+
+const BAR: () = ();
+struct Data;
+use m::f;
+
+fn main() {
+    const BAR2: () = ();
+    struct Data2;
+    use m::g;
+
+    f(Data, BAR);
+    g(Data2, BAR2);
+}
diff --git a/src/test/ui/resolve/export-fully-qualified.rs b/src/test/ui/resolve/export-fully-qualified.rs
new file mode 100644 (file)
index 0000000..4e73a2c
--- /dev/null
@@ -0,0 +1,11 @@
+// In this test baz isn't resolved when called as foo.baz even though
+// it's called from inside foo. This is somewhat surprising and may
+// want to change eventually.
+
+mod foo {
+    pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of undeclared crate or module `foo`
+
+    fn baz() { }
+}
+
+fn main() { }
diff --git a/src/test/ui/resolve/export-fully-qualified.stderr b/src/test/ui/resolve/export-fully-qualified.stderr
new file mode 100644 (file)
index 0000000..7ee352e
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve: use of undeclared crate or module `foo`
+  --> $DIR/export-fully-qualified.rs:6:20
+   |
+LL |     pub fn bar() { foo::baz(); }
+   |                    ^^^ use of undeclared crate or module `foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
index 4025b5030dc0fc8b49f6eb4ea7768a62e062da00..50446bb659b0c5822c57891d822e64113d718446 100644 (file)
@@ -58,7 +58,7 @@ LL |     async fn associated();
    |
    = note: while checking the return type of the `async fn`
    = note: expected fn pointer `fn()`
-              found fn pointer `fn() -> impl Future`
+              found fn pointer `fn() -> impl Future<Output = ()>`
 
 error: aborting due to 6 previous errors
 
diff --git a/src/test/ui/resolve/no-std-1.rs b/src/test/ui/resolve/no-std-1.rs
new file mode 100644 (file)
index 0000000..5b59e9b
--- /dev/null
@@ -0,0 +1,10 @@
+// run-pass
+
+#![no_std]
+
+extern crate std;
+
+fn main() {
+    let a = Some("foo");
+    a.unwrap();
+}
diff --git a/src/test/ui/resolve/no-std-2.rs b/src/test/ui/resolve/no-std-2.rs
new file mode 100644 (file)
index 0000000..487d416
--- /dev/null
@@ -0,0 +1,10 @@
+// run-pass
+
+#![no_std]
+
+extern crate std;
+
+fn main() {
+    let a = core::option::Option::Some("foo");
+    a.unwrap();
+}
diff --git a/src/test/ui/resolve/no-std-3.rs b/src/test/ui/resolve/no-std-3.rs
new file mode 100644 (file)
index 0000000..f6c4ed5
--- /dev/null
@@ -0,0 +1,17 @@
+// run-pass
+
+#![no_std]
+
+extern crate std;
+
+mod foo {
+    pub fn test() -> Option<i32> {
+        Some(2)
+    }
+}
+
+fn main() {
+    let a = core::option::Option::Some("foo");
+    a.unwrap();
+    foo::test().unwrap();
+}
diff --git a/src/test/ui/resolve/pathless-extern-ok.rs b/src/test/ui/resolve/pathless-extern-ok.rs
new file mode 100644 (file)
index 0000000..0ffa5eb
--- /dev/null
@@ -0,0 +1,9 @@
+// edition:2018
+// compile-flags:--extern alloc
+// build-pass
+
+// Test that `--extern alloc` will load from the sysroot without error.
+
+fn main() {
+    let _: Vec<i32> = alloc::vec::Vec::new();
+}
index 06c52befd52b2daa8694f9c2d12af234bae2e67f..c93ba915efb2f36fd919fff93466f6fdd41ba55c 100644 (file)
@@ -340,8 +340,9 @@ LL |         let _ = Z::Unit();
    |
 help: `Z::Unit` is a unit variant, you need to write it without the parentheses
    |
-LL |         let _ = Z::Unit;
-   |                 ~~~~~~~
+LL -         let _ = Z::Unit();
+LL +         let _ = Z::Unit;
+   | 
 
 error[E0308]: mismatched types
   --> $DIR/privacy-enum-ctor.rs:43:16
@@ -374,8 +375,9 @@ LL |     let _: E = m::E::Unit();
    |
 help: `m::E::Unit` is a unit variant, you need to write it without the parentheses
    |
-LL |     let _: E = m::E::Unit;
-   |                ~~~~~~~~~~
+LL -     let _: E = m::E::Unit();
+LL +     let _: E = m::E::Unit;
+   | 
 
 error[E0308]: mismatched types
   --> $DIR/privacy-enum-ctor.rs:51:16
@@ -408,8 +410,9 @@ LL |     let _: E = E::Unit();
    |
 help: `E::Unit` is a unit variant, you need to write it without the parentheses
    |
-LL |     let _: E = E::Unit;
-   |                ~~~~~~~
+LL -     let _: E = E::Unit();
+LL +     let _: E = E::Unit;
+   | 
 
 error: aborting due to 23 previous errors
 
diff --git a/src/test/ui/retslot-cast.rs b/src/test/ui/retslot-cast.rs
deleted file mode 100644 (file)
index ae500cb..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#![allow(warnings)]
-
-pub fn fail(x: Option<&(Iterator<Item=()>+Send)>)
-            -> Option<&Iterator<Item=()>> {
-    // This call used to trigger an LLVM assertion because the return
-    // slot had type "Option<&Iterator>"* instead of
-    // "Option<&(Iterator+Send)>"* -- but this now yields a
-    // compilation error and I'm not sure how to create a comparable
-    // test. To ensure that this PARTICULAR failure doesn't occur
-    // again, though, I've left this test here, so if this ever starts
-    // to compile again, we can adjust the test appropriately (clearly
-    // it should never ICE...). -nmatsakis
-    inner(x) //~ ERROR mismatched types
-}
-
-pub fn inner(x: Option<&(Iterator<Item=()>+Send)>)
-             -> Option<&(Iterator<Item=()>+Send)> {
-    x
-}
-
-
-fn main() {}
diff --git a/src/test/ui/retslot-cast.stderr b/src/test/ui/retslot-cast.stderr
deleted file mode 100644 (file)
index 798ce11..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/retslot-cast.rs:13:5
-   |
-LL |             -> Option<&Iterator<Item=()>> {
-   |                -------------------------- expected `Option<&dyn Iterator<Item = ()>>` because of return type
-...
-LL |     inner(x)
-   |     ^^^^^^^^ expected trait `Iterator<Item = ()>`, found trait `Iterator<Item = ()> + Send`
-   |
-   = note: expected enum `Option<&dyn Iterator<Item = ()>>`
-              found enum `Option<&dyn Iterator<Item = ()> + Send>`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
index 513b473c4de436f5b96e79b75a2f064d01c58acf..3fc5cb1b079734ad94d5a8df71daf9248b1fbaec 100644 (file)
@@ -544,11 +544,6 @@ LL |     if (let 0 = 0)? {}
    |        ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
    |
    = help: the trait `Try` is not implemented for `bool`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/disallowed-positions.rs:44:19
@@ -566,11 +561,6 @@ LL | | }
    | |_- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<_>` is not implemented for `()`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
   --> $DIR/disallowed-positions.rs:54:8
@@ -710,11 +700,6 @@ LL |         if let 0 = 0? {}
    |                    ^^ the `?` operator cannot be applied to type `{integer}`
    |
    = help: the trait `Try` is not implemented for `{integer}`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
   --> $DIR/disallowed-positions.rs:94:11
@@ -747,11 +732,6 @@ LL |     while (let 0 = 0)? {}
    |           ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
    |
    = help: the trait `Try` is not implemented for `bool`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/disallowed-positions.rs:108:22
@@ -769,11 +749,6 @@ LL | | }
    | |_- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<_>` is not implemented for `()`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
   --> $DIR/disallowed-positions.rs:118:11
@@ -913,11 +888,6 @@ LL |         while let 0 = 0? {}
    |                       ^^ the `?` operator cannot be applied to type `{integer}`
    |
    = help: the trait `Try` is not implemented for `{integer}`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0614]: type `bool` cannot be dereferenced
   --> $DIR/disallowed-positions.rs:171:5
@@ -938,11 +908,6 @@ LL |     (let 0 = 0)?;
    |     ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
    |
    = help: the trait `Try` is not implemented for `bool`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/disallowed-positions.rs:181:16
@@ -960,11 +925,6 @@ LL | | }
    | |_- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<_>` is not implemented for `()`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
   --> $DIR/disallowed-positions.rs:196:10
@@ -993,11 +953,6 @@ LL |         let 0 = 0?;
    |                 ^^ the `?` operator cannot be applied to type `{integer}`
    |
    = help: the trait `Try` is not implemented for `{integer}`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 103 previous errors; 1 warning emitted
 
index 987412126771778a502f7a747337f9aa86f700dc..0ab994ecd45bedeff1ce909a16f40b9049c51a13 100644 (file)
@@ -4,9 +4,8 @@
 
 #[link(name = "foo", kind = "raw-dylib")]
 extern "C" {
-    #[link_ordinal(1)]
+    #[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes
     #[link_ordinal(2)]
-    //~^ ERROR multiple `link_ordinal` attributes on a single definition
     fn foo();
 }
 
index a79fb2de94402c377ba484aa13caab3ac71376b9..4772533ab2f07199b99dc35e377a3f3fde044b8f 100644 (file)
@@ -7,7 +7,13 @@ LL | #![feature(raw_dylib)]
    = note: `#[warn(incomplete_features)]` on by default
    = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information
 
-error: multiple `link_ordinal` attributes on a single definition
+error: multiple `link_ordinal` attributes
+  --> $DIR/link-ordinal-multiple.rs:7:5
+   |
+LL |     #[link_ordinal(1)]
+   |     ^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
   --> $DIR/link-ordinal-multiple.rs:8:5
    |
 LL |     #[link_ordinal(2)]
index 785095c29ae4ebc8e886f96583285bbd08994615..154a6a35a44efdcb25233065f4ef9811b0e9596d 100644 (file)
@@ -31,17 +31,6 @@ note: multiple `impl`s satisfying `i32: Add` found
 LL | impl const std::ops::Add for i32 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: and another `impl` found in the `core` crate: `impl Add for i32;`
-note: required by a bound in `Add`
-  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
-   |
-LL | / pub trait Add<Rhs = Self> {
-LL | |     /// The resulting type after applying the `+` operator.
-LL | |     #[stable(feature = "rust1", since = "1.0.0")]
-LL | |     type Output;
-...  |
-LL | |     fn add(self, rhs: Rhs) -> Self::Output;
-LL | | }
-   | |_^ required by this bound in `Add`
 
 error[E0283]: type annotations needed
   --> $DIR/const-and-non-const-impl.rs:14:6
@@ -57,17 +46,6 @@ LL | impl std::ops::Add for Int {
 ...
 LL | impl const std::ops::Add for Int {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `Add`
-  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
-   |
-LL | / pub trait Add<Rhs = Self> {
-LL | |     /// The resulting type after applying the `+` operator.
-LL | |     #[stable(feature = "rust1", since = "1.0.0")]
-LL | |     type Output;
-...  |
-LL | |     fn add(self, rhs: Rhs) -> Self::Output;
-LL | | }
-   | |_^ required by this bound in `Add`
 
 error[E0283]: type annotations needed
   --> $DIR/const-and-non-const-impl.rs:22:12
@@ -83,17 +61,6 @@ LL | impl std::ops::Add for Int {
 ...
 LL | impl const std::ops::Add for Int {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `Add`
-  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
-   |
-LL | / pub trait Add<Rhs = Self> {
-LL | |     /// The resulting type after applying the `+` operator.
-LL | |     #[stable(feature = "rust1", since = "1.0.0")]
-LL | |     type Output;
-...  |
-LL | |     fn add(self, rhs: Rhs) -> Self::Output;
-LL | | }
-   | |_^ required by this bound in `Add`
 
 error: aborting due to 5 previous errors
 
index efe46d7e81d3de1ea8759a1acd7aead7f7c1948f..04c21101e758b62e1058b35812e3060116abd34f 100644 (file)
@@ -42,11 +42,11 @@ error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
 LL |     ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop`
    |
-note: required by `ConstDropImplWithBounds`
-  --> $DIR/const-drop-fail.rs:27:1
+note: required by a bound in `ConstDropImplWithBounds`
+  --> $DIR/const-drop-fail.rs:27:35
    |
 LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                                   ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
 
 error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
   --> $DIR/const-drop-fail.rs:49:5
index efe46d7e81d3de1ea8759a1acd7aead7f7c1948f..04c21101e758b62e1058b35812e3060116abd34f 100644 (file)
@@ -42,11 +42,11 @@ error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
 LL |     ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop`
    |
-note: required by `ConstDropImplWithBounds`
-  --> $DIR/const-drop-fail.rs:27:1
+note: required by a bound in `ConstDropImplWithBounds`
+  --> $DIR/const-drop-fail.rs:27:35
    |
 LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                                   ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
 
 error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
   --> $DIR/const-drop-fail.rs:49:5
index fffb91f98700bdf8f9c9210468645a851944d9ca..08d91d7daf85b8ac13c5a110e5ba21736c1e7ee9 100644 (file)
@@ -4,11 +4,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
 LL |     T::b();
    |     ^^^^ the trait `Bar` is not implemented for `T`
    |
-note: required by `Foo::b`
-  --> $DIR/trait-where-clause.rs:8:5
+note: required by a bound in `Foo::b`
+  --> $DIR/trait-where-clause.rs:8:24
    |
 LL |     fn b() where Self: ~const Bar;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                        ^^^^^^^^^^ required by this bound in `Foo::b`
 help: consider further restricting this bound
    |
 LL | const fn test1<T: ~const Foo + Bar + Bar>() {
@@ -20,11 +20,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
 LL |     T::c::<T>();
    |     ^^^^^^^^^ the trait `Bar` is not implemented for `T`
    |
-note: required by `Foo::c`
-  --> $DIR/trait-where-clause.rs:9:5
+note: required by a bound in `Foo::c`
+  --> $DIR/trait-where-clause.rs:9:13
    |
 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 + Bar>() {
@@ -36,11 +36,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
 LL |     T::b();
    |     ^^^^ the trait `Bar` is not implemented for `T`
    |
-note: required by `Foo::b`
-  --> $DIR/trait-where-clause.rs:8:5
+note: required by a bound in `Foo::b`
+  --> $DIR/trait-where-clause.rs:8:24
    |
 LL |     fn b() where Self: ~const Bar;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                        ^^^^^^^^^^ required by this bound in `Foo::b`
 help: consider further restricting this bound
    |
 LL | fn test3<T: Foo + Bar>() {
@@ -52,11 +52,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
 LL |     T::c::<T>();
    |     ^^^^^^^^^ the trait `Bar` is not implemented for `T`
    |
-note: required by `Foo::c`
-  --> $DIR/trait-where-clause.rs:9:5
+note: required by a bound in `Foo::c`
+  --> $DIR/trait-where-clause.rs:9:13
    |
 LL |     fn c<T: ~const Bar>();
-   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |             ^^^^^^^^^^ required by this bound in `Foo::c`
 help: consider further restricting this bound
    |
 LL | fn test3<T: Foo + Bar>() {
diff --git a/src/test/ui/runtime/atomic-print.rs b/src/test/ui/runtime/atomic-print.rs
new file mode 100644 (file)
index 0000000..fe57910
--- /dev/null
@@ -0,0 +1,45 @@
+// run-pass
+
+#![allow(unused_must_use)]
+#![allow(deprecated)]
+// ignore-emscripten no threads support
+// ignore-sgx no processes
+
+use std::{env, fmt, process, sync, thread};
+
+struct SlowFmt(u32);
+impl fmt::Debug for SlowFmt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        thread::sleep_ms(3);
+        self.0.fmt(f)
+    }
+}
+
+fn do_print(x: u32) {
+    let x = SlowFmt(x);
+    println!("{:?}{:?}{:?}{:?}{:?}", x, x, x, x, x);
+}
+
+fn main(){
+    if env::args().count() == 2 {
+        let barrier = sync::Arc::new(sync::Barrier::new(2));
+        let tbarrier = barrier.clone();
+        let t = thread::spawn(move || {
+            tbarrier.wait();
+            do_print(1);
+        });
+        barrier.wait();
+        do_print(2);
+        t.join();
+    } else {
+        let this = env::args().next().unwrap();
+        let output = process::Command::new(this).arg("-").output().unwrap();
+        for line in String::from_utf8(output.stdout).unwrap().lines() {
+            match line.chars().next().unwrap() {
+                '1' => assert_eq!(line, "11111"),
+                '2' => assert_eq!(line, "22222"),
+                chr => panic!("unexpected character {:?}", chr)
+            }
+        }
+    }
+}
diff --git a/src/test/ui/runtime/backtrace-debuginfo-aux.rs b/src/test/ui/runtime/backtrace-debuginfo-aux.rs
new file mode 100644 (file)
index 0000000..1411bcf
--- /dev/null
@@ -0,0 +1,14 @@
+// run-pass
+// ignore-test: not a test, used by backtrace-debuginfo.rs to test file!()
+
+#[inline(never)]
+pub fn callback<F>(f: F) where F: FnOnce((&'static str, u32)) {
+    f((file!(), line!()))
+}
+
+// We emit the wrong location for the caller here when inlined on MSVC
+#[cfg_attr(not(target_env = "msvc"), inline(always))]
+#[cfg_attr(target_env = "msvc", inline(never))]
+pub fn callback_inlined<F>(f: F) where F: FnOnce((&'static str, u32)) {
+    f((file!(), line!()))
+}
diff --git a/src/test/ui/runtime/backtrace-debuginfo.rs b/src/test/ui/runtime/backtrace-debuginfo.rs
new file mode 100644 (file)
index 0000000..b976c3a
--- /dev/null
@@ -0,0 +1,188 @@
+// run-pass
+// We disable tail merging here because it can't preserve debuginfo and thus
+// potentially breaks the backtraces. Also, subtle changes can decide whether
+// tail merging succeeds, so the test might work today but fail tomorrow due to a
+// seemingly completely unrelated change.
+// Unfortunately, LLVM has no "disable" option for this, so we have to set
+// "enable" to 0 instead.
+
+// compile-flags:-g -Copt-level=0 -Cllvm-args=-enable-tail-merge=0
+// compile-flags:-Cforce-frame-pointers=yes
+// ignore-pretty issue #37195
+// ignore-emscripten spawning processes is not supported
+// ignore-sgx no processes
+
+use std::env;
+
+#[path = "backtrace-debuginfo-aux.rs"] mod aux;
+
+macro_rules! pos {
+    () => ((file!(), line!()))
+}
+
+macro_rules! dump_and_die {
+    ($($pos:expr),*) => ({
+        // FIXME(#18285): we cannot include the current position because
+        // the macro span takes over the last frame's file/line.
+        //
+        // You might also be wondering why a major platform,
+        // i686-pc-windows-msvc, is located in here. Some of the saga can be
+        // found on #62897, but the tl;dr; is that it appears that if the
+        // standard library doesn't have debug information or frame pointers,
+        // which it doesn't by default on the test builders, then the stack
+        // walking routines in dbghelp will randomly terminate the stack trace
+        // in libstd without going further. Presumably the addition of frame
+        // pointers and/or debuginfo fixes this since tests always work with
+        // nightly compilers (which have debuginfo). In general though this test
+        // is replicated in rust-lang/backtrace-rs and has extensive coverage
+        // there, even on i686-pc-windows-msvc. We do the best we can in
+        // rust-lang/rust to test it as well, but sometimes we just gotta keep
+        // landing PRs.
+        if cfg!(any(target_os = "android",
+                    all(target_os = "linux", target_arch = "arm"),
+                    all(target_env = "msvc", target_arch = "x86"),
+                    target_os = "freebsd",
+                    target_os = "dragonfly",
+                    target_os = "openbsd")) {
+            // skip these platforms as this support isn't implemented yet.
+        } else {
+            dump_filelines(&[$($pos),*]);
+            panic!();
+        }
+    })
+}
+
+// we can't use a function as it will alter the backtrace
+macro_rules! check {
+    ($counter:expr; $($pos:expr),*) => ({
+        if *$counter == 0 {
+            dump_and_die!($($pos),*)
+        } else {
+            *$counter -= 1;
+        }
+    })
+}
+
+type Pos = (&'static str, u32);
+
+// this goes to stdout and each line has to be occurred
+// in the following backtrace to stderr with a correct order.
+fn dump_filelines(filelines: &[Pos]) {
+    for &(file, line) in filelines.iter().rev() {
+        // extract a basename
+        let basename = file.split(&['/', '\\'][..]).last().unwrap();
+        println!("{}:{}", basename, line);
+    }
+}
+
+#[inline(never)]
+fn inner(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
+    check!(counter; main_pos, outer_pos);
+    check!(counter; main_pos, outer_pos);
+    let inner_pos = pos!(); aux::callback(|aux_pos| {
+        check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
+    });
+    let inner_pos = pos!(); aux::callback_inlined(|aux_pos| {
+        check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
+    });
+}
+
+// We emit the wrong location for the caller here when inlined on MSVC
+#[cfg_attr(not(target_env = "msvc"), inline(always))]
+#[cfg_attr(target_env = "msvc", inline(never))]
+fn inner_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
+    check!(counter; main_pos, outer_pos);
+    check!(counter; main_pos, outer_pos);
+
+    // Again, disable inlining for MSVC.
+    #[cfg_attr(not(target_env = "msvc"), inline(always))]
+    #[cfg_attr(target_env = "msvc", inline(never))]
+    fn inner_further_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos, inner_pos: Pos) {
+        check!(counter; main_pos, outer_pos, inner_pos);
+    }
+    inner_further_inlined(counter, main_pos, outer_pos, pos!());
+
+    let inner_pos = pos!(); aux::callback(|aux_pos| {
+        check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
+    });
+    let inner_pos = pos!(); aux::callback_inlined(|aux_pos| {
+        check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
+    });
+
+    // this tests a distinction between two independent calls to the inlined function.
+    // (un)fortunately, LLVM somehow merges two consecutive such calls into one node.
+    inner_further_inlined(counter, main_pos, outer_pos, pos!());
+}
+
+#[inline(never)]
+fn outer(mut counter: i32, main_pos: Pos) {
+    inner(&mut counter, main_pos, pos!());
+    inner_inlined(&mut counter, main_pos, pos!());
+}
+
+fn check_trace(output: &str, error: &str) -> Result<(), String> {
+    // reverse the position list so we can start with the last item (which was the first line)
+    let mut remaining: Vec<&str> = output.lines().map(|s| s.trim()).rev().collect();
+
+    if !error.contains("stack backtrace") {
+        return Err(format!("no backtrace found in stderr:\n{}", error))
+    }
+    for line in error.lines() {
+        if !remaining.is_empty() && line.contains(remaining.last().unwrap()) {
+            remaining.pop();
+        }
+    }
+    if !remaining.is_empty() {
+        return Err(format!("trace does not match position list\n\
+            still need to find {:?}\n\n\
+            --- stdout\n{}\n\
+            --- stderr\n{}",
+            remaining, output, error))
+    }
+    Ok(())
+}
+
+fn run_test(me: &str) {
+    use std::str;
+    use std::process::Command;
+
+    let mut i = 0;
+    let mut errors = Vec::new();
+    loop {
+        let out = Command::new(me)
+                          .env("RUST_BACKTRACE", "full")
+                          .arg(i.to_string()).output().unwrap();
+        let output = str::from_utf8(&out.stdout).unwrap();
+        let error = str::from_utf8(&out.stderr).unwrap();
+        if out.status.success() {
+            assert!(output.contains("done."), "bad output for successful run: {}", output);
+            break;
+        } else {
+            if let Err(e) = check_trace(output, error) {
+                errors.push(e);
+            }
+        }
+        i += 1;
+    }
+    if errors.len() > 0 {
+        for error in errors {
+            println!("---------------------------------------");
+            println!("{}", error);
+        }
+
+        panic!("found some errors");
+    }
+}
+
+#[inline(never)]
+fn main() {
+    let args: Vec<String> = env::args().collect();
+    if args.len() >= 2 {
+        let case = args[1].parse().unwrap();
+        eprintln!("test case {}", case);
+        outer(case, pos!());
+        println!("done.");
+    } else {
+        run_test(&args[0]);
+    }
+}
diff --git a/src/test/ui/runtime/native-print-no-runtime.rs b/src/test/ui/runtime/native-print-no-runtime.rs
new file mode 100644 (file)
index 0000000..f17c9fa
--- /dev/null
@@ -0,0 +1,9 @@
+// run-pass
+
+#![feature(start)]
+
+#[start]
+pub fn main(_: isize, _: *const *const u8) -> isize {
+    println!("hello");
+    0
+}
index 6c3f1892cb3697ffd27bf570d72bd64917908850..2d9a6a9a924998fec8b3e91b0b8f659e9ca42105 100644 (file)
@@ -8,7 +8,7 @@ macro_rules! legacy_macro { () => () }
 
     use legacy_macro as _; // OK
     pub(crate) use legacy_macro as _; // OK
-    pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported
+    pub use legacy_macro as _; //~ ERROR `legacy_macro` is only public within the crate, and cannot be re-exported outside
 }
 
 mod m2 {
index 622595bfa0328cba4f449f5448db1373bcd6f130..9e48e26b1dfd30451d279d5fd3421ff377aa4b1e 100644 (file)
@@ -1,4 +1,4 @@
-error[E0364]: `legacy_macro` is private, and cannot be re-exported
+error[E0364]: `legacy_macro` is only public within the crate, and cannot be re-exported outside
   --> $DIR/macro-rules.rs:11:13
    |
 LL |     pub use legacy_macro as _;
diff --git a/src/test/ui/safe-extern-statics-mut.mir.stderr b/src/test/ui/safe-extern-statics-mut.mir.stderr
deleted file mode 100644 (file)
index cec5f9d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0133]: use of mutable static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics-mut.rs:13:13
-   |
-LL |     let b = B;
-   |             ^ use of mutable static
-   |
-   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of mutable static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics-mut.rs:14:14
-   |
-LL |     let rb = &B;
-   |              ^^ use of mutable static
-   |
-   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of mutable static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics-mut.rs:15:14
-   |
-LL |     let xb = XB;
-   |              ^^ use of mutable static
-   |
-   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of mutable static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics-mut.rs:16:15
-   |
-LL |     let xrb = &XB;
-   |               ^^^ use of mutable static
-   |
-   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/safe-extern-statics-mut.rs b/src/test/ui/safe-extern-statics-mut.rs
deleted file mode 100644 (file)
index 389a458..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// aux-build:extern-statics.rs
-// revisions: mir thir
-// [thir]compile-flags: -Z thir-unsafeck
-
-extern crate extern_statics;
-use extern_statics::*;
-
-extern "C" {
-    static mut B: u8;
-}
-
-fn main() {
-    let b = B; //~ ERROR use of mutable static is unsafe
-    let rb = &B; //~ ERROR use of mutable static is unsafe
-    let xb = XB; //~ ERROR use of mutable static is unsafe
-    let xrb = &XB; //~ ERROR use of mutable static is unsafe
-}
diff --git a/src/test/ui/safe-extern-statics-mut.thir.stderr b/src/test/ui/safe-extern-statics-mut.thir.stderr
deleted file mode 100644 (file)
index 8e6d280..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0133]: use of mutable static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics-mut.rs:13:13
-   |
-LL |     let b = B;
-   |             ^ use of mutable static
-   |
-   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of mutable static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics-mut.rs:14:15
-   |
-LL |     let rb = &B;
-   |               ^ use of mutable static
-   |
-   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of mutable static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics-mut.rs:15:14
-   |
-LL |     let xb = XB;
-   |              ^^ use of mutable static
-   |
-   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of mutable static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics-mut.rs:16:16
-   |
-LL |     let xrb = &XB;
-   |                ^^ use of mutable static
-   |
-   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/safe-extern-statics.mir.stderr b/src/test/ui/safe-extern-statics.mir.stderr
deleted file mode 100644 (file)
index 102abd0..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0133]: use of extern static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics.rs:13:13
-   |
-LL |     let a = A;
-   |             ^ use of extern static
-   |
-   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of extern static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics.rs:14:14
-   |
-LL |     let ra = &A;
-   |              ^^ use of extern static
-   |
-   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of extern static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics.rs:15:14
-   |
-LL |     let xa = XA;
-   |              ^^ use of extern static
-   |
-   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of extern static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics.rs:16:15
-   |
-LL |     let xra = &XA;
-   |               ^^^ use of extern static
-   |
-   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/safe-extern-statics.rs b/src/test/ui/safe-extern-statics.rs
deleted file mode 100644 (file)
index 0aa90c4..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// aux-build:extern-statics.rs
-// revisions: mir thir
-// [thir]compile-flags: -Z thir-unsafeck
-
-extern crate extern_statics;
-use extern_statics::*;
-
-extern "C" {
-    static A: u8;
-}
-
-fn main() {
-    let a = A; //~ ERROR use of extern static is unsafe
-    let ra = &A; //~ ERROR use of extern static is unsafe
-    let xa = XA; //~ ERROR use of extern static is unsafe
-    let xra = &XA; //~ ERROR use of extern static is unsafe
-}
diff --git a/src/test/ui/safe-extern-statics.thir.stderr b/src/test/ui/safe-extern-statics.thir.stderr
deleted file mode 100644 (file)
index 7fd2182..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0133]: use of extern static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics.rs:13:13
-   |
-LL |     let a = A;
-   |             ^ use of extern static
-   |
-   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of extern static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics.rs:14:15
-   |
-LL |     let ra = &A;
-   |               ^ use of extern static
-   |
-   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of extern static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics.rs:15:14
-   |
-LL |     let xa = XA;
-   |              ^^ use of extern static
-   |
-   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
-
-error[E0133]: use of extern static is unsafe and requires unsafe function or block
-  --> $DIR/safe-extern-statics.rs:16:16
-   |
-LL |     let xra = &XA;
-   |                ^^ use of extern static
-   |
-   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
index 08544bce45db97dca47c604f50a2b0073337edff..3c913c0adfa6000cd801e41b02cd305655a3aae0 100644 (file)
@@ -2,7 +2,6 @@
 // ignore-emscripten FIXME(#45351) hits an LLVM assert
 
 #![feature(repr_simd, platform_intrinsics)]
-#![allow(incomplete_features)]
 #![feature(inline_const)]
 
 #[repr(simd)]
index 24dfdf8ebc2990b54b7c5f8ca861093b81cf0c4a..92445e4073130678d69cd3e236409682a31cd079 100644 (file)
@@ -3,12 +3,6 @@ error[E0277]: the trait bound `u8: Tr` is not satisfied
    |
 LL |     let a: u8 = Tr::C;
    |                 ^^^^^ the trait `Tr` is not implemented for `u8`
-   |
-note: required by `Tr::C`
-  --> $DIR/issue-29595.rs:2:5
-   |
-LL |     const C: Self;
-   |     ^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index ce981bc00982afc380777638fe7e86907da24296..81e2a9a1ffcc7f44d743159ff907bd2b335123c1 100644 (file)
@@ -20,8 +20,12 @@ LL | struct MyStruct;
 LL |     println!("{}", MyStruct.foo_one());
    |                             ^^^^^^^ method cannot be called on `MyStruct` due to unsatisfied trait bounds
    |
-   = note: the following trait bounds were not satisfied:
-           `MyStruct: Foo`
+note: the following trait bounds were not satisfied because of the requirements of the implementation of `Foo` for `_`:
+      `MyStruct: Foo`
+  --> $DIR/specialization-trait-not-implemented.rs:14:17
+   |
+LL | default impl<T> Foo for T {
+   |                 ^^^     ^
 note: the following trait must be implemented
   --> $DIR/specialization-trait-not-implemented.rs:7:1
    |
diff --git a/src/test/ui/stability-attribute/stability-in-private-module.rs b/src/test/ui/stability-attribute/stability-in-private-module.rs
new file mode 100644 (file)
index 0000000..f12e919
--- /dev/null
@@ -0,0 +1,4 @@
+fn main() {
+    let _ = std::thread::thread_info::current_thread();
+    //~^ERROR module `thread_info` is private
+}
diff --git a/src/test/ui/stability-attribute/stability-in-private-module.stderr b/src/test/ui/stability-attribute/stability-in-private-module.stderr
new file mode 100644 (file)
index 0000000..e64f2ac
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0603]: module `thread_info` is private
+  --> $DIR/stability-in-private-module.rs:2:26
+   |
+LL |     let _ = std::thread::thread_info::current_thread();
+   |                          ^^^^^^^^^^^ private module
+   |
+note: the module `thread_info` is defined here
+  --> $SRC_DIR/std/src/thread/mod.rs:LL:COL
+   |
+LL | use crate::sys_common::thread_info;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/stability-attribute/suggest-vec-allocator-api.rs b/src/test/ui/stability-attribute/suggest-vec-allocator-api.rs
new file mode 100644 (file)
index 0000000..fac52ab
--- /dev/null
@@ -0,0 +1,9 @@
+fn main() {
+    let _: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api'
+    #[rustfmt::skip]
+    let _: Vec<
+        String,
+        _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api'
+    let _ = Vec::<u16, _>::new(); //~ ERROR use of unstable library feature 'allocator_api'
+    let _boxed: Box<u32, _> = Box::new(10); //~ ERROR use of unstable library feature 'allocator_api'
+}
diff --git a/src/test/ui/stability-attribute/suggest-vec-allocator-api.stderr b/src/test/ui/stability-attribute/suggest-vec-allocator-api.stderr
new file mode 100644 (file)
index 0000000..41e5787
--- /dev/null
@@ -0,0 +1,49 @@
+error[E0658]: use of unstable library feature 'allocator_api'
+  --> $DIR/suggest-vec-allocator-api.rs:2:20
+   |
+LL |     let _: Vec<u8, _> = vec![];
+   |                ----^
+   |                |
+   |                help: consider wrapping the inner types in tuple: `(u8, _)`
+   |
+   = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
+   = help: add `#![feature(allocator_api)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'allocator_api'
+  --> $DIR/suggest-vec-allocator-api.rs:6:9
+   |
+LL |         _> = vec![];
+   |         ^
+   |
+   = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
+   = help: add `#![feature(allocator_api)]` to the crate attributes to enable
+help: consider wrapping the inner types in tuple
+   |
+LL ~     let _: Vec<(
+LL +         String,
+LL ~         _)> = vec![];
+   |
+
+error[E0658]: use of unstable library feature 'allocator_api'
+  --> $DIR/suggest-vec-allocator-api.rs:8:26
+   |
+LL |     let _boxed: Box<u32, _> = Box::new(10);
+   |                          ^
+   |
+   = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
+   = help: add `#![feature(allocator_api)]` to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'allocator_api'
+  --> $DIR/suggest-vec-allocator-api.rs:7:24
+   |
+LL |     let _ = Vec::<u16, _>::new();
+   |                   -----^
+   |                   |
+   |                   help: consider wrapping the inner types in tuple: `(u16, _)`
+   |
+   = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
+   = help: add `#![feature(allocator_api)]` to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/stability-in-private-module.rs b/src/test/ui/stability-in-private-module.rs
deleted file mode 100644 (file)
index f12e919..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {
-    let _ = std::thread::thread_info::current_thread();
-    //~^ERROR module `thread_info` is private
-}
diff --git a/src/test/ui/stability-in-private-module.stderr b/src/test/ui/stability-in-private-module.stderr
deleted file mode 100644 (file)
index e64f2ac..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0603]: module `thread_info` is private
-  --> $DIR/stability-in-private-module.rs:2:26
-   |
-LL |     let _ = std::thread::thread_info::current_thread();
-   |                          ^^^^^^^^^^^ private module
-   |
-note: the module `thread_info` is defined here
-  --> $SRC_DIR/std/src/thread/mod.rs:LL:COL
-   |
-LL | use crate::sys_common::thread_info;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/stack-protector/warn-stack-protector-unsupported.all.stderr b/src/test/ui/stack-protector/warn-stack-protector-unsupported.all.stderr
new file mode 100644 (file)
index 0000000..5488771
--- /dev/null
@@ -0,0 +1,4 @@
+warning: `-Z stack-protector=all` is not supported for target nvptx64-nvidia-cuda and will be ignored
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/stack-protector/warn-stack-protector-unsupported.basic.stderr b/src/test/ui/stack-protector/warn-stack-protector-unsupported.basic.stderr
new file mode 100644 (file)
index 0000000..f7a1ee3
--- /dev/null
@@ -0,0 +1,4 @@
+warning: `-Z stack-protector=basic` is not supported for target nvptx64-nvidia-cuda and will be ignored
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/stack-protector/warn-stack-protector-unsupported.rs b/src/test/ui/stack-protector/warn-stack-protector-unsupported.rs
new file mode 100644 (file)
index 0000000..6df5d3c
--- /dev/null
@@ -0,0 +1,19 @@
+// build-pass
+// revisions: all strong basic
+// compile-flags: --target nvptx64-nvidia-cuda
+// needs-llvm-components: nvptx
+// [all] compile-flags: -Z stack-protector=all
+// [strong] compile-flags: -Z stack-protector=strong
+// [basic] compile-flags: -Z stack-protector=basic
+
+#![crate_type = "lib"]
+#![feature(no_core, lang_items)]
+#![no_std]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+
+pub fn main(){}
diff --git a/src/test/ui/stack-protector/warn-stack-protector-unsupported.strong.stderr b/src/test/ui/stack-protector/warn-stack-protector-unsupported.strong.stderr
new file mode 100644 (file)
index 0000000..ccc2f9f
--- /dev/null
@@ -0,0 +1,4 @@
+warning: `-Z stack-protector=strong` is not supported for target nvptx64-nvidia-cuda and will be ignored
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/static/auxiliary/extern-statics.rs b/src/test/ui/static/auxiliary/extern-statics.rs
new file mode 100644 (file)
index 0000000..c090bc7
--- /dev/null
@@ -0,0 +1,4 @@
+extern "C" {
+    pub static XA: u8;
+    pub static mut XB: u8;
+}
diff --git a/src/test/ui/static/safe-extern-statics-mut.mir.stderr b/src/test/ui/static/safe-extern-statics-mut.mir.stderr
new file mode 100644 (file)
index 0000000..cec5f9d
--- /dev/null
@@ -0,0 +1,35 @@
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics-mut.rs:13:13
+   |
+LL |     let b = B;
+   |             ^ use of mutable static
+   |
+   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics-mut.rs:14:14
+   |
+LL |     let rb = &B;
+   |              ^^ use of mutable static
+   |
+   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics-mut.rs:15:14
+   |
+LL |     let xb = XB;
+   |              ^^ use of mutable static
+   |
+   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics-mut.rs:16:15
+   |
+LL |     let xrb = &XB;
+   |               ^^^ use of mutable static
+   |
+   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/static/safe-extern-statics-mut.rs b/src/test/ui/static/safe-extern-statics-mut.rs
new file mode 100644 (file)
index 0000000..389a458
--- /dev/null
@@ -0,0 +1,17 @@
+// aux-build:extern-statics.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+extern crate extern_statics;
+use extern_statics::*;
+
+extern "C" {
+    static mut B: u8;
+}
+
+fn main() {
+    let b = B; //~ ERROR use of mutable static is unsafe
+    let rb = &B; //~ ERROR use of mutable static is unsafe
+    let xb = XB; //~ ERROR use of mutable static is unsafe
+    let xrb = &XB; //~ ERROR use of mutable static is unsafe
+}
diff --git a/src/test/ui/static/safe-extern-statics-mut.thir.stderr b/src/test/ui/static/safe-extern-statics-mut.thir.stderr
new file mode 100644 (file)
index 0000000..8e6d280
--- /dev/null
@@ -0,0 +1,35 @@
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics-mut.rs:13:13
+   |
+LL |     let b = B;
+   |             ^ use of mutable static
+   |
+   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics-mut.rs:14:15
+   |
+LL |     let rb = &B;
+   |               ^ use of mutable static
+   |
+   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics-mut.rs:15:14
+   |
+LL |     let xb = XB;
+   |              ^^ use of mutable static
+   |
+   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics-mut.rs:16:16
+   |
+LL |     let xrb = &XB;
+   |                ^^ use of mutable static
+   |
+   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/static/safe-extern-statics.mir.stderr b/src/test/ui/static/safe-extern-statics.mir.stderr
new file mode 100644 (file)
index 0000000..102abd0
--- /dev/null
@@ -0,0 +1,35 @@
+error[E0133]: use of extern static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics.rs:13:13
+   |
+LL |     let a = A;
+   |             ^ use of extern static
+   |
+   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of extern static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics.rs:14:14
+   |
+LL |     let ra = &A;
+   |              ^^ use of extern static
+   |
+   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of extern static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics.rs:15:14
+   |
+LL |     let xa = XA;
+   |              ^^ use of extern static
+   |
+   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of extern static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics.rs:16:15
+   |
+LL |     let xra = &XA;
+   |               ^^^ use of extern static
+   |
+   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/static/safe-extern-statics.rs b/src/test/ui/static/safe-extern-statics.rs
new file mode 100644 (file)
index 0000000..0aa90c4
--- /dev/null
@@ -0,0 +1,17 @@
+// aux-build:extern-statics.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+extern crate extern_statics;
+use extern_statics::*;
+
+extern "C" {
+    static A: u8;
+}
+
+fn main() {
+    let a = A; //~ ERROR use of extern static is unsafe
+    let ra = &A; //~ ERROR use of extern static is unsafe
+    let xa = XA; //~ ERROR use of extern static is unsafe
+    let xra = &XA; //~ ERROR use of extern static is unsafe
+}
diff --git a/src/test/ui/static/safe-extern-statics.thir.stderr b/src/test/ui/static/safe-extern-statics.thir.stderr
new file mode 100644 (file)
index 0000000..7fd2182
--- /dev/null
@@ -0,0 +1,35 @@
+error[E0133]: use of extern static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics.rs:13:13
+   |
+LL |     let a = A;
+   |             ^ use of extern static
+   |
+   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of extern static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics.rs:14:15
+   |
+LL |     let ra = &A;
+   |               ^ use of extern static
+   |
+   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of extern static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics.rs:15:14
+   |
+LL |     let xa = XA;
+   |              ^^ use of extern static
+   |
+   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of extern static is unsafe and requires unsafe function or block
+  --> $DIR/safe-extern-statics.rs:16:16
+   |
+LL |     let xra = &XA;
+   |                ^^ use of extern static
+   |
+   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/static/thread-local-in-ctfe.rs b/src/test/ui/static/thread-local-in-ctfe.rs
new file mode 100644 (file)
index 0000000..547e544
--- /dev/null
@@ -0,0 +1,23 @@
+#![feature(thread_local)]
+
+#[thread_local]
+static A: u32 = 1;
+
+static B: u32 = A;
+//~^ ERROR thread-local statics cannot be accessed at compile-time
+
+static C: &u32 = &A;
+//~^ ERROR thread-local statics cannot be accessed at compile-time
+
+const D: u32 = A;
+//~^ ERROR thread-local statics cannot be accessed at compile-time
+
+const E: &u32 = &A;
+//~^ ERROR thread-local statics cannot be accessed at compile-time
+
+const fn f() -> u32 {
+    A
+    //~^ ERROR thread-local statics cannot be accessed at compile-time
+}
+
+fn main() {}
diff --git a/src/test/ui/static/thread-local-in-ctfe.stderr b/src/test/ui/static/thread-local-in-ctfe.stderr
new file mode 100644 (file)
index 0000000..fd96760
--- /dev/null
@@ -0,0 +1,33 @@
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:6:17
+   |
+LL | static B: u32 = A;
+   |                 ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:9:19
+   |
+LL | static C: &u32 = &A;
+   |                   ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:12:16
+   |
+LL | const D: u32 = A;
+   |                ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:15:18
+   |
+LL | const E: &u32 = &A;
+   |                  ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+  --> $DIR/thread-local-in-ctfe.rs:19:5
+   |
+LL |     A
+   |     ^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0625`.
diff --git a/src/test/ui/statics/issue-91050-1.rs b/src/test/ui/statics/issue-91050-1.rs
new file mode 100644 (file)
index 0000000..403a414
--- /dev/null
@@ -0,0 +1,34 @@
+// build-pass
+// compile-flags: --crate-type=rlib --emit=llvm-ir -Cno-prepopulate-passes
+
+// This test declares globals by the same name with different types, which
+// caused problems because Module::getOrInsertGlobal would return a Constant*
+// bitcast instead of a GlobalVariable* that could access linkage/visibility.
+// In alt builds with LLVM assertions this would fail:
+//
+// rustc: /checkout/src/llvm-project/llvm/include/llvm/Support/Casting.h:269:
+// typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = llvm::GlobalValue, Y = llvm::Value]:
+// Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
+//
+// In regular builds, the bad cast was UB, like "Invalid LLVMRustVisibility value!"
+
+pub mod before {
+    #[no_mangle]
+    pub static GLOBAL1: [u8; 1] = [1];
+}
+
+pub mod inner {
+    extern "C" {
+        pub static GLOBAL1: u8;
+        pub static GLOBAL2: u8;
+    }
+
+    pub fn call() {
+        drop(unsafe { (GLOBAL1, GLOBAL2) });
+    }
+}
+
+pub mod after {
+    #[no_mangle]
+    pub static GLOBAL2: [u8; 1] = [2];
+}
diff --git a/src/test/ui/statics/issue-91050-2.rs b/src/test/ui/statics/issue-91050-2.rs
new file mode 100644 (file)
index 0000000..2ff954d
--- /dev/null
@@ -0,0 +1,24 @@
+// build-pass
+// compile-flags: --crate-type=rlib --emit=llvm-ir -Cno-prepopulate-passes
+
+// This is a variant of issue-91050-1.rs -- see there for an explanation.
+
+pub mod before {
+    extern "C" {
+        pub static GLOBAL1: [u8; 1];
+    }
+
+    pub unsafe fn do_something_with_array() -> u8 {
+        GLOBAL1[0]
+    }
+}
+
+pub mod inner {
+    extern "C" {
+        pub static GLOBAL1: u8;
+    }
+
+    pub unsafe fn call() -> u8 {
+        GLOBAL1 + 42
+    }
+}
diff --git a/src/test/ui/stdlib-unit-tests/matches2021.rs b/src/test/ui/stdlib-unit-tests/matches2021.rs
new file mode 100644 (file)
index 0000000..9143a8c
--- /dev/null
@@ -0,0 +1,13 @@
+// run-pass
+// edition:2021
+
+// regression test for https://github.com/rust-lang/rust/pull/85678
+
+#![feature(assert_matches)]
+
+use std::assert_matches::assert_matches;
+
+fn main() {
+    assert!(matches!((), ()));
+    assert_matches!((), ());
+}
diff --git a/src/test/ui/stdlib-unit-tests/minmax-stability-issue-23687.rs b/src/test/ui/stdlib-unit-tests/minmax-stability-issue-23687.rs
new file mode 100644 (file)
index 0000000..9100bfb
--- /dev/null
@@ -0,0 +1,64 @@
+// run-pass
+
+use std::fmt::Debug;
+use std::cmp::{self, PartialOrd, Ordering};
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+struct Foo {
+    n: u8,
+    name: &'static str
+}
+
+impl PartialOrd for Foo {
+    fn partial_cmp(&self, other: &Foo) -> Option<Ordering> {
+        Some(self.cmp(other))
+    }
+}
+
+impl Ord for Foo {
+    fn cmp(&self, other: &Foo) -> Ordering {
+        self.n.cmp(&other.n)
+    }
+}
+
+fn main() {
+    let a = Foo { n: 4, name: "a" };
+    let b = Foo { n: 4, name: "b" };
+    let c = Foo { n: 8, name: "c" };
+    let d = Foo { n: 8, name: "d" };
+    let e = Foo { n: 22, name: "e" };
+    let f = Foo { n: 22, name: "f" };
+
+    let data = [a, b, c, d, e, f];
+
+    // `min` should return the left when the values are equal
+    assert_eq!(data.iter().min(), Some(&a));
+    assert_eq!(data.iter().min_by_key(|a| a.n), Some(&a));
+    assert_eq!(cmp::min(a, b), a);
+    assert_eq!(cmp::min(b, a), b);
+
+    // `max` should return the right when the values are equal
+    assert_eq!(data.iter().max(), Some(&f));
+    assert_eq!(data.iter().max_by_key(|a| a.n), Some(&f));
+    assert_eq!(cmp::max(e, f), f);
+    assert_eq!(cmp::max(f, e), e);
+
+    let mut presorted = data.to_vec();
+    presorted.sort();
+    assert_stable(&presorted);
+
+    let mut presorted = data.to_vec();
+    presorted.sort_by(|a, b| a.cmp(b));
+    assert_stable(&presorted);
+
+    // Assert that sorted and min/max are the same
+    fn assert_stable<T: Ord + Debug>(presorted: &[T]) {
+        for slice in presorted.windows(2) {
+            let a = &slice[0];
+            let b = &slice[1];
+
+            assert_eq!(a, cmp::min(a, b));
+            assert_eq!(b, cmp::max(a, b));
+        }
+    }
+}
diff --git a/src/test/ui/stdlib-unit-tests/not-sync.rs b/src/test/ui/stdlib-unit-tests/not-sync.rs
new file mode 100644 (file)
index 0000000..f464899
--- /dev/null
@@ -0,0 +1,22 @@
+use std::cell::{Cell, RefCell};
+use std::rc::{Rc, Weak};
+use std::sync::mpsc::{Receiver, Sender};
+
+fn test<T: Sync>() {}
+
+fn main() {
+    test::<Cell<i32>>();
+    //~^ ERROR `Cell<i32>` cannot be shared between threads safely [E0277]
+    test::<RefCell<i32>>();
+    //~^ ERROR `RefCell<i32>` cannot be shared between threads safely [E0277]
+
+    test::<Rc<i32>>();
+    //~^ ERROR `Rc<i32>` cannot be shared between threads safely [E0277]
+    test::<Weak<i32>>();
+    //~^ ERROR `std::rc::Weak<i32>` cannot be shared between threads safely [E0277]
+
+    test::<Receiver<i32>>();
+    //~^ ERROR `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely [E0277]
+    test::<Sender<i32>>();
+    //~^ ERROR `Sender<i32>` cannot be shared between threads safely [E0277]
+}
diff --git a/src/test/ui/stdlib-unit-tests/not-sync.stderr b/src/test/ui/stdlib-unit-tests/not-sync.stderr
new file mode 100644 (file)
index 0000000..1ee358b
--- /dev/null
@@ -0,0 +1,81 @@
+error[E0277]: `Cell<i32>` cannot be shared between threads safely
+  --> $DIR/not-sync.rs:8:12
+   |
+LL |     test::<Cell<i32>>();
+   |            ^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely
+   |
+   = help: the trait `Sync` is not implemented for `Cell<i32>`
+note: required by a bound in `test`
+  --> $DIR/not-sync.rs:5:12
+   |
+LL | fn test<T: Sync>() {}
+   |            ^^^^ required by this bound in `test`
+
+error[E0277]: `RefCell<i32>` cannot be shared between threads safely
+  --> $DIR/not-sync.rs:10:12
+   |
+LL |     test::<RefCell<i32>>();
+   |            ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
+   |
+   = help: the trait `Sync` is not implemented for `RefCell<i32>`
+note: required by a bound in `test`
+  --> $DIR/not-sync.rs:5:12
+   |
+LL | fn test<T: Sync>() {}
+   |            ^^^^ required by this bound in `test`
+
+error[E0277]: `Rc<i32>` cannot be shared between threads safely
+  --> $DIR/not-sync.rs:13:12
+   |
+LL |     test::<Rc<i32>>();
+   |            ^^^^^^^ `Rc<i32>` cannot be shared between threads safely
+   |
+   = help: the trait `Sync` is not implemented for `Rc<i32>`
+note: required by a bound in `test`
+  --> $DIR/not-sync.rs:5:12
+   |
+LL | fn test<T: Sync>() {}
+   |            ^^^^ required by this bound in `test`
+
+error[E0277]: `std::rc::Weak<i32>` cannot be shared between threads safely
+  --> $DIR/not-sync.rs:15:12
+   |
+LL |     test::<Weak<i32>>();
+   |            ^^^^^^^^^ `std::rc::Weak<i32>` cannot be shared between threads safely
+   |
+   = help: the trait `Sync` is not implemented for `std::rc::Weak<i32>`
+note: required by a bound in `test`
+  --> $DIR/not-sync.rs:5:12
+   |
+LL | fn test<T: Sync>() {}
+   |            ^^^^ required by this bound in `test`
+
+error[E0277]: `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely
+  --> $DIR/not-sync.rs:18:12
+   |
+LL |     test::<Receiver<i32>>();
+   |            ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely
+   |
+   = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<i32>`
+note: required by a bound in `test`
+  --> $DIR/not-sync.rs:5:12
+   |
+LL | fn test<T: Sync>() {}
+   |            ^^^^ required by this bound in `test`
+
+error[E0277]: `Sender<i32>` cannot be shared between threads safely
+  --> $DIR/not-sync.rs:20:12
+   |
+LL |     test::<Sender<i32>>();
+   |            ^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely
+   |
+   = help: the trait `Sync` is not implemented for `Sender<i32>`
+note: required by a bound in `test`
+  --> $DIR/not-sync.rs:5:12
+   |
+LL | fn test<T: Sync>() {}
+   |            ^^^^ required by this bound in `test`
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/stdlib-unit-tests/raw-fat-ptr.rs b/src/test/ui/stdlib-unit-tests/raw-fat-ptr.rs
new file mode 100644 (file)
index 0000000..9f50659
--- /dev/null
@@ -0,0 +1,118 @@
+// run-pass
+// check raw fat pointer ops
+
+use std::mem;
+
+fn assert_inorder<T: PartialEq + PartialOrd>(a: &[T]) {
+    for i in 0..a.len() {
+        for j in 0..a.len() {
+            if i < j {
+                assert!(a[i] < a[j]);
+                assert!(a[i] <= a[j]);
+                assert!(!(a[i] == a[j]));
+                assert!(a[i] != a[j]);
+                assert!(!(a[i] >= a[j]));
+                assert!(!(a[i] > a[j]));
+            } else if i == j {
+                assert!(!(a[i] < a[j]));
+                assert!(a[i] <= a[j]);
+                assert!(a[i] == a[j]);
+                assert!(!(a[i] != a[j]));
+                assert!(a[i] >= a[j]);
+                assert!(!(a[i] > a[j]));
+            } else {
+                assert!(!(a[i] < a[j]));
+                assert!(!(a[i] <= a[j]));
+                assert!(!(a[i] == a[j]));
+                assert!(a[i] != a[j]);
+                assert!(a[i] >= a[j]);
+                assert!(a[i] > a[j]);
+            }
+        }
+    }
+}
+
+trait Foo { fn foo(&self) -> usize; }
+impl<T> Foo for T {
+    fn foo(&self) -> usize {
+        mem::size_of::<T>()
+    }
+}
+
+struct S<T:?Sized>(u32, T);
+
+fn main() {
+    let mut array = [0,1,2,3,4];
+    let mut array2 = [5,6,7,8,9];
+
+    // fat ptr comparison: addr then extra
+
+    // check ordering for arrays
+    let mut ptrs: Vec<*const [u8]> = vec![
+        &array[0..0], &array[0..1], &array, &array[1..]
+    ];
+
+    let array_addr = &array as *const [u8] as *const u8 as usize;
+    let array2_addr = &array2 as *const [u8] as *const u8 as usize;
+    if array2_addr < array_addr {
+        ptrs.insert(0, &array2);
+    } else {
+        ptrs.push(&array2);
+    }
+    assert_inorder(&ptrs);
+
+    // check ordering for mut arrays
+    let mut ptrs: Vec<*mut [u8]> = vec![
+        &mut array[0..0], &mut array[0..1], &mut array, &mut array[1..]
+    ];
+
+    let array_addr = &mut array as *mut [u8] as *mut u8 as usize;
+    let array2_addr = &mut array2 as *mut [u8] as *mut u8 as usize;
+    if array2_addr < array_addr {
+        ptrs.insert(0, &mut array2);
+    } else {
+        ptrs.push(&mut array2);
+    }
+    assert_inorder(&ptrs);
+
+    let mut u8_ = (0u8, 1u8);
+    let mut u32_ = (4u32, 5u32);
+
+    // check ordering for ptrs
+    let buf: &mut [*const dyn Foo] = &mut [
+        &u8_, &u8_.0,
+        &u32_, &u32_.0,
+    ];
+    buf.sort_by(|u,v| {
+        let u : [*const (); 2] = unsafe { mem::transmute(*u) };
+        let v : [*const (); 2] = unsafe { mem::transmute(*v) };
+        u.cmp(&v)
+    });
+    assert_inorder(buf);
+
+    // check ordering for mut ptrs
+    let buf: &mut [*mut dyn Foo] = &mut [
+        &mut u8_, &mut u8_.0,
+        &mut u32_, &mut u32_.0,
+    ];
+    buf.sort_by(|u,v| {
+        let u : [*const (); 2] = unsafe { mem::transmute(*u) };
+        let v : [*const (); 2] = unsafe { mem::transmute(*v) };
+        u.cmp(&v)
+    });
+    assert_inorder(buf);
+
+    // check ordering for structs containing arrays
+    let ss: (S<[u8; 2]>,
+             S<[u8; 3]>,
+             S<[u8; 2]>) = (
+        S(7, [8, 9]),
+        S(10, [11, 12, 13]),
+        S(4, [5, 6])
+    );
+    assert_inorder(&[
+        &ss.0 as *const S<[u8]>,
+        &ss.1 as *const S<[u8]>,
+        &ss.2 as *const S<[u8]>
+    ]);
+}
diff --git a/src/test/ui/stdlib-unit-tests/volatile-fat-ptr.rs b/src/test/ui/stdlib-unit-tests/volatile-fat-ptr.rs
new file mode 100644 (file)
index 0000000..f73e7e1
--- /dev/null
@@ -0,0 +1,15 @@
+// run-pass
+
+#![allow(stable_features)]
+#![feature(volatile)]
+use std::ptr::{read_volatile, write_volatile};
+
+fn main() {
+    let mut x: &'static str = "test";
+    unsafe {
+        let a = read_volatile(&x);
+        assert_eq!(a, "test");
+        write_volatile(&mut x, "foo");
+        assert_eq!(x, "foo");
+    }
+}
index 47bd6f6bfa73d0158de9caf50e65c7c293f1fa15..9c3c3646139dc2ec955f70a2570e08d08a621b91 100644 (file)
@@ -20,6 +20,11 @@ LL |     let _ = s.get(4);
    = help: the trait `SliceIndex<str>` is not implemented for `{integer}`
    = note: you can use `.chars().nth()` or `.bytes().nth()`
            for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
+note: required by a bound in `core::str::<impl str>::get`
+  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
+   |
+LL |     pub fn get<I: SliceIndex<str>>(&self, i: I) -> Option<&I::Output> {
+   |                   ^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get`
 
 error[E0277]: the type `str` cannot be indexed by `{integer}`
   --> $DIR/str-idx.rs:5:29
@@ -32,6 +37,11 @@ LL |     let _ = s.get_unchecked(4);
    = help: the trait `SliceIndex<str>` is not implemented for `{integer}`
    = note: you can use `.chars().nth()` or `.bytes().nth()`
            for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
+note: required by a bound in `core::str::<impl str>::get_unchecked`
+  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
+   |
+LL |     pub unsafe fn get_unchecked<I: SliceIndex<str>>(&self, i: I) -> &I::Output {
+   |                                    ^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked`
 
 error[E0277]: the type `str` cannot be indexed by `char`
   --> $DIR/str-idx.rs:6:17
index ab647c75cf1205c88d919bf040775ff230c203a2..2559ee9eb49b25f3ff0ad8c8ed4a7c12f9aff049 100644 (file)
@@ -44,6 +44,11 @@ LL |     s.get_mut(1);
    = help: the trait `SliceIndex<str>` is not implemented for `{integer}`
    = note: you can use `.chars().nth()` or `.bytes().nth()`
            for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
+note: required by a bound in `core::str::<impl str>::get_mut`
+  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
+   |
+LL |     pub fn get_mut<I: SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> {
+   |                       ^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_mut`
 
 error[E0277]: the type `str` cannot be indexed by `{integer}`
   --> $DIR/str-mut-idx.rs:11:25
@@ -56,6 +61,11 @@ LL |     s.get_unchecked_mut(1);
    = help: the trait `SliceIndex<str>` is not implemented for `{integer}`
    = note: you can use `.chars().nth()` or `.bytes().nth()`
            for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
+note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
+  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
+   |
+LL |     pub unsafe fn get_unchecked_mut<I: SliceIndex<str>>(&mut self, i: I) -> &mut I::Output {
+   |                                        ^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked_mut`
 
 error[E0277]: the type `str` cannot be indexed by `char`
   --> $DIR/str-mut-idx.rs:13:5
index e0a22c2df1aca529b65b67bcf33bf55ddf09b838..7a80e7270ba36f9682c5b4d7b6707537722b20c8 100644 (file)
@@ -4,11 +4,11 @@ error[E0277]: the trait bound `NoClone: Clone` is not satisfied
 LL |     let s = A { a: NoClone };
    |             ^ the trait `Clone` is not implemented for `NoClone`
    |
-note: required by `S`
-  --> $DIR/struct-path-alias-bounds.rs:3:1
+note: required by a bound in `S`
+  --> $DIR/struct-path-alias-bounds.rs:3:13
    |
 LL | struct S<T: Clone> { a: T }
-   | ^^^^^^^^^^^^^^^^^^
+   |             ^^^^^ required by this bound in `S`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/substs-ppaux.normal.stderr
deleted file mode 100644 (file)
index 97caa83..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/substs-ppaux.rs:16:17
-   |
-LL |     fn bar<'a, T>() where T: 'a {}
-   |     --------------------------- fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>} defined here
-...
-LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>;
-   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
-   |            |
-   |            expected due to this
-   |
-   = note: expected unit type `()`
-                found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
-help: use parentheses to call this function
-   |
-LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>();
-   |                                                                         ++
-
-error[E0308]: mismatched types
-  --> $DIR/substs-ppaux.rs:25:17
-   |
-LL |     fn bar<'a, T>() where T: 'a {}
-   |     --------------------------- fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>} defined here
-...
-LL |     let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>;
-   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
-   |            |
-   |            expected due to this
-   |
-   = note: expected unit type `()`
-                found fn item `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
-help: use parentheses to call this function
-   |
-LL |     let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>();
-   |                                                                          ++
-
-error[E0308]: mismatched types
-  --> $DIR/substs-ppaux.rs:33:17
-   |
-LL |     fn baz() {}
-   |     -------- fn() {<i8 as Foo<'static, 'static, u8>>::baz} defined here
-...
-LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::baz;
-   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
-   |            |
-   |            expected due to this
-   |
-   = note: expected unit type `()`
-                found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
-help: use parentheses to call this function
-   |
-LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::baz();
-   |                                                        ++
-
-error[E0308]: mismatched types
-  --> $DIR/substs-ppaux.rs:41:17
-   |
-LL | fn foo<'z>() where &'z (): Sized {
-   | -------------------------------- fn() {foo::<'static>} defined here
-...
-LL |     let x: () = foo::<'static>;
-   |            --   ^^^^^^^^^^^^^^ expected `()`, found fn item
-   |            |
-   |            expected due to this
-   |
-   = note: expected unit type `()`
-                found fn item `fn() {foo::<'static>}`
-help: use parentheses to call this function
-   |
-LL |     let x: () = foo::<'static>();
-   |                               ++
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/substs-ppaux.rs:49:5
-   |
-LL |     <str as Foo<u8>>::bar;
-   |     ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
-   |
-   = help: the trait `Sized` is not implemented for `str`
-note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for `str`
-  --> $DIR/substs-ppaux.rs:11:17
-   |
-LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
-   |                 ^^^^^^^^^^^^^^     ^
-note: required by a bound in `Foo::bar`
-  --> $DIR/substs-ppaux.rs:7:30
-   |
-LL |     fn bar<'a, T>() where T: 'a {}
-   |                              ^^ required by this bound in `Foo::bar`
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0277, E0308.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/substs-ppaux.rs b/src/test/ui/substs-ppaux.rs
deleted file mode 100644 (file)
index 66cd94d..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// revisions: verbose normal
-//
-//[verbose] compile-flags: -Z verbose
-
-trait Foo<'b, 'c, S=u32> {
-    fn bar<'a, T>() where T: 'a {}
-    fn baz() {}
-}
-
-impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
-
-fn main() {}
-
-fn foo<'z>() where &'z (): Sized {
-    let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>;
-    //[verbose]~^ ERROR mismatched types
-    //[verbose]~| expected unit type `()`
-    //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
-    //[normal]~^^^^ ERROR mismatched types
-    //[normal]~| expected unit type `()`
-    //[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
-
-
-    let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>;
-    //[verbose]~^ ERROR mismatched types
-    //[verbose]~| expected unit type `()`
-    //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}`
-    //[normal]~^^^^ ERROR mismatched types
-    //[normal]~| expected unit type `()`
-    //[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
-
-    let x: () = <i8 as Foo<'static, 'static,  u8>>::baz;
-    //[verbose]~^ ERROR mismatched types
-    //[verbose]~| expected unit type `()`
-    //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
-    //[normal]~^^^^ ERROR mismatched types
-    //[normal]~| expected unit type `()`
-    //[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
-
-    let x: () = foo::<'static>;
-    //[verbose]~^ ERROR mismatched types
-    //[verbose]~| expected unit type `()`
-    //[verbose]~| found fn item `fn() {foo::<ReStatic>}`
-    //[normal]~^^^^ ERROR mismatched types
-    //[normal]~| expected unit type `()`
-    //[normal]~| found fn item `fn() {foo::<'static>}`
-
-    <str as Foo<u8>>::bar;
-    //[verbose]~^ ERROR the size for values of type
-    //[normal]~^^ ERROR the size for values of type
-}
diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/substs-ppaux.verbose.stderr
deleted file mode 100644 (file)
index 5829073..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/substs-ppaux.rs:16:17
-   |
-LL |     fn bar<'a, T>() where T: 'a {}
-   |     --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>} defined here
-...
-LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>;
-   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
-   |            |
-   |            expected due to this
-   |
-   = note: expected unit type `()`
-                found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
-help: use parentheses to call this function
-   |
-LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::bar::<'static, char>();
-   |                                                                         ++
-
-error[E0308]: mismatched types
-  --> $DIR/substs-ppaux.rs:25:17
-   |
-LL |     fn bar<'a, T>() where T: 'a {}
-   |     --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>} defined here
-...
-LL |     let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>;
-   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
-   |            |
-   |            expected due to this
-   |
-   = note: expected unit type `()`
-                found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}`
-help: use parentheses to call this function
-   |
-LL |     let x: () = <i8 as Foo<'static, 'static,  u32>>::bar::<'static, char>();
-   |                                                                          ++
-
-error[E0308]: mismatched types
-  --> $DIR/substs-ppaux.rs:33:17
-   |
-LL |     fn baz() {}
-   |     -------- fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz} defined here
-...
-LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::baz;
-   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item
-   |            |
-   |            expected due to this
-   |
-   = note: expected unit type `()`
-                found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
-help: use parentheses to call this function
-   |
-LL |     let x: () = <i8 as Foo<'static, 'static,  u8>>::baz();
-   |                                                        ++
-
-error[E0308]: mismatched types
-  --> $DIR/substs-ppaux.rs:41:17
-   |
-LL | fn foo<'z>() where &'z (): Sized {
-   | -------------------------------- fn() {foo::<ReStatic>} defined here
-...
-LL |     let x: () = foo::<'static>;
-   |            --   ^^^^^^^^^^^^^^ expected `()`, found fn item
-   |            |
-   |            expected due to this
-   |
-   = note: expected unit type `()`
-                found fn item `fn() {foo::<ReStatic>}`
-help: use parentheses to call this function
-   |
-LL |     let x: () = foo::<'static>();
-   |                               ++
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/substs-ppaux.rs:49:5
-   |
-LL |     <str as Foo<u8>>::bar;
-   |     ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
-   |
-   = help: the trait `Sized` is not implemented for `str`
-note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8>` for `str`
-  --> $DIR/substs-ppaux.rs:11:17
-   |
-LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {}
-   |                 ^^^^^^^^^^^^^^     ^
-note: required by a bound in `Foo::bar`
-  --> $DIR/substs-ppaux.rs:7:30
-   |
-LL |     fn bar<'a, T>() where T: 'a {}
-   |                              ^^ required by this bound in `Foo::bar`
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0277, E0308.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/suffixed-literal-meta.rs b/src/test/ui/suffixed-literal-meta.rs
deleted file mode 100644 (file)
index a653149..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#![feature(rustc_attrs)]
-
-#[rustc_dummy = 1usize] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1u8] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1u16] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1u32] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1u64] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1isize] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1i8] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1i16] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1i32] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1i64] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes
-#[rustc_dummy = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes
-fn main() {}
diff --git a/src/test/ui/suffixed-literal-meta.stderr b/src/test/ui/suffixed-literal-meta.stderr
deleted file mode 100644 (file)
index 5245ffe..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:3:17
-   |
-LL | #[rustc_dummy = 1usize]
-   |                 ^^^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:4:17
-   |
-LL | #[rustc_dummy = 1u8]
-   |                 ^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:5:17
-   |
-LL | #[rustc_dummy = 1u16]
-   |                 ^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:6:17
-   |
-LL | #[rustc_dummy = 1u32]
-   |                 ^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:7:17
-   |
-LL | #[rustc_dummy = 1u64]
-   |                 ^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:8:17
-   |
-LL | #[rustc_dummy = 1isize]
-   |                 ^^^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:9:17
-   |
-LL | #[rustc_dummy = 1i8]
-   |                 ^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:10:17
-   |
-LL | #[rustc_dummy = 1i16]
-   |                 ^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:11:17
-   |
-LL | #[rustc_dummy = 1i32]
-   |                 ^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:12:17
-   |
-LL | #[rustc_dummy = 1i64]
-   |                 ^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:13:17
-   |
-LL | #[rustc_dummy = 1.0f32]
-   |                 ^^^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: suffixed literals are not allowed in attributes
-  --> $DIR/suffixed-literal-meta.rs:14:17
-   |
-LL | #[rustc_dummy = 1.0f64]
-   |                 ^^^^^^
-   |
-   = help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
-
-error: aborting due to 12 previous errors
-
index 78ebb3d6bfc245cebfe2b58aa8a040de58a158c4..4759ebea0e9b700b388174f043deca50807296d3 100644 (file)
@@ -1,15 +1,15 @@
-error[E0277]: `fn() -> impl Future {foo}` is not a future
+error[E0277]: `fn() -> impl Future<Output = ()> {foo}` is not a future
   --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:10:9
    |
 LL | async fn foo() {}
    |          --- consider calling this function
 ...
 LL |     bar(foo);
-   |     --- ^^^ `fn() -> impl Future {foo}` is not a future
+   |     --- ^^^ `fn() -> impl Future<Output = ()> {foo}` is not a future
    |     |
    |     required by a bound introduced by this call
    |
-   = help: the trait `Future` is not implemented for `fn() -> impl Future {foo}`
+   = help: the trait `Future` is not implemented for `fn() -> impl Future<Output = ()> {foo}`
 note: required by a bound in `bar`
   --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16
    |
index d8f7fac15135635b10cb4d8b1df9772a35d594d0..9b9e70a675fb1119725baa0152398e0587d6e005 100644 (file)
@@ -9,7 +9,7 @@ fn foo(x: Ty) -> Ty {
         Ty::List(elem) => foo(elem),
         //~^ ERROR mismatched types
         //~| HELP try dereferencing the `Box`
-        //~| HELP try using a variant of the expected enum
+        //~| HELP try wrapping
     }
 }
 
index d4ccb2ca490bc0f9fb0f899cda5fc8565645d71d..e865b993a4c178bb128935eef88c7afaf6a286ae 100644 (file)
@@ -10,10 +10,10 @@ help: try dereferencing the `Box`
    |
 LL |         Ty::List(elem) => foo(*elem),
    |                               +
-help: try using a variant of the expected enum
+help: try wrapping the expression in `Ty::List`
    |
 LL |         Ty::List(elem) => foo(Ty::List(elem)),
-   |                               ~~~~~~~~~~~~~~
+   |                               +++++++++    +
 
 error: aborting due to previous error
 
index aa3175dae2e66cca43d57f73472b30826c67ccce..7ef4895249cec7218f08a5836b9dd9edc0d817c2 100644 (file)
@@ -46,11 +46,11 @@ LL |     Pin::new(x)
    |     ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future<Output = i32> + Send`
    |
    = note: consider using `Box::pin`
-note: required by `Pin::<P>::new`
+note: required by a bound in `Pin::<P>::new`
   --> $SRC_DIR/core/src/pin.rs:LL:COL
    |
-LL |     pub const fn new(pointer: P) -> Pin<P> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | impl<P: Deref<Target: Unpin>> Pin<P> {
+   |                       ^^^^^ required by this bound in `Pin::<P>::new`
 
 error[E0277]: `dyn Future<Output = i32> + Send` cannot be unpinned
   --> $DIR/expected-boxed-future-isnt-pinned.rs:24:5
@@ -59,11 +59,11 @@ LL |     Pin::new(Box::new(x))
    |     ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future<Output = i32> + Send`
    |
    = note: consider using `Box::pin`
-note: required by `Pin::<P>::new`
+note: required by a bound in `Pin::<P>::new`
   --> $SRC_DIR/core/src/pin.rs:LL:COL
    |
-LL |     pub const fn new(pointer: P) -> Pin<P> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | impl<P: Deref<Target: Unpin>> Pin<P> {
+   |                       ^^^^^ required by this bound in `Pin::<P>::new`
 
 error[E0308]: mismatched types
   --> $DIR/expected-boxed-future-isnt-pinned.rs:28:5
index 29ba39cbe109c5ecf84f32459c8b4d60e493ffbc..bc1c69406d139c138add6ee92c32d22ec7292567 100644 (file)
@@ -8,6 +8,11 @@ LL |     println!("{:?}", line.find(pattern));
    |
    = note: the trait bound `String: Pattern<'_>` is not satisfied
    = note: required because of the requirements on the impl of `Pattern<'_>` for `String`
+note: required by a bound in `core::str::<impl str>::find`
+  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
+   |
+LL |     pub fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize> {
+   |                        ^^^^^^^^^^^ required by this bound in `core::str::<impl str>::find`
 help: consider borrowing here
    |
 LL |     println!("{:?}", line.find(&pattern));
index 43ba35d0205bd38bcbbcaf19e5d75bf55039980a..f257bb9b0e88744ea061f22a8d9ad939f6a9ea72 100644 (file)
@@ -2,14 +2,9 @@ error[E0277]: the `?` operator can only be applied to values that implement `Try
   --> $DIR/issue-72766.rs:14:5
    |
 LL |     SadGirl {}.call()?;
-   |     ^^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `impl Future`
+   |     ^^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `impl Future<Output = Result<(), ()>>`
    |
-   = help: the trait `Try` is not implemented for `impl Future`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = help: the trait `Try` is not implemented for `impl Future<Output = Result<(), ()>>`
 help: consider `await`ing on the `Future`
    |
 LL |     SadGirl {}.call().await?;
index 1e0aa9ce40d18c18c96ae0b3f3f0c189e64749ea..0b1c41b837f6a9d334104ce46d87d1531c9bd48b 100644 (file)
@@ -20,7 +20,7 @@ note: while checking the return type of the `async fn`
 LL |     pub async fn answer_str(&self, _s: &str) -> Test {
    |                                                 ^^^^ checked the `Output` of this `async fn`, found opaque type
    = note:     expected type `()`
-           found opaque type `impl Future`
+           found opaque type `impl Future<Output = Test>`
 
 error: aborting due to previous error
 
index 16a28c73aa7247db0184c755bfb8ab880f9359d1..24c989ec3e86d51f2168e8f87988bdbda7353b4b 100644 (file)
@@ -6,11 +6,14 @@ LL |     let o = Other::new(f);
    |             |
    |             required by a bound introduced by this call
    |
-note: required by `Other::<'a, G>::new`
-  --> $DIR/issue-84973.rs:27:5
+note: required by a bound in `Other::<'a, G>::new`
+  --> $DIR/issue-84973.rs:25:8
    |
+LL |     G: SomeTrait,
+   |        ^^^^^^^^^ required by this bound in `Other::<'a, G>::new`
+LL | {
 LL |     pub fn new(g: G) -> Self {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |            --- required by a bound in this
 help: consider borrowing here
    |
 LL |     let o = Other::new(&f);
diff --git a/src/test/ui/suggestions/issue-90974.rs b/src/test/ui/suggestions/issue-90974.rs
new file mode 100644 (file)
index 0000000..83590db
--- /dev/null
@@ -0,0 +1,3 @@
+fn main() {
+    println!("{}", (3.).recip()); //~ERROR
+}
diff --git a/src/test/ui/suggestions/issue-90974.stderr b/src/test/ui/suggestions/issue-90974.stderr
new file mode 100644 (file)
index 0000000..e1fb479
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0689]: can't call method `recip` on ambiguous numeric type `{float}`
+  --> $DIR/issue-90974.rs:2:25
+   |
+LL |     println!("{}", (3.).recip());
+   |                         ^^^^^
+   |
+help: you must specify a concrete type for this numeric value, like `f32`
+   |
+LL |     println!("{}", (3_f32).recip());
+   |                     ~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0689`.
index 0cf0074dc3d255ade32cbe7ab4a9b0eddc160d2f..adb928aa8a3766e73cf79d6fba51de548f4afffb 100644 (file)
@@ -11,11 +11,16 @@ note: the parameter type `T` must be valid for the anonymous lifetime defined he
    |
 LL | fn func<T: Test>(foo: &Foo, t: T) {
    |                        ^^^
-note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature-2.rs:20:13: 23:6]` will meet its required lifetime bounds
+note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature-2.rs:20:13: 23:6]` will meet its required lifetime bounds...
   --> $DIR/missing-lifetimes-in-signature-2.rs:20:9
    |
 LL |     foo.bar(move |_| {
    |         ^^^
+note: ...that is required by this bound
+  --> $DIR/missing-lifetimes-in-signature-2.rs:11:12
+   |
+LL |         F: 'a,
+   |            ^^
 
 error: aborting due to previous error
 
index 990a4469764f0410168430c3c02a73a5047705eb..6aa93a24d2f04badad96d70142113ee6b07a00f6 100644 (file)
@@ -55,7 +55,7 @@ async fn async_different_futures() {
         //~| HELP consider `await`ing on both `Future`s
         false => async_dummy2(), //~ ERROR `match` arms have incompatible types
         //~^ NOTE expected opaque type, found a different opaque type
-        //~| NOTE expected type `impl Future`
+        //~| NOTE expected type `impl Future<Output = ()>`
         //~| NOTE distinct uses of `impl Trait` result in different opaque types
     };
 }
index a8f7f3cb177799cbc9b3561d3b5da35a3088b1d2..b55c51b92809a35f5d9e020a6d0db9ee332d5afa 100644 (file)
@@ -21,7 +21,7 @@ note: while checking the return type of the `async fn`
 LL | async fn async_dummy() {}
    |                        ^ checked the `Output` of this `async fn`, found opaque type
    = note:     expected type `()`
-           found opaque type `impl Future`
+           found opaque type `impl Future<Output = ()>`
 help: consider `await`ing on the `Future`
    |
 LL |         false => async_dummy().await,
@@ -55,7 +55,7 @@ note: while checking the return type of the `async fn`
 LL | async fn async_dummy2() {}
    |                         ^ checked the `Output` of this `async fn`, found opaque type
    = note:     expected type `()`
-           found opaque type `impl Future`
+           found opaque type `impl Future<Output = ()>`
 help: consider `await`ing on the `Future`
    |
 LL |         false => async_dummy2().await,
@@ -74,7 +74,7 @@ error[E0308]: `match` arms have incompatible types
 LL |       let _ = match true {
    |  _____________-
 LL | |         true => async_dummy(),
-   | |                 ------------- this is found to be of type `impl Future`
+   | |                 ------------- this is found to be of type `impl Future<Output = ()>`
 LL | |
 LL | |         false => async_dummy2(),
    | |                  ^^^^^^^^^^^^^^ expected opaque type, found a different opaque type
@@ -88,8 +88,8 @@ note: while checking the return type of the `async fn`
    |
 LL | async fn async_dummy2() {}
    |                         ^ checked the `Output` of this `async fn`, found opaque type
-   = note:     expected type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>)
-           found opaque type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:19:25>)
+   = note:     expected type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>)
+           found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:19:25>)
    = note: distinct uses of `impl Trait` result in different opaque types
 help: consider `await`ing on both `Future`s
    |
diff --git a/src/test/ui/suggestions/missing-trait-bound-for-op.fixed b/src/test/ui/suggestions/missing-trait-bound-for-op.fixed
deleted file mode 100644 (file)
index 6b24375..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-rustfix
-
-pub fn foo<T: std::cmp::PartialEq>(s: &[T], t: &[T]) {
-    let _ = s == t; //~ ERROR binary operation `==` cannot be applied to type `&[T]`
-}
-
-fn main() {}
diff --git a/src/test/ui/suggestions/missing-trait-bound-for-op.rs b/src/test/ui/suggestions/missing-trait-bound-for-op.rs
deleted file mode 100644 (file)
index df47be0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-rustfix
-
-pub fn foo<T>(s: &[T], t: &[T]) {
-    let _ = s == t; //~ ERROR binary operation `==` cannot be applied to type `&[T]`
-}
-
-fn main() {}
diff --git a/src/test/ui/suggestions/missing-trait-bound-for-op.stderr b/src/test/ui/suggestions/missing-trait-bound-for-op.stderr
deleted file mode 100644 (file)
index cde0755..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0369]: binary operation `==` cannot be applied to type `&[T]`
-  --> $DIR/missing-trait-bound-for-op.rs:4:15
-   |
-LL |     let _ = s == t;
-   |             - ^^ - &[T]
-   |             |
-   |             &[T]
-   |
-help: consider restricting type parameter `T`
-   |
-LL | pub fn foo<T: std::cmp::PartialEq>(s: &[T], t: &[T]) {
-   |             +++++++++++++++++++++
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/ui/suggestions/missing-trait-bounds-for-method-call.rs b/src/test/ui/suggestions/missing-trait-bounds-for-method-call.rs
deleted file mode 100644 (file)
index afd47f7..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#[derive(Default, PartialEq)]
-struct Foo<T> {
-    bar: Box<[T]>,
-}
-
-trait Bar {
-    fn foo(&self) {}
-}
-
-impl<T: Default + Bar> Bar for Foo<T> {}
-
-impl<T> Foo<T> {
-    fn bar(&self) {
-        self.foo();
-        //~^ ERROR the method
-    }
-}
-
-struct Fin<T> where T: Bar {
-    bar: Box<[T]>,
-}
-
-impl<T: Default + Bar> Bar for Fin<T> {}
-
-impl<T: Bar> Fin<T> {
-    fn bar(&self) {
-        self.foo();
-        //~^ ERROR the method
-    }
-}
-fn main() {}
diff --git a/src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr b/src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr
deleted file mode 100644 (file)
index 2f0fd69..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0599]: the method `foo` exists for reference `&Foo<T>`, but its trait bounds were not satisfied
-  --> $DIR/missing-trait-bounds-for-method-call.rs:14:14
-   |
-LL | struct Foo<T> {
-   | ------------- doesn't satisfy `Foo<T>: Bar`
-...
-LL |         self.foo();
-   |              ^^^ method cannot be called on `&Foo<T>` due to unsatisfied trait bounds
-   |
-   = note: the following trait bounds were not satisfied:
-           `T: Default`
-           which is required by `Foo<T>: Bar`
-           `T: Bar`
-           which is required by `Foo<T>: Bar`
-help: consider restricting the type parameters to satisfy the trait bounds
-   |
-LL | struct Foo<T> where T: Bar, T: Default {
-   |               ++++++++++++++++++++++++
-
-error[E0599]: the method `foo` exists for reference `&Fin<T>`, but its trait bounds were not satisfied
-  --> $DIR/missing-trait-bounds-for-method-call.rs:27:14
-   |
-LL | struct Fin<T> where T: Bar {
-   | -------------------------- doesn't satisfy `Fin<T>: Bar`
-...
-LL |         self.foo();
-   |              ^^^ method cannot be called on `&Fin<T>` due to unsatisfied trait bounds
-   |
-   = note: the following trait bounds were not satisfied:
-           `T: Default`
-           which is required by `Fin<T>: Bar`
-help: consider restricting the type parameter to satisfy the trait bound
-   |
-LL | struct Fin<T> where T: Bar, T: Default {
-   |                           ++++++++++++
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0599`.
index e6a2231390076e02c059bd0b26959f54af4c97ab..d121932c842e35324a8a8f1060e4713f8dd8ab0c 100644 (file)
@@ -7,11 +7,11 @@ LL |     let fp = BufWriter::new(fp);
    |              required by a bound introduced by this call
    |
    = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
-note: required by `BufWriter::<W>::new`
+note: required by a bound in `BufWriter::<W>::new`
   --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
    |
-LL |     pub fn new(inner: W) -> BufWriter<W> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | impl<W: Write> BufWriter<W> {
+   |         ^^^^^ required by this bound in `BufWriter::<W>::new`
 
 error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
   --> $DIR/mut-borrow-needed-by-trait.rs:17:14
index 851073734515d7a92c488997f9ede9e909726d22..e065e0aaa8e0622480eef0c1d5d679d706a8ce28 100644 (file)
@@ -13,8 +13,8 @@ LL | |         thing_two()
 LL | |     }.await
    | |_____- `if` and `else` have incompatible types
    |
-   = note:     expected type `impl Future` (opaque type at <$DIR/opaque-type-error.rs:8:19>)
-           found opaque type `impl Future` (opaque type at <$DIR/opaque-type-error.rs:12:19>)
+   = note:     expected type `impl Future<Output = Result<(), ()>>` (opaque type at <$DIR/opaque-type-error.rs:8:19>)
+           found opaque type `impl Future<Output = Result<(), ()>>` (opaque type at <$DIR/opaque-type-error.rs:12:19>)
    = note: distinct uses of `impl Trait` result in different opaque types
 help: consider `await`ing on both `Future`s
    |
index 0275fd475d8c6a1f5363b5ba7a807884a90c6fa2..fd2a44f9a82ba448f0ad28574d18342cff567635 100644 (file)
@@ -6,11 +6,6 @@ LL |   for _ in v[1..] {
    |
    = note: the trait bound `[i32]: IntoIterator` is not satisfied
    = note: required because of the requirements on the impl of `IntoIterator` for `[i32]`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider borrowing here
    |
 LL |   for _ in &v[1..] {
@@ -26,11 +21,6 @@ LL |   for _ in v[1..] {
    |
    = note: the trait bound `[i32]: IntoIterator` is not satisfied
    = note: required because of the requirements on the impl of `IntoIterator` for `[i32]`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider borrowing here
    |
 LL |   for _ in &v[1..] {
@@ -46,11 +36,6 @@ LL |   for i2 in v2[1..] {
    |
    = note: the trait bound `[K]: IntoIterator` is not satisfied
    = note: required because of the requirements on the impl of `IntoIterator` for `[K]`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider borrowing here
    |
 LL |   for i2 in &v2[1..] {
@@ -66,11 +51,6 @@ LL |   for i2 in v2[1..] {
    |
    = note: the trait bound `[K]: IntoIterator` is not satisfied
    = note: required because of the requirements on the impl of `IntoIterator` for `[K]`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider borrowing here
    |
 LL |   for i2 in &v2[1..] {
index 8dfab8dfa17e5bc1b50b1ab4df1d84cd1721f5ba..2fa69cd5a2c8d51ac988d16af597a23bb93aeb7a 100644 (file)
@@ -6,11 +6,11 @@ LL |         let mut stream_reader = BufReader::new(&stream);
    |                                 |
    |                                 required by a bound introduced by this call
    |
-note: required by `BufReader::<R>::new`
+note: required by a bound in `BufReader::<R>::new`
   --> $SRC_DIR/std/src/io/buffered/bufreader.rs:LL:COL
    |
-LL |     pub fn new(inner: R) -> BufReader<R> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | impl<R: Read> BufReader<R> {
+   |         ^^^^ required by this bound in `BufReader::<R>::new`
 help: consider removing the leading `&`-reference
    |
 LL -         let mut stream_reader = BufReader::new(&stream);
index 22a0ce1e91d7243324dc0245a935d98f94024bbb..9b6dba7e9e75b9d7ac273c434f16af7a88da2c04 100644 (file)
@@ -2,14 +2,16 @@ error[E0308]: mismatched types
   --> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28
    |
 LL |     let _: option::O<()> = ();
-   |            -------------   ^^
-   |            |               |
-   |            |               expected enum `O`, found `()`
-   |            |               help: try using a variant of the expected enum: `option::O::Some(())`
+   |            -------------   ^^ expected enum `O`, found `()`
+   |            |
    |            expected due to this
    |
    = note:   expected enum `O<()>`
            found unit type `()`
+help: try wrapping the expression in `option::O::Some`
+   |
+LL |     let _: option::O<()> = option::O::Some(());
+   |                            ++++++++++++++++  +
 
 error: aborting due to previous error
 
index a5c01484d424c5e2829a6c3ceeeb543e66dfd895..1083b2f971311c21d28cb86a6feeb2ba11e7eff5 100644 (file)
@@ -9,11 +9,6 @@ LL |     for (i, _) in &v.iter().enumerate() {
    |
    = help: the trait `Iterator` is not implemented for `&Enumerate<std::slice::Iter<'_, {integer}>>`
    = note: required because of the requirements on the impl of `IntoIterator` for `&Enumerate<std::slice::Iter<'_, {integer}>>`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index b128590f9d0e75de0daaf3a1e082b814ae8bd85a..197b19a1bffc273fb9b8ec02226c781c9cda2c69 100644 (file)
@@ -9,11 +9,6 @@ LL |     for (i, _) in & & & & &v.iter().enumerate() {
    |
    = help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
    = note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index 1c32a33e3712fb3a61e488ba175cfc8be7ae369d..bb0cceac1db7b6d9a625627575b45a8c547d2f55 100644 (file)
@@ -13,11 +13,6 @@ LL | |          .enumerate() {
    |
    = help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
    = note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`
-note: required by `into_iter`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
-   |
-LL |     fn into_iter(self) -> Self::IntoIter;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/syntax-trait-polarity-feature-gate.rs b/src/test/ui/syntax-trait-polarity-feature-gate.rs
deleted file mode 100644 (file)
index 4a3b243..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-use std::marker::Send;
-
-struct TestType;
-
-trait TestTrait {}
-
-impl !Send for TestType {}
-//~^ ERROR negative trait bounds
-
-fn main() {}
diff --git a/src/test/ui/syntax-trait-polarity-feature-gate.stderr b/src/test/ui/syntax-trait-polarity-feature-gate.stderr
deleted file mode 100644 (file)
index 3562dee..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: negative trait bounds are not yet fully implemented; use marker types for now
-  --> $DIR/syntax-trait-polarity-feature-gate.rs:7:6
-   |
-LL | impl !Send for TestType {}
-   |      ^^^^^
-   |
-   = note: see issue #68318 <https://github.com/rust-lang/rust/issues/68318> for more information
-   = help: add `#![feature(negative_impls)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/synthetic-param.rs b/src/test/ui/synthetic-param.rs
deleted file mode 100644 (file)
index e14697f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#![feature(rustc_attrs)]
-
-fn func<#[rustc_synthetic] T>(_: T) {}
-
-struct Foo;
-
-impl Foo {
-    pub fn func<#[rustc_synthetic] T>(_: T) {}
-}
-
-struct Bar<S> {
-    t: S
-}
-
-impl<S> Bar<S> {
-    pub fn func<#[rustc_synthetic] T>(_: T) {}
-}
-
-fn main() {
-    func::<u8>(42); //~ ERROR cannot provide explicit generic arguments
-    func(42); // Ok
-
-    Foo::func::<u8>(42); //~ ERROR cannot provide explicit generic arguments
-    Foo::func(42); // Ok
-
-    Bar::<i8>::func::<u8>(42); //~ ERROR cannot provide explicit generic arguments
-    Bar::<i8>::func(42); // Ok
-}
diff --git a/src/test/ui/synthetic-param.stderr b/src/test/ui/synthetic-param.stderr
deleted file mode 100644 (file)
index 5cb9ad3..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
-  --> $DIR/synthetic-param.rs:20:12
-   |
-LL |     func::<u8>(42);
-   |            ^^ explicit generic argument not allowed
-   |
-   = note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
-   = help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable
-
-error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
-  --> $DIR/synthetic-param.rs:23:17
-   |
-LL |     Foo::func::<u8>(42);
-   |                 ^^ explicit generic argument not allowed
-   |
-   = note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
-   = help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable
-
-error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
-  --> $DIR/synthetic-param.rs:26:23
-   |
-LL |     Bar::<i8>::func::<u8>(42);
-   |                       ^^ explicit generic argument not allowed
-   |
-   = note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
-   = help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0632`.
diff --git a/src/test/ui/tail-direct.rs b/src/test/ui/tail-direct.rs
deleted file mode 100644 (file)
index c67c5b7..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-pass
-
-pub fn main() { assert!((even(42))); assert!((odd(45))); }
-
-fn even(n: isize) -> bool { if n == 0 { return true; } else { return odd(n - 1); } }
-
-fn odd(n: isize) -> bool { if n == 0 { return false; } else { return even(n - 1); } }
diff --git a/src/test/ui/tcp-stress.rs b/src/test/ui/tcp-stress.rs
deleted file mode 100644 (file)
index 1756636..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// run-pass
-// ignore-android needs extra network permissions
-// ignore-emscripten no threads or sockets support
-// ignore-netbsd system ulimit (Too many open files)
-// ignore-openbsd system ulimit (Too many open files)
-
-use std::io::prelude::*;
-use std::net::{TcpListener, TcpStream};
-use std::process;
-use std::sync::mpsc::channel;
-use std::time::Duration;
-use std::thread::{self, Builder};
-
-const TARGET_CNT: usize = 200;
-
-fn main() {
-    // This test has a chance to time out, try to not let it time out
-    thread::spawn(move|| -> () {
-        thread::sleep(Duration::from_secs(30));
-        process::exit(1);
-    });
-
-    let listener = TcpListener::bind("127.0.0.1:0").unwrap();
-    let addr = listener.local_addr().unwrap();
-    thread::spawn(move || -> () {
-        loop {
-            let mut stream = match listener.accept() {
-                Ok(stream) => stream.0,
-                Err(_) => continue,
-            };
-            let _ = stream.read(&mut [0]);
-            let _ = stream.write(&[2]);
-        }
-    });
-
-    let (tx, rx) = channel();
-
-    let mut spawned_cnt = 0;
-    for _ in 0..TARGET_CNT {
-        let tx = tx.clone();
-        let res = Builder::new().stack_size(64 * 1024).spawn(move|| {
-            match TcpStream::connect(addr) {
-                Ok(mut stream) => {
-                    let _ = stream.write(&[1]);
-                    let _ = stream.read(&mut [0]);
-                },
-                Err(..) => {}
-            }
-            tx.send(()).unwrap();
-        });
-        if let Ok(_) = res {
-            spawned_cnt += 1;
-        };
-    }
-
-    // Wait for all clients to exit, but don't wait for the server to exit. The
-    // server just runs infinitely.
-    drop(tx);
-    for _ in 0..spawned_cnt {
-        rx.recv().unwrap();
-    }
-    assert_eq!(spawned_cnt, TARGET_CNT);
-    process::exit(0);
-}
diff --git a/src/test/ui/thread-local-in-ctfe.rs b/src/test/ui/thread-local-in-ctfe.rs
deleted file mode 100644 (file)
index 547e544..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#![feature(thread_local)]
-
-#[thread_local]
-static A: u32 = 1;
-
-static B: u32 = A;
-//~^ ERROR thread-local statics cannot be accessed at compile-time
-
-static C: &u32 = &A;
-//~^ ERROR thread-local statics cannot be accessed at compile-time
-
-const D: u32 = A;
-//~^ ERROR thread-local statics cannot be accessed at compile-time
-
-const E: &u32 = &A;
-//~^ ERROR thread-local statics cannot be accessed at compile-time
-
-const fn f() -> u32 {
-    A
-    //~^ ERROR thread-local statics cannot be accessed at compile-time
-}
-
-fn main() {}
diff --git a/src/test/ui/thread-local-in-ctfe.stderr b/src/test/ui/thread-local-in-ctfe.stderr
deleted file mode 100644 (file)
index fd96760..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0625]: thread-local statics cannot be accessed at compile-time
-  --> $DIR/thread-local-in-ctfe.rs:6:17
-   |
-LL | static B: u32 = A;
-   |                 ^
-
-error[E0625]: thread-local statics cannot be accessed at compile-time
-  --> $DIR/thread-local-in-ctfe.rs:9:19
-   |
-LL | static C: &u32 = &A;
-   |                   ^
-
-error[E0625]: thread-local statics cannot be accessed at compile-time
-  --> $DIR/thread-local-in-ctfe.rs:12:16
-   |
-LL | const D: u32 = A;
-   |                ^
-
-error[E0625]: thread-local statics cannot be accessed at compile-time
-  --> $DIR/thread-local-in-ctfe.rs:15:18
-   |
-LL | const E: &u32 = &A;
-   |                  ^
-
-error[E0625]: thread-local statics cannot be accessed at compile-time
-  --> $DIR/thread-local-in-ctfe.rs:19:5
-   |
-LL |     A
-   |     ^
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0625`.
diff --git a/src/test/ui/thread-local-not-in-prelude.rs b/src/test/ui/thread-local-not-in-prelude.rs
deleted file mode 100644 (file)
index e5ed09c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-pass
-#![no_std]
-
-extern crate std;
-
-std::thread_local!(static A: usize = 30);
-
-fn main() {
-}
diff --git a/src/test/ui/threads-sendsync/clone-with-exterior.rs b/src/test/ui/threads-sendsync/clone-with-exterior.rs
new file mode 100644 (file)
index 0000000..9fc661b
--- /dev/null
@@ -0,0 +1,20 @@
+// run-pass
+
+#![allow(unused_must_use)]
+// ignore-emscripten no threads support
+
+use std::thread;
+
+struct Pair {
+    a: isize,
+    b: isize
+}
+
+pub fn main() {
+    let z: Box<_> = Box::new(Pair { a : 10, b : 12});
+
+    thread::spawn(move|| {
+        assert_eq!(z.a, 10);
+        assert_eq!(z.b, 12);
+    }).join();
+}
diff --git a/src/test/ui/threads-sendsync/tcp-stress.rs b/src/test/ui/threads-sendsync/tcp-stress.rs
new file mode 100644 (file)
index 0000000..1756636
--- /dev/null
@@ -0,0 +1,64 @@
+// run-pass
+// ignore-android needs extra network permissions
+// ignore-emscripten no threads or sockets support
+// ignore-netbsd system ulimit (Too many open files)
+// ignore-openbsd system ulimit (Too many open files)
+
+use std::io::prelude::*;
+use std::net::{TcpListener, TcpStream};
+use std::process;
+use std::sync::mpsc::channel;
+use std::time::Duration;
+use std::thread::{self, Builder};
+
+const TARGET_CNT: usize = 200;
+
+fn main() {
+    // This test has a chance to time out, try to not let it time out
+    thread::spawn(move|| -> () {
+        thread::sleep(Duration::from_secs(30));
+        process::exit(1);
+    });
+
+    let listener = TcpListener::bind("127.0.0.1:0").unwrap();
+    let addr = listener.local_addr().unwrap();
+    thread::spawn(move || -> () {
+        loop {
+            let mut stream = match listener.accept() {
+                Ok(stream) => stream.0,
+                Err(_) => continue,
+            };
+            let _ = stream.read(&mut [0]);
+            let _ = stream.write(&[2]);
+        }
+    });
+
+    let (tx, rx) = channel();
+
+    let mut spawned_cnt = 0;
+    for _ in 0..TARGET_CNT {
+        let tx = tx.clone();
+        let res = Builder::new().stack_size(64 * 1024).spawn(move|| {
+            match TcpStream::connect(addr) {
+                Ok(mut stream) => {
+                    let _ = stream.write(&[1]);
+                    let _ = stream.read(&mut [0]);
+                },
+                Err(..) => {}
+            }
+            tx.send(()).unwrap();
+        });
+        if let Ok(_) = res {
+            spawned_cnt += 1;
+        };
+    }
+
+    // Wait for all clients to exit, but don't wait for the server to exit. The
+    // server just runs infinitely.
+    drop(tx);
+    for _ in 0..spawned_cnt {
+        rx.recv().unwrap();
+    }
+    assert_eq!(spawned_cnt, TARGET_CNT);
+    process::exit(0);
+}
diff --git a/src/test/ui/traits/alignment-gep-tup-like-1.rs b/src/test/ui/traits/alignment-gep-tup-like-1.rs
new file mode 100644 (file)
index 0000000..eb503dc
--- /dev/null
@@ -0,0 +1,37 @@
+// run-pass
+
+#![allow(non_camel_case_types)]
+#![allow(dead_code)]
+
+struct pair<A,B> {
+    a: A, b: B
+}
+
+trait Invokable<A> {
+    fn f(&self) -> (A, u16);
+}
+
+struct Invoker<A> {
+    a: A,
+    b: u16,
+}
+
+impl<A:Clone> Invokable<A> for Invoker<A> {
+    fn f(&self) -> (A, u16) {
+        (self.a.clone(), self.b)
+    }
+}
+
+fn f<A:Clone + 'static>(a: A, b: u16) -> Box<dyn Invokable<A>+'static> {
+    Box::new(Invoker {
+        a: a,
+        b: b,
+    }) as Box<dyn Invokable<A>+'static>
+}
+
+pub fn main() {
+    let (a, b) = f(22_u64, 44u16).f();
+    println!("a={} b={}", a, b);
+    assert_eq!(a, 22u64);
+    assert_eq!(b, 44u16);
+}
index 1e9d151629f2fadd7d2659d583a7bb267c36902f..8befa4c5f738ba4c507111f57ea7e4d806ad21df 100644 (file)
@@ -4,6 +4,11 @@ error[E0277]: `T` cannot be sent between threads safely
 LL |     1.bar::<T>();
    |       ^^^ `T` cannot be sent between threads safely
    |
+note: required by a bound in `Bar::bar`
+  --> $DIR/bad-method-typaram-kind.rs:6:14
+   |
+LL |     fn bar<T:Send>(&self);
+   |              ^^^^ required by this bound in `Bar::bar`
 help: consider further restricting this bound
    |
 LL | fn foo<T:'static + std::marker::Send>() {
index 5421e71509f3a84e2afae3f482fe26603336400c..6f9113fff516193e80bdca725a5e33454a25cf74 100644 (file)
@@ -29,11 +29,11 @@ LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
    |                                     ^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `dyn Trait`
-note: required by `Vec::<T>::new`
+note: required by a bound in `Vec::<T>::new`
   --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
    |
-LL |     pub const fn new() -> Self {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | impl<T> Vec<T> {
+   |      ^ required by this bound in `Vec::<T>::new`
 
 error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
   --> $DIR/bad-sized.rs:4:37
index cd33e18cfb695e6fedb102c6780df6891f96bc9a..c9068a270020d323dade48baed4b3725aa63be0e 100644 (file)
@@ -16,11 +16,11 @@ error[E0277]: the trait bound `{integer}: Trait` is not satisfied
 LL |     let foo = Foo {
    |               ^^^ the trait `Trait` is not implemented for `{integer}`
    |
-note: required by `Foo`
-  --> $DIR/on-structs-and-enums-locals.rs:5:1
+note: required by a bound in `Foo`
+  --> $DIR/on-structs-and-enums-locals.rs:5:14
    |
 LL | struct Foo<T:Trait> {
-   | ^^^^^^^^^^^^^^^^^^^
+   |              ^^^^^ required by this bound in `Foo`
 
 error: aborting due to 2 previous errors
 
index 0f25c8856882c95f3ac44ea249ad92f7ac42f74f..f4cc64af94f371f5d2fb1b8d7a84827a3b89e19d 100644 (file)
@@ -16,11 +16,11 @@ error[E0277]: the trait bound `{integer}: Trait` is not satisfied
 LL |     let foo = Foo {
    |               ^^^ the trait `Trait` is not implemented for `{integer}`
    |
-note: required by `Foo`
-  --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:1
+note: required by a bound in `Foo`
+  --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18
    |
 LL | pub struct Foo<T:Trait> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^
+   |                  ^^^^^ required by this bound in `Foo`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/traits/cycle-generic-bound.rs b/src/test/ui/traits/cycle-generic-bound.rs
new file mode 100644 (file)
index 0000000..9241f37
--- /dev/null
@@ -0,0 +1,11 @@
+// run-pass
+// Regression test for #15477. This test just needs to compile.
+
+// pretty-expanded FIXME #23616
+
+trait Chromosome<X: Chromosome<i32>> {
+}
+
+impl Chromosome<i32> for i32 { }
+
+fn main() { }
diff --git a/src/test/ui/traits/early-vtbl-resolution.rs b/src/test/ui/traits/early-vtbl-resolution.rs
new file mode 100644 (file)
index 0000000..f4b69c1
--- /dev/null
@@ -0,0 +1,19 @@
+// run-pass
+
+#![allow(non_camel_case_types)]
+#![allow(dead_code)]
+// pretty-expanded FIXME #23616
+
+trait thing<A> {
+    fn foo(&self) -> Option<A>;
+}
+impl<A> thing<A> for isize {
+    fn foo(&self) -> Option<A> { None }
+}
+fn foo_func<A, B: thing<A>>(x: B) -> Option<A> { x.foo() }
+
+struct A { a: isize }
+
+pub fn main() {
+    let _x: Option<f64> = foo_func(0);
+}
index fa8799bf7d8a19e0915919377cd4f19a16dd7f0d..2bff84363e9e511ee54f0fc5965417474454058c 100644 (file)
@@ -20,12 +20,6 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfi
    |
 LL |     <dyn CompareToInts>::same_as(c, 22)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
-   |
-note: required by `CompareTo::same_as`
-  --> $DIR/repeated-supertrait-ambig.rs:9:5
-   |
-LL |     fn same_as(&self, t: T) -> bool;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
   --> $DIR/repeated-supertrait-ambig.rs:38:5
@@ -33,11 +27,6 @@ error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
 LL |     CompareTo::same_as(c, 22)
    |     ^^^^^^^^^^^^^^^^^^ the trait `CompareTo<i32>` is not implemented for `C`
    |
-note: required by `CompareTo::same_as`
-  --> $DIR/repeated-supertrait-ambig.rs:9:5
-   |
-LL |     fn same_as(&self, t: T) -> bool;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider further restricting this bound
    |
 LL | fn with_ufcs2<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool {
index d1e8affd065f9356e9179a7053bb1670fbb9dfcc..45b1e1095c7d8db9629fb9e906b6787ce679a1cf 100644 (file)
@@ -8,11 +8,6 @@ LL |     the_foos: Vec<Foo>,
    |     ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo`
    |
    = note: required because of the requirements on the impl of `Clone` for `Vec<Foo>`
-note: required by `clone`
-  --> $SRC_DIR/core/src/clone.rs:LL:COL
-   |
-LL |     fn clone(&self) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index e868756504f19f36c5cee4996f42dd1aa60cbf0b..3c4a5d95c137ec6e9cdd752ca26ecef24f171c64 100644 (file)
@@ -10,6 +10,15 @@ LL |     opts.get(opt.as_ref());
            - impl Borrow<str> for String;
            - impl<T> Borrow<T> for T
              where T: ?Sized;
+note: required by a bound in `HashMap::<K, V, S>::get`
+  --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
+   |
+LL |         K: Borrow<Q>,
+   |            ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get`
+help: consider specifying the type argument in the function call
+   |
+LL |     opts.get::<Q>(opt.as_ref());
+   |             +++++
 
 error[E0283]: type annotations needed
   --> $DIR/issue-77982.rs:8:18
@@ -50,11 +59,6 @@ LL |     let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(
            - impl From<bool> for u32;
            - impl From<char> for u32;
            and 3 more
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0283]: type annotations needed for `Box<T>`
   --> $DIR/issue-77982.rs:36:16
index 2f5b4ad0e62c88069a285bf3bbade8d8e36fc3f4..3e83db142e0871cbbd45983b825c8e25470aa539 100644 (file)
@@ -10,11 +10,6 @@ LL |     bar: &'a mut T
    = help: the following implementations were found:
              <&T as Clone>
    = note: `Clone` is implemented for `&T`, but not for `&mut T`
-note: required by `clone`
-  --> $SRC_DIR/core/src/clone.rs:LL:COL
-   |
-LL |     fn clone(&self) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
index 1f81fa72547df3e32df878ca6aa03c6be8ce2791..33b12ef09ec26faa87dd7bb15fec57b28fc5917e 100644 (file)
@@ -5,15 +5,6 @@ LL |     T: FnMut(&'a ()),
    |        ^^^^^^^^^^^^^ cannot infer type for type parameter `T`
    |
    = note: cannot satisfy `T: FnMut<(&'a (),)>`
-note: required by a bound in `FnMut`
-  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
-   |
-LL | / pub trait FnMut<Args>: FnOnce<Args> {
-LL | |     /// Performs the call operation.
-LL | |     #[unstable(feature = "fn_traits", issue = "29625")]
-LL | |     extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
-LL | | }
-   | |_^ required by this bound in `FnMut`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/traits/map-types.rs b/src/test/ui/traits/map-types.rs
new file mode 100644 (file)
index 0000000..dc33b96
--- /dev/null
@@ -0,0 +1,19 @@
+use std::collections::HashMap;
+
+
+
+trait Map<K, V>
+{
+    fn get(&self, k: K) -> V { panic!() }
+}
+
+impl<K, V> Map<K, V> for HashMap<K, V> {}
+
+// Test that trait types printed in error msgs include the type arguments.
+
+fn main() {
+    let x: Box<HashMap<isize, isize>> = HashMap::new().into();
+    let x: Box<dyn Map<isize, isize>> = x;
+    let y: Box<dyn Map<usize, isize>> = Box::new(x);
+    //~^ ERROR `Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied
+}
diff --git a/src/test/ui/traits/map-types.stderr b/src/test/ui/traits/map-types.stderr
new file mode 100644 (file)
index 0000000..71006e1
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied
+  --> $DIR/map-types.rs:17:41
+   |
+LL |     let y: Box<dyn Map<usize, isize>> = Box::new(x);
+   |                                         ^^^^^^^^^^^ the trait `Map<usize, isize>` is not implemented for `Box<dyn Map<isize, isize>>`
+   |
+   = note: required for the cast to the object type `dyn Map<usize, isize>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
index 1ab130e0ab1432aa53682b2e763be3b760f090ce..c5d4ccc2fcd91105db992968856a6f4fbf3b3f47 100644 (file)
@@ -7,11 +7,11 @@ LL |     Outer(TestType);
    |     required by a bound introduced by this call
    |
    = help: the trait `Send` is not implemented for `dummy::TestType`
-note: required by `Outer`
-  --> $DIR/negated-auto-traits-error.rs:10:1
+note: required by a bound in `Outer`
+  --> $DIR/negated-auto-traits-error.rs:10:17
    |
 LL | struct Outer<T: Send>(T);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                 ^^^^ required by this bound in `Outer`
 
 error[E0277]: `dummy::TestType` cannot be sent between threads safely
   --> $DIR/negated-auto-traits-error.rs:23:5
diff --git a/src/test/ui/traits/no_send-struct.rs b/src/test/ui/traits/no_send-struct.rs
new file mode 100644 (file)
index 0000000..75a363f
--- /dev/null
@@ -0,0 +1,17 @@
+#![feature(negative_impls)]
+
+use std::marker::Send;
+
+struct Foo {
+    a: isize,
+}
+
+impl !Send for Foo {}
+
+fn bar<T: Send>(_: T) {}
+
+fn main() {
+    let x = Foo { a: 5 };
+    bar(x);
+    //~^ ERROR `Foo` cannot be sent between threads safely
+}
diff --git a/src/test/ui/traits/no_send-struct.stderr b/src/test/ui/traits/no_send-struct.stderr
new file mode 100644 (file)
index 0000000..ee7bdf2
--- /dev/null
@@ -0,0 +1,18 @@
+error[E0277]: `Foo` cannot be sent between threads safely
+  --> $DIR/no_send-struct.rs:15:9
+   |
+LL |     bar(x);
+   |     --- ^ `Foo` cannot be sent between threads safely
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `Send` is not implemented for `Foo`
+note: required by a bound in `bar`
+  --> $DIR/no_send-struct.rs:11:11
+   |
+LL | fn bar<T: Send>(_: T) {}
+   |           ^^^^ required by this bound in `bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
index e7d1ee616b34f731f4dfe5bd7e6c54d6d85ffba2..3d5bf3448bd5d64539c0bfc3067af8e0ef9ee097 100644 (file)
@@ -8,11 +8,6 @@ LL |     <() as MyTrait>::foo(&());
    |
    = help: the following implementations were found:
              <() as MyTrait>
-note: required by `MyTrait::foo`
-  --> $DIR/no-use.rs:5:17
-   |
-LL | trait MyTrait { fn foo(&self); }
-   |                 ^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index c8c804a9013bfd80f3f4008156e4af9b95252c2b..1a0bcf00a673a6ba1858e2e86b45978ca288922c 100644 (file)
@@ -5,11 +5,6 @@ LL |     let _f: base::Foo = base::HasNew::new();
    |                         ^^^^^^^^^^^^^^^^^ cannot infer type
    |
    = note: cannot satisfy `_: HasNew<Foo>`
-note: required by `HasNew::new`
-  --> $DIR/static-method-generic-inference.rs:8:9
-   |
-LL |         fn new() -> T;
-   |         ^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
index d955cb06a1d50e9dd8a0f88c2a8bd8405a1258db..e2cdd368888a8d6496568e883110a4e3b0f8f4be 100644 (file)
@@ -49,11 +49,6 @@ error[E0277]: the trait bound `u64: From<T>` is not satisfied
 LL |     <u64 as From<T>>::from;
    |     ^^^^^^^^^^^^^^^^^^^^^^ the trait `From<T>` is not implemented for `u64`
    |
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
    |
 LL | fn check<T: Iterator, U: ?Sized>() where u64: From<T> {
@@ -65,11 +60,6 @@ error[E0277]: the trait bound `u64: From<<T as Iterator>::Item>` is not satisfie
 LL |     <u64 as From<<T as Iterator>::Item>>::from;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<<T as Iterator>::Item>` is not implemented for `u64`
    |
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
    |
 LL | fn check<T: Iterator, U: ?Sized>() where u64: From<<T as Iterator>::Item> {
@@ -80,12 +70,6 @@ error[E0277]: the trait bound `Misc<_>: From<T>` is not satisfied
    |
 LL |     <Misc<_> as From<T>>::from;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<T>` is not implemented for `Misc<_>`
-   |
-note: required by `from`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   |
-LL |     fn from(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the size for values of type `[T]` cannot be known at compilation time
   --> $DIR/suggest-where-clause.rs:28:20
index c5fff622b6b232941913ef93fe33ee2fa67a3fd1..2b3e3de9b1ab4bdb6f9d231ecf2eaef20a89f1b2 100644 (file)
@@ -5,6 +5,12 @@ LL |     b.gimme_an_a(y)
    |       ---------- ^ the trait `TraitA` is not implemented for `{integer}`
    |       |
    |       required by a bound introduced by this call
+   |
+note: required by a bound in `TraitB::gimme_an_a`
+  --> $DIR/vtable-res-trait-param.rs:6:21
+   |
+LL |     fn gimme_an_a<A:TraitA>(&self, a: A) -> isize;
+   |                     ^^^^^^ required by this bound in `TraitB::gimme_an_a`
 
 error: aborting due to previous error
 
index f2b64fac3b75ea885d7c0b994761067304dfb1c4..f71bed84d5627fdd7d9422e1eb16475207e91e1f 100644 (file)
@@ -1,13 +1,13 @@
 error: vtable entries for `<S as D>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as A>::foo_a),
-    Method(<S as B>::foo_b),
-    Method(<S as C>::foo_c),
-    TraitVPtr(<S as C>),
-    Method(<S as D>::foo_d),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as A>::foo_a),
+           Method(<S as B>::foo_b),
+           Method(<S as C>::foo_c),
+           TraitVPtr(<S as C>),
+           Method(<S as D>::foo_d),
+       ]
   --> $DIR/vtable-diamond.rs:21:1
    |
 LL | / trait D: B + C {
@@ -17,12 +17,12 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as C>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as A>::foo_a),
-    Method(<S as C>::foo_c),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as A>::foo_a),
+           Method(<S as C>::foo_c),
+       ]
   --> $DIR/vtable-diamond.rs:15:1
    |
 LL | / trait C: A {
index 742b88ea8a9c9a770abb24cb3d3bbded856d7327..915fd701b03365b8108962905f2cd0fa602fc035 100644 (file)
@@ -1,34 +1,34 @@
 error: vtable entries for `<S as O>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as A>::foo_a),
-    Method(<S as B>::foo_b),
-    TraitVPtr(<S as B>),
-    Method(<S as C>::foo_c),
-    Method(<S as D>::foo_d),
-    TraitVPtr(<S as D>),
-    Method(<S as E>::foo_e),
-    TraitVPtr(<S as E>),
-    Method(<S as F>::foo_f),
-    TraitVPtr(<S as F>),
-    Method(<S as G>::foo_g),
-    Method(<S as H>::foo_h),
-    TraitVPtr(<S as H>),
-    Method(<S as I>::foo_i),
-    TraitVPtr(<S as I>),
-    Method(<S as J>::foo_j),
-    TraitVPtr(<S as J>),
-    Method(<S as K>::foo_k),
-    TraitVPtr(<S as K>),
-    Method(<S as L>::foo_l),
-    TraitVPtr(<S as L>),
-    Method(<S as M>::foo_m),
-    TraitVPtr(<S as M>),
-    Method(<S as N>::foo_n),
-    TraitVPtr(<S as N>),
-    Method(<S as O>::foo_o),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as A>::foo_a),
+           Method(<S as B>::foo_b),
+           TraitVPtr(<S as B>),
+           Method(<S as C>::foo_c),
+           Method(<S as D>::foo_d),
+           TraitVPtr(<S as D>),
+           Method(<S as E>::foo_e),
+           TraitVPtr(<S as E>),
+           Method(<S as F>::foo_f),
+           TraitVPtr(<S as F>),
+           Method(<S as G>::foo_g),
+           Method(<S as H>::foo_h),
+           TraitVPtr(<S as H>),
+           Method(<S as I>::foo_i),
+           TraitVPtr(<S as I>),
+           Method(<S as J>::foo_j),
+           TraitVPtr(<S as J>),
+           Method(<S as K>::foo_k),
+           TraitVPtr(<S as K>),
+           Method(<S as L>::foo_l),
+           TraitVPtr(<S as L>),
+           Method(<S as M>::foo_m),
+           TraitVPtr(<S as M>),
+           Method(<S as N>::foo_n),
+           TraitVPtr(<S as N>),
+           Method(<S as O>::foo_o),
+       ]
   --> $DIR/vtable-multi-level.rs:95:1
    |
 LL | / trait O: G + N {
@@ -38,11 +38,11 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as B>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as B>::foo_b),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as B>::foo_b),
+       ]
   --> $DIR/vtable-multi-level.rs:19:1
    |
 LL | / trait B {
@@ -52,11 +52,11 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as D>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as D>::foo_d),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as D>::foo_d),
+       ]
   --> $DIR/vtable-multi-level.rs:30:1
    |
 LL | / trait D {
@@ -66,11 +66,11 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as E>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as E>::foo_e),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as E>::foo_e),
+       ]
   --> $DIR/vtable-multi-level.rs:36:1
    |
 LL | / trait E {
@@ -80,14 +80,14 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as F>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as D>::foo_d),
-    Method(<S as E>::foo_e),
-    TraitVPtr(<S as E>),
-    Method(<S as F>::foo_f),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as D>::foo_d),
+           Method(<S as E>::foo_e),
+           TraitVPtr(<S as E>),
+           Method(<S as F>::foo_f),
+       ]
   --> $DIR/vtable-multi-level.rs:42:1
    |
 LL | / trait F: D + E {
@@ -97,11 +97,11 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as H>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as H>::foo_h),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as H>::foo_h),
+       ]
   --> $DIR/vtable-multi-level.rs:53:1
    |
 LL | / trait H {
@@ -111,11 +111,11 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as I>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as I>::foo_i),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as I>::foo_i),
+       ]
   --> $DIR/vtable-multi-level.rs:59:1
    |
 LL | / trait I {
@@ -125,14 +125,14 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as J>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as H>::foo_h),
-    Method(<S as I>::foo_i),
-    TraitVPtr(<S as I>),
-    Method(<S as J>::foo_j),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as H>::foo_h),
+           Method(<S as I>::foo_i),
+           TraitVPtr(<S as I>),
+           Method(<S as J>::foo_j),
+       ]
   --> $DIR/vtable-multi-level.rs:65:1
    |
 LL | / trait J: H + I {
@@ -142,11 +142,11 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as K>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as K>::foo_k),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as K>::foo_k),
+       ]
   --> $DIR/vtable-multi-level.rs:71:1
    |
 LL | / trait K {
@@ -156,11 +156,11 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as L>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as L>::foo_l),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as L>::foo_l),
+       ]
   --> $DIR/vtable-multi-level.rs:77:1
    |
 LL | / trait L {
@@ -170,14 +170,14 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as M>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as K>::foo_k),
-    Method(<S as L>::foo_l),
-    TraitVPtr(<S as L>),
-    Method(<S as M>::foo_m),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as K>::foo_k),
+           Method(<S as L>::foo_l),
+           TraitVPtr(<S as L>),
+           Method(<S as M>::foo_m),
+       ]
   --> $DIR/vtable-multi-level.rs:83:1
    |
 LL | / trait M: K + L {
@@ -187,21 +187,21 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as N>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as H>::foo_h),
-    Method(<S as I>::foo_i),
-    TraitVPtr(<S as I>),
-    Method(<S as J>::foo_j),
-    Method(<S as K>::foo_k),
-    TraitVPtr(<S as K>),
-    Method(<S as L>::foo_l),
-    TraitVPtr(<S as L>),
-    Method(<S as M>::foo_m),
-    TraitVPtr(<S as M>),
-    Method(<S as N>::foo_n),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as H>::foo_h),
+           Method(<S as I>::foo_i),
+           TraitVPtr(<S as I>),
+           Method(<S as J>::foo_j),
+           Method(<S as K>::foo_k),
+           TraitVPtr(<S as K>),
+           Method(<S as L>::foo_l),
+           TraitVPtr(<S as L>),
+           Method(<S as M>::foo_m),
+           TraitVPtr(<S as M>),
+           Method(<S as N>::foo_n),
+       ]
   --> $DIR/vtable-multi-level.rs:89:1
    |
 LL | / trait N: J + M {
index f25ac76fbe06931c9466cd7d66a814a3908e326b..f1c8947f9069f76e1b46becaa4fae1b69cb743c9 100644 (file)
@@ -1,12 +1,12 @@
 error: vtable entries for `<S as C>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as A>::foo_a),
-    Method(<S as B>::foo_b),
-    TraitVPtr(<S as B>),
-    Method(<S as C>::foo_c),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as A>::foo_a),
+           Method(<S as B>::foo_b),
+           TraitVPtr(<S as B>),
+           Method(<S as C>::foo_c),
+       ]
   --> $DIR/vtable-multiple.rs:16:1
    |
 LL | / trait C: A + B {
@@ -16,11 +16,11 @@ LL | | }
    | |_^
 
 error: vtable entries for `<S as B>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as B>::foo_b),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as B>::foo_b),
+       ]
   --> $DIR/vtable-multiple.rs:10:1
    |
 LL | / trait B {
index 34fe910525be1c17e7a61038c3900f5062c61aea..bbfbde222f3344fde1ef1a0b67325f9af535e8eb 100644 (file)
@@ -1,12 +1,12 @@
 error: vtable entries for `<std::vec::IntoIter<u8> as A>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<std::vec::IntoIter<u8> as Iterator>::next),
-    Method(<std::vec::IntoIter<u8> as Iterator>::size_hint),
-    Method(<std::vec::IntoIter<u8> as Iterator>::advance_by),
-    Method(<std::vec::IntoIter<u8> as Iterator>::nth),
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<std::vec::IntoIter<u8> as Iterator>::next),
+           Method(<std::vec::IntoIter<u8> as Iterator>::size_hint),
+           Method(<std::vec::IntoIter<u8> as Iterator>::advance_by),
+           Method(<std::vec::IntoIter<u8> as Iterator>::nth),
+       ]
   --> $DIR/vtable-non-object-safe.rs:8:1
    |
 LL | trait A: Iterator {}
index e3b75e7cf33f307dc3bc766f364dfa3f10a5c8df..c8cf58399723cea1c3bee793631e1e7800a032fa 100644 (file)
@@ -1,12 +1,12 @@
 error: vtable entries for `<S as B>`: [
-    MetadataDropInPlace,
-    MetadataSize,
-    MetadataAlign,
-    Method(<S as A>::foo_a1),
-    Vacant,
-    Method(<S as B>::foo_b1),
-    Vacant,
-]
+           MetadataDropInPlace,
+           MetadataSize,
+           MetadataAlign,
+           Method(<S as A>::foo_a1),
+           Vacant,
+           Method(<S as B>::foo_b1),
+           Vacant,
+       ]
   --> $DIR/vtable-vacant.rs:15:1
    |
 LL | / trait B: A {
index d9e0d21541edefaa2ac7cd83cdde96bf95bfe68f..02c5d5d2484039a1f47b43042714d07ee0ed755f 100644 (file)
@@ -27,12 +27,6 @@ LL |     Foo::test(&4i32);
    |     --------- ^^^^^ the trait `Foo` is not implemented for `i32`
    |     |
    |     required by a bound introduced by this call
-   |
-note: required by `Foo::test`
-  --> $DIR/trivial-bounds-leak.rs:5:5
-   |
-LL |     fn test(&self);
-   |     ^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `i32: Foo` is not satisfied
   --> $DIR/trivial-bounds-leak.rs:26:22
index fce8dbab4856ca7daf4e4de7278e22f62cb8b29c..cf3a07808de684bbcffa5e99e51e34e734f773ba 100644 (file)
@@ -8,11 +8,6 @@ LL |         Err("")?;
    = help: the following implementations were found:
              <TryFromSliceError as From<Infallible>>
    = note: required because of the requirements on the impl of `FromResidual<Result<Infallible, &str>>` for `Result<u32, TryFromSliceError>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str`
   --> $DIR/try-block-bad-type.rs:12:9
@@ -33,11 +28,6 @@ LL |     let res: () = try { };
    |                         ^ could not wrap the final value of the block as `()` doesn't implement `Try`
    |
    = help: the trait `Try` is not implemented for `()`
-note: required by `from_output`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_output(output: Self::Output) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: a `try` block must return `Result` or `Option` (or another type that implements `Try`)
   --> $DIR/try-block-bad-type.rs:20:26
@@ -46,11 +36,6 @@ LL |     let res: i32 = try { 5 };
    |                          ^ could not wrap the final value of the block as `i32` doesn't implement `Try`
    |
    = help: the trait `Try` is not implemented for `i32`
-note: required by `from_output`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_output(output: Self::Output) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 5 previous errors
 
index 4270df5b4063cc05439155017a371c7974f9e532..62cc26dd4010d4398dc2c674ea059f211eb31649 100644 (file)
@@ -5,11 +5,6 @@ LL |     while try { false } {}
    |                 ^^^^^ could not wrap the final value of the block as `bool` doesn't implement `Try`
    |
    = help: the trait `Try` is not implemented for `bool`
-note: required by `from_output`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_output(output: Self::Output) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/try-block/try-is-identifier-edition2015.rs b/src/test/ui/try-block/try-is-identifier-edition2015.rs
new file mode 100644 (file)
index 0000000..90f56d5
--- /dev/null
@@ -0,0 +1,11 @@
+// run-pass
+
+#![allow(non_camel_case_types)]
+// compile-flags: --edition 2015
+
+fn main() {
+    let try = 2;
+    struct try { try: u32 }
+    let try: try = try { try };
+    assert_eq!(try.try, 2);
+}
diff --git a/src/test/ui/try-is-identifier-edition2015.rs b/src/test/ui/try-is-identifier-edition2015.rs
deleted file mode 100644 (file)
index 90f56d5..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-pass
-
-#![allow(non_camel_case_types)]
-// compile-flags: --edition 2015
-
-fn main() {
-    let try = 2;
-    struct try { try: u32 }
-    let try: try = try { try };
-    assert_eq!(try.try, 2);
-}
index 5cecf9128bb2ca4118878aa27914d6116f7b8fc0..80c5e6f529cd671d459eac7bd7c4c027a42600cf 100644 (file)
@@ -11,11 +11,6 @@ LL |     Ok(Err(123_i32)?)
              <u8 as From<NonZeroU8>>
              <u8 as From<bool>>
    = note: required because of the requirements on the impl of `FromResidual<Result<Infallible, i32>>` for `Result<u64, u8>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result`
   --> $DIR/bad-interconversion.rs:11:12
@@ -29,11 +24,6 @@ LL | | }
    | |_- this function returns a `Result`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `Result<u64, String>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used on `Result`s in a function that returns `Result`
   --> $DIR/bad-interconversion.rs:17:31
@@ -46,11 +36,6 @@ LL | | }
    | |_- this function returns a `Result`
    |
    = help: the trait `FromResidual<ControlFlow<{integer}, Infallible>>` is not implemented for `Result<u64, String>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option`
   --> $DIR/bad-interconversion.rs:22:22
@@ -63,11 +48,6 @@ LL | | }
    | |_- this function returns an `Option`
    |
    = help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `Option<u16>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used on `Option`s in a function that returns `Option`
   --> $DIR/bad-interconversion.rs:27:33
@@ -80,11 +60,6 @@ LL | | }
    | |_- this function returns an `Option`
    |
    = help: the trait `FromResidual<ControlFlow<{integer}, Infallible>>` is not implemented for `Option<u64>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
   --> $DIR/bad-interconversion.rs:32:39
@@ -97,11 +72,6 @@ LL | | }
    | |_- this function returns a `ControlFlow`
    |
    = help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `ControlFlow<String>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
   --> $DIR/bad-interconversion.rs:37:12
@@ -115,11 +85,6 @@ LL | | }
    | |_- this function returns a `ControlFlow`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `ControlFlow<u64>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator in a function that returns `ControlFlow<B, _>` can only be used on other `ControlFlow<B, _>`s (with the same Break type)
   --> $DIR/bad-interconversion.rs:43:29
@@ -134,11 +99,6 @@ LL | | }
    |
    = help: the trait `FromResidual<ControlFlow<u8, Infallible>>` is not implemented for `ControlFlow<i64>`
    = note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 8 previous errors
 
index f89813e729fad60c22e2f8da16b3aec924137136..aadfbf61f28f8d600952eb5c7e4c45e57a5f0e31 100644 (file)
@@ -10,11 +10,6 @@ LL | | }
    | |_- this function returns a `Result`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `Result<(), ()>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option`
   --> $DIR/option-to-result.rs:11:6
@@ -28,11 +23,6 @@ LL | | }
    | |_- this function returns an `Option`
    |
    = help: the trait `FromResidual<Result<Infallible, i32>>` is not implemented for `Option<i32>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index bb65aae561f97949a5277c0435073d3e340ce7fc..a6badd1903885cfaf9fb503a22de18eb415c9095 100644 (file)
@@ -10,11 +10,6 @@ LL | | }
    | |_- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in a closure that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/try-on-option-diagnostics.rs:14:10
@@ -29,11 +24,6 @@ LL | |     };
    | |_____- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `{integer}`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/try-on-option-diagnostics.rs:26:14
@@ -46,11 +36,6 @@ LL | |         }
    | |_________- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `()`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in a trait method that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/try-on-option-diagnostics.rs:39:14
@@ -63,11 +48,6 @@ LL | |         }
    | |_________- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `()`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 4 previous errors
 
index b522dd5709b2946601927dc00480e362887fd5c2..27e33bc022efb1fddf8f2218b69e7f866415227a 100644 (file)
@@ -10,11 +10,6 @@ LL | | }
    | |_- this function returns a `Result`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `Result<u32, ()>`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/try-on-option.rs:13:6
@@ -28,11 +23,6 @@ LL | | }
    | |_- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `u32`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
index d669124e9f112a11058fc8078242134e3b6cb728..ad55f40b5b6382703bffae17bf321c29d55439c7 100644 (file)
@@ -12,11 +12,6 @@ LL | | }
    | |_- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be applied to values that implement `Try`
   --> $DIR/try-operator-on-main.rs:10:5
@@ -25,11 +20,6 @@ LL |     ()?;
    |     ^^^ the `?` operator cannot be applied to type `()`
    |
    = help: the trait `Try` is not implemented for `()`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
   --> $DIR/try-operator-on-main.rs:10:7
@@ -47,11 +37,6 @@ LL | | }
    | |_- this function should return `Result` or `Option` to accept `?`
    |
    = help: the trait `FromResidual<_>` is not implemented for `()`
-note: required by `from_residual`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn from_residual(residual: R) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `(): Try` is not satisfied
   --> $DIR/try-operator-on-main.rs:14:25
@@ -72,11 +57,6 @@ LL |     ()?;
    |     ^^^ the `?` operator cannot be applied to type `()`
    |
    = help: the trait `Try` is not implemented for `()`
-note: required by `branch`
-  --> $SRC_DIR/core/src/ops/try_trait.rs:LL:COL
-   |
-LL |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/try-wait.rs b/src/test/ui/try-wait.rs
deleted file mode 100644 (file)
index 6921972..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// run-pass
-
-#![allow(stable_features)]
-// ignore-emscripten no processes
-// ignore-sgx no processes
-
-#![feature(process_try_wait)]
-
-use std::env;
-use std::process::Command;
-use std::thread;
-use std::time::Duration;
-
-fn main() {
-    let args = env::args().collect::<Vec<_>>();
-    if args.len() != 1 {
-        match &args[1][..] {
-            "sleep" => thread::sleep(Duration::new(1_000, 0)),
-            _ => {}
-        }
-        return
-    }
-
-    let mut me = Command::new(env::current_exe().unwrap())
-                         .arg("sleep")
-                         .spawn()
-                         .unwrap();
-    let maybe_status = me.try_wait().unwrap();
-    assert!(maybe_status.is_none());
-    let maybe_status = me.try_wait().unwrap();
-    assert!(maybe_status.is_none());
-
-    me.kill().unwrap();
-    me.wait().unwrap();
-
-    let status = me.try_wait().unwrap().unwrap();
-    assert!(!status.success());
-    let status = me.try_wait().unwrap().unwrap();
-    assert!(!status.success());
-
-    let mut me = Command::new(env::current_exe().unwrap())
-                         .arg("return-quickly")
-                         .spawn()
-                         .unwrap();
-    loop {
-        match me.try_wait() {
-            Ok(Some(res)) => {
-                assert!(res.success());
-                break
-            }
-            Ok(None) => {
-                thread::sleep(Duration::from_millis(1));
-            }
-            Err(e) => panic!("error in try_wait: {}", e),
-        }
-    }
-
-    let status = me.try_wait().unwrap().unwrap();
-    assert!(status.success());
-}
diff --git a/src/test/ui/tutorial-suffix-inference-test.rs b/src/test/ui/tutorial-suffix-inference-test.rs
deleted file mode 100644 (file)
index 849adfd..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-fn main() {
-    let x = 3;
-    let y: i32 = 3;
-
-    fn identity_u8(n: u8) -> u8 { n }
-    fn identity_u16(n: u16) -> u16 { n }
-
-    identity_u8(x);  // after this, `x` is assumed to have type `u8`
-    identity_u16(x);
-    //~^ ERROR mismatched types
-    //~| expected `u16`, found `u8`
-    identity_u16(y);
-    //~^ ERROR mismatched types
-    //~| expected `u16`, found `i32`
-
-    let a = 3;
-
-    fn identity_i(n: isize) -> isize { n }
-
-    identity_i(a); // ok
-    identity_u16(a);
-    //~^ ERROR mismatched types
-    //~| expected `u16`, found `isize`
-}
diff --git a/src/test/ui/tutorial-suffix-inference-test.stderr b/src/test/ui/tutorial-suffix-inference-test.stderr
deleted file mode 100644 (file)
index fbfbffb..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/tutorial-suffix-inference-test.rs:9:18
-   |
-LL |     identity_u16(x);
-   |                  ^ expected `u16`, found `u8`
-   |
-help: you can convert a `u8` to a `u16`
-   |
-LL |     identity_u16(x.into());
-   |                   +++++++
-
-error[E0308]: mismatched types
-  --> $DIR/tutorial-suffix-inference-test.rs:12:18
-   |
-LL |     identity_u16(y);
-   |                  ^ expected `u16`, found `i32`
-   |
-help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
-   |
-LL |     identity_u16(y.try_into().unwrap());
-   |                   ++++++++++++++++++++
-
-error[E0308]: mismatched types
-  --> $DIR/tutorial-suffix-inference-test.rs:21:18
-   |
-LL |     identity_u16(a);
-   |                  ^ expected `u16`, found `isize`
-   |
-help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit
-   |
-LL |     identity_u16(a.try_into().unwrap());
-   |                   ++++++++++++++++++++
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
index e918551020c313ea09702b8f6abd877311c9cdb0..0cf020861c749558d86e0512d73762943a949d73 100644 (file)
@@ -29,8 +29,9 @@ LL |     Alias::Unit();
    |
 help: `Alias::Unit` is a unit variant, you need to write it without the parentheses
    |
-LL |     Alias::Unit;
-   |     ~~~~~~~~~~~
+LL -     Alias::Unit();
+LL +     Alias::Unit;
+   | 
 
 error[E0164]: expected tuple struct or tuple variant, found unit variant `Alias::Unit`
   --> $DIR/incorrect-variant-form-through-alias-caught.rs:17:9
diff --git a/src/test/ui/type-ascription.rs b/src/test/ui/type-ascription.rs
deleted file mode 100644 (file)
index 7adb074..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// run-pass
-
-#![allow(dead_code)]
-#![allow(unused_variables)]
-// Type ascription doesn't lead to unsoundness
-
-#![feature(type_ascription)]
-
-use std::mem;
-
-const C1: u8 = 10: u8;
-const C2: [u8; 1: usize] = [1];
-
-struct S {
-    a: u8
-}
-
-fn main() {
-    assert_eq!(C1.into(): i32, 10);
-    assert_eq!(C2[0], 1);
-
-    let s = S { a: 10: u8 };
-    let arr = &[1u8, 2, 3];
-
-    let mut v = arr.iter().cloned().collect(): Vec<_>;
-    v.push(4);
-    assert_eq!(v, [1, 2, 3, 4]);
-
-    let a = 1: u8;
-    let b = a.into(): u16;
-    assert_eq!(v[a.into(): usize], 2);
-    assert_eq!(mem::size_of_val(&a), 1);
-    assert_eq!(mem::size_of_val(&b), 2);
-    assert_eq!(b, 1: u16);
-
-    let mut v = Vec::new();
-    v: Vec<u8> = vec![1, 2, 3]; // Place expression type ascription
-    assert_eq!(v, [1u8, 2, 3]);
-}
diff --git a/src/test/ui/type-infer-generalize-ty-var.rs b/src/test/ui/type-infer-generalize-ty-var.rs
deleted file mode 100644 (file)
index a3d6916..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// run-pass
-
-#![allow(non_upper_case_globals)]
-#![allow(dead_code)]
-#![allow(unused_assignments)]
-#![allow(unused_variables)]
-// Test a scenario where we generate a constraint like `?1 <: &?2`.
-// In such a case, it is important that we instantiate `?1` with `&?3`
-// where `?3 <: ?2`, and not with `&?2`. This is a regression test for
-// #18653. The important thing is that we build.
-
-use std::cell::RefCell;
-
-enum Wrap<A> {
-    WrapSome(A),
-    WrapNone
-}
-
-use Wrap::*;
-
-struct T;
-struct U;
-
-trait Get<T: ?Sized> {
-    fn get(&self) -> &T;
-}
-
-impl Get<dyn MyShow + 'static> for Wrap<T> {
-    fn get(&self) -> &(dyn MyShow + 'static) {
-        static x: usize = 42;
-        &x
-    }
-}
-
-impl Get<usize> for Wrap<U> {
-    fn get(&self) -> &usize {
-        static x: usize = 55;
-        &x
-    }
-}
-
-trait MyShow { fn dummy(&self) { } }
-impl<'a> MyShow for &'a (dyn MyShow + 'a) { }
-impl MyShow for usize { }
-fn constrain<'a>(rc: RefCell<&'a (dyn MyShow + 'a)>) { }
-
-fn main() {
-    let mut collection: Wrap<_> = WrapNone;
-
-    {
-        let __arg0 = Get::get(&collection);
-        let __args_cell = RefCell::new(__arg0);
-        constrain(__args_cell);
-    }
-    collection = WrapSome(T);
-}
diff --git a/src/test/ui/type/type-ascription.rs b/src/test/ui/type/type-ascription.rs
new file mode 100644 (file)
index 0000000..7adb074
--- /dev/null
@@ -0,0 +1,39 @@
+// run-pass
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+// Type ascription doesn't lead to unsoundness
+
+#![feature(type_ascription)]
+
+use std::mem;
+
+const C1: u8 = 10: u8;
+const C2: [u8; 1: usize] = [1];
+
+struct S {
+    a: u8
+}
+
+fn main() {
+    assert_eq!(C1.into(): i32, 10);
+    assert_eq!(C2[0], 1);
+
+    let s = S { a: 10: u8 };
+    let arr = &[1u8, 2, 3];
+
+    let mut v = arr.iter().cloned().collect(): Vec<_>;
+    v.push(4);
+    assert_eq!(v, [1, 2, 3, 4]);
+
+    let a = 1: u8;
+    let b = a.into(): u16;
+    assert_eq!(v[a.into(): usize], 2);
+    assert_eq!(mem::size_of_val(&a), 1);
+    assert_eq!(mem::size_of_val(&b), 2);
+    assert_eq!(b, 1: u16);
+
+    let mut v = Vec::new();
+    v: Vec<u8> = vec![1, 2, 3]; // Place expression type ascription
+    assert_eq!(v, [1u8, 2, 3]);
+}
index f8dbd66c1c7ac178a959f5422f4c6cc755b842bd..2a61547997b63c5c7e5ed67697bb16829874c240 100644 (file)
@@ -29,36 +29,18 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
    |
 LL | struct Bounds<T:Copy=String>(T);
    |                 ^^^^ the trait `Copy` is not implemented for `String`
-   |
-note: required by `Bounds`
-  --> $DIR/type-check-defaults.rs:11:1
-   |
-LL | struct Bounds<T:Copy=String>(T);
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `String: Copy` is not satisfied
   --> $DIR/type-check-defaults.rs:14:42
    |
 LL | struct WhereClause<T=String>(T) where T: Copy;
    |                                          ^^^^ the trait `Copy` is not implemented for `String`
-   |
-note: required by `WhereClause`
-  --> $DIR/type-check-defaults.rs:14:1
-   |
-LL | struct WhereClause<T=String>(T) where T: Copy;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `String: Copy` is not satisfied
   --> $DIR/type-check-defaults.rs:17:20
    |
 LL | trait TraitBound<T:Copy=String> {}
    |                    ^^^^ the trait `Copy` is not implemented for `String`
-   |
-note: required by `TraitBound`
-  --> $DIR/type-check-defaults.rs:17:1
-   |
-LL | trait TraitBound<T:Copy=String> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `T: Copy` is not satisfied
   --> $DIR/type-check-defaults.rs:21:25
@@ -83,11 +65,6 @@ LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
    |                                                                  ^^^^^^^ no implementation for `i32 + u8`
    |
    = help: the trait `Add<u8>` is not implemented for `i32`
-note: required by `ProjectionPred`
-  --> $DIR/type-check-defaults.rs:24:1
-   |
-LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 7 previous errors
 
index 9ca07eaba838ab2b82f156c4ff86ea272636179b..6d1e490bcf3302a91159001ccd84d5251f05b9ee 100644 (file)
@@ -5,11 +5,6 @@ LL |     where &'a T : Foo,
    |                   ^^^ cannot infer type for reference `&'a T`
    |
    = note: cannot satisfy `&'a T: Foo`
-note: required by a bound in `Foo`
-  --> $DIR/issue-40294.rs:1:1
-   |
-LL | trait Foo: Sized {
-   | ^^^^^^^^^^^^^^^^ required by this bound in `Foo`
 
 error: aborting due to previous error
 
index 368adb456d61a9fb5a510d809bb29873eef2d130..53610985f31da73e6da9d56cf90e31bc596c1a95 100644 (file)
@@ -4,11 +4,6 @@ error[E0277]: the trait bound `Self: Tr<U>` is not satisfied
 LL |         Tr::op(u)
    |         ^^^^^^ the trait `Tr<U>` is not implemented for `Self`
    |
-note: required by `Tr::op`
-  --> $DIR/type-params-in-different-spaces-2.rs:5:5
-   |
-LL |     fn op(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^
 help: consider further restricting `Self`
    |
 LL |     fn test<U>(u: U) -> Self where Self: Tr<U> {
@@ -20,11 +15,6 @@ error[E0277]: the trait bound `Self: Tr<U>` is not satisfied
 LL |         Tr::op(u)
    |         ^^^^^^ the trait `Tr<U>` is not implemented for `Self`
    |
-note: required by `Tr::op`
-  --> $DIR/type-params-in-different-spaces-2.rs:5:5
-   |
-LL |     fn op(_: T) -> Self;
-   |     ^^^^^^^^^^^^^^^^^^^^
 help: consider further restricting `Self`
    |
 LL |     fn test<U>(u: U) -> Self where Self: Tr<U> {
index ec05fbe580edec8bf4fca21b30e1b2f4db0cbc26..39bff88e7f81a3624cbbf3ec0aa5bc3bc2e26122 100644 (file)
@@ -2,13 +2,14 @@ error[E0308]: mismatched types
   --> $DIR/issue-46112.rs:9:21
    |
 LL | fn main() { test(Ok(())); }
-   |                     ^^
-   |                     |
-   |                     expected enum `Option`, found `()`
-   |                     help: try using a variant of the expected enum: `Some(())`
+   |                     ^^ expected enum `Option`, found `()`
    |
    = note:   expected enum `Option<()>`
            found unit type `()`
+help: try wrapping the expression in `Some`
+   |
+LL | fn main() { test(Ok(Some(()))); }
+   |                     +++++  +
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/typeck/no-type-for-node-ice.rs b/src/test/ui/typeck/no-type-for-node-ice.rs
new file mode 100644 (file)
index 0000000..d0cfdbf
--- /dev/null
@@ -0,0 +1,5 @@
+// Related issues: #20401, #20506, #20614, #20752, #20829, #20846, #20885, #20886
+
+fn main() {
+    "".homura[""]; //~ no field `homura` on type `&'static str`
+}
diff --git a/src/test/ui/typeck/no-type-for-node-ice.stderr b/src/test/ui/typeck/no-type-for-node-ice.stderr
new file mode 100644 (file)
index 0000000..b50241f
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0609]: no field `homura` on type `&'static str`
+  --> $DIR/no-type-for-node-ice.rs:4:8
+   |
+LL |     "".homura[""];
+   |        ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/ui/typeck/project-cache-issue-37154.rs b/src/test/ui/typeck/project-cache-issue-37154.rs
new file mode 100644 (file)
index 0000000..b10239c
--- /dev/null
@@ -0,0 +1,21 @@
+// run-pass
+
+#![allow(dead_code)]
+// Regression test for #37154: the problem here was that the cache
+// results in a false error because it was caching placeholder results
+// even after those placeholder regions had been popped.
+
+trait Foo {
+    fn method(&self) {}
+}
+
+struct Wrapper<T>(T);
+
+impl<T> Foo for Wrapper<T> where for<'a> &'a T: IntoIterator<Item=&'a ()> {}
+
+fn f(x: Wrapper<Vec<()>>) {
+    x.method(); // This works.
+    x.method(); // error: no method named `method`
+}
+
+fn main() { }
diff --git a/src/test/ui/typeck/ufcs-type-params.rs b/src/test/ui/typeck/ufcs-type-params.rs
new file mode 100644 (file)
index 0000000..eee2b55
--- /dev/null
@@ -0,0 +1,15 @@
+// run-pass
+// pretty-expanded FIXME #23616
+
+trait Foo<T> {
+    fn get(&self) -> T;
+}
+
+impl Foo<i32> for i32 {
+    fn get(&self) -> i32 { *self }
+}
+
+fn main() {
+    let x: i32 = 1;
+    Foo::<i32>::get(&x);
+}
diff --git a/src/test/ui/typeck/unify-return-ty.rs b/src/test/ui/typeck/unify-return-ty.rs
new file mode 100644 (file)
index 0000000..da1d82e
--- /dev/null
@@ -0,0 +1,16 @@
+// run-pass
+// Tests that the tail expr in null() has its type
+// unified with the type *T, and so the type variable
+// in that type gets resolved.
+
+// pretty-expanded FIXME #23616
+
+use std::mem;
+
+fn null<T>() -> *const T {
+    unsafe {
+        mem::transmute(0_usize)
+    }
+}
+
+pub fn main() { null::<isize>(); }
diff --git a/src/test/ui/ufcs-type-params.rs b/src/test/ui/ufcs-type-params.rs
deleted file mode 100644 (file)
index eee2b55..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-
-trait Foo<T> {
-    fn get(&self) -> T;
-}
-
-impl Foo<i32> for i32 {
-    fn get(&self) -> i32 { *self }
-}
-
-fn main() {
-    let x: i32 = 1;
-    Foo::<i32>::get(&x);
-}
index 23b9157375657fba56ba004e252df3b55d53c377..d0bc432a1cd18e8788841732319afda3be4f245c 100644 (file)
@@ -5,11 +5,6 @@ LL |     <i32 as Add<u32>>::add(1, 2);
    |     ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32`
    |
    = help: the trait `Add<u32>` is not implemented for `i32`
-note: required by `add`
-  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
-   |
-LL |     fn add(self, rhs: Rhs) -> Self::Output;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
   --> $DIR/ufcs-qpath-self-mismatch.rs:6:28
index be6ed8d56232e6b454300e0f38d73698926b3d6e..03932d5ed03479a5c3a85d1fb7fa2212a702f348 100644 (file)
@@ -6,11 +6,6 @@ LL |     <[(); 0] as Foo>::foo()
    |
    = help: the following implementations were found:
              <[(); 1] as Foo>
-note: required by `Foo::foo`
-  --> $DIR/unevaluated_fixed_size_array_len.rs:4:5
-   |
-LL |     fn foo();
-   |     ^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unify-return-ty.rs b/src/test/ui/unify-return-ty.rs
deleted file mode 100644 (file)
index da1d82e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// run-pass
-// Tests that the tail expr in null() has its type
-// unified with the type *T, and so the type variable
-// in that type gets resolved.
-
-// pretty-expanded FIXME #23616
-
-use std::mem;
-
-fn null<T>() -> *const T {
-    unsafe {
-        mem::transmute(0_usize)
-    }
-}
-
-pub fn main() { null::<isize>(); }
index cd8577818647a9036b849eba4a88d3503b7824e3..a4f0c400d7310979668bc3f433d6599dc1ad8363 100644 (file)
@@ -4,11 +4,11 @@ error[E0277]: the trait bound `Rc<u32>: Copy` is not satisfied
 LL |     let u = U { a: Rc::new(0u32) };
    |             ^ the trait `Copy` is not implemented for `Rc<u32>`
    |
-note: required by `U`
-  --> $DIR/union-generic.rs:6:1
+note: required by a bound in `U`
+  --> $DIR/union-generic.rs:6:12
    |
 LL | union U<T: Copy> {
-   | ^^^^^^^^^^^^^^^^
+   |            ^^^^ required by this bound in `U`
 
 error[E0277]: the trait bound `Rc<u32>: Copy` is not satisfied
   --> $DIR/union-generic.rs:13:13
@@ -16,11 +16,11 @@ error[E0277]: the trait bound `Rc<u32>: Copy` is not satisfied
 LL |     let u = U::<Rc<u32>> { a: Default::default() };
    |             ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc<u32>`
    |
-note: required by `U`
-  --> $DIR/union-generic.rs:6:1
+note: required by a bound in `U`
+  --> $DIR/union-generic.rs:6:12
    |
 LL | union U<T: Copy> {
-   | ^^^^^^^^^^^^^^^^
+   |            ^^^^ required by this bound in `U`
 
 error: aborting due to 2 previous errors
 
index cd8577818647a9036b849eba4a88d3503b7824e3..a4f0c400d7310979668bc3f433d6599dc1ad8363 100644 (file)
@@ -4,11 +4,11 @@ error[E0277]: the trait bound `Rc<u32>: Copy` is not satisfied
 LL |     let u = U { a: Rc::new(0u32) };
    |             ^ the trait `Copy` is not implemented for `Rc<u32>`
    |
-note: required by `U`
-  --> $DIR/union-generic.rs:6:1
+note: required by a bound in `U`
+  --> $DIR/union-generic.rs:6:12
    |
 LL | union U<T: Copy> {
-   | ^^^^^^^^^^^^^^^^
+   |            ^^^^ required by this bound in `U`
 
 error[E0277]: the trait bound `Rc<u32>: Copy` is not satisfied
   --> $DIR/union-generic.rs:13:13
@@ -16,11 +16,11 @@ error[E0277]: the trait bound `Rc<u32>: Copy` is not satisfied
 LL |     let u = U::<Rc<u32>> { a: Default::default() };
    |             ^^^^^^^^^^^^ the trait `Copy` is not implemented for `Rc<u32>`
    |
-note: required by `U`
-  --> $DIR/union-generic.rs:6:1
+note: required by a bound in `U`
+  --> $DIR/union-generic.rs:6:12
    |
 LL | union U<T: Copy> {
-   | ^^^^^^^^^^^^^^^^
+   |            ^^^^ required by this bound in `U`
 
 error: aborting due to 2 previous errors
 
index be2df8c85e1afba96520b64d76497120fd4d0b83..d7b95f55769fdc600f7b37ff9ec22b43e9844215 100644 (file)
@@ -3,6 +3,15 @@ error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied
    |
 LL |     let x = x.cast::<[i32]>();
    |               ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo`
+   |
+note: required by a bound in `Cast::cast`
+  --> $DIR/issue-71659.rs:19:15
+   |
+LL |     fn cast<T: ?Sized>(&self) -> &T
+   |        ---- required by a bound in this
+LL |     where
+LL |         Self: CastTo<T>,
+   |               ^^^^^^^^^ required by this bound in `Cast::cast`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unsized/maybe-bounds-where.rs b/src/test/ui/unsized/maybe-bounds-where.rs
new file mode 100644 (file)
index 0000000..d7af0c4
--- /dev/null
@@ -0,0 +1,28 @@
+struct S1<T>(T) where (T): ?Sized;
+//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
+
+struct S2<T>(T) where u8: ?Sized;
+//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
+
+struct S3<T>(T) where &'static T: ?Sized;
+//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
+
+trait Trait<'a> {}
+
+struct S4<T>(T) where for<'a> T: ?Trait<'a>;
+//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
+//~| WARN default bound relaxed for a type parameter
+
+struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
+//~^ ERROR type parameter has more than one relaxed default bound
+//~| WARN default bound relaxed for a type parameter
+
+impl<T> S1<T> {
+    fn f() where T: ?Sized {}
+    //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
+}
+
+fn main() {
+    let u = vec![1, 2, 3];
+    let _s: S5<[u8]> = S5(&u[..]); // OK
+}
diff --git a/src/test/ui/unsized/maybe-bounds-where.stderr b/src/test/ui/unsized/maybe-bounds-where.stderr
new file mode 100644 (file)
index 0000000..39bc1b8
--- /dev/null
@@ -0,0 +1,51 @@
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+  --> $DIR/maybe-bounds-where.rs:1:28
+   |
+LL | struct S1<T>(T) where (T): ?Sized;
+   |                            ^^^^^^
+
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+  --> $DIR/maybe-bounds-where.rs:4:27
+   |
+LL | struct S2<T>(T) where u8: ?Sized;
+   |                           ^^^^^^
+
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+  --> $DIR/maybe-bounds-where.rs:7:35
+   |
+LL | struct S3<T>(T) where &'static T: ?Sized;
+   |                                   ^^^^^^
+
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+  --> $DIR/maybe-bounds-where.rs:12:34
+   |
+LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
+   |                                  ^^^^^^^^^^
+
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+  --> $DIR/maybe-bounds-where.rs:21:21
+   |
+LL |     fn f() where T: ?Sized {}
+   |                     ^^^^^^
+
+warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
+  --> $DIR/maybe-bounds-where.rs:12:11
+   |
+LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
+   |           ^
+
+error[E0203]: type parameter has more than one relaxed default bound, only one is supported
+  --> $DIR/maybe-bounds-where.rs:16:11
+   |
+LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
+   |           ^
+
+warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
+  --> $DIR/maybe-bounds-where.rs:16:11
+   |
+LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
+   |           ^
+
+error: aborting due to 6 previous errors; 2 warnings emitted
+
+For more information about this error, try `rustc --explain E0203`.
diff --git a/src/test/ui/volatile-fat-ptr.rs b/src/test/ui/volatile-fat-ptr.rs
deleted file mode 100644 (file)
index f73e7e1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// run-pass
-
-#![allow(stable_features)]
-#![feature(volatile)]
-use std::ptr::{read_volatile, write_volatile};
-
-fn main() {
-    let mut x: &'static str = "test";
-    unsafe {
-        let a = read_volatile(&x);
-        assert_eq!(a, "test");
-        write_volatile(&mut x, "foo");
-        assert_eq!(x, "foo");
-    }
-}
diff --git a/src/test/ui/wasm-import-module.rs b/src/test/ui/wasm-import-module.rs
deleted file mode 100644 (file)
index 4152a10..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form
-extern "C" {}
-
-#[link(name = "...", wasm_import_module(x))] //~ ERROR: must be of the form
-extern "C" {}
-
-#[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form
-extern "C" {}
-
-fn main() {}
diff --git a/src/test/ui/wasm-import-module.stderr b/src/test/ui/wasm-import-module.stderr
deleted file mode 100644 (file)
index 47d6cb6..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-error: must be of the form `#[link(wasm_import_module = "...")]`
-  --> $DIR/wasm-import-module.rs:1:22
-   |
-LL | #[link(name = "...", wasm_import_module)]
-   |                      ^^^^^^^^^^^^^^^^^^
-
-error: must be of the form `#[link(wasm_import_module = "...")]`
-  --> $DIR/wasm-import-module.rs:4:22
-   |
-LL | #[link(name = "...", wasm_import_module(x))]
-   |                      ^^^^^^^^^^^^^^^^^^^^^
-
-error: must be of the form `#[link(wasm_import_module = "...")]`
-  --> $DIR/wasm-import-module.rs:7:22
-   |
-LL | #[link(name = "...", wasm_import_module())]
-   |                      ^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/ui/wasm/wasm-import-module.rs b/src/test/ui/wasm/wasm-import-module.rs
new file mode 100644 (file)
index 0000000..4152a10
--- /dev/null
@@ -0,0 +1,10 @@
+#[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form
+extern "C" {}
+
+#[link(name = "...", wasm_import_module(x))] //~ ERROR: must be of the form
+extern "C" {}
+
+#[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form
+extern "C" {}
+
+fn main() {}
diff --git a/src/test/ui/wasm/wasm-import-module.stderr b/src/test/ui/wasm/wasm-import-module.stderr
new file mode 100644 (file)
index 0000000..47d6cb6
--- /dev/null
@@ -0,0 +1,20 @@
+error: must be of the form `#[link(wasm_import_module = "...")]`
+  --> $DIR/wasm-import-module.rs:1:22
+   |
+LL | #[link(name = "...", wasm_import_module)]
+   |                      ^^^^^^^^^^^^^^^^^^
+
+error: must be of the form `#[link(wasm_import_module = "...")]`
+  --> $DIR/wasm-import-module.rs:4:22
+   |
+LL | #[link(name = "...", wasm_import_module(x))]
+   |                      ^^^^^^^^^^^^^^^^^^^^^
+
+error: must be of the form `#[link(wasm_import_module = "...")]`
+  --> $DIR/wasm-import-module.rs:7:22
+   |
+LL | #[link(name = "...", wasm_import_module())]
+   |                      ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/wf-bound-region-in-object-type.rs b/src/test/ui/wf-bound-region-in-object-type.rs
deleted file mode 100644 (file)
index 7c4dd3e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-
-#![allow(dead_code)]
-#![allow(unused_variables)]
-// Test that the `wf` checker properly handles bound regions in object
-// types. Compiling this code used to trigger an ICE.
-
-// pretty-expanded FIXME #23616
-
-pub struct Context<'tcx> {
-    vec: &'tcx Vec<isize>
-}
-
-pub type Cmd<'a> = &'a isize;
-
-pub type DecodeInlinedItem<'a> =
-    Box<dyn for<'tcx> FnMut(Cmd, &Context<'tcx>) -> Result<&'tcx isize, ()> + 'a>;
-
-fn foo(d: DecodeInlinedItem) {
-}
-
-fn main() { }
index 66bfdbc596266eabb303c8793032af80aaed4ae5..b03023b5fd14f707d69bdeb7c927305ae6a36cac 100644 (file)
@@ -3,12 +3,6 @@ error[E0277]: the trait bound `(): Foo` is not satisfied
    |
 LL |     pub fn lint_me() -> <() as Foo>::Assoc;
    |                         ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()`
-   |
-note: required by a bound in `Foo`
-  --> $DIR/wf-foreign-fn-decl-ret.rs:6:1
-   |
-LL | pub trait Foo {
-   | ^^^^^^^^^^^^^ required by this bound in `Foo`
 
 error[E0277]: the trait bound `u32: Unsatisfied` is not satisfied
   --> $DIR/wf-foreign-fn-decl-ret.rs:14:32
index cb381d2d9fe71040356e5ae391fb639dd4c794b7..f431deee73f9adc9cd05a56161788d931e6d32ca 100644 (file)
@@ -3,6 +3,12 @@ error[E0277]: the trait bound `X: Foo<X>` is not satisfied
    |
 LL |     1.method::<X>();
    |       ^^^^^^ the trait `Foo<X>` is not implemented for `X`
+   |
+note: required by a bound in `Bar::method`
+  --> $DIR/where-clause-method-substituion.rs:6:34
+   |
+LL |     fn method<B>(&self) where A: Foo<B>;
+   |                                  ^^^^^^ required by this bound in `Bar::method`
 
 error: aborting due to previous error
 
index 3223dca3cddbfdb86e2c255e98c2068fd1fe8477..3a4cbb62d5597a5e0f90d283fab6dbc738ea7dfc 100644 (file)
@@ -5,6 +5,12 @@ LL |     x.equals(&x);
    |       ------ ^^ the trait `Eq` is not implemented for `Bar`
    |       |
    |       required by a bound introduced by this call
+   |
+note: required by a bound in `Foo::<T>::equals`
+  --> $DIR/where-clauses-method-unsatisfied.rs:11:52
+   |
+LL |     fn equals(&self, u: &Foo<T>) -> bool where T : Eq {
+   |                                                    ^^ required by this bound in `Foo::<T>::equals`
 
 error: aborting due to previous error
 
index ad50d0d266213e0cc4f6e526a39d96faae9a3842..e1fb17631eb1b3665cdbe45b1c186111577ef512 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ad50d0d266213e0cc4f6e526a39d96faae9a3842
+Subproject commit e1fb17631eb1b3665cdbe45b1c186111577ef512
index 98e60f7ed85cf16c939e8917a97f66976515ab0b..6f213d7a699030e9852bae7f6ca30c70df28eda2 100644 (file)
@@ -1,6 +1,4 @@
-use super::{
-    get_span_of_entire_for_loop, make_iterator_snippet, IncrementVisitor, InitializeVisitor, EXPLICIT_COUNTER_LOOP,
-};
+use super::{make_iterator_snippet, IncrementVisitor, InitializeVisitor, EXPLICIT_COUNTER_LOOP};
 use clippy_utils::diagnostics::span_lint_and_sugg;
 use clippy_utils::source::snippet_with_applicability;
 use clippy_utils::{get_enclosing_block, is_integer_const};
@@ -37,12 +35,10 @@ pub(super) fn check<'tcx>(
                 then {
                     let mut applicability = Applicability::MachineApplicable;
 
-                    let for_span = get_span_of_entire_for_loop(expr);
-
                     span_lint_and_sugg(
                         cx,
                         EXPLICIT_COUNTER_LOOP,
-                        for_span.with_hi(arg.span.hi()),
+                        expr.span.with_hi(arg.span.hi()),
                         &format!("the variable `{}` is used as a loop counter", name),
                         "consider using",
                         format!(
index 72027a163af821f3b46111992a2d70cf083e1562..2362b4b20670f842b2cacebc17bdcfc02729a0a8 100644 (file)
@@ -1,4 +1,4 @@
-use super::{get_span_of_entire_for_loop, IncrementVisitor, InitializeVisitor, MANUAL_MEMCPY};
+use super::{IncrementVisitor, InitializeVisitor, MANUAL_MEMCPY};
 use clippy_utils::diagnostics::span_lint_and_sugg;
 use clippy_utils::source::snippet;
 use clippy_utils::sugg::Sugg;
@@ -86,7 +86,7 @@ pub(super) fn check<'tcx>(
                 span_lint_and_sugg(
                     cx,
                     MANUAL_MEMCPY,
-                    get_span_of_entire_for_loop(expr),
+                    expr.span,
                     "it looks like you're manually copying between slices",
                     "try replacing the loop by",
                     big_sugg,
index 5df1b79640164302d2a8532175486208942569e4..fd4881b29474f95b36a7df6c8eb30171010ae362 100644 (file)
@@ -23,7 +23,7 @@
 use rustc_lint::{LateContext, LateLintPass};
 use rustc_session::{declare_lint_pass, declare_tool_lint};
 use rustc_span::source_map::Span;
-use utils::{get_span_of_entire_for_loop, make_iterator_snippet, IncrementVisitor, InitializeVisitor};
+use utils::{make_iterator_snippet, IncrementVisitor, InitializeVisitor};
 
 declare_clippy_lint! {
     /// ### What it does
 impl<'tcx> LateLintPass<'tcx> for Loops {
     #[allow(clippy::too_many_lines)]
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
-        if let Some(higher::ForLoop { pat, arg, body, span }) = higher::ForLoop::hir(expr) {
+        let for_loop = higher::ForLoop::hir(expr);
+        if let Some(higher::ForLoop {
+            pat,
+            arg,
+            body,
+            loop_id,
+            span,
+        }) = for_loop
+        {
             // we don't want to check expanded macros
             // this check is not at the top of the function
             // since higher::for_loop expressions are marked as expansions
@@ -574,6 +582,9 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
                 return;
             }
             check_for_loop(cx, pat, arg, body, expr, span);
+            if let ExprKind::Block(block, _) = body.kind {
+                never_loop::check(cx, block, loop_id, span, for_loop.as_ref());
+            }
         }
 
         // we don't want to check expanded macros
@@ -582,7 +593,9 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         }
 
         // check for never_loop
-        never_loop::check(cx, expr);
+        if let ExprKind::Loop(block, ..) = expr.kind {
+            never_loop::check(cx, block, expr.hir_id, expr.span, None);
+        }
 
         // check for `loop { if let {} else break }` that could be `while let`
         // (also matches an explicit "match" instead of "if let")
index c0fde5e51663e63a4609c8fafb6b3f04a1742f8a..86b7d6d989acc75fd6fc3dde238947886588aa51 100644 (file)
@@ -4,35 +4,41 @@
 use clippy_utils::higher::ForLoop;
 use clippy_utils::source::snippet;
 use rustc_errors::Applicability;
-use rustc_hir::{Block, Expr, ExprKind, HirId, InlineAsmOperand, LoopSource, Node, Pat, Stmt, StmtKind};
+use rustc_hir::{Block, Expr, ExprKind, HirId, InlineAsmOperand, Pat, Stmt, StmtKind};
 use rustc_lint::LateContext;
+use rustc_span::Span;
 use std::iter::{once, Iterator};
 
-pub(super) fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
-    if let ExprKind::Loop(block, _, source, _) = expr.kind {
-        match never_loop_block(block, expr.hir_id) {
-            NeverLoopResult::AlwaysBreak => {
-                span_lint_and_then(cx, NEVER_LOOP, expr.span, "this loop never actually loops", |diag| {
-                    if_chain! {
-                        if source == LoopSource::ForLoop;
-                        if let Some((_, Node::Expr(parent_match))) = cx.tcx.hir().parent_iter(expr.hir_id).nth(1);
-                        if let Some(ForLoop { arg: iterator, pat, span: for_span, .. }) = ForLoop::hir(parent_match);
-                        then {
-                            // Suggests using an `if let` instead. This is `Unspecified` because the
-                            // loop may (probably) contain `break` statements which would be invalid
-                            // in an `if let`.
-                            diag.span_suggestion_verbose(
-                                for_span.with_hi(iterator.span.hi()),
-                                "if you need the first element of the iterator, try writing",
-                                for_to_if_let_sugg(cx, iterator, pat),
-                                Applicability::Unspecified,
-                            );
-                        }
-                    };
-                });
-            },
-            NeverLoopResult::MayContinueMainLoop | NeverLoopResult::Otherwise => (),
-        }
+pub(super) fn check(
+    cx: &LateContext<'tcx>,
+    block: &'tcx Block<'_>,
+    loop_id: HirId,
+    span: Span,
+    for_loop: Option<&ForLoop<'_>>,
+) {
+    match never_loop_block(block, loop_id) {
+        NeverLoopResult::AlwaysBreak => {
+            span_lint_and_then(cx, NEVER_LOOP, span, "this loop never actually loops", |diag| {
+                if let Some(ForLoop {
+                    arg: iterator,
+                    pat,
+                    span: for_span,
+                    ..
+                }) = for_loop
+                {
+                    // Suggests using an `if let` instead. This is `Unspecified` because the
+                    // loop may (probably) contain `break` statements which would be invalid
+                    // in an `if let`.
+                    diag.span_suggestion_verbose(
+                        for_span.with_hi(iterator.span.hi()),
+                        "if you need the first element of the iterator, try writing",
+                        for_to_if_let_sugg(cx, iterator, pat),
+                        Applicability::Unspecified,
+                    );
+                }
+            });
+        },
+        NeverLoopResult::MayContinueMainLoop | NeverLoopResult::Otherwise => (),
     }
 }
 
index 0fd09ff7197ae7e03e42966a528bb596b1b0233e..e39605f3e7d621d79ede824a4c62b37603e1b8b7 100644 (file)
@@ -1,4 +1,4 @@
-use super::{get_span_of_entire_for_loop, SINGLE_ELEMENT_LOOP};
+use super::SINGLE_ELEMENT_LOOP;
 use clippy_utils::diagnostics::span_lint_and_sugg;
 use clippy_utils::single_segment_path;
 use clippy_utils::source::{indent_of, snippet};
@@ -30,7 +30,6 @@ pub(super) fn check<'tcx>(
         if !block.stmts.is_empty();
 
         then {
-            let for_span = get_span_of_entire_for_loop(expr);
             let mut block_str = snippet(cx, block.span, "..").into_owned();
             block_str.remove(0);
             block_str.pop();
@@ -39,7 +38,7 @@ pub(super) fn check<'tcx>(
             span_lint_and_sugg(
                 cx,
                 SINGLE_ELEMENT_LOOP,
-                for_span,
+                expr.span,
                 "for loop over a single element",
                 "try",
                 format!("{{\n{}let {} = &{};{}}}", " ".repeat(indent_of(cx, block.stmts[0].span).unwrap_or(0)), target.name, list_item_name, block_str),
index f9f515cc40a0fbdd120af9de1358d4e92ba66ce7..c3939a66c6accdced10229bdc3612975b71c03cf 100644 (file)
@@ -7,7 +7,6 @@
 use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, HirId, Mutability, Pat, PatKind, Stmt, StmtKind};
 use rustc_lint::LateContext;
 use rustc_middle::hir::map::Map;
-use rustc_span::source_map::Span;
 use rustc_span::symbol::{sym, Symbol};
 use std::iter::Iterator;
 
@@ -300,17 +299,6 @@ fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
     }
 }
 
-// this function assumes the given expression is a `for` loop.
-pub(super) fn get_span_of_entire_for_loop(expr: &Expr<'_>) -> Span {
-    // for some reason this is the only way to get the `Span`
-    // of the entire `for` loop
-    if let ExprKind::Match(_, arms, _) = &expr.kind {
-        arms[0].body.span
-    } else {
-        unreachable!()
-    }
-}
-
 /// If `arg` was the argument to a `for` loop, return the "cleanest" way of writing the
 /// actual `Iterator` that the loop uses.
 pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applic_ref: &mut Applicability) -> String {
index 0f32cd9164e2d7ecf874923a3a5d7a299b19365a..78183add9cc7c465b14b369158ae186afa7231dd 100644 (file)
@@ -20,8 +20,8 @@
 use clippy_utils::consts::{constant, Constant};
 use clippy_utils::sugg::Sugg;
 use clippy_utils::{
-    expr_path_res, get_item_name, get_parent_expr, higher, in_constant, is_diag_trait_item, is_integer_const,
-    iter_input_pats, last_path_segment, match_any_def_paths, paths, unsext, SpanlessEq,
+    expr_path_res, get_item_name, get_parent_expr, in_constant, is_diag_trait_item, is_integer_const, iter_input_pats,
+    last_path_segment, match_any_def_paths, paths, unsext, SpanlessEq,
 };
 
 declare_clippy_lint! {
@@ -312,7 +312,6 @@ fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
             if let StmtKind::Local(local) = stmt.kind;
             if let PatKind::Binding(an, .., name, None) = local.pat.kind;
             if let Some(init) = local.init;
-            if !higher::is_from_for_desugar(local);
             if an == BindingAnnotation::Ref || an == BindingAnnotation::RefMut;
             then {
                 // use the macro callsite when the init span (but not the whole local span)
index e7bc24465908b43851b87e2af2483e6ac7758028..018e6d611db77aa1e66744dc9dbb8d45bf3bbc87 100644 (file)
@@ -1,16 +1,12 @@
 use clippy_utils::diagnostics::span_lint_and_help;
-use clippy_utils::last_path_segment;
 use rustc_hir::{
-    intravisit, Body, Expr, ExprKind, FnDecl, HirId, LocalSource, MatchSource, Mutability, Pat, PatField, PatKind,
-    QPath, Stmt, StmtKind,
+    intravisit, Body, Expr, ExprKind, FnDecl, HirId, LocalSource, Mutability, Pat, PatKind, Stmt, StmtKind,
 };
 use rustc_lint::{LateContext, LateLintPass, LintContext};
 use rustc_middle::lint::in_external_macro;
-use rustc_middle::ty::subst::SubstsRef;
-use rustc_middle::ty::{AdtDef, FieldDef, Ty, TyKind, VariantDef};
+use rustc_middle::ty;
 use rustc_session::{declare_lint_pass, declare_tool_lint};
 use rustc_span::source_map::Span;
-use std::iter;
 
 declare_clippy_lint! {
     /// ### What it does
 impl<'tcx> LateLintPass<'tcx> for PatternTypeMismatch {
     fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
         if let StmtKind::Local(local) = stmt.kind {
-            if let Some(init) = &local.init {
-                if let Some(init_ty) = cx.typeck_results().node_type_opt(init.hir_id) {
-                    let pat = &local.pat;
-                    if in_external_macro(cx.sess(), pat.span) {
-                        return;
-                    }
-                    let deref_possible = match local.source {
-                        LocalSource::Normal => DerefPossible::Possible,
-                        _ => DerefPossible::Impossible,
-                    };
-                    apply_lint(cx, pat, init_ty, deref_possible);
-                }
+            if in_external_macro(cx.sess(), local.pat.span) {
+                return;
             }
+            let deref_possible = match local.source {
+                LocalSource::Normal => DerefPossible::Possible,
+                _ => DerefPossible::Impossible,
+            };
+            apply_lint(cx, local.pat, deref_possible);
         }
     }
 
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
-        if let ExprKind::Match(scrutinee, arms, MatchSource::Normal) = expr.kind {
-            if let Some(expr_ty) = cx.typeck_results().node_type_opt(scrutinee.hir_id) {
-                'pattern_checks: for arm in arms {
-                    let pat = &arm.pat;
-                    if in_external_macro(cx.sess(), pat.span) {
-                        continue 'pattern_checks;
-                    }
-                    if apply_lint(cx, pat, expr_ty, DerefPossible::Possible) {
-                        break 'pattern_checks;
-                    }
+        if let ExprKind::Match(_, arms, _) = expr.kind {
+            for arm in arms {
+                let pat = &arm.pat;
+                if apply_lint(cx, pat, DerefPossible::Possible) {
+                    break;
                 }
             }
         }
-        if let ExprKind::Let(let_pat, let_expr, _) = expr.kind {
-            if let Some(expr_ty) = cx.typeck_results().node_type_opt(let_expr.hir_id) {
-                if in_external_macro(cx.sess(), let_pat.span) {
-                    return;
-                }
-                apply_lint(cx, let_pat, expr_ty, DerefPossible::Possible);
-            }
+        if let ExprKind::Let(let_pat, ..) = expr.kind {
+            apply_lint(cx, let_pat, DerefPossible::Possible);
         }
     }
 
@@ -134,12 +115,10 @@ fn check_fn(
         _: &'tcx FnDecl<'_>,
         body: &'tcx Body<'_>,
         _: Span,
-        hir_id: HirId,
+        _: HirId,
     ) {
-        if let Some(fn_sig) = cx.typeck_results().liberated_fn_sigs().get(hir_id) {
-            for (param, ty) in iter::zip(body.params, fn_sig.inputs()) {
-                apply_lint(cx, param.pat, ty, DerefPossible::Impossible);
-            }
+        for param in body.params {
+            apply_lint(cx, param.pat, DerefPossible::Impossible);
         }
     }
 }
@@ -150,8 +129,8 @@ enum DerefPossible {
     Impossible,
 }
 
-fn apply_lint<'tcx>(cx: &LateContext<'tcx>, pat: &Pat<'_>, expr_ty: Ty<'tcx>, deref_possible: DerefPossible) -> bool {
-    let maybe_mismatch = find_first_mismatch(cx, pat, expr_ty, Level::Top);
+fn apply_lint<'tcx>(cx: &LateContext<'tcx>, pat: &Pat<'_>, deref_possible: DerefPossible) -> bool {
+    let maybe_mismatch = find_first_mismatch(cx, pat);
     if let Some((span, mutability, level)) = maybe_mismatch {
         span_lint_and_help(
             cx,
@@ -184,132 +163,32 @@ enum Level {
 }
 
 #[allow(rustc::usage_of_ty_tykind)]
-fn find_first_mismatch<'tcx>(
-    cx: &LateContext<'tcx>,
-    pat: &Pat<'_>,
-    ty: Ty<'tcx>,
-    level: Level,
-) -> Option<(Span, Mutability, Level)> {
-    if let PatKind::Ref(sub_pat, _) = pat.kind {
-        if let TyKind::Ref(_, sub_ty, _) = ty.kind() {
-            return find_first_mismatch(cx, sub_pat, sub_ty, Level::Lower);
-        }
-    }
-
-    if let TyKind::Ref(_, _, mutability) = *ty.kind() {
-        if is_non_ref_pattern(&pat.kind) {
-            return Some((pat.span, mutability, level));
-        }
-    }
-
-    if let PatKind::Struct(ref qpath, field_pats, _) = pat.kind {
-        if let TyKind::Adt(adt_def, substs_ref) = ty.kind() {
-            if let Some(variant) = get_variant(adt_def, qpath) {
-                let field_defs = &variant.fields;
-                return find_first_mismatch_in_struct(cx, field_pats, field_defs, substs_ref);
-            }
+fn find_first_mismatch<'tcx>(cx: &LateContext<'tcx>, pat: &Pat<'_>) -> Option<(Span, Mutability, Level)> {
+    let mut result = None;
+    pat.walk(|p| {
+        if result.is_some() {
+            return false;
         }
-    }
-
-    if let PatKind::TupleStruct(ref qpath, pats, _) = pat.kind {
-        if let TyKind::Adt(adt_def, substs_ref) = ty.kind() {
-            if let Some(variant) = get_variant(adt_def, qpath) {
-                let field_defs = &variant.fields;
-                let ty_iter = field_defs.iter().map(|field_def| field_def.ty(cx.tcx, substs_ref));
-                return find_first_mismatch_in_tuple(cx, pats, ty_iter);
-            }
-        }
-    }
-
-    if let PatKind::Tuple(pats, _) = pat.kind {
-        if let TyKind::Tuple(..) = ty.kind() {
-            return find_first_mismatch_in_tuple(cx, pats, ty.tuple_fields());
+        if in_external_macro(cx.sess(), p.span) {
+            return true;
         }
-    }
-
-    if let PatKind::Or(sub_pats) = pat.kind {
-        for pat in sub_pats {
-            let maybe_mismatch = find_first_mismatch(cx, pat, ty, level);
-            if let Some(mismatch) = maybe_mismatch {
-                return Some(mismatch);
-            }
-        }
-    }
-
-    None
-}
-
-fn get_variant<'a>(adt_def: &'a AdtDef, qpath: &QPath<'_>) -> Option<&'a VariantDef> {
-    if adt_def.is_struct() {
-        if let Some(variant) = adt_def.variants.iter().next() {
-            return Some(variant);
-        }
-    }
-
-    if adt_def.is_enum() {
-        let pat_ident = last_path_segment(qpath).ident;
-        for variant in &adt_def.variants {
-            if variant.ident == pat_ident {
-                return Some(variant);
-            }
-        }
-    }
-
-    None
-}
-
-fn find_first_mismatch_in_tuple<'tcx, I>(
-    cx: &LateContext<'tcx>,
-    pats: &[Pat<'_>],
-    ty_iter_src: I,
-) -> Option<(Span, Mutability, Level)>
-where
-    I: IntoIterator<Item = Ty<'tcx>>,
-{
-    let mut field_tys = ty_iter_src.into_iter();
-    'fields: for pat in pats {
-        let field_ty = if let Some(ty) = field_tys.next() {
-            ty
-        } else {
-            break 'fields;
+        let adjust_pat = match p.kind {
+            PatKind::Or([p, ..]) => p,
+            _ => p,
         };
-
-        let maybe_mismatch = find_first_mismatch(cx, pat, field_ty, Level::Lower);
-        if let Some(mismatch) = maybe_mismatch {
-            return Some(mismatch);
-        }
-    }
-
-    None
-}
-
-fn find_first_mismatch_in_struct<'tcx>(
-    cx: &LateContext<'tcx>,
-    field_pats: &[PatField<'_>],
-    field_defs: &[FieldDef],
-    substs_ref: SubstsRef<'tcx>,
-) -> Option<(Span, Mutability, Level)> {
-    for field_pat in field_pats {
-        'definitions: for field_def in field_defs {
-            if field_pat.ident == field_def.ident {
-                let field_ty = field_def.ty(cx.tcx, substs_ref);
-                let pat = &field_pat.pat;
-                let maybe_mismatch = find_first_mismatch(cx, pat, field_ty, Level::Lower);
-                if let Some(mismatch) = maybe_mismatch {
-                    return Some(mismatch);
+        if let Some(adjustments) = cx.typeck_results().pat_adjustments().get(adjust_pat.hir_id) {
+            if let [first, ..] = **adjustments {
+                if let ty::Ref(.., mutability) = *first.kind() {
+                    let level = if p.hir_id == pat.hir_id {
+                        Level::Top
+                    } else {
+                        Level::Lower
+                    };
+                    result = Some((p.span, mutability, level));
                 }
-                break 'definitions;
             }
         }
-    }
-
-    None
-}
-
-fn is_non_ref_pattern(pat_kind: &PatKind<'_>) -> bool {
-    match pat_kind {
-        PatKind::Struct(..) | PatKind::Tuple(..) | PatKind::TupleStruct(..) | PatKind::Path(..) => true,
-        PatKind::Or(sub_pats) => sub_pats.iter().any(|pat| is_non_ref_pattern(&pat.kind)),
-        _ => false,
-    }
+        result.is_none()
+    });
+    result
 }
index bdeff035e5ec99ab30dd2e68a90c06a2eb4033a7..63ad65b8afd9f6ffda92e75f326825448cb1df36 100644 (file)
@@ -3,10 +3,8 @@
 use clippy_utils::{match_def_path, paths};
 use if_chain::if_chain;
 use rustc_errors::Applicability;
-use rustc_hir::{
-    self as hir, GenericArg, GenericBounds, GenericParamKind, HirId, Lifetime, MutTy, Mutability, Node, QPath,
-    SyntheticTyParamKind, TyKind,
-};
+use rustc_hir::{self as hir, GenericArg, GenericBounds, GenericParamKind};
+use rustc_hir::{HirId, Lifetime, MutTy, Mutability, Node, QPath, TyKind};
 use rustc_lint::LateContext;
 
 use super::BORROWED_BOX;
@@ -105,7 +103,7 @@ fn get_bounds_if_impl_trait<'tcx>(cx: &LateContext<'tcx>, qpath: &QPath<'_>, id:
         if let Some(did) = cx.qpath_res(qpath, id).opt_def_id();
         if let Some(Node::GenericParam(generic_param)) = cx.tcx.hir().get_if_local(did);
         if let GenericParamKind::Type { synthetic, .. } = generic_param.kind;
-        if synthetic == Some(SyntheticTyParamKind::ImplTrait);
+        if synthetic;
         then {
             Some(generic_param.bounds)
         } else {
index fad647dfb2662ee4f380670e1c17f38a253d78fb..b25a6e3375bb4176b3d45f610e633a8f9ce1086b 100644 (file)
@@ -1,5 +1,4 @@
 use clippy_utils::diagnostics::span_lint_and_then;
-use clippy_utils::higher;
 use clippy_utils::source::snippet_with_macro_callsite;
 use rustc_errors::Applicability;
 use rustc_hir::{Stmt, StmtKind};
@@ -14,9 +13,6 @@ pub(super) fn check(cx: &LateContext<'_>, stmt: &Stmt<'_>) {
             if in_external_macro(cx.sess(), stmt.span) || local.pat.span.from_expansion() {
                 return;
             }
-            if higher::is_from_for_desugar(local) {
-                return;
-            }
             span_lint_and_then(
                 cx,
                 LET_UNIT_VALUE,
index 733cc97c84596546bd0005ab6608749270564f7c..7297265d08cfbf214db556486f3d96289454b521 100644 (file)
@@ -22,31 +22,31 @@ pub struct ForLoop<'tcx> {
     pub arg: &'tcx hir::Expr<'tcx>,
     /// `for` loop body
     pub body: &'tcx hir::Expr<'tcx>,
+    /// Compare this against `hir::Destination.target`
+    pub loop_id: HirId,
     /// entire `for` loop span
     pub span: Span,
 }
 
 impl<'tcx> ForLoop<'tcx> {
-    #[inline]
     /// Parses a desugared `for` loop
     pub fn hir(expr: &Expr<'tcx>) -> Option<Self> {
         if_chain! {
-            if let hir::ExprKind::Match(iterexpr, arms, hir::MatchSource::ForLoopDesugar) = expr.kind;
-            if let Some(first_arm) = arms.get(0);
-            if let hir::ExprKind::Call(_, iterargs) = iterexpr.kind;
-            if let Some(first_arg) = iterargs.get(0);
-            if iterargs.len() == 1 && arms.len() == 1 && first_arm.guard.is_none();
-            if let hir::ExprKind::Loop(block, ..) = first_arm.body.kind;
-            if block.expr.is_none();
-            if let [ _, _, ref let_stmt, ref body ] = *block.stmts;
-            if let hir::StmtKind::Local(local) = let_stmt.kind;
-            if let hir::StmtKind::Expr(body_expr) = body.kind;
+            if let hir::ExprKind::DropTemps(e) = expr.kind;
+            if let hir::ExprKind::Match(iterexpr, [arm], hir::MatchSource::ForLoopDesugar) = e.kind;
+            if let hir::ExprKind::Call(_, [arg]) = iterexpr.kind;
+            if let hir::ExprKind::Loop(block, ..) = arm.body.kind;
+            if let [stmt] = &*block.stmts;
+            if let hir::StmtKind::Expr(e) = stmt.kind;
+            if let hir::ExprKind::Match(_, [_, some_arm], _) = e.kind;
+            if let hir::PatKind::Struct(_, [field], _) = some_arm.pat.kind;
             then {
                 return Some(Self {
-                    pat: &*local.pat,
-                    arg: first_arg,
-                    body: body_expr,
-                    span: first_arm.span
+                    pat: field.pat,
+                    arg,
+                    body: some_arm.body,
+                    loop_id: arm.body.hir_id,
+                    span: expr.span.ctxt().outer_expn_data().call_site,
                 });
             }
         }
@@ -678,38 +678,6 @@ pub fn is_display(&self) -> bool {
     }
 }
 
-/// Checks if a `let` statement is from a `for` loop desugaring.
-pub fn is_from_for_desugar(local: &hir::Local<'_>) -> bool {
-    // This will detect plain for-loops without an actual variable binding:
-    //
-    // ```
-    // for x in some_vec {
-    //     // do stuff
-    // }
-    // ```
-    if_chain! {
-        if let Some(expr) = local.init;
-        if let hir::ExprKind::Match(_, _, hir::MatchSource::ForLoopDesugar) = expr.kind;
-        then {
-            return true;
-        }
-    }
-
-    // This detects a variable binding in for loop to avoid `let_unit_value`
-    // lint (see issue #1964).
-    //
-    // ```
-    // for _ in vec![()] {
-    //     // anything
-    // }
-    // ```
-    if let hir::LocalSource::ForLoopDesugar = local.source {
-        return true;
-    }
-
-    false
-}
-
 /// A parsed `panic!` expansion
 pub struct PanicExpn<'tcx> {
     /// Span of `panic!(..)`
index f1b4d4e096ec5e18b412f04bebc8320b779e3161..4d0e13c833fd768a7b0086769476aa1382d1c825 100644 (file)
@@ -11,11 +11,8 @@ if_chain! {
     // unimplemented: field checks
     if arms.len() == 1;
     if let ExprKind::Loop(ref body, ref label, LoopSource::ForLoop) = arms[0].body.kind;
-    if body.stmts.len() == 4;
-    if let StmtKind::Local(ref local) = body.stmts[0].kind;
-    if let PatKind::Binding(BindingAnnotation::Mutable, _, name, None) = local.pat.kind;
-    if name.as_str() == "__next";
-    if let StmtKind::Expr(ref e, _) = body.stmts[1].kind
+    if body.stmts.len() == 1;
+    if let StmtKind::Expr(ref e, _) = body.stmts[0].kind
     if let ExprKind::Match(ref expr2, ref arms1, MatchSource::ForLoopDesugar) = e.kind;
     if let ExprKind::Call(ref func1, ref args1) = expr2.kind;
     if let ExprKind::Path(ref path2) = func1.kind;
@@ -25,39 +22,27 @@ if_chain! {
     if let ExprKind::Path(ref path3) = inner.kind;
     if match_qpath(path3, &["iter"]);
     if arms1.len() == 2;
-    if let ExprKind::Assign(ref target, ref value, ref _span) = arms1[0].body.kind;
-    if let ExprKind::Path(ref path4) = target.kind;
-    if match_qpath(path4, &["__next"]);
-    if let ExprKind::Path(ref path5) = value.kind;
-    if match_qpath(path5, &["val"]);
-    if let PatKind::Struct(ref path6, ref fields1, false) = arms1[0].pat.kind;
-    if matches!(path6, QPath::LangItem(LangItem::OptionSome, _));
-    if fields1.len() == 1;
-    // unimplemented: field checks
-    if let ExprKind::Break(ref destination, None) = arms1[1].body.kind;
-    if let PatKind::Struct(ref path7, ref fields2, false) = arms1[1].pat.kind;
-    if matches!(path7, QPath::LangItem(LangItem::OptionNone, _));
-    if fields2.len() == 0;
+    if let ExprKind::Break(ref destination, None) = arms1[0].body.kind;
+    if let PatKind::Struct(ref path4, ref fields1, false) = arms1[0].pat.kind;
+    if matches!(path4, QPath::LangItem(LangItem::OptionNone, _));
+    if fields1.len() == 0;
     // unimplemented: field checks
-    if let StmtKind::Local(ref local1) = body.stmts[2].kind;
-    if let Some(ref init) = local1.init;
-    if let ExprKind::Path(ref path8) = init.kind;
-    if match_qpath(path8, &["__next"]);
-    if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local1.pat.kind;
-    if name1.as_str() == "y";
-    if let StmtKind::Expr(ref e1, _) = body.stmts[3].kind
-    if let ExprKind::Block(ref block) = e1.kind;
+    if let ExprKind::Block(ref block) = arms1[1].body.kind;
     if block.stmts.len() == 1;
-    if let StmtKind::Local(ref local2) = block.stmts[0].kind;
-    if let Some(ref init1) = local2.init;
-    if let ExprKind::Path(ref path9) = init1.kind;
-    if match_qpath(path9, &["y"]);
-    if let PatKind::Binding(BindingAnnotation::Unannotated, _, name2, None) = local2.pat.kind;
-    if name2.as_str() == "z";
+    if let StmtKind::Local(ref local) = block.stmts[0].kind;
+    if let Some(ref init) = local.init;
+    if let ExprKind::Path(ref path5) = init.kind;
+    if match_qpath(path5, &["y"]);
+    if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local.pat.kind;
+    if name.as_str() == "z";
     if block.expr.is_none();
+    if let PatKind::Struct(ref path6, ref fields2, false) = arms1[1].pat.kind;
+    if matches!(path6, QPath::LangItem(LangItem::OptionSome, _));
+    if fields2.len() == 1;
+    // unimplemented: field checks
     if body.expr.is_none();
-    if let PatKind::Binding(BindingAnnotation::Mutable, _, name3, None) = arms[0].pat.kind;
-    if name3.as_str() == "iter";
+    if let PatKind::Binding(BindingAnnotation::Mutable, _, name1, None) = arms[0].pat.kind;
+    if name1.as_str() == "iter";
     then {
         // report your lint here
     }
index 73668334f05c3446b04116ccc3156240d2d8ab19..183ef048f61ae36aa389d1d0345cde940fe788e9 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 73668334f05c3446b04116ccc3156240d2d8ab19
+Subproject commit 183ef048f61ae36aa389d1d0345cde940fe788e9
index b598c63f52ac8108f46cd1534936719b0a2c14c5..0d6a2605d4f2aabb09a0f76635c6d918de5569ec 100644 (file)
@@ -194,7 +194,7 @@ async function main(argv) {
             .then(out => {
                 const [output, nb_failures] = out;
                 results[nb_failures === 0 ? "successful" : "failed"].push({
-                    file_name: file_name,
+                    file_name: testPath,
                     output: output,
                 });
                 if (nb_failures > 0) {
@@ -206,7 +206,7 @@ async function main(argv) {
             })
             .catch(err => {
                 results.errored.push({
-                    file_name: file_name,
+                    file_name: testPath + file_name,
                     output: err,
                 });
                 status_bar.erroneous();
@@ -239,7 +239,7 @@ async function main(argv) {
         console.log("");
         results.failed.sort(by_filename);
         results.failed.forEach(r => {
-            console.log(r.output);
+            console.log(r.file_name, r.output);
         });
     }
     if (results.errored.length > 0) {
@@ -247,7 +247,7 @@ async function main(argv) {
         // print run errors on the bottom so developers see them better
         results.errored.sort(by_filename);
         results.errored.forEach(r => {
-            console.error(r.output);
+            console.error(r.file_name, r.output);
         });
     }
 
index 022a3dfde8217bcc173e4d9cd995daf8aa3fc3b2..6ece94771401d5ab2ae0b668704ab95934efe5f6 100644 (file)
@@ -266,6 +266,8 @@ fn skip(path: &Path) -> bool {
             contains_ignore_directive(can_contain, &contents, "end-whitespace");
         let mut skip_trailing_newlines =
             contains_ignore_directive(can_contain, &contents, "trailing-newlines");
+        let mut skip_leading_newlines =
+            contains_ignore_directive(can_contain, &contents, "leading-newlines");
         let mut skip_copyright = contains_ignore_directive(can_contain, &contents, "copyright");
         let mut leading_new_lines = false;
         let mut trailing_new_lines = 0;
@@ -350,7 +352,10 @@ fn skip(path: &Path) -> bool {
             }
         }
         if leading_new_lines {
-            tidy_error!(bad, "{}: leading newline", file.display());
+            let mut err = |_| {
+                tidy_error!(bad, "{}: leading newline", file.display());
+            };
+            suppressible_tidy_err!(err, skip_leading_newlines, "mising leading newline");
         }
         let mut err = |msg: &str| {
             tidy_error!(bad, "{}: {}", file.display(), msg);
@@ -395,6 +400,9 @@ fn skip(path: &Path) -> bool {
         if let Directive::Ignore(false) = skip_trailing_newlines {
             tidy_error!(bad, "{}: ignoring trailing newlines unnecessarily", file.display());
         }
+        if let Directive::Ignore(false) = skip_leading_newlines {
+            tidy_error!(bad, "{}: ignoring leading newlines unnecessarily", file.display());
+        }
         if let Directive::Ignore(false) = skip_copyright {
             tidy_error!(bad, "{}: ignoring copyright unnecessarily", file.display());
         }
index 681b2486d07cc0bc20b54ccf95ac22dc20d7e798..7fae9bf0f69b3df1d06c878b18135121d4689e26 100644 (file)
@@ -7,9 +7,9 @@
 
 const ENTRY_LIMIT: usize = 1000;
 // FIXME: The following limits should be reduced eventually.
-const ROOT_ENTRY_LIMIT: usize = 1102;
+const ROOT_ENTRY_LIMIT: usize = 983;
 const ISSUES_ENTRY_LIMIT: usize = 2310;
-const PARSER_LIMIT: usize = 1005;
+const PARSER_LIMIT: usize = 1012;
 
 fn check_entries(path: &Path, bad: &mut bool) {
     let dirs = walkdir::WalkDir::new(&path.join("test/ui"))