From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/span/E0046.rs | 11 - src/test/ui/span/E0046.stderr | 12 - src/test/ui/span/E0072.rs | 7 - src/test/ui/span/E0072.stderr | 17 - src/test/ui/span/E0204.rs | 26 - src/test/ui/span/E0204.stderr | 43 - src/test/ui/span/E0493.rs | 21 - src/test/ui/span/E0493.stderr | 11 - src/test/ui/span/E0535.rs | 6 - src/test/ui/span/E0535.stderr | 11 - src/test/ui/span/E0536.rs | 4 - src/test/ui/span/E0536.stderr | 9 - src/test/ui/span/E0537.rs | 4 - src/test/ui/span/E0537.stderr | 9 - src/test/ui/span/auxiliary/transitive_dep_three.rs | 9 - src/test/ui/span/auxiliary/transitive_dep_two.rs | 3 - .../borrowck-borrow-overloaded-auto-deref-mut.rs | 142 -- ...orrowck-borrow-overloaded-auto-deref-mut.stderr | 88 -- .../span/borrowck-borrow-overloaded-deref-mut.rs | 60 - .../borrowck-borrow-overloaded-deref-mut.stderr | 35 - .../ui/span/borrowck-call-is-borrow-issue-12224.rs | 62 - .../borrowck-call-is-borrow-issue-12224.stderr | 55 - .../borrowck-call-method-from-mut-aliasable.rs | 21 - .../borrowck-call-method-from-mut-aliasable.stderr | 12 - src/test/ui/span/borrowck-fn-in-const-b.rs | 14 - src/test/ui/span/borrowck-fn-in-const-b.stderr | 11 - .../ui/span/borrowck-let-suggestion-suffixes.rs | 59 - .../span/borrowck-let-suggestion-suffixes.stderr | 63 - src/test/ui/span/borrowck-object-mutability.rs | 26 - src/test/ui/span/borrowck-object-mutability.stderr | 21 - src/test/ui/span/borrowck-ref-into-rvalue.fixed | 13 - src/test/ui/span/borrowck-ref-into-rvalue.rs | 12 - src/test/ui/span/borrowck-ref-into-rvalue.stderr | 20 - src/test/ui/span/coerce-suggestions.rs | 23 - src/test/ui/span/coerce-suggestions.stderr | 72 - src/test/ui/span/destructor-restrictions.rs | 11 - src/test/ui/span/destructor-restrictions.stderr | 23 - ...ust-2021-incompatible-closure-captures-93117.rs | 18 - ...2021-incompatible-closure-captures-93117.stderr | 95 -- ...ust-2021-incompatible-closure-captures-96258.rs | 15 - ...2021-incompatible-closure-captures-96258.stderr | 24 - src/test/ui/span/dropck-object-cycle.rs | 47 - src/test/ui/span/dropck-object-cycle.stderr | 15 - src/test/ui/span/dropck_arr_cycle_checked.rs | 106 -- src/test/ui/span/dropck_arr_cycle_checked.stderr | 43 - src/test/ui/span/dropck_direct_cycle_with_drop.rs | 44 - .../ui/span/dropck_direct_cycle_with_drop.stderr | 29 - src/test/ui/span/dropck_misc_variants.rs | 37 - src/test/ui/span/dropck_misc_variants.stderr | 30 - src/test/ui/span/dropck_vec_cycle_checked.rs | 111 -- src/test/ui/span/dropck_vec_cycle_checked.stderr | 43 - src/test/ui/span/gated-features-attr-spans.rs | 7 - src/test/ui/span/gated-features-attr-spans.stderr | 12 - src/test/ui/span/impl-wrong-item-for-trait.rs | 38 - src/test/ui/span/impl-wrong-item-for-trait.stderr | 66 - src/test/ui/span/import-ty-params.rs | 23 - src/test/ui/span/import-ty-params.stderr | 20 - src/test/ui/span/issue-11925.rs | 13 - src/test/ui/span/issue-11925.stderr | 9 - src/test/ui/span/issue-15480.fixed | 14 - src/test/ui/span/issue-15480.rs | 13 - src/test/ui/span/issue-15480.stderr | 21 - .../issue-23338-locals-die-before-temps-of-body.rs | 28 - ...ue-23338-locals-die-before-temps-of-body.stderr | 44 - src/test/ui/span/issue-23729.rs | 33 - src/test/ui/span/issue-23729.stderr | 11 - src/test/ui/span/issue-23827.rs | 33 - src/test/ui/span/issue-23827.stderr | 11 - src/test/ui/span/issue-24356.rs | 27 - src/test/ui/span/issue-24356.stderr | 11 - src/test/ui/span/issue-24690.rs | 16 - src/test/ui/span/issue-24690.stderr | 29 - ...ssue-24805-dropck-child-has-items-via-parent.rs | 37 - ...-24805-dropck-child-has-items-via-parent.stderr | 17 - .../ui/span/issue-24805-dropck-trait-has-items.rs | 57 - .../span/issue-24805-dropck-trait-has-items.stderr | 42 - src/test/ui/span/issue-24895-copy-clone-dropck.rs | 29 - .../ui/span/issue-24895-copy-clone-dropck.stderr | 16 - src/test/ui/span/issue-25199.rs | 74 -- src/test/ui/span/issue-25199.stderr | 15 - src/test/ui/span/issue-26656.rs | 42 - src/test/ui/span/issue-26656.stderr | 16 - src/test/ui/span/issue-27522.rs | 9 - src/test/ui/span/issue-27522.stderr | 12 - src/test/ui/span/issue-29106.rs | 26 - src/test/ui/span/issue-29106.stderr | 29 - src/test/ui/span/issue-29595.rs | 7 - src/test/ui/span/issue-29595.stderr | 9 - src/test/ui/span/issue-33884.rs | 18 - src/test/ui/span/issue-33884.stderr | 11 - src/test/ui/span/issue-34264.rs | 11 - src/test/ui/span/issue-34264.stderr | 102 -- src/test/ui/span/issue-35987.rs | 14 - src/test/ui/span/issue-35987.stderr | 19 - src/test/ui/span/issue-36537.rs | 14 - src/test/ui/span/issue-36537.stderr | 14 - src/test/ui/span/issue-37767.rs | 41 - src/test/ui/span/issue-37767.stderr | 78 -- src/test/ui/span/issue-39018.rs | 38 - src/test/ui/span/issue-39018.stderr | 197 --- src/test/ui/span/issue-39698.rs | 16 - src/test/ui/span/issue-39698.stderr | 43 - src/test/ui/span/issue-40157.rs | 4 - src/test/ui/span/issue-40157.stderr | 13 - .../issue-42234-unknown-receiver-type.full.stderr | 27 - ...-42234-unknown-receiver-type.generic_arg.stderr | 27 - .../ui/span/issue-42234-unknown-receiver-type.rs | 19 - src/test/ui/span/issue-43927-non-ADT-derive.rs | 6 - src/test/ui/span/issue-43927-non-ADT-derive.stderr | 21 - src/test/ui/span/issue-71363.rs | 19 - src/test/ui/span/issue-71363.stderr | 33 - src/test/ui/span/issue-81800.rs | 2 - src/test/ui/span/issue-81800.stderr | 19 - src/test/ui/span/issue28498-reject-ex1.rs | 37 - src/test/ui/span/issue28498-reject-ex1.stderr | 17 - .../ui/span/issue28498-reject-lifetime-param.rs | 36 - .../span/issue28498-reject-lifetime-param.stderr | 17 - src/test/ui/span/issue28498-reject-passed-to-fn.rs | 38 - .../ui/span/issue28498-reject-passed-to-fn.stderr | 17 - src/test/ui/span/issue28498-reject-trait-bound.rs | 38 - .../ui/span/issue28498-reject-trait-bound.stderr | 17 - src/test/ui/span/lint-unused-unsafe-thir.rs | 61 - src/test/ui/span/lint-unused-unsafe-thir.stderr | 50 - src/test/ui/span/lint-unused-unsafe.mir.stderr | 1402 -------------------- src/test/ui/span/lint-unused-unsafe.rs | 1100 --------------- src/test/ui/span/macro-span-replacement.rs | 13 - src/test/ui/span/macro-span-replacement.stderr | 19 - src/test/ui/span/macro-ty-params.rs | 15 - src/test/ui/span/macro-ty-params.stderr | 26 - .../ui/span/method-and-field-eager-resolution.rs | 15 - .../span/method-and-field-eager-resolution.stderr | 31 - src/test/ui/span/missing-unit-argument.rs | 17 - src/test/ui/span/missing-unit-argument.stderr | 99 -- src/test/ui/span/move-closure.rs | 6 - src/test/ui/span/move-closure.stderr | 18 - src/test/ui/span/multiline-span-E0072.rs | 10 - src/test/ui/span/multiline-span-E0072.stderr | 18 - src/test/ui/span/multiline-span-simple.rs | 20 - src/test/ui/span/multiline-span-simple.stderr | 16 - src/test/ui/span/multispan-import-lint.rs | 10 - src/test/ui/span/multispan-import-lint.stderr | 15 - src/test/ui/span/mut-arg-hint.rs | 22 - src/test/ui/span/mut-arg-hint.stderr | 27 - src/test/ui/span/mut-ptr-cant-outlive-ref.rs | 15 - src/test/ui/span/mut-ptr-cant-outlive-ref.stderr | 14 - src/test/ui/span/non-existing-module-import.rs | 3 - src/test/ui/span/non-existing-module-import.stderr | 9 - src/test/ui/span/pub-struct-field.rs | 10 - src/test/ui/span/pub-struct-field.stderr | 20 - src/test/ui/span/range-2.rs | 15 - src/test/ui/span/range-2.stderr | 25 - src/test/ui/span/recursive-type-field.rs | 18 - src/test/ui/span/recursive-type-field.stderr | 27 - .../ui/span/regionck-unboxed-closure-lifetimes.rs | 16 - .../span/regionck-unboxed-closure-lifetimes.stderr | 14 - .../span/regions-close-over-borrowed-ref-in-obj.rs | 16 - .../regions-close-over-borrowed-ref-in-obj.stderr | 16 - .../ui/span/regions-close-over-type-parameter-2.rs | 27 - .../regions-close-over-type-parameter-2.stderr | 13 - .../ui/span/regions-escape-loop-via-variable.rs | 14 - .../span/regions-escape-loop-via-variable.stderr | 13 - src/test/ui/span/regions-escape-loop-via-vec.rs | 13 - .../ui/span/regions-escape-loop-via-vec.stderr | 50 - .../span/regions-infer-borrow-scope-within-loop.rs | 22 - .../regions-infer-borrow-scope-within-loop.stderr | 14 - .../ui/span/send-is-not-static-ensures-scoping.rs | 26 - .../span/send-is-not-static-ensures-scoping.stderr | 29 - src/test/ui/span/send-is-not-static-std-sync-2.rs | 39 - .../ui/span/send-is-not-static-std-sync-2.stderr | 37 - src/test/ui/span/send-is-not-static-std-sync.rs | 55 - .../ui/span/send-is-not-static-std-sync.stderr | 72 - src/test/ui/span/slice-borrow.rs | 14 - src/test/ui/span/slice-borrow.stderr | 17 - src/test/ui/span/suggestion-non-ascii.rs | 4 - src/test/ui/span/suggestion-non-ascii.stderr | 9 - src/test/ui/span/transitive-dep-span.rs | 15 - src/test/ui/span/transitive-dep-span.stderr | 18 - src/test/ui/span/type-annotations-needed-expr.rs | 3 - .../ui/span/type-annotations-needed-expr.stderr | 14 - src/test/ui/span/type-binding.rs | 9 - src/test/ui/span/type-binding.stderr | 9 - src/test/ui/span/typo-suggestion.rs | 9 - src/test/ui/span/typo-suggestion.stderr | 15 - .../ui/span/unused-warning-point-at-identifier.rs | 30 - .../span/unused-warning-point-at-identifier.stderr | 33 - .../ui/span/vec-must-not-hide-type-from-dropck.rs | 125 -- .../span/vec-must-not-hide-type-from-dropck.stderr | 29 - src/test/ui/span/vec_refs_data_with_early_death.rs | 33 - .../ui/span/vec_refs_data_with_early_death.stderr | 31 - src/test/ui/span/visibility-ty-params.rs | 13 - src/test/ui/span/visibility-ty-params.stderr | 21 - src/test/ui/span/wf-method-late-bound-regions.rs | 24 - .../ui/span/wf-method-late-bound-regions.stderr | 14 - 193 files changed, 7783 deletions(-) delete mode 100644 src/test/ui/span/E0046.rs delete mode 100644 src/test/ui/span/E0046.stderr delete mode 100644 src/test/ui/span/E0072.rs delete mode 100644 src/test/ui/span/E0072.stderr delete mode 100644 src/test/ui/span/E0204.rs delete mode 100644 src/test/ui/span/E0204.stderr delete mode 100644 src/test/ui/span/E0493.rs delete mode 100644 src/test/ui/span/E0493.stderr delete mode 100644 src/test/ui/span/E0535.rs delete mode 100644 src/test/ui/span/E0535.stderr delete mode 100644 src/test/ui/span/E0536.rs delete mode 100644 src/test/ui/span/E0536.stderr delete mode 100644 src/test/ui/span/E0537.rs delete mode 100644 src/test/ui/span/E0537.stderr delete mode 100644 src/test/ui/span/auxiliary/transitive_dep_three.rs delete mode 100644 src/test/ui/span/auxiliary/transitive_dep_two.rs delete mode 100644 src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs delete mode 100644 src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr delete mode 100644 src/test/ui/span/borrowck-borrow-overloaded-deref-mut.rs delete mode 100644 src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr delete mode 100644 src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs delete mode 100644 src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr delete mode 100644 src/test/ui/span/borrowck-call-method-from-mut-aliasable.rs delete mode 100644 src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr delete mode 100644 src/test/ui/span/borrowck-fn-in-const-b.rs delete mode 100644 src/test/ui/span/borrowck-fn-in-const-b.stderr delete mode 100644 src/test/ui/span/borrowck-let-suggestion-suffixes.rs delete mode 100644 src/test/ui/span/borrowck-let-suggestion-suffixes.stderr delete mode 100644 src/test/ui/span/borrowck-object-mutability.rs delete mode 100644 src/test/ui/span/borrowck-object-mutability.stderr delete mode 100644 src/test/ui/span/borrowck-ref-into-rvalue.fixed delete mode 100644 src/test/ui/span/borrowck-ref-into-rvalue.rs delete mode 100644 src/test/ui/span/borrowck-ref-into-rvalue.stderr delete mode 100644 src/test/ui/span/coerce-suggestions.rs delete mode 100644 src/test/ui/span/coerce-suggestions.stderr delete mode 100644 src/test/ui/span/destructor-restrictions.rs delete mode 100644 src/test/ui/span/destructor-restrictions.stderr delete mode 100644 src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs delete mode 100644 src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr delete mode 100644 src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs delete mode 100644 src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr delete mode 100644 src/test/ui/span/dropck-object-cycle.rs delete mode 100644 src/test/ui/span/dropck-object-cycle.stderr delete mode 100644 src/test/ui/span/dropck_arr_cycle_checked.rs delete mode 100644 src/test/ui/span/dropck_arr_cycle_checked.stderr delete mode 100644 src/test/ui/span/dropck_direct_cycle_with_drop.rs delete mode 100644 src/test/ui/span/dropck_direct_cycle_with_drop.stderr delete mode 100644 src/test/ui/span/dropck_misc_variants.rs delete mode 100644 src/test/ui/span/dropck_misc_variants.stderr delete mode 100644 src/test/ui/span/dropck_vec_cycle_checked.rs delete mode 100644 src/test/ui/span/dropck_vec_cycle_checked.stderr delete mode 100644 src/test/ui/span/gated-features-attr-spans.rs delete mode 100644 src/test/ui/span/gated-features-attr-spans.stderr delete mode 100644 src/test/ui/span/impl-wrong-item-for-trait.rs delete mode 100644 src/test/ui/span/impl-wrong-item-for-trait.stderr delete mode 100644 src/test/ui/span/import-ty-params.rs delete mode 100644 src/test/ui/span/import-ty-params.stderr delete mode 100644 src/test/ui/span/issue-11925.rs delete mode 100644 src/test/ui/span/issue-11925.stderr delete mode 100644 src/test/ui/span/issue-15480.fixed delete mode 100644 src/test/ui/span/issue-15480.rs delete mode 100644 src/test/ui/span/issue-15480.stderr delete mode 100644 src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs delete mode 100644 src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr delete mode 100644 src/test/ui/span/issue-23729.rs delete mode 100644 src/test/ui/span/issue-23729.stderr delete mode 100644 src/test/ui/span/issue-23827.rs delete mode 100644 src/test/ui/span/issue-23827.stderr delete mode 100644 src/test/ui/span/issue-24356.rs delete mode 100644 src/test/ui/span/issue-24356.stderr delete mode 100644 src/test/ui/span/issue-24690.rs delete mode 100644 src/test/ui/span/issue-24690.stderr delete mode 100644 src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs delete mode 100644 src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr delete mode 100644 src/test/ui/span/issue-24805-dropck-trait-has-items.rs delete mode 100644 src/test/ui/span/issue-24805-dropck-trait-has-items.stderr delete mode 100644 src/test/ui/span/issue-24895-copy-clone-dropck.rs delete mode 100644 src/test/ui/span/issue-24895-copy-clone-dropck.stderr delete mode 100644 src/test/ui/span/issue-25199.rs delete mode 100644 src/test/ui/span/issue-25199.stderr delete mode 100644 src/test/ui/span/issue-26656.rs delete mode 100644 src/test/ui/span/issue-26656.stderr delete mode 100644 src/test/ui/span/issue-27522.rs delete mode 100644 src/test/ui/span/issue-27522.stderr delete mode 100644 src/test/ui/span/issue-29106.rs delete mode 100644 src/test/ui/span/issue-29106.stderr delete mode 100644 src/test/ui/span/issue-29595.rs delete mode 100644 src/test/ui/span/issue-29595.stderr delete mode 100644 src/test/ui/span/issue-33884.rs delete mode 100644 src/test/ui/span/issue-33884.stderr delete mode 100644 src/test/ui/span/issue-34264.rs delete mode 100644 src/test/ui/span/issue-34264.stderr delete mode 100644 src/test/ui/span/issue-35987.rs delete mode 100644 src/test/ui/span/issue-35987.stderr delete mode 100644 src/test/ui/span/issue-36537.rs delete mode 100644 src/test/ui/span/issue-36537.stderr delete mode 100644 src/test/ui/span/issue-37767.rs delete mode 100644 src/test/ui/span/issue-37767.stderr delete mode 100644 src/test/ui/span/issue-39018.rs delete mode 100644 src/test/ui/span/issue-39018.stderr delete mode 100644 src/test/ui/span/issue-39698.rs delete mode 100644 src/test/ui/span/issue-39698.stderr delete mode 100644 src/test/ui/span/issue-40157.rs delete mode 100644 src/test/ui/span/issue-40157.stderr delete mode 100644 src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr delete mode 100644 src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr delete mode 100644 src/test/ui/span/issue-42234-unknown-receiver-type.rs delete mode 100644 src/test/ui/span/issue-43927-non-ADT-derive.rs delete mode 100644 src/test/ui/span/issue-43927-non-ADT-derive.stderr delete mode 100644 src/test/ui/span/issue-71363.rs delete mode 100644 src/test/ui/span/issue-71363.stderr delete mode 100644 src/test/ui/span/issue-81800.rs delete mode 100644 src/test/ui/span/issue-81800.stderr delete mode 100644 src/test/ui/span/issue28498-reject-ex1.rs delete mode 100644 src/test/ui/span/issue28498-reject-ex1.stderr delete mode 100644 src/test/ui/span/issue28498-reject-lifetime-param.rs delete mode 100644 src/test/ui/span/issue28498-reject-lifetime-param.stderr delete mode 100644 src/test/ui/span/issue28498-reject-passed-to-fn.rs delete mode 100644 src/test/ui/span/issue28498-reject-passed-to-fn.stderr delete mode 100644 src/test/ui/span/issue28498-reject-trait-bound.rs delete mode 100644 src/test/ui/span/issue28498-reject-trait-bound.stderr delete mode 100644 src/test/ui/span/lint-unused-unsafe-thir.rs delete mode 100644 src/test/ui/span/lint-unused-unsafe-thir.stderr delete mode 100644 src/test/ui/span/lint-unused-unsafe.mir.stderr delete mode 100644 src/test/ui/span/lint-unused-unsafe.rs delete mode 100644 src/test/ui/span/macro-span-replacement.rs delete mode 100644 src/test/ui/span/macro-span-replacement.stderr delete mode 100644 src/test/ui/span/macro-ty-params.rs delete mode 100644 src/test/ui/span/macro-ty-params.stderr delete mode 100644 src/test/ui/span/method-and-field-eager-resolution.rs delete mode 100644 src/test/ui/span/method-and-field-eager-resolution.stderr delete mode 100644 src/test/ui/span/missing-unit-argument.rs delete mode 100644 src/test/ui/span/missing-unit-argument.stderr delete mode 100644 src/test/ui/span/move-closure.rs delete mode 100644 src/test/ui/span/move-closure.stderr delete mode 100644 src/test/ui/span/multiline-span-E0072.rs delete mode 100644 src/test/ui/span/multiline-span-E0072.stderr delete mode 100644 src/test/ui/span/multiline-span-simple.rs delete mode 100644 src/test/ui/span/multiline-span-simple.stderr delete mode 100644 src/test/ui/span/multispan-import-lint.rs delete mode 100644 src/test/ui/span/multispan-import-lint.stderr delete mode 100644 src/test/ui/span/mut-arg-hint.rs delete mode 100644 src/test/ui/span/mut-arg-hint.stderr delete mode 100644 src/test/ui/span/mut-ptr-cant-outlive-ref.rs delete mode 100644 src/test/ui/span/mut-ptr-cant-outlive-ref.stderr delete mode 100644 src/test/ui/span/non-existing-module-import.rs delete mode 100644 src/test/ui/span/non-existing-module-import.stderr delete mode 100644 src/test/ui/span/pub-struct-field.rs delete mode 100644 src/test/ui/span/pub-struct-field.stderr delete mode 100644 src/test/ui/span/range-2.rs delete mode 100644 src/test/ui/span/range-2.stderr delete mode 100644 src/test/ui/span/recursive-type-field.rs delete mode 100644 src/test/ui/span/recursive-type-field.stderr delete mode 100644 src/test/ui/span/regionck-unboxed-closure-lifetimes.rs delete mode 100644 src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr delete mode 100644 src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs delete mode 100644 src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr delete mode 100644 src/test/ui/span/regions-close-over-type-parameter-2.rs delete mode 100644 src/test/ui/span/regions-close-over-type-parameter-2.stderr delete mode 100644 src/test/ui/span/regions-escape-loop-via-variable.rs delete mode 100644 src/test/ui/span/regions-escape-loop-via-variable.stderr delete mode 100644 src/test/ui/span/regions-escape-loop-via-vec.rs delete mode 100644 src/test/ui/span/regions-escape-loop-via-vec.stderr delete mode 100644 src/test/ui/span/regions-infer-borrow-scope-within-loop.rs delete mode 100644 src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr delete mode 100644 src/test/ui/span/send-is-not-static-ensures-scoping.rs delete mode 100644 src/test/ui/span/send-is-not-static-ensures-scoping.stderr delete mode 100644 src/test/ui/span/send-is-not-static-std-sync-2.rs delete mode 100644 src/test/ui/span/send-is-not-static-std-sync-2.stderr delete mode 100644 src/test/ui/span/send-is-not-static-std-sync.rs delete mode 100644 src/test/ui/span/send-is-not-static-std-sync.stderr delete mode 100644 src/test/ui/span/slice-borrow.rs delete mode 100644 src/test/ui/span/slice-borrow.stderr delete mode 100644 src/test/ui/span/suggestion-non-ascii.rs delete mode 100644 src/test/ui/span/suggestion-non-ascii.stderr delete mode 100644 src/test/ui/span/transitive-dep-span.rs delete mode 100644 src/test/ui/span/transitive-dep-span.stderr delete mode 100644 src/test/ui/span/type-annotations-needed-expr.rs delete mode 100644 src/test/ui/span/type-annotations-needed-expr.stderr delete mode 100644 src/test/ui/span/type-binding.rs delete mode 100644 src/test/ui/span/type-binding.stderr delete mode 100644 src/test/ui/span/typo-suggestion.rs delete mode 100644 src/test/ui/span/typo-suggestion.stderr delete mode 100644 src/test/ui/span/unused-warning-point-at-identifier.rs delete mode 100644 src/test/ui/span/unused-warning-point-at-identifier.stderr delete mode 100644 src/test/ui/span/vec-must-not-hide-type-from-dropck.rs delete mode 100644 src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr delete mode 100644 src/test/ui/span/vec_refs_data_with_early_death.rs delete mode 100644 src/test/ui/span/vec_refs_data_with_early_death.stderr delete mode 100644 src/test/ui/span/visibility-ty-params.rs delete mode 100644 src/test/ui/span/visibility-ty-params.stderr delete mode 100644 src/test/ui/span/wf-method-late-bound-regions.rs delete mode 100644 src/test/ui/span/wf-method-late-bound-regions.stderr (limited to 'src/test/ui/span') diff --git a/src/test/ui/span/E0046.rs b/src/test/ui/span/E0046.rs deleted file mode 100644 index 961109892..000000000 --- a/src/test/ui/span/E0046.rs +++ /dev/null @@ -1,11 +0,0 @@ -trait Foo { - fn foo(); -} - -struct Bar; - -impl Foo for Bar {} -//~^ ERROR E0046 - -fn main() { -} diff --git a/src/test/ui/span/E0046.stderr b/src/test/ui/span/E0046.stderr deleted file mode 100644 index 1323524f2..000000000 --- a/src/test/ui/span/E0046.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0046]: not all trait items implemented, missing: `foo` - --> $DIR/E0046.rs:7:1 - | -LL | fn foo(); - | --------- `foo` from trait -... -LL | impl Foo for Bar {} - | ^^^^^^^^^^^^^^^^ missing `foo` in implementation - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0046`. diff --git a/src/test/ui/span/E0072.rs b/src/test/ui/span/E0072.rs deleted file mode 100644 index bc284cdcb..000000000 --- a/src/test/ui/span/E0072.rs +++ /dev/null @@ -1,7 +0,0 @@ -struct ListNode { //~ ERROR has infinite size - head: u8, - tail: Option, -} - -fn main() { -} diff --git a/src/test/ui/span/E0072.stderr b/src/test/ui/span/E0072.stderr deleted file mode 100644 index 20f2e0df0..000000000 --- a/src/test/ui/span/E0072.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0072]: recursive type `ListNode` has infinite size - --> $DIR/E0072.rs:1:1 - | -LL | struct ListNode { - | ^^^^^^^^^^^^^^^ -LL | head: u8, -LL | tail: Option, - | -------- recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle - | -LL | tail: Option>, - | ++++ + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0072`. diff --git a/src/test/ui/span/E0204.rs b/src/test/ui/span/E0204.rs deleted file mode 100644 index 174de8cdd..000000000 --- a/src/test/ui/span/E0204.rs +++ /dev/null @@ -1,26 +0,0 @@ -struct Foo { - foo: Vec, -} - -impl Copy for Foo { } //~ ERROR may not be implemented for this type - -#[derive(Copy)] //~ ERROR may not be implemented for this type -struct Foo2<'a> { - ty: &'a mut bool, -} - -enum EFoo { - Bar { x: Vec }, - Baz, -} - -impl Copy for EFoo { } //~ ERROR may not be implemented for this type - -#[derive(Copy)] //~ ERROR may not be implemented for this type -enum EFoo2<'a> { - Bar(&'a mut bool), - Baz, -} - -fn main() { -} diff --git a/src/test/ui/span/E0204.stderr b/src/test/ui/span/E0204.stderr deleted file mode 100644 index 0b2166eed..000000000 --- a/src/test/ui/span/E0204.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/E0204.rs:5:15 - | -LL | foo: Vec, - | ------------- this field does not implement `Copy` -... -LL | impl Copy for Foo { } - | ^^^ - -error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/E0204.rs:7:10 - | -LL | #[derive(Copy)] - | ^^^^ -LL | struct Foo2<'a> { -LL | ty: &'a mut bool, - | ---------------- this field does not implement `Copy` - | - = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/E0204.rs:17:15 - | -LL | Bar { x: Vec }, - | ----------- this field does not implement `Copy` -... -LL | impl Copy for EFoo { } - | ^^^^ - -error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/E0204.rs:19:10 - | -LL | #[derive(Copy)] - | ^^^^ -LL | enum EFoo2<'a> { -LL | Bar(&'a mut bool), - | ------------ this field does not implement `Copy` - | - = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0204`. diff --git a/src/test/ui/span/E0493.rs b/src/test/ui/span/E0493.rs deleted file mode 100644 index 625da25a7..000000000 --- a/src/test/ui/span/E0493.rs +++ /dev/null @@ -1,21 +0,0 @@ -struct Foo { - a: u32 -} - -impl Drop for Foo { - fn drop(&mut self) {} -} - -struct Bar { - a: u32 -} - -impl Drop for Bar { - fn drop(&mut self) {} -} - -const F : Foo = (Foo { a : 0 }, Foo { a : 1 }).1; -//~^ ERROR destructor of - -fn main() { -} diff --git a/src/test/ui/span/E0493.stderr b/src/test/ui/span/E0493.stderr deleted file mode 100644 index 9db627562..000000000 --- a/src/test/ui/span/E0493.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0493]: destructor of `(Foo, Foo)` cannot be evaluated at compile-time - --> $DIR/E0493.rs:17:17 - | -LL | const F : Foo = (Foo { a : 0 }, Foo { a : 1 }).1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in constants - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0493`. diff --git a/src/test/ui/span/E0535.rs b/src/test/ui/span/E0535.rs deleted file mode 100644 index e26334e9b..000000000 --- a/src/test/ui/span/E0535.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[inline(unknown)] //~ ERROR E0535 -pub fn something() {} - -fn main() { - something(); -} diff --git a/src/test/ui/span/E0535.stderr b/src/test/ui/span/E0535.stderr deleted file mode 100644 index b1411bc43..000000000 --- a/src/test/ui/span/E0535.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0535]: invalid argument - --> $DIR/E0535.rs:1:10 - | -LL | #[inline(unknown)] - | ^^^^^^^ - | - = help: valid inline arguments are `always` and `never` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0535`. diff --git a/src/test/ui/span/E0536.rs b/src/test/ui/span/E0536.rs deleted file mode 100644 index 72de7b6f4..000000000 --- a/src/test/ui/span/E0536.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[cfg(not())] //~ ERROR E0536 -pub fn something() {} - -pub fn main() {} diff --git a/src/test/ui/span/E0536.stderr b/src/test/ui/span/E0536.stderr deleted file mode 100644 index 820b0d744..000000000 --- a/src/test/ui/span/E0536.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0536]: expected 1 cfg-pattern - --> $DIR/E0536.rs:1:7 - | -LL | #[cfg(not())] - | ^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0536`. diff --git a/src/test/ui/span/E0537.rs b/src/test/ui/span/E0537.rs deleted file mode 100644 index 4088a9ae5..000000000 --- a/src/test/ui/span/E0537.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[cfg(unknown())] //~ ERROR E0537 -pub fn something() {} - -pub fn main() {} diff --git a/src/test/ui/span/E0537.stderr b/src/test/ui/span/E0537.stderr deleted file mode 100644 index 5478c3fbc..000000000 --- a/src/test/ui/span/E0537.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0537]: invalid predicate `unknown` - --> $DIR/E0537.rs:1:7 - | -LL | #[cfg(unknown())] - | ^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0537`. diff --git a/src/test/ui/span/auxiliary/transitive_dep_three.rs b/src/test/ui/span/auxiliary/transitive_dep_three.rs deleted file mode 100644 index 99b51625a..000000000 --- a/src/test/ui/span/auxiliary/transitive_dep_three.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[macro_export] -macro_rules! define_parse_error { - () => { - #[macro_export] - macro_rules! parse_error { - () => { parse error } - } - } -} diff --git a/src/test/ui/span/auxiliary/transitive_dep_two.rs b/src/test/ui/span/auxiliary/transitive_dep_two.rs deleted file mode 100644 index 5110c4276..000000000 --- a/src/test/ui/span/auxiliary/transitive_dep_two.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate transitive_dep_three; - -transitive_dep_three::define_parse_error!(); diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs deleted file mode 100644 index 76a1d12ea..000000000 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs +++ /dev/null @@ -1,142 +0,0 @@ -// Test how overloaded deref interacts with borrows when DerefMut -// is implemented. - -use std::ops::{Deref, DerefMut}; - -struct Own { - value: *mut T -} - -impl Deref for Own { - type Target = T; - - fn deref(&self) -> &T { - unsafe { &*self.value } - } -} - -impl DerefMut for Own { - fn deref_mut(&mut self) -> &mut T { - unsafe { &mut *self.value } - } -} - -struct Point { - x: isize, - y: isize -} - -impl Point { - fn get(&self) -> (isize, isize) { - (self.x, self.y) - } - - fn set(&mut self, x: isize, y: isize) { - self.x = x; - self.y = y; - } - - fn x_ref(&self) -> &isize { - &self.x - } - - fn y_mut(&mut self) -> &mut isize { - &mut self.y - } -} - -fn deref_imm_field(x: Own) { - let __isize = &x.y; -} - -fn deref_mut_field1(x: Own) { - let __isize = &mut x.y; //~ ERROR cannot borrow -} - -fn deref_mut_field2(mut x: Own) { - let __isize = &mut x.y; -} - -fn deref_extend_field(x: &Own) -> &isize { - &x.y -} - -fn deref_extend_mut_field1(x: &Own) -> &mut isize { - &mut x.y //~ ERROR cannot borrow -} - -fn deref_extend_mut_field2(x: &mut Own) -> &mut isize { - &mut x.y -} - -fn deref_extend_mut_field3(x: &mut Own) { - // Hmm, this is unfortunate, because with box it would work, - // but it's presently the expected outcome. See `deref_extend_mut_field4` - // for the workaround. - - let _x = &mut x.x; - let _y = &mut x.y; //~ ERROR cannot borrow - use_mut(_x); -} -fn deref_extend_mut_field4<'a>(x: &'a mut Own) { - let p = &mut **x; - let _x = &mut p.x; - let _y = &mut p.y; -} - -fn assign_field1<'a>(x: Own) { - x.y = 3; //~ ERROR cannot borrow -} - -fn assign_field2<'a>(x: &'a Own) { - x.y = 3; //~ ERROR cannot borrow -} - -fn assign_field3<'a>(x: &'a mut Own) { - x.y = 3; -} - -fn assign_field4<'a>(x: &'a mut Own) { - let _p: &mut Point = &mut **x; - x.y = 3; //~ ERROR cannot borrow - use_mut(_p); -} -fn deref_imm_method(x: Own) { - let __isize = x.get(); -} - -fn deref_mut_method1(x: Own) { - x.set(0, 0); //~ ERROR cannot borrow -} - -fn deref_mut_method2(mut x: Own) { - x.set(0, 0); -} - -fn deref_extend_method(x: &Own) -> &isize { - x.x_ref() -} - -fn deref_extend_mut_method1(x: &Own) -> &mut isize { - x.y_mut() //~ ERROR cannot borrow -} - -fn deref_extend_mut_method2(x: &mut Own) -> &mut isize { - x.y_mut() -} - -fn assign_method1<'a>(x: Own) { - *x.y_mut() = 3; //~ ERROR cannot borrow -} - -fn assign_method2<'a>(x: &'a Own) { - *x.y_mut() = 3; //~ ERROR cannot borrow -} - -fn assign_method3<'a>(x: &'a mut Own) { - *x.y_mut() = 3; -} - -pub fn main() {} - -fn use_mut(_: &mut T) {} diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr deleted file mode 100644 index e4ec9f875..000000000 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr +++ /dev/null @@ -1,88 +0,0 @@ -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:53:24 - | -LL | fn deref_mut_field1(x: Own) { - | - help: consider changing this to be mutable: `mut x` -LL | let __isize = &mut x.y; - | ^ cannot borrow as mutable - -error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:65:10 - | -LL | fn deref_extend_mut_field1(x: &Own) -> &mut isize { - | ----------- help: consider changing this to be a mutable reference: `&mut Own` -LL | &mut x.y - | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:78:19 - | -LL | let _x = &mut x.x; - | - first mutable borrow occurs here -LL | let _y = &mut x.y; - | ^ second mutable borrow occurs here -LL | use_mut(_x); - | -- first borrow later used here - -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:5 - | -LL | fn assign_field1<'a>(x: Own) { - | - help: consider changing this to be mutable: `mut x` -LL | x.y = 3; - | ^ cannot borrow as mutable - -error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:92:5 - | -LL | fn assign_field2<'a>(x: &'a Own) { - | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | x.y = 3; - | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:101:5 - | -LL | let _p: &mut Point = &mut **x; - | -- first mutable borrow occurs here -LL | x.y = 3; - | ^ second mutable borrow occurs here -LL | use_mut(_p); - | -- first borrow later used here - -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:109:5 - | -LL | fn deref_mut_method1(x: Own) { - | - help: consider changing this to be mutable: `mut x` -LL | x.set(0, 0); - | ^^^^^^^^^^^ cannot borrow as mutable - -error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:121:5 - | -LL | fn deref_extend_mut_method1(x: &Own) -> &mut isize { - | ----------- help: consider changing this to be a mutable reference: `&mut Own` -LL | x.y_mut() - | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:129:6 - | -LL | fn assign_method1<'a>(x: Own) { - | - help: consider changing this to be mutable: `mut x` -LL | *x.y_mut() = 3; - | ^^^^^^^^^ cannot borrow as mutable - -error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:133:6 - | -LL | fn assign_method2<'a>(x: &'a Own) { - | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | *x.y_mut() = 3; - | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error: aborting due to 10 previous errors - -Some errors have detailed explanations: E0499, E0596. -For more information about an error, try `rustc --explain E0499`. diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.rs b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.rs deleted file mode 100644 index 8d43d5da4..000000000 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Test how overloaded deref interacts with borrows when DerefMut -// is implemented. - -use std::ops::{Deref, DerefMut}; - -struct Own { - value: *mut T -} - -impl Deref for Own { - type Target = T; - - fn deref<'a>(&'a self) -> &'a T { - unsafe { &*self.value } - } -} - -impl DerefMut for Own { - fn deref_mut<'a>(&'a mut self) -> &'a mut T { - unsafe { &mut *self.value } - } -} - -fn deref_imm(x: Own) { - let __isize = &*x; -} - -fn deref_mut1(x: Own) { - let __isize = &mut *x; //~ ERROR cannot borrow -} - -fn deref_mut2(mut x: Own) { - let __isize = &mut *x; -} - -fn deref_extend<'a>(x: &'a Own) -> &'a isize { - &**x -} - -fn deref_extend_mut1<'a>(x: &'a Own) -> &'a mut isize { - &mut **x //~ ERROR cannot borrow -} - -fn deref_extend_mut2<'a>(x: &'a mut Own) -> &'a mut isize { - &mut **x -} - -fn assign1<'a>(x: Own) { - *x = 3; //~ ERROR cannot borrow -} - -fn assign2<'a>(x: &'a Own) { - **x = 3; //~ ERROR cannot borrow -} - -fn assign3<'a>(x: &'a mut Own) { - **x = 3; -} - -pub fn main() {} diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr deleted file mode 100644 index 3ebfba7e4..000000000 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:29:25 - | -LL | fn deref_mut1(x: Own) { - | - help: consider changing this to be mutable: `mut x` -LL | let __isize = &mut *x; - | ^ cannot borrow as mutable - -error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:41:11 - | -LL | fn deref_extend_mut1<'a>(x: &'a Own) -> &'a mut isize { - | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | &mut **x - | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:49:6 - | -LL | fn assign1<'a>(x: Own) { - | - help: consider changing this to be mutable: `mut x` -LL | *x = 3; - | ^ cannot borrow as mutable - -error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:53:6 - | -LL | fn assign2<'a>(x: &'a Own) { - | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | **x = 3; - | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs deleted file mode 100644 index 938fdaf11..000000000 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs +++ /dev/null @@ -1,62 +0,0 @@ -#![feature(fn_traits)] - -// Ensure that invoking a closure counts as a unique immutable borrow - -type Fn<'a> = Box; - -struct Test<'a> { - f: Box -} - -fn call(mut f: F) where F: FnMut(Fn) { - f(Box::new(|| { - //~^ ERROR: cannot borrow `f` as mutable more than once - f((Box::new(|| {}))) - })); -} - -fn test1() { - call(|mut a| { - a.call_mut(()); - }); -} - -fn test2(f: &F) where F: FnMut() { - (*f)(); - //~^ ERROR cannot borrow `*f` as mutable, as it is behind a `&` reference -} - -fn test3(f: &mut F) where F: FnMut() { - (*f)(); -} - -fn test4(f: &Test) { - f.f.call_mut(()) - //~^ ERROR: cannot borrow `f.f` as mutable, as it is behind a `&` reference -} - -fn test5(f: &mut Test) { - f.f.call_mut(()) -} - -fn test6() { - let mut f = || {}; - (|| { - f(); - })(); -} - -fn test7() { - fn foo(_: F) where F: FnMut(Box, isize) {} - let s = String::new(); // Capture to make f !Copy - let mut f = move |g: Box, b: isize| { - let _ = s.len(); - }; - f(Box::new(|a| { - //~^ ERROR cannot move out of `f` because it is borrowed - foo(f); - //~^ ERROR cannot move out of `f`, a captured variable in an `FnMut` closure - }), 3); -} - -fn main() {} diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr deleted file mode 100644 index 6b43801b5..000000000 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ /dev/null @@ -1,55 +0,0 @@ -error[E0499]: cannot borrow `f` as mutable more than once at a time - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:12:16 - | -LL | f(Box::new(|| { - | - ^^ second mutable borrow occurs here - | | - | first mutable borrow occurs here - | first borrow later used by call -LL | -LL | f((Box::new(|| {}))) - | - second borrow occurs due to use of `f` in closure - -error[E0596]: cannot borrow `*f` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:25:5 - | -LL | fn test2(f: &F) where F: FnMut() { - | -- help: consider changing this to be a mutable reference: `&mut F` -LL | (*f)(); - | ^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error[E0596]: cannot borrow `f.f` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5 - | -LL | fn test4(f: &Test) { - | ----- help: consider changing this to be a mutable reference: `&mut Test<'_>` -LL | f.f.call_mut(()) - | ^^^^^^^^^^^^^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error[E0507]: cannot move out of `f`, a captured variable in an `FnMut` closure - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13 - | -LL | let mut f = move |g: Box, b: isize| { - | ----- captured outer variable -... -LL | f(Box::new(|a| { - | --- captured by this `FnMut` closure -LL | -LL | foo(f); - | ^ move occurs because `f` has type `[closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58]`, which does not implement the `Copy` trait - -error[E0505]: cannot move out of `f` because it is borrowed - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16 - | -LL | f(Box::new(|a| { - | - ^^^ move out of `f` occurs here - | | - | borrow of `f` occurs here -LL | -LL | foo(f); - | - move occurs due to use in closure - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0499, E0505, E0507, E0596. -For more information about an error, try `rustc --explain E0499`. diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.rs b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.rs deleted file mode 100644 index caf2d2a55..000000000 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.rs +++ /dev/null @@ -1,21 +0,0 @@ -struct Foo { - x: isize, -} - -impl Foo { - pub fn f(&self) {} - pub fn h(&mut self) {} -} - -fn a(x: &mut Foo) { - x.f(); - x.h(); -} - -fn b(x: &Foo) { - x.f(); - x.h(); //~ ERROR cannot borrow -} - -fn main() { -} diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr deleted file mode 100644 index 1864f5de1..000000000 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-call-method-from-mut-aliasable.rs:17:5 - | -LL | fn b(x: &Foo) { - | ---- help: consider changing this to be a mutable reference: `&mut Foo` -LL | x.f(); -LL | x.h(); - | ^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/span/borrowck-fn-in-const-b.rs b/src/test/ui/span/borrowck-fn-in-const-b.rs deleted file mode 100644 index 822083efe..000000000 --- a/src/test/ui/span/borrowck-fn-in-const-b.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Check that we check fns appearing in constant declarations. -// Issue #22382. - -// How about mutating an immutable vector? -const MUTATE: fn(&Vec) = { - fn broken(x: &Vec) { - x.push(format!("this is broken")); - //~^ ERROR cannot borrow - } - broken -}; - -fn main() { -} diff --git a/src/test/ui/span/borrowck-fn-in-const-b.stderr b/src/test/ui/span/borrowck-fn-in-const-b.stderr deleted file mode 100644 index 1f5d8bd32..000000000 --- a/src/test/ui/span/borrowck-fn-in-const-b.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-fn-in-const-b.rs:7:9 - | -LL | fn broken(x: &Vec) { - | ------------ help: consider changing this to be a mutable reference: `&mut Vec` -LL | x.push(format!("this is broken")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs deleted file mode 100644 index 18abfb5c3..000000000 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs +++ /dev/null @@ -1,59 +0,0 @@ -fn id(x: T) -> T { x } - -fn f() { - let old = ['o']; // statement 0 - let mut v1 = Vec::new(); // statement 1 - - let mut v2 = Vec::new(); // statement 2 - - { - let young = ['y']; // statement 3 - - v2.push(&young[0]); // statement 4 - //~^ ERROR `young[_]` does not live long enough - //~| NOTE borrowed value does not live long enough - } //~ NOTE `young[_]` dropped here while still borrowed - - let mut v3 = Vec::new(); // statement 5 - - v3.push(&id('x')); // statement 6 - //~^ ERROR temporary value dropped while borrowed - //~| NOTE creates a temporary value which is freed while still in use - //~| NOTE temporary value is freed at the end of this statement - //~| HELP consider using a `let` binding to create a longer lived value - - { - - let mut v4 = Vec::new(); // (sub) statement 0 - - v4.push(&id('y')); - //~^ ERROR temporary value dropped while borrowed - //~| NOTE creates a temporary value which is freed while still in use - //~| NOTE temporary value is freed at the end of this statement - //~| NOTE consider using a `let` binding to create a longer lived value - v4.use_ref(); - //~^ NOTE borrow later used here - } // (statement 7) - - let mut v5 = Vec::new(); // statement 8 - - v5.push(&id('z')); - //~^ ERROR temporary value dropped while borrowed - //~| NOTE creates a temporary value which is freed while still in use - //~| NOTE temporary value is freed at the end of this statement - //~| HELP consider using a `let` binding to create a longer lived value - - v1.push(&old[0]); - - (v1, v2, v3, /* v4 is above. */ v5).use_ref(); - //~^ NOTE borrow later used here - //~| NOTE borrow later used here - //~| NOTE borrow later used here -} - -fn main() { - f(); -} - -trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } -impl Fake for T { } diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr deleted file mode 100644 index 2dc29a78d..000000000 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0597]: `young[_]` does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:12:17 - | -LL | v2.push(&young[0]); // statement 4 - | ^^^^^^^^^ borrowed value does not live long enough -... -LL | } - | - `young[_]` dropped here while still borrowed -... -LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); - | -- borrow later used here - -error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion-suffixes.rs:19:14 - | -LL | v3.push(&id('x')); // statement 6 - | ^^^^^^^ - temporary value is freed at the end of this statement - | | - | creates a temporary value which is freed while still in use -... -LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); - | -- borrow later used here - | -help: consider using a `let` binding to create a longer lived value - | -LL ~ let binding = id('x'); -LL ~ v3.push(&binding); // statement 6 - | - -error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion-suffixes.rs:29:18 - | -LL | v4.push(&id('y')); - | ^^^^^^^ - temporary value is freed at the end of this statement - | | - | creates a temporary value which is freed while still in use -... -LL | v4.use_ref(); - | ------------ borrow later used here - | - = note: consider using a `let` binding to create a longer lived value - -error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion-suffixes.rs:40:14 - | -LL | v5.push(&id('z')); - | ^^^^^^^ - temporary value is freed at the end of this statement - | | - | creates a temporary value which is freed while still in use -... -LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); - | -- borrow later used here - | -help: consider using a `let` binding to create a longer lived value - | -LL ~ let binding = id('z'); -LL ~ v5.push(&binding); - | - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0597, E0716. -For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/borrowck-object-mutability.rs b/src/test/ui/span/borrowck-object-mutability.rs deleted file mode 100644 index f5adc2cc1..000000000 --- a/src/test/ui/span/borrowck-object-mutability.rs +++ /dev/null @@ -1,26 +0,0 @@ -trait Foo { - fn borrowed(&self); - fn borrowed_mut(&mut self); -} - -fn borrowed_receiver(x: &dyn Foo) { - x.borrowed(); - x.borrowed_mut(); //~ ERROR cannot borrow -} - -fn borrowed_mut_receiver(x: &mut dyn Foo) { - x.borrowed(); - x.borrowed_mut(); -} - -fn owned_receiver(x: Box) { - x.borrowed(); - x.borrowed_mut(); //~ ERROR cannot borrow -} - -fn mut_owned_receiver(mut x: Box) { - x.borrowed(); - x.borrowed_mut(); -} - -fn main() {} diff --git a/src/test/ui/span/borrowck-object-mutability.stderr b/src/test/ui/span/borrowck-object-mutability.stderr deleted file mode 100644 index cc43f6d09..000000000 --- a/src/test/ui/span/borrowck-object-mutability.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-object-mutability.rs:8:5 - | -LL | fn borrowed_receiver(x: &dyn Foo) { - | -------- help: consider changing this to be a mutable reference: `&mut dyn Foo` -LL | x.borrowed(); -LL | x.borrowed_mut(); - | ^^^^^^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable - --> $DIR/borrowck-object-mutability.rs:18:5 - | -LL | fn owned_receiver(x: Box) { - | - help: consider changing this to be mutable: `mut x` -LL | x.borrowed(); -LL | x.borrowed_mut(); - | ^^^^^^^^^^^^^^^^ cannot borrow as mutable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.fixed b/src/test/ui/span/borrowck-ref-into-rvalue.fixed deleted file mode 100644 index 51f65e534..000000000 --- a/src/test/ui/span/borrowck-ref-into-rvalue.fixed +++ /dev/null @@ -1,13 +0,0 @@ -// run-rustfix -fn main() { - let msg; - let binding = Some("Hello".to_string()); - match binding { - //~^ ERROR temporary value dropped while borrowed - Some(ref m) => { - msg = m; - }, - None => { panic!() } - } - println!("{}", *msg); -} diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.rs b/src/test/ui/span/borrowck-ref-into-rvalue.rs deleted file mode 100644 index 7b09fad92..000000000 --- a/src/test/ui/span/borrowck-ref-into-rvalue.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-rustfix -fn main() { - let msg; - match Some("Hello".to_string()) { - //~^ ERROR temporary value dropped while borrowed - Some(ref m) => { - msg = m; - }, - None => { panic!() } - } - println!("{}", *msg); -} diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.stderr b/src/test/ui/span/borrowck-ref-into-rvalue.stderr deleted file mode 100644 index 25e344fed..000000000 --- a/src/test/ui/span/borrowck-ref-into-rvalue.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-ref-into-rvalue.rs:4:11 - | -LL | match Some("Hello".to_string()) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use -... -LL | } - | - temporary value is freed at the end of this statement -LL | println!("{}", *msg); - | ---- borrow later used here - | -help: consider using a `let` binding to create a longer lived value - | -LL ~ let binding = Some("Hello".to_string()); -LL ~ match binding { - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/span/coerce-suggestions.rs b/src/test/ui/span/coerce-suggestions.rs deleted file mode 100644 index 7920ae0b2..000000000 --- a/src/test/ui/span/coerce-suggestions.rs +++ /dev/null @@ -1,23 +0,0 @@ -fn test(_x: &mut String) {} - -fn test2(_x: &mut i32) {} - - -fn main() { - let x: usize = String::new(); - //~^ ERROR E0308 - let x: &str = String::new(); - //~^ ERROR E0308 - let y = String::new(); - test(&y); - //~^ ERROR E0308 - test2(&y); - //~^ ERROR E0308 - let f; - f = Box::new(f); - //~^ ERROR E0308 - - let s = &mut String::new(); - s = format!("foo"); - //~^ ERROR E0308 -} diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr deleted file mode 100644 index db784d5fe..000000000 --- a/src/test/ui/span/coerce-suggestions.stderr +++ /dev/null @@ -1,72 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:7:20 - | -LL | let x: usize = String::new(); - | ----- ^^^^^^^^^^^^^ expected `usize`, found struct `String` - | | - | expected due to this - -error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:9:19 - | -LL | let x: &str = String::new(); - | ---- ^^^^^^^^^^^^^ - | | | - | | expected `&str`, found struct `String` - | | help: consider borrowing here: `&String::new()` - | expected due to this - -error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:12:10 - | -LL | test(&y); - | ---- ^^ types differ in mutability - | | - | arguments to this function are incorrect - | - = note: expected mutable reference `&mut String` - found reference `&String` -note: function defined here - --> $DIR/coerce-suggestions.rs:1:4 - | -LL | fn test(_x: &mut String) {} - | ^^^^ --------------- - -error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:14:11 - | -LL | test2(&y); - | ----- ^^ types differ in mutability - | | - | arguments to this function are incorrect - | - = note: expected mutable reference `&mut i32` - found reference `&String` -note: function defined here - --> $DIR/coerce-suggestions.rs:3:4 - | -LL | fn test2(_x: &mut i32) {} - | ^^^^^ ------------ - -error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:17:9 - | -LL | f = Box::new(f); - | ^^^^^^^^^^^ cyclic type of infinite size - | -help: consider unboxing the value - | -LL | f = *Box::new(f); - | + - -error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:21:9 - | -LL | s = format!("foo"); - | ^^^^^^^^^^^^^^ expected `&mut String`, found struct `String` - | - = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/span/destructor-restrictions.rs b/src/test/ui/span/destructor-restrictions.rs deleted file mode 100644 index 7fb348a14..000000000 --- a/src/test/ui/span/destructor-restrictions.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Tests the new destructor semantics. - -use std::cell::RefCell; - -fn main() { - let b = { - let a = Box::new(RefCell::new(4)); - *a.borrow() + 1 - }; //~^ ERROR `*a` does not live long enough - println!("{}", b); -} diff --git a/src/test/ui/span/destructor-restrictions.stderr b/src/test/ui/span/destructor-restrictions.stderr deleted file mode 100644 index 53c940462..000000000 --- a/src/test/ui/span/destructor-restrictions.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0597]: `*a` does not live long enough - --> $DIR/destructor-restrictions.rs:8:10 - | -LL | *a.borrow() + 1 - | ^^^^^^^^^^ - | | - | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... -LL | }; - | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Ref<'_, i32>` - | | - | `*a` dropped here while still borrowed - | - = note: the temporary is part of an expression at the end of a block; - consider forcing this temporary to be dropped sooner, before the block's local variables are dropped -help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block - | -LL | let x = *a.borrow() + 1; x - | +++++++ +++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs deleted file mode 100644 index 4559da91e..000000000 --- a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs +++ /dev/null @@ -1,18 +0,0 @@ -// compile-flags: -Wrust-2021-incompatible-closure-captures - -pub struct A {} - -impl A { - async fn create(path: impl AsRef) { //~ ERROR `async fn` is not permitted in Rust 2015 - //~^ WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures] - ; - crate(move || {} ).await //~ ERROR expected function, found module `crate` - } -} - -trait C{async fn new(val: T) {} //~ ERROR `async fn` is not permitted in Rust 2015 -//~^ ERROR functions in traits cannot be declared `async` -//~| ERROR cannot find type `T` in this scope -//~| WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures] - -//~ ERROR this file contains an unclosed delimiter diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr deleted file mode 100644 index df1cafdb7..000000000 --- a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr +++ /dev/null @@ -1,95 +0,0 @@ -error: this file contains an unclosed delimiter - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:18:53 - | -LL | trait C{async fn new(val: T) {} - | - unclosed delimiter -... -LL | - | ^ - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:5 - | -LL | async fn create(path: impl AsRef) { - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9 - | -LL | trait C{async fn new(val: T) {} - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0412]: cannot find type `T` in this scope - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:27 - | -LL | pub struct A {} - | ------------ similarly named struct `A` defined here -... -LL | trait C{async fn new(val: T) {} - | ^ help: a struct with a similar name exists: `A` - -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9 - | -LL | trait C{async fn new(val: T) {} - | -----^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = note: `async` trait functions are not currently supported - = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait - = note: see issue #91611 for more information - = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable - -error[E0423]: expected function, found module `crate` - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:9:5 - | -LL | crate(move || {} ).await - | ^^^^^ not a function - -warning: changes to closure capture in Rust 2021 will affect drop order - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:57 - | -LL | async fn create(path: impl AsRef) { - | _____________________----_____________________________-__^ - | | | | - | | | in Rust 2018, `path` is dropped here along with the closure, but in Rust 2021 `path` is not part of the closure - | | in Rust 2018, this causes the closure to capture `path`, but in Rust 2021, it has no effect -LL | | -LL | | ; -LL | | crate(move || {} ).await -LL | | } - | |_____^ - | - = note: for more information, see - = note: requested on the command line with `-W rust-2021-incompatible-closure-captures` -help: add a dummy let to cause `path` to be fully captured - | -LL | async fn create(path: impl AsRef) { let _ = &path; - | ++++++++++++++ - -warning: changes to closure capture in Rust 2021 will affect drop order - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30 - | -LL | trait C{async fn new(val: T) {} - | --- - ^^ - | | | - | | in Rust 2018, `val` is dropped here along with the closure, but in Rust 2021 `val` is not part of the closure - | in Rust 2018, this causes the closure to capture `val`, but in Rust 2021, it has no effect - | - = note: for more information, see -help: add a dummy let to cause `val` to be fully captured - | -LL | trait C{async fn new(val: T) { let _ = &val;} - | +++++++++++++ - -error: aborting due to 6 previous errors; 2 warnings emitted - -Some errors have detailed explanations: E0412, E0423, E0670, E0706. -For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs deleted file mode 100644 index a776e5089..000000000 --- a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs +++ /dev/null @@ -1,15 +0,0 @@ -// compile-flags -Wrust-2021-incompatible-closure-captures - -fn main() {} - -pub(crate) struct Numberer {} - -impl Numberer { - pub(crate) async fn new( - //~^ ERROR `async fn` is not permitted in Rust 2015 - interval: Duration, - //~^ ERROR cannot find type `Duration` in this scope - ) -> Numberer { - Numberer {} - } -} diff --git a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr b/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr deleted file mode 100644 index 37b2f4138..000000000 --- a/src/test/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0670]: `async fn` is not permitted in Rust 2015 - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs:8:16 - | -LL | pub(crate) async fn new( - | ^^^^^ to use `async fn`, switch to Rust 2018 or later - | - = help: pass `--edition 2021` to `rustc` - = note: for more on editions, read https://doc.rust-lang.org/edition-guide - -error[E0412]: cannot find type `Duration` in this scope - --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.rs:10:19 - | -LL | interval: Duration, - | ^^^^^^^^ not found in this scope - | -help: consider importing this struct - | -LL | use std::time::Duration; - | - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0412, E0670. -For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/span/dropck-object-cycle.rs b/src/test/ui/span/dropck-object-cycle.rs deleted file mode 100644 index a26123d52..000000000 --- a/src/test/ui/span/dropck-object-cycle.rs +++ /dev/null @@ -1,47 +0,0 @@ -// This test used to be part of a run-pass test, but revised outlives -// rule means that it no longer compiles. - -#![allow(unused_variables)] - -trait Trait<'a> { - fn long(&'a self) -> isize; - fn short<'b>(&'b self) -> isize; -} - -fn object_invoke1<'d>(x: &'d dyn Trait<'d>) -> (isize, isize) { loop { } } - -trait MakerTrait { - fn mk() -> Self; -} - -fn make_val() -> T { - MakerTrait::mk() -} - -impl<'t> MakerTrait for Box+'static> { - fn mk() -> Box+'static> { loop { } } -} - -pub fn main() { - let m : Box = make_val(); - assert_eq!(object_invoke1(&*m), (4,5)); - //~^ ERROR `*m` does not live long enough - - // the problem here is that the full type of `m` is - // - // Box+'static> - // - // Here `'m` must be exactly the lifetime of the variable `m`. - // This is because of two requirements: - // 1. First, the basic type rules require that the - // type of `m`'s value outlives the lifetime of `m`. This puts a lower - // bound `'m`. - // - // 2. Meanwhile, the signature of `object_invoke1` requires that - // we create a reference of type `&'d Trait<'d>` for some `'d`. - // `'d` cannot outlive `'m`, so that forces the lifetime to be `'m`. - // - // This then conflicts with the dropck rules, which require that - // the type of `m` *strictly outlives* `'m`. Hence we get an - // error. -} diff --git a/src/test/ui/span/dropck-object-cycle.stderr b/src/test/ui/span/dropck-object-cycle.stderr deleted file mode 100644 index 229d17e1c..000000000 --- a/src/test/ui/span/dropck-object-cycle.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0597]: `*m` does not live long enough - --> $DIR/dropck-object-cycle.rs:27:31 - | -LL | assert_eq!(object_invoke1(&*m), (4,5)); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `*m` dropped here while still borrowed - | borrow might be used here, when `m` is dropped and runs the destructor for type `Box>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/dropck_arr_cycle_checked.rs b/src/test/ui/span/dropck_arr_cycle_checked.rs deleted file mode 100644 index a14db5ff0..000000000 --- a/src/test/ui/span/dropck_arr_cycle_checked.rs +++ /dev/null @@ -1,106 +0,0 @@ -// Reject mixing cyclic structure and Drop when using fixed length -// arrays. -// -// (Compare against ui/span/dropck_vec_cycle_checked.rs) - - - -use std::cell::Cell; -use id::Id; - -mod s { - use std::sync::atomic::{AtomicUsize, Ordering}; - - static S_COUNT: AtomicUsize = AtomicUsize::new(0); - - pub fn next_count() -> usize { - S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 - } -} - -mod id { - use s; - #[derive(Debug)] - pub struct Id { - orig_count: usize, - count: usize, - } - - impl Id { - pub fn new() -> Id { - let c = s::next_count(); - println!("building Id {}", c); - Id { orig_count: c, count: c } - } - pub fn count(&self) -> usize { - println!("Id::count on {} returns {}", self.orig_count, self.count); - self.count - } - } - - impl Drop for Id { - fn drop(&mut self) { - println!("dropping Id {}", self.count); - self.count = 0; - } - } -} - -trait HasId { - fn count(&self) -> usize; -} - -#[derive(Debug)] -struct CheckId { - v: T -} - -#[allow(non_snake_case)] -fn CheckId(t: T) -> CheckId { CheckId{ v: t } } - -impl Drop for CheckId { - fn drop(&mut self) { - assert!(self.v.count() > 0); - } -} - -#[derive(Debug)] -struct B<'a> { - id: Id, - a: [CheckId>>>; 2] -} - -impl<'a> HasId for Cell>> { - fn count(&self) -> usize { - match self.get() { - None => 1, - Some(b) => b.id.count(), - } - } -} - -impl<'a> B<'a> { - fn new() -> B<'a> { - B { id: Id::new(), a: [CheckId(Cell::new(None)), CheckId(Cell::new(None))] } - } -} - -fn f() { - let (b1, b2, b3); - b1 = B::new(); - b2 = B::new(); - b3 = B::new(); - b1.a[0].v.set(Some(&b2)); - //~^ ERROR `b2` does not live long enough - b1.a[1].v.set(Some(&b3)); - //~^ ERROR `b3` does not live long enough - b2.a[0].v.set(Some(&b2)); - b2.a[1].v.set(Some(&b3)); - b3.a[0].v.set(Some(&b1)); - //~^ ERROR `b1` does not live long enough - b3.a[1].v.set(Some(&b2)); -} - -fn main() { - f(); -} diff --git a/src/test/ui/span/dropck_arr_cycle_checked.stderr b/src/test/ui/span/dropck_arr_cycle_checked.stderr deleted file mode 100644 index 068c779ae..000000000 --- a/src/test/ui/span/dropck_arr_cycle_checked.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0597]: `b2` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:93:24 - | -LL | b1.a[0].v.set(Some(&b2)); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `b2` dropped here while still borrowed - | borrow might be used here, when `b1` is dropped and runs the destructor for type `B<'_>` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `b3` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:95:24 - | -LL | b1.a[1].v.set(Some(&b3)); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `b3` dropped here while still borrowed - | borrow might be used here, when `b1` is dropped and runs the destructor for type `B<'_>` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `b1` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:99:24 - | -LL | b3.a[0].v.set(Some(&b1)); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `b1` dropped here while still borrowed - | borrow might be used here, when `b1` is dropped and runs the destructor for type `B<'_>` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.rs b/src/test/ui/span/dropck_direct_cycle_with_drop.rs deleted file mode 100644 index 14d6e6654..000000000 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.rs +++ /dev/null @@ -1,44 +0,0 @@ -// A simple example of an unsound mixing of cyclic structure and Drop. -// -// Each `D` has a name and an optional reference to another `D` -// sibling, but also implements a drop method that prints out its own -// name as well as the name of its sibling. -// -// By setting up a cyclic structure, the drop code cannot possibly -// work. Therefore this code must be rejected. -// -// (As it turns out, essentially any attempt to install a sibling here -// will be rejected, regardless of whether it forms a cyclic -// structure or not. This is because the use of the same lifetime -// `'a` in `&'a D<'a>` cannot be satisfied when `D<'a>` implements -// `Drop`.) - -use std::cell::Cell; - -struct D<'a> { - name: String, - p: Cell>>, -} - -impl<'a> D<'a> { - fn new(name: String) -> D<'a> { D { name: name, p: Cell::new(None) } } -} - -impl<'a> Drop for D<'a> { - fn drop(&mut self) { - println!("dropping {} whose sibling is {:?}", - self.name, self.p.get().map(|d| &d.name)); - } -} - -fn g() { - let (d1, d2) = (D::new(format!("d1")), D::new(format!("d2"))); - d1.p.set(Some(&d2)); - //~^ ERROR `d2` does not live long enough - d2.p.set(Some(&d1)); - //~^ ERROR `d1` does not live long enough -} - -fn main() { - g(); -} diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr deleted file mode 100644 index 07ae138ac..000000000 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0597]: `d2` does not live long enough - --> $DIR/dropck_direct_cycle_with_drop.rs:36:19 - | -LL | d1.p.set(Some(&d2)); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `d2` dropped here while still borrowed - | borrow might be used here, when `d1` is dropped and runs the `Drop` code for type `D` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `d1` does not live long enough - --> $DIR/dropck_direct_cycle_with_drop.rs:38:19 - | -LL | d2.p.set(Some(&d1)); - | ^^^ borrowed value does not live long enough -LL | -LL | } - | - - | | - | `d1` dropped here while still borrowed - | borrow might be used here, when `d1` is dropped and runs the `Drop` code for type `D` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/dropck_misc_variants.rs b/src/test/ui/span/dropck_misc_variants.rs deleted file mode 100644 index 5818a94bc..000000000 --- a/src/test/ui/span/dropck_misc_variants.rs +++ /dev/null @@ -1,37 +0,0 @@ -// check that dropck does the right thing with misc. Ty variants - -use std::fmt; -struct NoisyDrop(T); -impl Drop for NoisyDrop { - fn drop(&mut self) { - let _ = vec!["0wned"]; - println!("dropping {:?}", self.0) - } -} - -trait Associator { - type As; -} -impl Associator for T { - type As = NoisyDrop; -} -struct Wrap(::As); - -fn projection() { - let (_w, bomb); - bomb = vec![""]; - _w = Wrap::<&[&str]>(NoisyDrop(&bomb)); -} -//~^^ ERROR `bomb` does not live long enough - -fn closure() { - let (_w,v); - v = vec![""]; - _w = { - let u = NoisyDrop(&v); - //~^ ERROR `v` does not live long enough - move || u.0.len() - }; -} - -fn main() { closure(); projection() } diff --git a/src/test/ui/span/dropck_misc_variants.stderr b/src/test/ui/span/dropck_misc_variants.stderr deleted file mode 100644 index 76e90574c..000000000 --- a/src/test/ui/span/dropck_misc_variants.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error[E0597]: `bomb` does not live long enough - --> $DIR/dropck_misc_variants.rs:23:36 - | -LL | _w = Wrap::<&[&str]>(NoisyDrop(&bomb)); - | ^^^^^ borrowed value does not live long enough -LL | } - | - - | | - | `bomb` dropped here while still borrowed - | borrow might be used here, when `_w` is dropped and runs the destructor for type `Wrap<&[&str]>` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `v` does not live long enough - --> $DIR/dropck_misc_variants.rs:31:27 - | -LL | let u = NoisyDrop(&v); - | ^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `v` dropped here while still borrowed - | borrow might be used here, when `_w` is dropped and runs the destructor for closure - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/dropck_vec_cycle_checked.rs b/src/test/ui/span/dropck_vec_cycle_checked.rs deleted file mode 100644 index c5d21507d..000000000 --- a/src/test/ui/span/dropck_vec_cycle_checked.rs +++ /dev/null @@ -1,111 +0,0 @@ -// Reject mixing cyclic structure and Drop when using Vec. -// -// (Compare against ui/span/dropck_arr_cycle_checked.rs) - -use std::cell::Cell; -use id::Id; - -mod s { - use std::sync::atomic::{AtomicUsize, Ordering}; - - static S_COUNT: AtomicUsize = AtomicUsize::new(0); - - pub fn next_count() -> usize { - S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 - } -} - -mod id { - use s; - #[derive(Debug)] - pub struct Id { - orig_count: usize, - count: usize, - } - - impl Id { - pub fn new() -> Id { - let c = s::next_count(); - println!("building Id {}", c); - Id { orig_count: c, count: c } - } - pub fn count(&self) -> usize { - println!("Id::count on {} returns {}", self.orig_count, self.count); - self.count - } - } - - impl Drop for Id { - fn drop(&mut self) { - println!("dropping Id {}", self.count); - self.count = 0; - } - } -} - -trait HasId { - fn count(&self) -> usize; -} - -#[derive(Debug)] -struct CheckId { - v: T -} - -#[allow(non_snake_case)] -fn CheckId(t: T) -> CheckId { CheckId{ v: t } } - -impl Drop for CheckId { - fn drop(&mut self) { - assert!(self.v.count() > 0); - } -} - -#[derive(Debug)] -struct C<'a> { - id: Id, - v: Vec>>>>, -} - -impl<'a> HasId for Cell>> { - fn count(&self) -> usize { - match self.get() { - None => 1, - Some(c) => c.id.count(), - } - } -} - -impl<'a> C<'a> { - fn new() -> C<'a> { - C { id: Id::new(), v: Vec::new() } - } -} - -fn f() { - let (mut c1, mut c2, mut c3); - c1 = C::new(); - c2 = C::new(); - c3 = C::new(); - - c1.v.push(CheckId(Cell::new(None))); - c1.v.push(CheckId(Cell::new(None))); - c2.v.push(CheckId(Cell::new(None))); - c2.v.push(CheckId(Cell::new(None))); - c3.v.push(CheckId(Cell::new(None))); - c3.v.push(CheckId(Cell::new(None))); - - c1.v[0].v.set(Some(&c2)); - //~^ ERROR `c2` does not live long enough - c1.v[1].v.set(Some(&c3)); - //~^ ERROR `c3` does not live long enough - c2.v[0].v.set(Some(&c2)); - c2.v[1].v.set(Some(&c3)); - c3.v[0].v.set(Some(&c1)); - //~^ ERROR `c1` does not live long enough - c3.v[1].v.set(Some(&c2)); -} - -fn main() { - f(); -} diff --git a/src/test/ui/span/dropck_vec_cycle_checked.stderr b/src/test/ui/span/dropck_vec_cycle_checked.stderr deleted file mode 100644 index 7ff991c0c..000000000 --- a/src/test/ui/span/dropck_vec_cycle_checked.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0597]: `c2` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:98:24 - | -LL | c1.v[0].v.set(Some(&c2)); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `c2` dropped here while still borrowed - | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `c3` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:100:24 - | -LL | c1.v[1].v.set(Some(&c3)); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `c3` dropped here while still borrowed - | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `c1` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:104:24 - | -LL | c3.v[0].v.set(Some(&c1)); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `c1` dropped here while still borrowed - | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/gated-features-attr-spans.rs b/src/test/ui/span/gated-features-attr-spans.rs deleted file mode 100644 index 69511ab8e..000000000 --- a/src/test/ui/span/gated-features-attr-spans.rs +++ /dev/null @@ -1,7 +0,0 @@ -#[repr(simd)] //~ ERROR are experimental -struct Coord { - x: u32, - y: u32, -} - -fn main() {} diff --git a/src/test/ui/span/gated-features-attr-spans.stderr b/src/test/ui/span/gated-features-attr-spans.stderr deleted file mode 100644 index c8b8f346b..000000000 --- a/src/test/ui/span/gated-features-attr-spans.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: SIMD types are experimental and possibly buggy - --> $DIR/gated-features-attr-spans.rs:1:1 - | -LL | #[repr(simd)] - | ^^^^^^^^^^^^^ - | - = note: see issue #27731 for more information - = help: add `#![feature(repr_simd)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/span/impl-wrong-item-for-trait.rs b/src/test/ui/span/impl-wrong-item-for-trait.rs deleted file mode 100644 index bf3358686..000000000 --- a/src/test/ui/span/impl-wrong-item-for-trait.rs +++ /dev/null @@ -1,38 +0,0 @@ -use std::fmt::Debug; - -trait Foo { - fn bar(&self); - const MY_CONST: u32; -} - -pub struct FooConstForMethod; - -impl Foo for FooConstForMethod { - //~^ ERROR E0046 - const bar: u64 = 1; - //~^ ERROR E0323 - const MY_CONST: u32 = 1; -} - -pub struct FooMethodForConst; - -impl Foo for FooMethodForConst { - //~^ ERROR E0046 - fn bar(&self) {} - fn MY_CONST() {} - //~^ ERROR E0324 -} - -pub struct FooTypeForMethod; - -impl Foo for FooTypeForMethod { - //~^ ERROR E0046 - type bar = u64; - //~^ ERROR E0325 - const MY_CONST: u32 = 1; -} - -impl Debug for FooTypeForMethod {} -//~^ ERROR E0046 - -fn main() {} diff --git a/src/test/ui/span/impl-wrong-item-for-trait.stderr b/src/test/ui/span/impl-wrong-item-for-trait.stderr deleted file mode 100644 index f919092f9..000000000 --- a/src/test/ui/span/impl-wrong-item-for-trait.stderr +++ /dev/null @@ -1,66 +0,0 @@ -error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:12:5 - | -LL | fn bar(&self); - | -------------- item in trait -... -LL | const bar: u64 = 1; - | ^^^^^^^^^^^^^^^^^^^ does not match trait - -error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:22:5 - | -LL | const MY_CONST: u32; - | -------------------- item in trait -... -LL | fn MY_CONST() {} - | ^^^^^^^^^^^^^^^^ does not match trait - -error[E0325]: item `bar` is an associated type, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:30:5 - | -LL | fn bar(&self); - | -------------- item in trait -... -LL | type bar = u64; - | ^^^^^^^^^^^^^^^ does not match trait - -error[E0046]: not all trait items implemented, missing: `bar` - --> $DIR/impl-wrong-item-for-trait.rs:10:1 - | -LL | fn bar(&self); - | -------------- `bar` from trait -... -LL | impl Foo for FooConstForMethod { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation - -error[E0046]: not all trait items implemented, missing: `MY_CONST` - --> $DIR/impl-wrong-item-for-trait.rs:19:1 - | -LL | const MY_CONST: u32; - | ------------------- `MY_CONST` from trait -... -LL | impl Foo for FooMethodForConst { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `MY_CONST` in implementation - -error[E0046]: not all trait items implemented, missing: `bar` - --> $DIR/impl-wrong-item-for-trait.rs:28:1 - | -LL | fn bar(&self); - | -------------- `bar` from trait -... -LL | impl Foo for FooTypeForMethod { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation - -error[E0046]: not all trait items implemented, missing: `fmt` - --> $DIR/impl-wrong-item-for-trait.rs:35:1 - | -LL | impl Debug for FooTypeForMethod {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation - | - = help: implement the missing item: `fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { todo!() }` - -error: aborting due to 7 previous errors - -Some errors have detailed explanations: E0046, E0323, E0324, E0325. -For more information about an error, try `rustc --explain E0046`. diff --git a/src/test/ui/span/import-ty-params.rs b/src/test/ui/span/import-ty-params.rs deleted file mode 100644 index 313cd227b..000000000 --- a/src/test/ui/span/import-ty-params.rs +++ /dev/null @@ -1,23 +0,0 @@ -mod a { - pub mod b { - pub mod c { - pub struct S(T); - } - } -} - -macro_rules! import { - ($p: path) => (use $p;); -} - -fn f1() { - import! { a::b::c::S } //~ ERROR unexpected generic arguments in path -} -fn f2() { - import! { a::b::c::S<> } //~ ERROR unexpected generic arguments in path -} -fn f3() { - import! { a::b<>::c::S<> } //~ ERROR unexpected generic arguments in path -} - -fn main() {} diff --git a/src/test/ui/span/import-ty-params.stderr b/src/test/ui/span/import-ty-params.stderr deleted file mode 100644 index 701cd0c04..000000000 --- a/src/test/ui/span/import-ty-params.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: unexpected generic arguments in path - --> $DIR/import-ty-params.rs:14:25 - | -LL | import! { a::b::c::S } - | ^^^^ - -error: unexpected generic arguments in path - --> $DIR/import-ty-params.rs:17:25 - | -LL | import! { a::b::c::S<> } - | ^^ - -error: unexpected generic arguments in path - --> $DIR/import-ty-params.rs:20:19 - | -LL | import! { a::b<>::c::S<> } - | ^^ ^^^^ ^^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/span/issue-11925.rs b/src/test/ui/span/issue-11925.rs deleted file mode 100644 index cac9fd5bf..000000000 --- a/src/test/ui/span/issue-11925.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(unboxed_closures, tuple_trait)] - -fn to_fn_once>(f: F) -> F { f } - -fn main() { - let r = { - let x: Box<_> = Box::new(42); - let f = to_fn_once(move|| &x); //~ ERROR cannot return reference to local data `x` - f() - }; - - drop(r); -} diff --git a/src/test/ui/span/issue-11925.stderr b/src/test/ui/span/issue-11925.stderr deleted file mode 100644 index 1d317fc33..000000000 --- a/src/test/ui/span/issue-11925.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0515]: cannot return reference to local data `x` - --> $DIR/issue-11925.rs:8:35 - | -LL | let f = to_fn_once(move|| &x); - | ^^ returns a reference to data owned by the current function - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0515`. diff --git a/src/test/ui/span/issue-15480.fixed b/src/test/ui/span/issue-15480.fixed deleted file mode 100644 index e6d1a4dd3..000000000 --- a/src/test/ui/span/issue-15480.fixed +++ /dev/null @@ -1,14 +0,0 @@ -// run-rustfix -fn id(x: T) -> T { x } - -fn main() { - let binding = id(3); - let v = vec![ - &binding - ]; - //~^^ ERROR temporary value dropped while borrowed - - for &&x in &v { - println!("{}", x + 3); - } -} diff --git a/src/test/ui/span/issue-15480.rs b/src/test/ui/span/issue-15480.rs deleted file mode 100644 index 916ce4b1e..000000000 --- a/src/test/ui/span/issue-15480.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-rustfix -fn id(x: T) -> T { x } - -fn main() { - let v = vec![ - &id(3) - ]; - //~^^ ERROR temporary value dropped while borrowed - - for &&x in &v { - println!("{}", x + 3); - } -} diff --git a/src/test/ui/span/issue-15480.stderr b/src/test/ui/span/issue-15480.stderr deleted file mode 100644 index d9cce2254..000000000 --- a/src/test/ui/span/issue-15480.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-15480.rs:6:10 - | -LL | &id(3) - | ^^^^^ creates a temporary value which is freed while still in use -LL | ]; - | - temporary value is freed at the end of this statement -... -LL | for &&x in &v { - | -- borrow later used here - | -help: consider using a `let` binding to create a longer lived value - | -LL ~ let binding = id(3); -LL ~ let v = vec![ -LL ~ &binding - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs deleted file mode 100644 index a92ea4ddc..000000000 --- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs +++ /dev/null @@ -1,28 +0,0 @@ -// This is just checking that we still reject code where temp values -// are borrowing values for longer than they will be around. -// -// Compare to run-pass/issue-23338-params-outlive-temps-of-body.rs - -use std::cell::RefCell; - -fn foo(x: RefCell) -> String { - let y = x; - y.borrow().clone() -} -//~^^ ERROR `y` does not live long enough - -fn foo2(x: RefCell) -> String { - let ret = { - let y = x; - y.borrow().clone() - }; - //~^^ ERROR `y` does not live long enough - ret -} - -fn main() { - let r = RefCell::new(format!("data")); - assert_eq!(foo(r), "data"); - let r = RefCell::new(format!("data")); - assert_eq!(foo2(r), "data"); -} diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr deleted file mode 100644 index 3c2022748..000000000 --- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error[E0597]: `y` does not live long enough - --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:10:5 - | -LL | y.borrow().clone() - | ^^^^^^^^^^ - | | - | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... -LL | } - | - - | | - | `y` dropped here while still borrowed - | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Ref<'_, String>` - | - = note: the temporary is part of an expression at the end of a block; - consider forcing this temporary to be dropped sooner, before the block's local variables are dropped -help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block - | -LL | let x = y.borrow().clone(); x - | +++++++ +++ - -error[E0597]: `y` does not live long enough - --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:17:9 - | -LL | y.borrow().clone() - | ^^^^^^^^^^ - | | - | borrowed value does not live long enough - | a temporary with access to the borrow is created here ... -LL | }; - | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Ref<'_, String>` - | | - | `y` dropped here while still borrowed - | - = note: the temporary is part of an expression at the end of a block; - consider forcing this temporary to be dropped sooner, before the block's local variables are dropped -help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block - | -LL | let x = y.borrow().clone(); x - | +++++++ +++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-23729.rs b/src/test/ui/span/issue-23729.rs deleted file mode 100644 index ca33f9c77..000000000 --- a/src/test/ui/span/issue-23729.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Regression test for #23729 - -fn main() { - let fib = { - struct Recurrence { - mem: [u64; 2], - pos: usize, - } - - impl Iterator for Recurrence { - //~^ ERROR E0046 - #[inline] - fn next(&mut self) -> Option { - if self.pos < 2 { - let next_val = self.mem[self.pos]; - self.pos += 1; - Some(next_val) - } else { - let next_val = self.mem[0] + self.mem[1]; - self.mem[0] = self.mem[1]; - self.mem[1] = next_val; - Some(next_val) - } - } - } - - Recurrence { mem: [0, 1], pos: 0 } - }; - - for e in fib.take(10) { - println!("{}", e) - } -} diff --git a/src/test/ui/span/issue-23729.stderr b/src/test/ui/span/issue-23729.stderr deleted file mode 100644 index f88ce6c88..000000000 --- a/src/test/ui/span/issue-23729.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0046]: not all trait items implemented, missing: `Item` - --> $DIR/issue-23729.rs:10:9 - | -LL | impl Iterator for Recurrence { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Item` in implementation - | - = help: implement the missing item: `type Item = Type;` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0046`. diff --git a/src/test/ui/span/issue-23827.rs b/src/test/ui/span/issue-23827.rs deleted file mode 100644 index 6b065bf6c..000000000 --- a/src/test/ui/span/issue-23827.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Regression test for #23827 - -#![feature(fn_traits, unboxed_closures)] - -pub struct Prototype { - pub target: u32 -} - -trait Component { - fn apply(self, e: u32); -} - -impl Fn<(C,)> for Prototype { - extern "rust-call" fn call(&self, (comp,): (C,)) -> Prototype { - comp.apply(self.target); - *self - } -} - -impl FnMut<(C,)> for Prototype { - extern "rust-call" fn call_mut(&mut self, (comp,): (C,)) -> Prototype { - Fn::call(*&self, (comp,)) - } -} - -impl FnOnce<(C,)> for Prototype { - //~^ ERROR E0046 - extern "rust-call" fn call_once(self, (comp,): (C,)) -> Prototype { - Fn::call(&self, (comp,)) - } -} - -fn main() {} diff --git a/src/test/ui/span/issue-23827.stderr b/src/test/ui/span/issue-23827.stderr deleted file mode 100644 index 46a820f1b..000000000 --- a/src/test/ui/span/issue-23827.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0046]: not all trait items implemented, missing: `Output` - --> $DIR/issue-23827.rs:26:1 - | -LL | impl FnOnce<(C,)> for Prototype { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Output` in implementation - | - = help: implement the missing item: `type Output = Type;` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0046`. diff --git a/src/test/ui/span/issue-24356.rs b/src/test/ui/span/issue-24356.rs deleted file mode 100644 index 7ec05aab2..000000000 --- a/src/test/ui/span/issue-24356.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Regression test for #24356 - -fn main() { - { - use std::ops::Deref; - - struct Thing(i8); - - /* - // Correct impl - impl Deref for Thing { - type Target = i8; - fn deref(&self) -> &i8 { &self.0 } - } - */ - - // Causes ICE - impl Deref for Thing { - //~^ ERROR E0046 - fn deref(&self) -> i8 { self.0 } - } - - let thing = Thing(72); - - *thing - }; -} diff --git a/src/test/ui/span/issue-24356.stderr b/src/test/ui/span/issue-24356.stderr deleted file mode 100644 index a1f9b2550..000000000 --- a/src/test/ui/span/issue-24356.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0046]: not all trait items implemented, missing: `Target` - --> $DIR/issue-24356.rs:18:9 - | -LL | impl Deref for Thing { - | ^^^^^^^^^^^^^^^^^^^^ missing `Target` in implementation - | - = help: implement the missing item: `type Target = Type;` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0046`. diff --git a/src/test/ui/span/issue-24690.rs b/src/test/ui/span/issue-24690.rs deleted file mode 100644 index 2b7349c55..000000000 --- a/src/test/ui/span/issue-24690.rs +++ /dev/null @@ -1,16 +0,0 @@ -//! A test to ensure that helpful `note` messages aren't emitted more often -//! than necessary. - -// check-pass - -// Although there are three warnings, we should only get two "lint level defined -// here" notes pointing at the `warnings` span, one for each error type. -#![warn(unused)] - - -fn main() { - let theTwo = 2; //~ WARN should have a snake case name - let theOtherTwo = 2; //~ WARN should have a snake case name - //~^ WARN unused variable - println!("{}", theTwo); -} diff --git a/src/test/ui/span/issue-24690.stderr b/src/test/ui/span/issue-24690.stderr deleted file mode 100644 index 73e166e64..000000000 --- a/src/test/ui/span/issue-24690.stderr +++ /dev/null @@ -1,29 +0,0 @@ -warning: unused variable: `theOtherTwo` - --> $DIR/issue-24690.rs:13:9 - | -LL | let theOtherTwo = 2; - | ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_theOtherTwo` - | -note: the lint level is defined here - --> $DIR/issue-24690.rs:8:9 - | -LL | #![warn(unused)] - | ^^^^^^ - = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` - -warning: variable `theTwo` should have a snake case name - --> $DIR/issue-24690.rs:12:9 - | -LL | let theTwo = 2; - | ^^^^^^ help: convert the identifier to snake case: `the_two` - | - = note: `#[warn(non_snake_case)]` on by default - -warning: variable `theOtherTwo` should have a snake case name - --> $DIR/issue-24690.rs:13:9 - | -LL | let theOtherTwo = 2; - | ^^^^^^^^^^^ help: convert the identifier to snake case: `the_other_two` - -warning: 3 warnings emitted - diff --git a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs deleted file mode 100644 index 9c772052f..000000000 --- a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Check that child trait who only has items via its *parent* trait -// does cause dropck to inject extra region constraints. - -#![allow(non_camel_case_types)] - -trait Parent { fn foo(&self); } -trait Child: Parent { } - -impl Parent for i32 { fn foo(&self) { } } -impl<'a> Parent for &'a D_Child { - fn foo(&self) { - println!("accessing child value: {}", self.0); - } -} - -impl Child for i32 { } -impl<'a> Child for &'a D_Child { } - -struct D_Child(T); -impl Drop for D_Child { fn drop(&mut self) { self.0.foo() } } - -fn f_child() { - // `_d` and `d1` are assigned the *same* lifetime by region inference ... - let (_d, d1); - - d1 = D_Child(1); - // ... we store a reference to `d1` within `_d` ... - _d = D_Child(&d1); - //~^ ERROR `d1` does not live long enough - - // ... dropck *should* complain, because Drop of _d could (and - // does) access the already dropped `d1` via the `foo` method. -} - -fn main() { - f_child(); -} diff --git a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr deleted file mode 100644 index 809e60a8c..000000000 --- a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:28:18 - | -LL | _d = D_Child(&d1); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `d1` dropped here while still borrowed - | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_Child` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-24805-dropck-trait-has-items.rs b/src/test/ui/span/issue-24805-dropck-trait-has-items.rs deleted file mode 100644 index b5c410cd3..000000000 --- a/src/test/ui/span/issue-24805-dropck-trait-has-items.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Check that traits with various kinds of associated items cause -// dropck to inject extra region constraints. - -#![allow(non_camel_case_types)] - -trait HasSelfMethod { fn m1(&self) { } } -trait HasMethodWithSelfArg { fn m2(x: &Self) { } } -trait HasType { type Something; } - -impl HasSelfMethod for i32 { } -impl HasMethodWithSelfArg for i32 { } -impl HasType for i32 { type Something = (); } - -impl<'a,T> HasSelfMethod for &'a T { } -impl<'a,T> HasMethodWithSelfArg for &'a T { } -impl<'a,T> HasType for &'a T { type Something = (); } - -// e.g., `impl_drop!(Send, D_Send)` expands to: -// ```rust -// struct D_Send(T); -// impl Drop for D_Send { fn drop(&mut self) { } } -// ``` -macro_rules! impl_drop { - ($Bound:ident, $Id:ident) => { - struct $Id(T); - impl Drop for $Id { fn drop(&mut self) { } } - } -} - -impl_drop!{HasSelfMethod, D_HasSelfMethod} -impl_drop!{HasMethodWithSelfArg, D_HasMethodWithSelfArg} -impl_drop!{HasType, D_HasType} - -fn f_sm() { - let (_d, d1); - d1 = D_HasSelfMethod(1); - _d = D_HasSelfMethod(&d1); -} -//~^^ ERROR `d1` does not live long enough -fn f_mwsa() { - let (_d, d1); - d1 = D_HasMethodWithSelfArg(1); - _d = D_HasMethodWithSelfArg(&d1); -} -//~^^ ERROR `d1` does not live long enough -fn f_t() { - let (_d, d1); - d1 = D_HasType(1); - _d = D_HasType(&d1); -} -//~^^ ERROR `d1` does not live long enough - -fn main() { - f_sm(); - f_mwsa(); - f_t(); -} diff --git a/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr b/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr deleted file mode 100644 index 2e2170669..000000000 --- a/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:37:26 - | -LL | _d = D_HasSelfMethod(&d1); - | ^^^ borrowed value does not live long enough -LL | } - | - - | | - | `d1` dropped here while still borrowed - | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_HasSelfMethod` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:43:33 - | -LL | _d = D_HasMethodWithSelfArg(&d1); - | ^^^ borrowed value does not live long enough -LL | } - | - - | | - | `d1` dropped here while still borrowed - | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_HasMethodWithSelfArg` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:49:20 - | -LL | _d = D_HasType(&d1); - | ^^^ borrowed value does not live long enough -LL | } - | - - | | - | `d1` dropped here while still borrowed - | borrow might be used here, when `_d` is dropped and runs the `Drop` code for type `D_HasType` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-24895-copy-clone-dropck.rs b/src/test/ui/span/issue-24895-copy-clone-dropck.rs deleted file mode 100644 index 904cd8f67..000000000 --- a/src/test/ui/span/issue-24895-copy-clone-dropck.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Check that one cannot subvert Drop Check rule via a user-defined -// Clone implementation. - -#![allow(unused_variables, unused_assignments)] - -struct D(T, &'static str); - -#[derive(Copy)] -struct S<'a>(&'a D, &'static str); -impl<'a> Clone for S<'a> { - fn clone(&self) -> S<'a> { - println!("cloning `S(_, {})` and thus accessing: {}", self.1, (self.0).0); - S(self.0, self.1) - } -} - -impl Drop for D { - fn drop(&mut self) { - println!("calling Drop for {}", self.1); - let _call = self.0.clone(); - } -} - -fn main() { - let (d2, d1); - d1 = D(34, "d1"); - d2 = D(S(&d1, "inner"), "d2"); -} -//~^^ ERROR `d1` does not live long enough diff --git a/src/test/ui/span/issue-24895-copy-clone-dropck.stderr b/src/test/ui/span/issue-24895-copy-clone-dropck.stderr deleted file mode 100644 index 18a3dc9e6..000000000 --- a/src/test/ui/span/issue-24895-copy-clone-dropck.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0597]: `d1` does not live long enough - --> $DIR/issue-24895-copy-clone-dropck.rs:27:14 - | -LL | d2 = D(S(&d1, "inner"), "d2"); - | ^^^ borrowed value does not live long enough -LL | } - | - - | | - | `d1` dropped here while still borrowed - | borrow might be used here, when `d2` is dropped and runs the `Drop` code for type `D` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-25199.rs b/src/test/ui/span/issue-25199.rs deleted file mode 100644 index dbc3b1900..000000000 --- a/src/test/ui/span/issue-25199.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Regression test for Issue 25199: Check that one cannot hide a -// destructor's access to borrowed data behind a boxed trait object. -// -// Prior to fixing Issue 25199, this example was able to be compiled -// with rustc, and thus when you ran it, you would see the `Drop` impl -// for `Test` accessing state that had already been dropping (which is -// marked explicitly here with checking code within the `Drop` impl -// for `VecHolder`, but in the general case could just do unsound -// things like accessing memory that has been freed). -// -// Note that I would have liked to encode my go-to example of cyclic -// structure that accesses its neighbors in drop (and thus is -// fundamentally unsound) via this trick, but the closest I was able -// to come was dropck_trait_cycle_checked.rs, which is not quite as -// "good" as this regression test because the encoding of that example -// was forced to attach a lifetime to the trait definition itself -// (`trait Obj<'a>`) while *this* example is solely - -use std::cell::RefCell; - -trait Obj { } - -struct VecHolder { - v: Vec<(bool, &'static str)>, -} - -impl Drop for VecHolder { - fn drop(&mut self) { - println!("Dropping Vec"); - self.v[30].0 = false; - self.v[30].1 = "invalid access: VecHolder dropped already"; - } -} - -struct Container<'a> { - v: VecHolder, - d: RefCell>>, -} - -impl<'a> Container<'a> { - fn new() -> Container<'a> { - Container { - d: RefCell::new(Vec::new()), - v: VecHolder { - v: vec![(true, "valid"); 100] - } - } - } - - fn store(&'a self, val: T) { - self.d.borrow_mut().push(Box::new(val)); - } -} - -struct Test<'a> { - test: &'a Container<'a>, -} - -impl<'a> Obj for Test<'a> { } -impl<'a> Drop for Test<'a> { - fn drop(&mut self) { - for e in &self.test.v.v { - assert!(e.0, e.1); - } - } -} - -fn main() { - let container = Container::new(); - let test = Test{test: &container}; - //~^ ERROR `container` does not live long enough - println!("container.v[30]: {:?}", container.v.v[30]); - container.store(test); -} diff --git a/src/test/ui/span/issue-25199.stderr b/src/test/ui/span/issue-25199.stderr deleted file mode 100644 index d70a4afc1..000000000 --- a/src/test/ui/span/issue-25199.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0597]: `container` does not live long enough - --> $DIR/issue-25199.rs:70:27 - | -LL | let test = Test{test: &container}; - | ^^^^^^^^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `container` dropped here while still borrowed - | borrow might be used here, when `container` is dropped and runs the destructor for type `Container<'_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-26656.rs b/src/test/ui/span/issue-26656.rs deleted file mode 100644 index cde68da18..000000000 --- a/src/test/ui/span/issue-26656.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Issue #26656: Verify that trait objects cannot bypass dropck. - -// Using this instead of Fn etc. to take HRTB out of the equation. -trait Trigger { fn fire(&self, b: &mut B); } -impl Trigger for () { - fn fire(&self, b: &mut B) { - b.push(); - } -} - -// Still unsound Zook -trait Button { fn push(&self); } -struct Zook { button: B, trigger: Box+'static> } - -impl Drop for Zook { - fn drop(&mut self) { - self.trigger.fire(&mut self.button); - } -} - -// AND -struct Bomb { usable: bool } -impl Drop for Bomb { fn drop(&mut self) { self.usable = false; } } -impl Bomb { fn activate(&self) { assert!(self.usable) } } - -enum B<'a> { HarmlessButton, BigRedButton(&'a Bomb) } -impl<'a> Button for B<'a> { - fn push(&self) { - if let B::BigRedButton(borrowed) = *self { - borrowed.activate(); - } - } -} - -fn main() { - let (mut zook, ticking); - zook = Zook { button: B::HarmlessButton, - trigger: Box::new(()) }; - ticking = Bomb { usable: true }; - zook.button = B::BigRedButton(&ticking); -} -//~^^ ERROR `ticking` does not live long enough diff --git a/src/test/ui/span/issue-26656.stderr b/src/test/ui/span/issue-26656.stderr deleted file mode 100644 index 1e939c484..000000000 --- a/src/test/ui/span/issue-26656.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0597]: `ticking` does not live long enough - --> $DIR/issue-26656.rs:40:35 - | -LL | zook.button = B::BigRedButton(&ticking); - | ^^^^^^^^ borrowed value does not live long enough -LL | } - | - - | | - | `ticking` dropped here while still borrowed - | borrow might be used here, when `zook` is dropped and runs the `Drop` code for type `Zook` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-27522.rs b/src/test/ui/span/issue-27522.rs deleted file mode 100644 index 7a0cfb679..000000000 --- a/src/test/ui/span/issue-27522.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Point at correct span for self type - -struct SomeType {} - -trait Foo { - fn handler(self: &SomeType); //~ ERROR invalid `self` parameter type -} - -fn main() {} diff --git a/src/test/ui/span/issue-27522.stderr b/src/test/ui/span/issue-27522.stderr deleted file mode 100644 index 8a254a968..000000000 --- a/src/test/ui/span/issue-27522.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0307]: invalid `self` parameter type: &SomeType - --> $DIR/issue-27522.rs:6:22 - | -LL | fn handler(self: &SomeType); - | ^^^^^^^^^ - | - = note: type of `self` must be `Self` or a type that dereferences to it - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0307`. diff --git a/src/test/ui/span/issue-29106.rs b/src/test/ui/span/issue-29106.rs deleted file mode 100644 index 1be8d4cba..000000000 --- a/src/test/ui/span/issue-29106.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::rc::Rc; -use std::sync::Arc; - -struct Foo<'a>(&'a String); - -impl<'a> Drop for Foo<'a> { - fn drop(&mut self) { - println!("{:?}", self.0); - } -} - -fn main() { - { - let (y, x); - x = "alive".to_string(); - y = Arc::new(Foo(&x)); - } - //~^^ ERROR `x` does not live long enough - - { - let (y, x); - x = "alive".to_string(); - y = Rc::new(Foo(&x)); - } - //~^^ ERROR `x` does not live long enough -} diff --git a/src/test/ui/span/issue-29106.stderr b/src/test/ui/span/issue-29106.stderr deleted file mode 100644 index 71fbd60ee..000000000 --- a/src/test/ui/span/issue-29106.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/issue-29106.rs:16:26 - | -LL | y = Arc::new(Foo(&x)); - | ^^ borrowed value does not live long enough -LL | } - | - - | | - | `x` dropped here while still borrowed - | borrow might be used here, when `y` is dropped and runs the `Drop` code for type `Arc` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `x` does not live long enough - --> $DIR/issue-29106.rs:23:25 - | -LL | y = Rc::new(Foo(&x)); - | ^^ borrowed value does not live long enough -LL | } - | - - | | - | `x` dropped here while still borrowed - | borrow might be used here, when `y` is dropped and runs the `Drop` code for type `Rc` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-29595.rs b/src/test/ui/span/issue-29595.rs deleted file mode 100644 index 87d7c4cfd..000000000 --- a/src/test/ui/span/issue-29595.rs +++ /dev/null @@ -1,7 +0,0 @@ -trait Tr { - const C: Self; -} - -fn main() { - let a: u8 = Tr::C; //~ ERROR the trait bound `u8: Tr` is not satisfied -} diff --git a/src/test/ui/span/issue-29595.stderr b/src/test/ui/span/issue-29595.stderr deleted file mode 100644 index 92445e407..000000000 --- a/src/test/ui/span/issue-29595.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0277]: the trait bound `u8: Tr` is not satisfied - --> $DIR/issue-29595.rs:6:17 - | -LL | let a: u8 = Tr::C; - | ^^^^^ the trait `Tr` is not implemented for `u8` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/span/issue-33884.rs b/src/test/ui/span/issue-33884.rs deleted file mode 100644 index 5d927a5ac..000000000 --- a/src/test/ui/span/issue-33884.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::net::TcpListener; -use std::net::TcpStream; -use std::io::{self, Read, Write}; - -fn handle_client(stream: TcpStream) -> io::Result<()> { - stream.write_fmt(format!("message received")) - //~^ ERROR mismatched types -} - -fn main() { - if let Ok(listener) = TcpListener::bind("127.0.0.1:8080") { - for incoming in listener.incoming() { - if let Ok(stream) = incoming { - handle_client(stream); - } - } - } -} diff --git a/src/test/ui/span/issue-33884.stderr b/src/test/ui/span/issue-33884.stderr deleted file mode 100644 index aee153085..000000000 --- a/src/test/ui/span/issue-33884.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-33884.rs:6:22 - | -LL | stream.write_fmt(format!("message received")) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Arguments`, found struct `String` - | - = note: this error originates in the macro `format` (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/span/issue-34264.rs b/src/test/ui/span/issue-34264.rs deleted file mode 100644 index 5b8fc7138..000000000 --- a/src/test/ui/span/issue-34264.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn foo(Option, String) {} //~ ERROR expected one of -//~^ ERROR expected one of -fn bar(x, y: usize) {} //~ ERROR expected one of - -fn main() { - foo(Some(42), 2); - foo(Some(42), 2, ""); //~ ERROR this function takes - bar("", ""); //~ ERROR mismatched types - bar(1, 2); - bar(1, 2, 3); //~ ERROR this function takes -} diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr deleted file mode 100644 index 15179954a..000000000 --- a/src/test/ui/span/issue-34264.stderr +++ /dev/null @@ -1,102 +0,0 @@ -error: expected one of `:`, `@`, or `|`, found `<` - --> $DIR/issue-34264.rs:1:14 - | -LL | fn foo(Option, String) {} - | ^ expected one of `:`, `@`, or `|` - | - = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) -help: if this is a `self` type, give it a parameter name - | -LL | fn foo(self: Option, String) {} - | +++++ -help: if this is a type, explicitly ignore the parameter name - | -LL | fn foo(_: Option, String) {} - | ++ - -error: expected one of `:`, `@`, or `|`, found `)` - --> $DIR/issue-34264.rs:1:27 - | -LL | fn foo(Option, String) {} - | ^ expected one of `:`, `@`, or `|` - | - = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) -help: if this is a parameter name, give it a type - | -LL | fn foo(Option, String: TypeName) {} - | ++++++++++ -help: if this is a type, explicitly ignore the parameter name - | -LL | fn foo(Option, _: String) {} - | ++ - -error: expected one of `:`, `@`, or `|`, found `,` - --> $DIR/issue-34264.rs:3:9 - | -LL | fn bar(x, y: usize) {} - | ^ expected one of `:`, `@`, or `|` - | - = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) -help: if this is a `self` type, give it a parameter name - | -LL | fn bar(self: x, y: usize) {} - | +++++ -help: if this is a parameter name, give it a type - | -LL | fn bar(x: TypeName, y: usize) {} - | ++++++++++ -help: if this is a type, explicitly ignore the parameter name - | -LL | fn bar(_: x, y: usize) {} - | ++ - -error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/issue-34264.rs:7:5 - | -LL | foo(Some(42), 2, ""); - | ^^^ -- argument of type `&'static str` unexpected - | -note: function defined here - --> $DIR/issue-34264.rs:1:4 - | -LL | fn foo(Option, String) {} - | ^^^ ----------- ------ -help: remove the extra argument - | -LL | foo(Some(42), 2); - | ~~~~~~~~~~~~~ - -error[E0308]: mismatched types - --> $DIR/issue-34264.rs:8:13 - | -LL | bar("", ""); - | --- ^^ expected `usize`, found `&str` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/issue-34264.rs:3:4 - | -LL | fn bar(x, y: usize) {} - | ^^^ -------- - -error[E0061]: this function takes 2 arguments but 3 arguments were supplied - --> $DIR/issue-34264.rs:10:5 - | -LL | bar(1, 2, 3); - | ^^^ - argument of type `{integer}` unexpected - | -note: function defined here - --> $DIR/issue-34264.rs:3:4 - | -LL | fn bar(x, y: usize) {} - | ^^^ - -------- -help: remove the extra argument - | -LL | bar(1, 2); - | ~~~~~~ - -error: aborting due to 6 previous errors - -Some errors have detailed explanations: E0061, E0308. -For more information about an error, try `rustc --explain E0061`. diff --git a/src/test/ui/span/issue-35987.rs b/src/test/ui/span/issue-35987.rs deleted file mode 100644 index 3a6e6ffe2..000000000 --- a/src/test/ui/span/issue-35987.rs +++ /dev/null @@ -1,14 +0,0 @@ -struct Foo(T); - -use std::ops::Add; - -impl Add for Foo { -//~^ ERROR expected trait, found type parameter - type Output = usize; - - fn add(self, rhs: Self) -> Self::Output { - unimplemented!(); - } -} - -fn main() {} diff --git a/src/test/ui/span/issue-35987.stderr b/src/test/ui/span/issue-35987.stderr deleted file mode 100644 index 057d40ac0..000000000 --- a/src/test/ui/span/issue-35987.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0404]: expected trait, found type parameter `Add` - --> $DIR/issue-35987.rs:5:21 - | -LL | use std::ops::Add; - | --- you might have meant to refer to this trait -LL | -LL | impl Add for Foo { - | --- ^^^ not a trait - | | - | found this type parameter - | -help: consider importing this trait instead - | -LL | use std::ops::Add; - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0404`. diff --git a/src/test/ui/span/issue-36537.rs b/src/test/ui/span/issue-36537.rs deleted file mode 100644 index a5546ccbb..000000000 --- a/src/test/ui/span/issue-36537.rs +++ /dev/null @@ -1,14 +0,0 @@ -fn main() { - let p; - { - let a = 42; - p = &a; - //~^ ERROR `a` does not live long enough - - } - p.use_ref(); - -} - -trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } -impl Fake for T { } diff --git a/src/test/ui/span/issue-36537.stderr b/src/test/ui/span/issue-36537.stderr deleted file mode 100644 index 79a0ebaeb..000000000 --- a/src/test/ui/span/issue-36537.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0597]: `a` does not live long enough - --> $DIR/issue-36537.rs:5:13 - | -LL | p = &a; - | ^^ borrowed value does not live long enough -... -LL | } - | - `a` dropped here while still borrowed -LL | p.use_ref(); - | ----------- borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-37767.rs b/src/test/ui/span/issue-37767.rs deleted file mode 100644 index 9e34c2c1f..000000000 --- a/src/test/ui/span/issue-37767.rs +++ /dev/null @@ -1,41 +0,0 @@ -trait A { - fn foo(&mut self) {} -} - -trait B : A { - fn foo(&mut self) {} -} - -fn bar(a: &T) { - a.foo() //~ ERROR multiple applicable items -} - -trait C { - fn foo(&self) {} -} - -trait D : C { - fn foo(&self) {} -} - -fn quz(a: &T) { - a.foo() //~ ERROR multiple applicable items -} - -trait E : Sized { - fn foo(self) {} -} - -trait F : E { - fn foo(self) {} -} - -fn foo(a: T) { - a.foo() //~ ERROR multiple applicable items -} - -fn pass(a: &T) { - a.foo() -} - -fn main() {} diff --git a/src/test/ui/span/issue-37767.stderr b/src/test/ui/span/issue-37767.stderr deleted file mode 100644 index f7732847a..000000000 --- a/src/test/ui/span/issue-37767.stderr +++ /dev/null @@ -1,78 +0,0 @@ -error[E0034]: multiple applicable items in scope - --> $DIR/issue-37767.rs:10:7 - | -LL | a.foo() - | ^^^ multiple `foo` found - | -note: candidate #1 is defined in the trait `A` - --> $DIR/issue-37767.rs:2:5 - | -LL | fn foo(&mut self) {} - | ^^^^^^^^^^^^^^^^^ -note: candidate #2 is defined in the trait `B` - --> $DIR/issue-37767.rs:6:5 - | -LL | fn foo(&mut self) {} - | ^^^^^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 - | -LL | A::foo(&a) - | ~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 - | -LL | B::foo(&a) - | ~~~~~~~~~~ - -error[E0034]: multiple applicable items in scope - --> $DIR/issue-37767.rs:22:7 - | -LL | a.foo() - | ^^^ multiple `foo` found - | -note: candidate #1 is defined in the trait `C` - --> $DIR/issue-37767.rs:14:5 - | -LL | fn foo(&self) {} - | ^^^^^^^^^^^^^ -note: candidate #2 is defined in the trait `D` - --> $DIR/issue-37767.rs:18:5 - | -LL | fn foo(&self) {} - | ^^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 - | -LL | C::foo(&a) - | ~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 - | -LL | D::foo(&a) - | ~~~~~~~~~~ - -error[E0034]: multiple applicable items in scope - --> $DIR/issue-37767.rs:34:7 - | -LL | a.foo() - | ^^^ multiple `foo` found - | -note: candidate #1 is defined in the trait `E` - --> $DIR/issue-37767.rs:26:5 - | -LL | fn foo(self) {} - | ^^^^^^^^^^^^ -note: candidate #2 is defined in the trait `F` - --> $DIR/issue-37767.rs:30:5 - | -LL | fn foo(self) {} - | ^^^^^^^^^^^^ -help: disambiguate the associated function for candidate #1 - | -LL | E::foo(a) - | ~~~~~~~~~ -help: disambiguate the associated function for candidate #2 - | -LL | F::foo(a) - | ~~~~~~~~~ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0034`. diff --git a/src/test/ui/span/issue-39018.rs b/src/test/ui/span/issue-39018.rs deleted file mode 100644 index b6db4008d..000000000 --- a/src/test/ui/span/issue-39018.rs +++ /dev/null @@ -1,38 +0,0 @@ -pub fn main() { - let x = "Hello " + "World!"; - //~^ ERROR cannot add - - // Make sure that the span outputs a warning - // for not having an implementation for std::ops::Add - // that won't output for the above string concatenation - let y = World::Hello + World::Goodbye; - //~^ ERROR cannot add - - let x = "Hello " + "World!".to_owned(); - //~^ ERROR cannot add -} - -enum World { - Hello, - Goodbye, -} - -fn foo() { - let a = String::new(); - let b = String::new(); - let c = ""; - let d = ""; - let e = &a; - let _ = &a + &b; //~ ERROR cannot add - let _ = &a + b; //~ ERROR cannot add - let _ = a + &b; // ok - let _ = a + b; //~ ERROR mismatched types - let _ = e + b; //~ ERROR cannot add - let _ = e + &b; //~ ERROR cannot add - let _ = e + d; //~ ERROR cannot add - let _ = e + &d; //~ ERROR cannot add - let _ = &c + &d; //~ ERROR cannot add - let _ = &c + d; //~ ERROR cannot add - let _ = c + &d; //~ ERROR cannot add - let _ = c + d; //~ ERROR cannot add -} diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr deleted file mode 100644 index eea94643e..000000000 --- a/src/test/ui/span/issue-39018.stderr +++ /dev/null @@ -1,197 +0,0 @@ -error[E0369]: cannot add `&str` to `&str` - --> $DIR/issue-39018.rs:2:22 - | -LL | let x = "Hello " + "World!"; - | -------- ^ -------- &str - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &str - | - = note: string concatenation requires an owned `String` on the left -help: create an owned `String` from a string reference - | -LL | let x = "Hello ".to_owned() + "World!"; - | +++++++++++ - -error[E0369]: cannot add `World` to `World` - --> $DIR/issue-39018.rs:8:26 - | -LL | let y = World::Hello + World::Goodbye; - | ------------ ^ -------------- World - | | - | World - | -note: an implementation of `Add<_>` might be missing for `World` - --> $DIR/issue-39018.rs:15:1 - | -LL | enum World { - | ^^^^^^^^^^ must implement `Add<_>` -note: the following trait must be implemented - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Add { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0369]: cannot add `String` to `&str` - --> $DIR/issue-39018.rs:11:22 - | -LL | let x = "Hello " + "World!".to_owned(); - | -------- ^ ------------------- String - | | | - | | `+` cannot be used to concatenate a `&str` with a `String` - | &str - | -help: create an owned `String` on the left and add a borrow on the right - | -LL | let x = "Hello ".to_owned() + &"World!".to_owned(); - | +++++++++++ + - -error[E0369]: cannot add `&String` to `&String` - --> $DIR/issue-39018.rs:26:16 - | -LL | let _ = &a + &b; - | -- ^ -- &String - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &String - | - = note: string concatenation requires an owned `String` on the left -help: remove the borrow to obtain an owned `String` - | -LL - let _ = &a + &b; -LL + let _ = a + &b; - | - -error[E0369]: cannot add `String` to `&String` - --> $DIR/issue-39018.rs:27:16 - | -LL | let _ = &a + b; - | -- ^ - String - | | | - | | `+` cannot be used to concatenate a `&str` with a `String` - | &String - | -help: remove the borrow on the left and add one on the right - | -LL - let _ = &a + b; -LL + let _ = a + &b; - | - -error[E0308]: mismatched types - --> $DIR/issue-39018.rs:29:17 - | -LL | let _ = a + b; - | ^ - | | - | expected `&str`, found struct `String` - | help: consider borrowing here: `&b` - -error[E0369]: cannot add `String` to `&String` - --> $DIR/issue-39018.rs:30:15 - | -LL | let _ = e + b; - | - ^ - String - | | | - | | `+` cannot be used to concatenate a `&str` with a `String` - | &String - | -help: create an owned `String` on the left and add a borrow on the right - | -LL | let _ = e.to_owned() + &b; - | +++++++++++ + - -error[E0369]: cannot add `&String` to `&String` - --> $DIR/issue-39018.rs:31:15 - | -LL | let _ = e + &b; - | - ^ -- &String - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &String - | - = note: string concatenation requires an owned `String` on the left -help: create an owned `String` from a string reference - | -LL | let _ = e.to_owned() + &b; - | +++++++++++ - -error[E0369]: cannot add `&str` to `&String` - --> $DIR/issue-39018.rs:32:15 - | -LL | let _ = e + d; - | - ^ - &str - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &String - | - = note: string concatenation requires an owned `String` on the left -help: create an owned `String` from a string reference - | -LL | let _ = e.to_owned() + d; - | +++++++++++ - -error[E0369]: cannot add `&&str` to `&String` - --> $DIR/issue-39018.rs:33:15 - | -LL | let _ = e + &d; - | - ^ -- &&str - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &String - | - = note: string concatenation requires an owned `String` on the left -help: create an owned `String` from a string reference - | -LL | let _ = e.to_owned() + &d; - | +++++++++++ - -error[E0369]: cannot add `&&str` to `&&str` - --> $DIR/issue-39018.rs:34:16 - | -LL | let _ = &c + &d; - | -- ^ -- &&str - | | - | &&str - -error[E0369]: cannot add `&str` to `&&str` - --> $DIR/issue-39018.rs:35:16 - | -LL | let _ = &c + d; - | -- ^ - &str - | | - | &&str - -error[E0369]: cannot add `&&str` to `&str` - --> $DIR/issue-39018.rs:36:15 - | -LL | let _ = c + &d; - | - ^ -- &&str - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &str - | - = note: string concatenation requires an owned `String` on the left -help: create an owned `String` from a string reference - | -LL | let _ = c.to_owned() + &d; - | +++++++++++ - -error[E0369]: cannot add `&str` to `&str` - --> $DIR/issue-39018.rs:37:15 - | -LL | let _ = c + d; - | - ^ - &str - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &str - | - = note: string concatenation requires an owned `String` on the left -help: create an owned `String` from a string reference - | -LL | let _ = c.to_owned() + d; - | +++++++++++ - -error: aborting due to 14 previous errors - -Some errors have detailed explanations: E0308, E0369. -For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/span/issue-39698.rs b/src/test/ui/span/issue-39698.rs deleted file mode 100644 index 1079bae2c..000000000 --- a/src/test/ui/span/issue-39698.rs +++ /dev/null @@ -1,16 +0,0 @@ -enum T { - T1(i32, i32), - T2(i32, i32), - T3(i32), - T4(i32), -} - -fn main() { - match T::T1(123, 456) { - T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } - //~^ ERROR is not bound in all patterns - //~| ERROR is not bound in all patterns - //~| ERROR is not bound in all patterns - //~| ERROR is not bound in all patterns - } -} diff --git a/src/test/ui/span/issue-39698.stderr b/src/test/ui/span/issue-39698.stderr deleted file mode 100644 index 25c35fd54..000000000 --- a/src/test/ui/span/issue-39698.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0408]: variable `d` is not bound in all patterns - --> $DIR/issue-39698.rs:10:37 - | -LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } - | - - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `d` - | | | | - | | | pattern doesn't bind `d` - | | variable not in all patterns - | variable not in all patterns - -error[E0408]: variable `a` is not bound in all patterns - --> $DIR/issue-39698.rs:10:23 - | -LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } - | - ^^^^^^^^^^^ ^^^^^^^^ - variable not in all patterns - | | | | - | | | pattern doesn't bind `a` - | | pattern doesn't bind `a` - | variable not in all patterns - -error[E0408]: variable `b` is not bound in all patterns - --> $DIR/issue-39698.rs:10:9 - | -LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } - | ^^^^^^^^^^^ - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `b` - | | | | - | | | pattern doesn't bind `b` - | | variable not in all patterns - | pattern doesn't bind `b` - -error[E0408]: variable `c` is not bound in all patterns - --> $DIR/issue-39698.rs:10:9 - | -LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } - | ^^^^^^^^^^^ ^^^^^^^^^^^ - ^^^^^^^^ pattern doesn't bind `c` - | | | | - | | | variable not in all patterns - | | pattern doesn't bind `c` - | pattern doesn't bind `c` - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0408`. diff --git a/src/test/ui/span/issue-40157.rs b/src/test/ui/span/issue-40157.rs deleted file mode 100644 index 03ad21ae7..000000000 --- a/src/test/ui/span/issue-40157.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main () { - {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });} - //~^ ERROR does not live long enough -} diff --git a/src/test/ui/span/issue-40157.stderr b/src/test/ui/span/issue-40157.stderr deleted file mode 100644 index 57f80214a..000000000 --- a/src/test/ui/span/issue-40157.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0597]: `foo` does not live long enough - --> $DIR/issue-40157.rs:2:53 - | -LL | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });} - | ------------------------^^^^^^^^^^-- - | | | | - | | | `foo` dropped here while still borrowed - | | borrowed value does not live long enough - | borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr deleted file mode 100644 index 2b1789908..000000000 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:9:24 - | -LL | let x: Option<_> = None; - | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` -LL | x.unwrap().method_that_could_exist_on_some_type(); - | ---------- type must be known at this point - | -help: consider specifying the generic argument - | -LL | let x: Option<_> = None::; - | +++++ - -error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:15:10 - | -LL | .sum::<_>() - | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` - | -help: consider specifying the generic argument - | -LL | .sum::<_>() - | ~~~~~ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr deleted file mode 100644 index d93d54e87..000000000 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:9:24 - | -LL | let x: Option<_> = None; - | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` -LL | x.unwrap().method_that_could_exist_on_some_type(); - | ---------- type must be known at this point - | -help: consider specifying the generic argument - | -LL | let x: Option<_> = None::; - | +++++ - -error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:15:10 - | -LL | .sum::<_>() - | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` - | -help: consider specifying the generic argument - | -LL | .sum::() - | ~~~~~ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.rs b/src/test/ui/span/issue-42234-unknown-receiver-type.rs deleted file mode 100644 index fd5312120..000000000 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.rs +++ /dev/null @@ -1,19 +0,0 @@ -// revisions: full generic_arg -#![cfg_attr(generic_arg, feature(generic_arg_infer))] - -// When the type of a method call's receiver is unknown, the span should point -// to the receiver (and not the entire call, as was previously the case before -// the fix of which this tests). - -fn shines_a_beacon_through_the_darkness() { - let x: Option<_> = None; //~ ERROR type annotations needed - x.unwrap().method_that_could_exist_on_some_type(); -} - -fn courier_to_des_moines_and_points_west(data: &[u32]) -> String { - data.iter() - .sum::<_>() //~ ERROR type annotations needed - .to_string() -} - -fn main() {} diff --git a/src/test/ui/span/issue-43927-non-ADT-derive.rs b/src/test/ui/span/issue-43927-non-ADT-derive.rs deleted file mode 100644 index 935bfa001..000000000 --- a/src/test/ui/span/issue-43927-non-ADT-derive.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![derive(Debug, PartialEq, Eq)] // should be an outer attribute! -//~^ ERROR cannot determine resolution for the attribute macro `derive` -//~^^ ERROR `derive` attribute cannot be used at crate level -struct DerivedOn; - -fn main() {} diff --git a/src/test/ui/span/issue-43927-non-ADT-derive.stderr b/src/test/ui/span/issue-43927-non-ADT-derive.stderr deleted file mode 100644 index e3ae37e36..000000000 --- a/src/test/ui/span/issue-43927-non-ADT-derive.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: cannot determine resolution for the attribute macro `derive` - --> $DIR/issue-43927-non-ADT-derive.rs:1:4 - | -LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! - | ^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error: `derive` attribute cannot be used at crate level - --> $DIR/issue-43927-non-ADT-derive.rs:1:1 - | -LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: perhaps you meant to use an outer attribute - | -LL | #[derive(Debug, PartialEq, Eq)] // should be an outer attribute! - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/span/issue-71363.rs b/src/test/ui/span/issue-71363.rs deleted file mode 100644 index f187d0efa..000000000 --- a/src/test/ui/span/issue-71363.rs +++ /dev/null @@ -1,19 +0,0 @@ -// compile-flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ui-testing=no - -struct MyError; -impl std::error::Error for MyError {} -//~^ ERROR: `MyError` doesn't implement `std::fmt::Display` -//~| ERROR: `MyError` doesn't implement `Debug` - -fn main() {} - -// This test relies on library/std/src/error.rs *not* being included in the error message, so that -// we can test whether a file not included in the error message affects it (more specifically -// whether the line number of the excluded file affects the indentation of the other line numbers). -// -// To test this we're simulating a remap of the rust src base (so that library/std/src/error.rs -// does not point to a local file) *and* we're disabling the code to try mapping a remapped path to -// a local file (which would defeat the purpose of the former flag). -// -// Note that this comment is at the bottom of the file intentionally, as we need the line number of -// the impl to be lower than 10. diff --git a/src/test/ui/span/issue-71363.stderr b/src/test/ui/span/issue-71363.stderr deleted file mode 100644 index 0370e46e6..000000000 --- a/src/test/ui/span/issue-71363.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0277]: `MyError` doesn't implement `std::fmt::Display` - --> $DIR/issue-71363.rs:4:6 - | -4 | impl std::error::Error for MyError {} - | ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `MyError` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $SRC_DIR/core/src/error.rs:LL:COL - | - = note: required by this bound in `std::error::Error` - -error[E0277]: `MyError` doesn't implement `Debug` - --> $DIR/issue-71363.rs:4:6 - | -4 | impl std::error::Error for MyError {} - | ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted using `{:?}` - | - = help: the trait `Debug` is not implemented for `MyError` - = note: add `#[derive(Debug)]` to `MyError` or manually `impl Debug for MyError` -note: required by a bound in `std::error::Error` - --> $SRC_DIR/core/src/error.rs:LL:COL - | - = note: required by this bound in `std::error::Error` -help: consider annotating `MyError` with `#[derive(Debug)]` - | -3 | #[derive(Debug)] - | - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/span/issue-81800.rs b/src/test/ui/span/issue-81800.rs deleted file mode 100644 index 6ac66fdcb..000000000 --- a/src/test/ui/span/issue-81800.rs +++ /dev/null @@ -1,2 +0,0 @@ -fn x˂- //~ ERROR: unknown start of token - //~^ ERROR: expected one of `#`, `>`, `const`, identifier, or lifetime, found `-` diff --git a/src/test/ui/span/issue-81800.stderr b/src/test/ui/span/issue-81800.stderr deleted file mode 100644 index 86c64573b..000000000 --- a/src/test/ui/span/issue-81800.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: unknown start of token: \u{2c2} - --> $DIR/issue-81800.rs:1:5 - | -LL | fn x˂- - | ^ - | -help: Unicode character '˂' (Modifier Letter Left Arrowhead) looks like '<' (Less-Than Sign), but it is not - | -LL | fn x<- - | ~ - -error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `-` - --> $DIR/issue-81800.rs:1:6 - | -LL | fn x˂- - | ^ expected one of `#`, `>`, `const`, identifier, or lifetime - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/span/issue28498-reject-ex1.rs b/src/test/ui/span/issue28498-reject-ex1.rs deleted file mode 100644 index 4d1b41255..000000000 --- a/src/test/ui/span/issue28498-reject-ex1.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Example taken from RFC 1238 text - -// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md -// #examples-of-code-that-will-start-to-be-rejected - -// Compare against test/run-pass/issue28498-must-work-ex2.rs - -use std::cell::Cell; - -struct Concrete<'a>(u32, Cell>>); - -struct Foo { data: Vec } - -fn potentially_specialized_wrt_t(t: &T) { - // Hypothetical code that does one thing for generic T and then is - // specialized for T == Concrete (and the specialized form can - // then access a reference held in concrete tuple). - // - // (We don't have specialization yet, but we want to allow for it - // in the future.) -} - -impl Drop for Foo { - fn drop(&mut self) { - potentially_specialized_wrt_t(&self.data[0]) - } -} - -fn main() { - let mut foo = Foo { data: Vec::new() }; - foo.data.push(Concrete(0, Cell::new(None))); - foo.data.push(Concrete(0, Cell::new(None))); - - foo.data[0].1.set(Some(&foo.data[1])); - //~^ ERROR borrow may still be in use when destructor runs - foo.data[1].1.set(Some(&foo.data[0])); -} diff --git a/src/test/ui/span/issue28498-reject-ex1.stderr b/src/test/ui/span/issue28498-reject-ex1.stderr deleted file mode 100644 index 86e2d8c56..000000000 --- a/src/test/ui/span/issue28498-reject-ex1.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue28498-reject-ex1.rs:34:29 - | -LL | foo.data[0].1.set(Some(&foo.data[1])); - | ^^^^^^^^ -... -LL | } - | - - | | - | here, drop of `foo` needs exclusive access to `foo.data`, because the type `Foo>` implements the `Drop` trait - | borrow might be used here, when `foo` is dropped and runs the `Drop` code for type `Foo` - | - = note: consider using a `let` binding to create a longer lived value - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0713`. diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.rs b/src/test/ui/span/issue28498-reject-lifetime-param.rs deleted file mode 100644 index 1e7190157..000000000 --- a/src/test/ui/span/issue28498-reject-lifetime-param.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Demonstrate that having a lifetime param causes dropck to reject code -// that might indirectly access previously dropped value. -// -// Compare with run-pass/issue28498-ugeh-with-lifetime-param.rs - -#[derive(Debug)] -struct ScribbleOnDrop(String); - -impl Drop for ScribbleOnDrop { - fn drop(&mut self) { - self.0 = format!("DROPPED"); - } -} - -struct Foo<'a>(u32, &'a ScribbleOnDrop); - -impl<'a> Drop for Foo<'a> { - fn drop(&mut self) { - // Use of `may_dangle` is unsound, because destructor accesses borrowed data - // in `self.1` and we must force that to strictly outlive `self`. - println!("Dropping Foo({}, {:?})", self.0, self.1); - } -} - -fn main() { - let (last_dropped, foo0); - let (foo1, first_dropped); - - last_dropped = ScribbleOnDrop(format!("last")); - first_dropped = ScribbleOnDrop(format!("first")); - foo0 = Foo(0, &last_dropped); // OK - foo1 = Foo(1, &first_dropped); - //~^ ERROR `first_dropped` does not live long enough - - println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); -} diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.stderr b/src/test/ui/span/issue28498-reject-lifetime-param.stderr deleted file mode 100644 index 3119ddd03..000000000 --- a/src/test/ui/span/issue28498-reject-lifetime-param.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-lifetime-param.rs:32:19 - | -LL | foo1 = Foo(1, &first_dropped); - | ^^^^^^^^^^^^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `first_dropped` dropped here while still borrowed - | borrow might be used here, when `foo1` is dropped and runs the `Drop` code for type `Foo` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.rs b/src/test/ui/span/issue28498-reject-passed-to-fn.rs deleted file mode 100644 index dcd2e9ad4..000000000 --- a/src/test/ui/span/issue28498-reject-passed-to-fn.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Demonstrate that a type param in negative position causes dropck to reject code -// that might indirectly access previously dropped value. -// -// Compare with run-pass/issue28498-ugeh-with-passed-to-fn.rs - -#[derive(Debug)] -struct ScribbleOnDrop(String); - -impl Drop for ScribbleOnDrop { - fn drop(&mut self) { - self.0 = format!("DROPPED"); - } -} - -struct Foo(u32, T, Box fn(&'r T) -> String>); - -impl Drop for Foo { - fn drop(&mut self) { - // Use of `may_dangle` is unsound, because we pass `T` to the callback in `self.2` - // below, and thus potentially read from borrowed data. - println!("Dropping Foo({}, {})", self.0, (self.2)(&self.1)); - } -} - -fn callback(s: & &ScribbleOnDrop) -> String { format!("{:?}", s) } - -fn main() { - let (last_dropped, foo0); - let (foo1, first_dropped); - - last_dropped = ScribbleOnDrop(format!("last")); - first_dropped = ScribbleOnDrop(format!("first")); - foo0 = Foo(0, &last_dropped, Box::new(callback)); // OK - foo1 = Foo(1, &first_dropped, Box::new(callback)); - //~^ ERROR `first_dropped` does not live long enough - - println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); -} diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr b/src/test/ui/span/issue28498-reject-passed-to-fn.stderr deleted file mode 100644 index 60e8a648c..000000000 --- a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-passed-to-fn.rs:34:19 - | -LL | foo1 = Foo(1, &first_dropped, Box::new(callback)); - | ^^^^^^^^^^^^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `first_dropped` dropped here while still borrowed - | borrow might be used here, when `foo1` is dropped and runs the `Drop` code for type `Foo` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/issue28498-reject-trait-bound.rs b/src/test/ui/span/issue28498-reject-trait-bound.rs deleted file mode 100644 index 444cebb19..000000000 --- a/src/test/ui/span/issue28498-reject-trait-bound.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Demonstrate that having a trait bound causes dropck to reject code -// that might indirectly access previously dropped value. -// -// Compare with run-pass/issue28498-ugeh-with-trait-bound.rs - -use std::fmt; - -#[derive(Debug)] -struct ScribbleOnDrop(String); - -impl Drop for ScribbleOnDrop { - fn drop(&mut self) { - self.0 = format!("DROPPED"); - } -} - -struct Foo(u32, T); - -impl Drop for Foo { - fn drop(&mut self) { - // Use of `may_dangle` is unsound, because we access `T` fmt method when we pass - // `self.1` below, and thus potentially read from borrowed data. - println!("Dropping Foo({}, {:?})", self.0, self.1); - } -} - -fn main() { - let (last_dropped, foo0); - let (foo1, first_dropped); - - last_dropped = ScribbleOnDrop(format!("last")); - first_dropped = ScribbleOnDrop(format!("first")); - foo0 = Foo(0, &last_dropped); // OK - foo1 = Foo(1, &first_dropped); - //~^ ERROR `first_dropped` does not live long enough - - println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); -} diff --git a/src/test/ui/span/issue28498-reject-trait-bound.stderr b/src/test/ui/span/issue28498-reject-trait-bound.stderr deleted file mode 100644 index 22e4a8205..000000000 --- a/src/test/ui/span/issue28498-reject-trait-bound.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-trait-bound.rs:34:19 - | -LL | foo1 = Foo(1, &first_dropped); - | ^^^^^^^^^^^^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `first_dropped` dropped here while still borrowed - | borrow might be used here, when `foo1` is dropped and runs the `Drop` code for type `Foo` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/lint-unused-unsafe-thir.rs b/src/test/ui/span/lint-unused-unsafe-thir.rs deleted file mode 100644 index adb72c26b..000000000 --- a/src/test/ui/span/lint-unused-unsafe-thir.rs +++ /dev/null @@ -1,61 +0,0 @@ -// FIXME: This file is tracking old lint behavior that's still unchanged in the -// unstable -Zthir-unsafeck implementation. See lint-unused-unsafe.rs for more details. -// -// Exercise the unused_unsafe attribute in some positive and negative cases - -// compile-flags: -Zthir-unsafeck - -#![allow(dead_code)] -#![deny(unused_unsafe)] - - -mod foo { - extern "C" { - pub fn bar(); - } -} - -fn callback(_f: F) -> T where F: FnOnce() -> T { panic!() } -unsafe fn unsf() {} - -fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block -fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block -fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad5() { unsafe { unsf() } } -fn bad6() { - unsafe { // don't put the warning here - unsafe { //~ ERROR: unnecessary `unsafe` block - unsf() - } - } -} -unsafe fn bad7() { - unsafe { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsf() - } - } -} - -unsafe fn good0() { unsf() } -fn good1() { unsafe { unsf() } } -fn good2() { - /* bug uncovered when implementing warning about unused unsafe blocks. Be - sure that when purity is inherited that the source of the unsafe-ness - is tracked correctly */ - unsafe { - unsafe fn what() -> Vec { panic!() } - - callback(|| { - what(); - }); - } -} - -unsafe fn good3() { foo::bar() } -fn good4() { unsafe { foo::bar() } } - -#[allow(unused_unsafe)] fn allowed() { unsafe {} } - -fn main() {} diff --git a/src/test/ui/span/lint-unused-unsafe-thir.stderr b/src/test/ui/span/lint-unused-unsafe-thir.stderr deleted file mode 100644 index 3bcbb7597..000000000 --- a/src/test/ui/span/lint-unused-unsafe-thir.stderr +++ /dev/null @@ -1,50 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:21:13 - | -LL | fn bad1() { unsafe {} } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe-thir.rs:9:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:22:13 - | -LL | fn bad2() { unsafe { bad1() } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:23:20 - | -LL | unsafe fn bad3() { unsafe {} } - | ---------------- ^^^^^^ unnecessary `unsafe` block - | | - | because it's nested under this `unsafe` fn - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:24:13 - | -LL | fn bad4() { unsafe { callback(||{}) } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:28:9 - | -LL | unsafe { // don't put the warning here - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe-thir.rs:35:9 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/span/lint-unused-unsafe.mir.stderr b/src/test/ui/span/lint-unused-unsafe.mir.stderr deleted file mode 100644 index d8412908c..000000000 --- a/src/test/ui/span/lint-unused-unsafe.mir.stderr +++ /dev/null @@ -1,1402 +0,0 @@ -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:26:13 - | -LL | fn bad1() { unsafe {} } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:14:9 - | -LL | #![deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:27:13 - | -LL | fn bad2() { unsafe { bad1() } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:28:20 - | -LL | unsafe fn bad3() { unsafe {} } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:29:13 - | -LL | fn bad4() { unsafe { callback(||{}) } } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:32:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:39:5 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:74:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:83:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:84:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:85:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:90:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:100:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:101:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:102:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:112:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:110:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:113:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:114:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:124:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:134:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:135:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:136:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:142:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:153:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:154:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:155:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:166:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:164:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:167:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:168:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:178:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:188:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:189:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:190:13 - | -LL | unsafe {} - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:196:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:207:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:208:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:209:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:220:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:218:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:221:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:222:17 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | unsafe { unsf() } - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:242:9 - | -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:255:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:268:13 - | -LL | unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:286:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:295:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:296:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:297:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:302:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:312:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:313:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:314:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:324:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:322:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:325:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:326:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:336:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:346:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:347:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:348:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:354:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:365:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:366:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:367:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:378:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:376:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:379:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:380:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:390:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:400:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:401:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:402:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:408:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:419:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:420:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:421:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:432:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:430:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:433:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:434:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:454:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:467:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:480:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:499:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:508:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:509:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:510:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:515:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:525:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsf(); -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:526:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:527:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:537:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:535:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:538:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:539:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:549:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:559:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:560:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:561:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:567:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:578:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsf(); -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:579:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:580:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:591:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:589:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:592:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:593:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:603:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:613:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:614:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:615:24 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:621:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:632:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsf(); -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:633:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:634:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:645:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:643:20 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:646:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:647:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { let _ = || unsf(); }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:667:20 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:680:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:693:24 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:711:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:721:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:722:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:723:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:729:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:740:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:741:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:742:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:753:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:751:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:754:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:755:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:765:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:775:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:776:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:777:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:783:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:794:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:795:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:796:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:807:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:805:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:808:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:809:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:829:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:842:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:855:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:869:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:879:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:880:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:881:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:887:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:898:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:899:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:900:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:911:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:909:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:912:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:913:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:923:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:933:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:934:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:935:28 - | -LL | let _ = || unsafe {}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:941:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:952:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | unsf(); -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:953:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:954:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:965:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - | -note: the lint level is defined here - --> $DIR/lint-unused-unsafe.rs:963:24 - | -LL | #[deny(unused_unsafe)] - | ^^^^^^^^^^^^^ - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:966:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:967:32 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = || unsafe { unsf() }; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:987:24 - | -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1000:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1013:28 - | -LL | let _ = || unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = || unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1059:29 - | -LL | let _ = async { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1066:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = async { unsf() }; -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1067:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1068:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1073:29 - | -LL | let _ = async { unsafe { - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1080:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -LL | let _ = async { unsf() }; -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1081:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1082:33 - | -LL | let _ = async { unsafe { - | ------ because it's nested under this `unsafe` block -... -LL | let _ = async { unsafe { let _ = async { unsf() }; }}; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1092:22 - | -LL | let _x: [(); unsafe { 0 }] = []; - | ^^^^^^ unnecessary `unsafe` block - -error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:1096:22 - | -LL | let _x: [(); unsafe { unsafe { size() } }] = []; - | ^^^^^^ unnecessary `unsafe` block - -error: aborting due to 174 previous errors - diff --git a/src/test/ui/span/lint-unused-unsafe.rs b/src/test/ui/span/lint-unused-unsafe.rs deleted file mode 100644 index 5d042768b..000000000 --- a/src/test/ui/span/lint-unused-unsafe.rs +++ /dev/null @@ -1,1100 +0,0 @@ -// Exercise the unused_unsafe attribute in some positive and negative cases - - -// edition:2018 - -// revisions: mir - -// FIXME: Adapt -Zthir-unsafeck to behave the same as the mir version after #93678, -// then delete lint-unused-unsafe-thir.rs, and go back to using the settings below -// // revisions: mir thir -// // [thir]compile-flags: -Zthir-unsafeck - -#![allow(dead_code)] -#![deny(unused_unsafe)] - - -mod foo { - extern "C" { - pub fn bar(); - } -} - -fn callback(_f: F) -> T where F: FnOnce() -> T { panic!() } -unsafe fn unsf() {} - -fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block -fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block -fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block -unsafe fn bad5() { unsafe { unsf() } } -fn bad6() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { // don't put the warning here - unsf() - } - } -} -unsafe fn bad7() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { - unsf() - } - } -} - -unsafe fn good0() { unsf() } -fn good1() { unsafe { unsf() } } -fn good2() { - /* bug uncovered when implementing warning about unused unsafe blocks. Be - sure that when purity is inherited that the source of the unsafe-ness - is tracked correctly */ - unsafe { - unsafe fn what() -> Vec { panic!() } - - callback(|| { - what(); - }); - } -} - -unsafe fn good3() { foo::bar() } -fn good4() { unsafe { foo::bar() } } - -#[allow(unused_unsafe)] fn allowed() { unsafe {} } - -fn main() {} - -mod additional_tests { - unsafe fn unsf() {} - - // some tests - - fn inner_ignored() { - unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - unsafe { - unsf() - } - } - } - - fn multi_level_unused() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe {} //~ ERROR: unnecessary `unsafe` block - unsafe {} //~ ERROR: unnecessary `unsafe` block - } - } - - fn granularity() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } - unsafe { unsf() } - unsafe { unsf() } - } - } - - fn top_level_used() { - unsafe { - unsf(); - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - } - - } - - fn top_level_ignored() { - #[allow(unused_unsafe)] - unsafe { - #[deny(unused_unsafe)] - { - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - } - } - - } - - // same tests in unsafe fn without unsafe_op_in_unsafe_fn allowed - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_1() { - unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - unsafe { - unsf() - } - } - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_1() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe {} //~ ERROR: unnecessary `unsafe` block - unsafe {} //~ ERROR: unnecessary `unsafe` block - } - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_1() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } - unsafe { unsf() } - unsafe { unsf() } - } - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_1() { - unsafe { - unsf(); - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - } - - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_1() { - #[allow(unused_unsafe)] - unsafe { - #[deny(unused_unsafe)] - { - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - } - } - } - - // same tests, but unsafe_op_in_unsafe_fn allowed, - // so that *all* unsafe blocks are unused - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_2() { - unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - unsafe { - unsf() - } - } - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_2() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe {} //~ ERROR: unnecessary `unsafe` block - unsafe {} //~ ERROR: unnecessary `unsafe` block - } - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_2() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } - unsafe { unsf() } - unsafe { unsf() } - } - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_2() { - unsafe { - unsf(); - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - } - - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_2() { - #[allow(unused_unsafe)] - unsafe { - #[deny(unused_unsafe)] - { - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - unsafe { unsf() } //~ ERROR: unnecessary `unsafe` block - } - } - } - - // additional tests when using unsafe_op_in_unsafe_fn - // in more complex ways - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn() { - unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - } - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_2() { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - } - } - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_3() { - unsafe { - unsafe { //~ ERROR: unnecessary `unsafe` block - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - } - unsf(); - } - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_4() { - unsafe { - unsafe { //~ ERROR: unnecessary `unsafe` block - unsf(); - } - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - } - } -} - -// the same set of tests, with closures everywhere -mod additional_tests_closures { - unsafe fn unsf() {} - - // some tests - - fn inner_ignored() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - unsf() - }; - }; - } - - fn multi_level_unused() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - fn granularity() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - }; - } - - fn top_level_used() { - let _ = || unsafe { - unsf(); - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - fn top_level_ignored() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - } - }; - - } - - // same tests in unsafe fn without unsafe_op_in_unsafe_fn allowed - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - unsf() - }; - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_1() { - let _ = || unsafe { - unsf(); - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_1() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - } - }; - } - - // same tests, but unsafe_op_in_unsafe_fn allowed, - // so that *all* unsafe blocks are unused - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - unsf() - }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_2() { - let _ = || unsafe { - unsf(); - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_2() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - } - }; - } - - // additional tests when using unsafe_op_in_unsafe_fn - // in more complex ways - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn() { - let _ = || unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_3() { - let _ = || unsafe { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - unsf(); - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_4() { - let _ = || unsafe { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - unsf(); - }; - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - } -} - -// the same set of tests, with closures everywhere -// and closures on the unsafe fn calls -mod additional_tests_even_more_closures { - unsafe fn unsf() {} - - // some tests - - fn inner_ignored() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - let _ = || unsf(); - }; - }; - } - - fn multi_level_unused() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - fn granularity() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; - let _ = || unsafe { let _ = || unsf(); }; - let _ = || unsafe { let _ = || unsf(); }; - }; - } - - fn top_level_used() { - let _ = || unsafe { - let _ = || unsf(); - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - fn top_level_ignored() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - } - }; - - } - - // same tests in unsafe fn without unsafe_op_in_unsafe_fn allowed - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - let _ = || unsf(); - }; - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; - let _ = || unsafe { let _ = || unsf(); }; - let _ = || unsafe { let _ = || unsf(); }; - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_1() { - let _ = || unsafe { - let _ = || unsf(); - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_1() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - } - }; - } - - // same tests, but unsafe_op_in_unsafe_fn allowed, - // so that *all* unsafe blocks are unused - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - let _ = || unsf(); - }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; - let _ = || unsafe { let _ = || unsf(); }; - let _ = || unsafe { let _ = || unsf(); }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_2() { - let _ = || unsafe { - let _ = || unsf(); - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_2() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { let _ = || unsf(); }; //~ ERROR: unnecessary `unsafe` block - } - }; - } - - // additional tests when using unsafe_op_in_unsafe_fn - // in more complex ways - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn() { - let _ = || unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - let _ = || unsf(); - } - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - let _ = || unsf(); - } - }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_3() { - let _ = || unsafe { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[deny(unsafe_op_in_unsafe_fn)] - { - let _ = || unsf(); - } - }; - let _ = || unsf(); - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_4() { - let _ = || unsafe { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsf(); - }; - #[deny(unsafe_op_in_unsafe_fn)] - { - let _ = || unsf(); - } - }; - } -} - -mod item_likes { - unsafe fn unsf() {} - - struct S; - impl S { - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - unsf() - }; - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_1() { - let _ = || unsafe { - unsf(); - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_1() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - } - }; - } - - // same tests, but unsafe_op_in_unsafe_fn allowed, - // so that *all* unsafe blocks are unused - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - unsf() - }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_2() { - let _ = || unsafe { - unsf(); - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_2() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - } - }; - } - - // additional tests when using unsafe_op_in_unsafe_fn - // in more complex ways - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn() { - let _ = || unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_3() { - let _ = || unsafe { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - unsf(); - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_4() { - let _ = || unsafe { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - unsf(); - }; - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - } - } - - trait T { - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - unsf() - }; - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_1() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - }; - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_1() { - let _ = || unsafe { - unsf(); - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - #[deny(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_1() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - } - }; - } - - // same tests, but unsafe_op_in_unsafe_fn allowed, - // so that *all* unsafe blocks are unused - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn inner_ignored_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[allow(unused_unsafe)] - let _ = || unsafe { - unsf() - }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn multi_level_unused_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe {}; //~ ERROR: unnecessary `unsafe` block - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granularity_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - let _ = || unsafe { unsf() }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_used_2() { - let _ = || unsafe { - unsf(); - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - }; - - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn top_level_ignored_2() { - #[allow(unused_unsafe)] - let _ = || unsafe { - #[deny(unused_unsafe)] - { - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { unsf() }; //~ ERROR: unnecessary `unsafe` block - } - }; - } - - // additional tests when using unsafe_op_in_unsafe_fn - // in more complex ways - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn() { - let _ = || unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_2() { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = || unsafe { - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_3() { - let _ = || unsafe { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - unsf(); - }; - } - - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn_4() { - let _ = || unsafe { - let _ = || unsafe { //~ ERROR: unnecessary `unsafe` block - unsf(); - }; - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - } - } -} - -mod additional_tests_extra { - unsafe fn unsf() {} - - // multiple uses with different `unsafe_op_in_unsafe_fn` in the same closure - #[allow(unsafe_op_in_unsafe_fn)] - unsafe fn granular_disallow_op_in_unsafe_fn() { - let _ = || unsafe { - let _ = || { - unsf(); - #[deny(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - }; - }; - } - - #[warn(unsafe_op_in_unsafe_fn)] - unsafe fn multiple_unsafe_op_in_unsafe_fn_allows() { - unsafe { - #[allow(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - #[allow(unsafe_op_in_unsafe_fn)] - { - unsf(); - } - } - } - - async unsafe fn async_blocks() { - #[deny(unsafe_op_in_unsafe_fn)] - { - let _ = async { unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = async { unsafe { let _ = async { unsf() }; }}; - let _ = async { unsafe { let _ = async { unsf() }; }}; - let _ = async { unsafe { let _ = async { unsf() }; }}; - }}; - let _ = async { unsafe { - let _ = async { unsf() }; - let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block - let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block - let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block - }}; - } - #[allow(unsafe_op_in_unsafe_fn)] - { - let _ = async { unsafe { //~ ERROR: unnecessary `unsafe` block - let _ = async { unsafe { let _ = async { unsf() }; }}; - let _ = async { unsafe { let _ = async { unsf() }; }}; - let _ = async { unsafe { let _ = async { unsf() }; }}; - }}; - let _ = async { unsafe { - let _ = async { unsf() }; - let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block - let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block - let _ = async { unsafe { let _ = async { unsf() }; }}; //~ ERROR: unnecessary `unsafe` block - }}; - } - } - - fn used_unsafe_in_const() { - let _x: [(); unsafe { size() }] = []; - } - - fn unused_unsafe_in_const_1() { - let _x: [(); unsafe { 0 }] = []; //~ ERROR: unnecessary `unsafe` block - } - - fn unused_unsafe_in_const_2() { - let _x: [(); unsafe { unsafe { size() } }] = []; //~ ERROR: unnecessary `unsafe` block - } - - const unsafe fn size() -> usize { 0 } -} diff --git a/src/test/ui/span/macro-span-replacement.rs b/src/test/ui/span/macro-span-replacement.rs deleted file mode 100644 index 66973c58d..000000000 --- a/src/test/ui/span/macro-span-replacement.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass - -#![warn(unused)] - -macro_rules! m { - ($a:tt $b:tt) => { - $b $a; //~ WARN struct `S` is never constructed - } -} - -fn main() { - m!(S struct); -} diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr deleted file mode 100644 index 5dd563428..000000000 --- a/src/test/ui/span/macro-span-replacement.stderr +++ /dev/null @@ -1,19 +0,0 @@ -warning: struct `S` is never constructed - --> $DIR/macro-span-replacement.rs:7:12 - | -LL | $b $a; - | ^^ -... -LL | m!(S struct); - | ------------ in this macro invocation - | -note: the lint level is defined here - --> $DIR/macro-span-replacement.rs:3:9 - | -LL | #![warn(unused)] - | ^^^^^^ - = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` - = note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: 1 warning emitted - diff --git a/src/test/ui/span/macro-ty-params.rs b/src/test/ui/span/macro-ty-params.rs deleted file mode 100644 index cf28b0255..000000000 --- a/src/test/ui/span/macro-ty-params.rs +++ /dev/null @@ -1,15 +0,0 @@ -macro_rules! m { - ($p1: path) => { - #[derive($p1)] struct U; - } -} - -macro_rules! foo { () => () } - -fn main() { - foo::!(); //~ ERROR generic arguments in macro path - foo::<>!(); //~ ERROR generic arguments in macro path - m!(Default<>); - //~^ ERROR unexpected generic arguments in path - //~^^ ERROR generic arguments in macro path -} diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr deleted file mode 100644 index 7023ef8cd..000000000 --- a/src/test/ui/span/macro-ty-params.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:10:10 - | -LL | foo::!(); - | ^^^ - -error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:11:10 - | -LL | foo::<>!(); - | ^^ - -error: unexpected generic arguments in path - --> $DIR/macro-ty-params.rs:12:15 - | -LL | m!(Default<>); - | ^^ - -error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:12:15 - | -LL | m!(Default<>); - | ^^ - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/span/method-and-field-eager-resolution.rs b/src/test/ui/span/method-and-field-eager-resolution.rs deleted file mode 100644 index a0f0d8810..000000000 --- a/src/test/ui/span/method-and-field-eager-resolution.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Test that spans get only base in eager type resolution (structurally_resolve_type). - -fn main() { - let mut x = Default::default(); - //~^ ERROR type annotations needed - x.0; - x = 1; -} - -fn foo() { - let mut x = Default::default(); - //~^ ERROR type annotations needed - x[0]; - x = 1; -} diff --git a/src/test/ui/span/method-and-field-eager-resolution.stderr b/src/test/ui/span/method-and-field-eager-resolution.stderr deleted file mode 100644 index 7d240589a..000000000 --- a/src/test/ui/span/method-and-field-eager-resolution.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/method-and-field-eager-resolution.rs:4:9 - | -LL | let mut x = Default::default(); - | ^^^^^ -LL | -LL | x.0; - | - type must be known at this point - | -help: consider giving `x` an explicit type - | -LL | let mut x: _ = Default::default(); - | +++ - -error[E0282]: type annotations needed - --> $DIR/method-and-field-eager-resolution.rs:11:9 - | -LL | let mut x = Default::default(); - | ^^^^^ -LL | -LL | x[0]; - | - type must be known at this point - | -help: consider giving `x` an explicit type - | -LL | let mut x: _ = Default::default(); - | +++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/span/missing-unit-argument.rs b/src/test/ui/span/missing-unit-argument.rs deleted file mode 100644 index 5b9861da6..000000000 --- a/src/test/ui/span/missing-unit-argument.rs +++ /dev/null @@ -1,17 +0,0 @@ -fn foo(():(), ():()) {} -fn bar(():()) {} - -struct S; -impl S { - fn baz(self, (): ()) { } - fn generic(self, _: T) { } -} - -fn main() { - let _: Result<(), String> = Ok(); //~ ERROR this enum variant takes - foo(); //~ ERROR this function takes - foo(()); //~ ERROR this function takes - bar(); //~ ERROR this function takes - S.baz(); //~ ERROR this function takes - S.generic::<()>(); //~ ERROR this function takes -} diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr deleted file mode 100644 index b76a3ab30..000000000 --- a/src/test/ui/span/missing-unit-argument.stderr +++ /dev/null @@ -1,99 +0,0 @@ -error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied - --> $DIR/missing-unit-argument.rs:11:33 - | -LL | let _: Result<(), String> = Ok(); - | ^^-- an argument of type `()` is missing - | -note: tuple variant defined here - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^ -help: provide the argument - | -LL | let _: Result<(), String> = Ok(()); - | ~~~~ - -error[E0061]: this function takes 2 arguments but 0 arguments were supplied - --> $DIR/missing-unit-argument.rs:12:5 - | -LL | foo(); - | ^^^-- two arguments of type `()` and `()` are missing - | -note: function defined here - --> $DIR/missing-unit-argument.rs:1:4 - | -LL | fn foo(():(), ():()) {} - | ^^^ ----- ----- -help: provide the arguments - | -LL | foo((), ()); - | ~~~~~~~~ - -error[E0061]: this function takes 2 arguments but 1 argument was supplied - --> $DIR/missing-unit-argument.rs:13:5 - | -LL | foo(()); - | ^^^---- an argument of type `()` is missing - | -note: function defined here - --> $DIR/missing-unit-argument.rs:1:4 - | -LL | fn foo(():(), ():()) {} - | ^^^ ----- ----- -help: provide the argument - | -LL | foo((), ()); - | ~~~~~~~~ - -error[E0061]: this function takes 1 argument but 0 arguments were supplied - --> $DIR/missing-unit-argument.rs:14:5 - | -LL | bar(); - | ^^^-- an argument of type `()` is missing - | -note: function defined here - --> $DIR/missing-unit-argument.rs:2:4 - | -LL | fn bar(():()) {} - | ^^^ ----- -help: provide the argument - | -LL | bar(()); - | ~~~~ - -error[E0061]: this function takes 1 argument but 0 arguments were supplied - --> $DIR/missing-unit-argument.rs:15:7 - | -LL | S.baz(); - | ^^^-- an argument of type `()` is missing - | -note: associated function defined here - --> $DIR/missing-unit-argument.rs:6:8 - | -LL | fn baz(self, (): ()) { } - | ^^^ ------ -help: provide the argument - | -LL | S.baz(()); - | ~~~~ - -error[E0061]: this function takes 1 argument but 0 arguments were supplied - --> $DIR/missing-unit-argument.rs:16:7 - | -LL | S.generic::<()>(); - | ^^^^^^^^^^^^^-- an argument of type `()` is missing - | -note: associated function defined here - --> $DIR/missing-unit-argument.rs:7:8 - | -LL | fn generic(self, _: T) { } - | ^^^^^^^ ---- -help: provide the argument - | -LL | S.generic::<()>(()); - | ~~~~ - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0061`. diff --git a/src/test/ui/span/move-closure.rs b/src/test/ui/span/move-closure.rs deleted file mode 100644 index bdd7951b3..000000000 --- a/src/test/ui/span/move-closure.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Regression test for issue #24986 -// Make sure that the span of a closure marked `move` begins at the `move` keyword. - -fn main() { - let x: () = move || (); //~ ERROR mismatched types -} diff --git a/src/test/ui/span/move-closure.stderr b/src/test/ui/span/move-closure.stderr deleted file mode 100644 index dcc607896..000000000 --- a/src/test/ui/span/move-closure.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/move-closure.rs:5:17 - | -LL | let x: () = move || (); - | -- ^^^^^^^^^^ expected `()`, found closure - | | - | expected due to this - | - = note: expected unit type `()` - found closure `[closure@$DIR/move-closure.rs:5:17: 5:24]` -help: use parentheses to call this closure - | -LL | let x: () = (move || ())(); - | + +++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/span/multiline-span-E0072.rs b/src/test/ui/span/multiline-span-E0072.rs deleted file mode 100644 index 728b47d65..000000000 --- a/src/test/ui/span/multiline-span-E0072.rs +++ /dev/null @@ -1,10 +0,0 @@ -// It should just use the entire body instead of pointing at the next two lines -struct //~ ERROR has infinite size -ListNode -{ - head: u8, - tail: Option, -} - -fn main() { -} diff --git a/src/test/ui/span/multiline-span-E0072.stderr b/src/test/ui/span/multiline-span-E0072.stderr deleted file mode 100644 index fc2f6e662..000000000 --- a/src/test/ui/span/multiline-span-E0072.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0072]: recursive type `ListNode` has infinite size - --> $DIR/multiline-span-E0072.rs:2:1 - | -LL | / struct -LL | | ListNode - | |________^ -... -LL | tail: Option, - | -------- recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle - | -LL | tail: Option>, - | ++++ + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0072`. diff --git a/src/test/ui/span/multiline-span-simple.rs b/src/test/ui/span/multiline-span-simple.rs deleted file mode 100644 index 204a7f6b1..000000000 --- a/src/test/ui/span/multiline-span-simple.rs +++ /dev/null @@ -1,20 +0,0 @@ -fn foo(a: u32, b: u32) { - a + b; -} - -fn bar(a: u32, b: u32) { - a + b; -} - -fn main() { - let x = 1; - let y = 2; - let z = 3; - foo(1 as u32 + //~ ERROR cannot add `()` to `u32` - - bar(x, - - y), - - z) -} diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr deleted file mode 100644 index b44df962a..000000000 --- a/src/test/ui/span/multiline-span-simple.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0277]: cannot add `()` to `u32` - --> $DIR/multiline-span-simple.rs:13:18 - | -LL | foo(1 as u32 + - | ^ no implementation for `u32 + ()` - | - = help: the trait `Add<()>` is not implemented for `u32` - = help: the following other types implement trait `Add`: - <&'a u32 as Add> - <&u32 as Add<&u32>> - > - - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/span/multispan-import-lint.rs b/src/test/ui/span/multispan-import-lint.rs deleted file mode 100644 index 3ce7f2ce3..000000000 --- a/src/test/ui/span/multispan-import-lint.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass - -#![warn(unused)] - -use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; -//~^ WARN unused imports - -fn main() { - let _ = min(1, 2); -} diff --git a/src/test/ui/span/multispan-import-lint.stderr b/src/test/ui/span/multispan-import-lint.stderr deleted file mode 100644 index 4a955d1b3..000000000 --- a/src/test/ui/span/multispan-import-lint.stderr +++ /dev/null @@ -1,15 +0,0 @@ -warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd` - --> $DIR/multispan-import-lint.rs:5:16 - | -LL | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; - | ^^ ^^^ ^^^^^^^^^ ^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/multispan-import-lint.rs:3:9 - | -LL | #![warn(unused)] - | ^^^^^^ - = note: `#[warn(unused_imports)]` implied by `#[warn(unused)]` - -warning: 1 warning emitted - diff --git a/src/test/ui/span/mut-arg-hint.rs b/src/test/ui/span/mut-arg-hint.rs deleted file mode 100644 index d7ff1f0de..000000000 --- a/src/test/ui/span/mut-arg-hint.rs +++ /dev/null @@ -1,22 +0,0 @@ -trait B { - fn foo(mut a: &String) { - a.push_str("bar"); //~ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference - } -} - -pub fn foo<'a>(mut a: &'a String) { - a.push_str("foo"); //~ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference -} - -struct A {} - -impl A { - pub fn foo(mut a: &String) { - a.push_str("foo"); //~ ERROR cannot borrow `*a` as mutable, as it is behind a `&` reference - } -} - -fn main() { - foo(&"a".to_string()); - A::foo(&"a".to_string()); -} diff --git a/src/test/ui/span/mut-arg-hint.stderr b/src/test/ui/span/mut-arg-hint.stderr deleted file mode 100644 index 8a7c504f0..000000000 --- a/src/test/ui/span/mut-arg-hint.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference - --> $DIR/mut-arg-hint.rs:3:9 - | -LL | fn foo(mut a: &String) { - | ------- help: consider changing this to be a mutable reference: `&mut String` -LL | a.push_str("bar"); - | ^^^^^^^^^^^^^^^^^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference - --> $DIR/mut-arg-hint.rs:8:5 - | -LL | pub fn foo<'a>(mut a: &'a String) { - | ---------- help: consider changing this to be a mutable reference: `&'a mut String` -LL | a.push_str("foo"); - | ^^^^^^^^^^^^^^^^^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference - --> $DIR/mut-arg-hint.rs:15:9 - | -LL | pub fn foo(mut a: &String) { - | ------- help: consider changing this to be a mutable reference: `&mut String` -LL | a.push_str("foo"); - | ^^^^^^^^^^^^^^^^^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.rs b/src/test/ui/span/mut-ptr-cant-outlive-ref.rs deleted file mode 100644 index b8c752d73..000000000 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::cell::RefCell; - -fn main() { - let m = RefCell::new(0); - let p; - { - let b = m.borrow(); - p = &*b; - } - //~^^ ERROR `b` does not live long enough - p.use_ref(); -} - -trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } -impl Fake for T { } diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr deleted file mode 100644 index 4d976a7bb..000000000 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0597]: `b` does not live long enough - --> $DIR/mut-ptr-cant-outlive-ref.rs:8:15 - | -LL | p = &*b; - | ^ borrowed value does not live long enough -LL | } - | - `b` dropped here while still borrowed -LL | -LL | p.use_ref(); - | ----------- borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/non-existing-module-import.rs b/src/test/ui/span/non-existing-module-import.rs deleted file mode 100644 index d2ce7ec4f..000000000 --- a/src/test/ui/span/non-existing-module-import.rs +++ /dev/null @@ -1,3 +0,0 @@ -use std::bar::{foo1, foo2}; //~ ERROR unresolved import - -fn main() {} diff --git a/src/test/ui/span/non-existing-module-import.stderr b/src/test/ui/span/non-existing-module-import.stderr deleted file mode 100644 index 25c099590..000000000 --- a/src/test/ui/span/non-existing-module-import.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0432]: unresolved import `std::bar` - --> $DIR/non-existing-module-import.rs:1:10 - | -LL | use std::bar::{foo1, foo2}; - | ^^^ could not find `bar` in `std` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/span/pub-struct-field.rs b/src/test/ui/span/pub-struct-field.rs deleted file mode 100644 index e149b9dbf..000000000 --- a/src/test/ui/span/pub-struct-field.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Regression test for issue #26083 and #35435 -// Test that span for public struct fields start at `pub` - -struct Foo { - bar: u8, - pub bar: u8, //~ ERROR is already declared - pub(crate) bar: u8, //~ ERROR is already declared -} - -fn main() {} diff --git a/src/test/ui/span/pub-struct-field.stderr b/src/test/ui/span/pub-struct-field.stderr deleted file mode 100644 index 065340f44..000000000 --- a/src/test/ui/span/pub-struct-field.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0124]: field `bar` is already declared - --> $DIR/pub-struct-field.rs:6:5 - | -LL | bar: u8, - | ------- `bar` first declared here -LL | pub bar: u8, - | ^^^^^^^^^^^ field already declared - -error[E0124]: field `bar` is already declared - --> $DIR/pub-struct-field.rs:7:5 - | -LL | bar: u8, - | ------- `bar` first declared here -LL | pub bar: u8, -LL | pub(crate) bar: u8, - | ^^^^^^^^^^^^^^^^^^ field already declared - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0124`. diff --git a/src/test/ui/span/range-2.rs b/src/test/ui/span/range-2.rs deleted file mode 100644 index c4bb16f44..000000000 --- a/src/test/ui/span/range-2.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Test range syntax - borrow errors. -#![feature(rustc_attrs)] -pub fn main() { #![rustc_error] // rust-lang/rust#49855 - let r = { - let a = 42; - let b = 42; - &a..&b - }; - //~^^ ERROR `a` does not live long enough - //~| ERROR `b` does not live long enough - r.use_ref(); -} - -trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } -impl Fake for T { } diff --git a/src/test/ui/span/range-2.stderr b/src/test/ui/span/range-2.stderr deleted file mode 100644 index 8ca8156b0..000000000 --- a/src/test/ui/span/range-2.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0597]: `a` does not live long enough - --> $DIR/range-2.rs:7:9 - | -LL | let r = { - | - borrow later stored here -... -LL | &a..&b - | ^^ borrowed value does not live long enough -LL | }; - | - `a` dropped here while still borrowed - -error[E0597]: `b` does not live long enough - --> $DIR/range-2.rs:7:13 - | -LL | let r = { - | - borrow later stored here -... -LL | &a..&b - | ^^ borrowed value does not live long enough -LL | }; - | - `b` dropped here while still borrowed - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/recursive-type-field.rs b/src/test/ui/span/recursive-type-field.rs deleted file mode 100644 index bd4c43534..000000000 --- a/src/test/ui/span/recursive-type-field.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::rc::Rc; - -struct Foo<'a> { //~ ERROR recursive types `Foo` and `Bar` have infinite size - bar: Bar<'a>, - b: Rc>, -} - -struct Bar<'a> { - y: (Foo<'a>, Foo<'a>), - z: Option>, - a: &'a Foo<'a>, - c: &'a [Bar<'a>], - d: [Bar<'a>; 1], - e: Foo<'a>, - x: Bar<'a>, -} - -fn main() {} diff --git a/src/test/ui/span/recursive-type-field.stderr b/src/test/ui/span/recursive-type-field.stderr deleted file mode 100644 index 10af4c36b..000000000 --- a/src/test/ui/span/recursive-type-field.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0072]: recursive types `Foo` and `Bar` have infinite size - --> $DIR/recursive-type-field.rs:3:1 - | -LL | struct Foo<'a> { - | ^^^^^^^^^^^^^^ -LL | bar: Bar<'a>, - | ------- recursive without indirection -... -LL | struct Bar<'a> { - | ^^^^^^^^^^^^^^ -LL | y: (Foo<'a>, Foo<'a>), - | ------- ------- recursive without indirection - | | - | recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle - | -LL ~ bar: Box>, -LL | b: Rc>, - ... -LL | struct Bar<'a> { -LL ~ y: (Box>, Box>), - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0072`. diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs b/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs deleted file mode 100644 index 60ccaa872..000000000 --- a/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(rustc_attrs)] -use std::ops::FnMut; - -fn main() { #![rustc_error] // rust-lang/rust#49855 - let mut f; - { - let c = 1; - let c_ref = &c; - //~^ ERROR `c` does not live long enough - f = move |a: isize, b: isize| { a + b + *c_ref }; - } - f.use_mut(); -} - -trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } -impl Fake for T { } diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr b/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr deleted file mode 100644 index 0b985de60..000000000 --- a/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/regionck-unboxed-closure-lifetimes.rs:8:21 - | -LL | let c_ref = &c; - | ^^ borrowed value does not live long enough -... -LL | } - | - `c` dropped here while still borrowed -LL | f.use_mut(); - | ----------- borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs deleted file mode 100644 index 16b4cc258..000000000 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs +++ /dev/null @@ -1,16 +0,0 @@ -fn id(x: T) -> T { x } - -trait Foo { } - -impl<'a> Foo for &'a isize { } - -fn main() { - - let blah; - - { - let ss: &isize = &id(1); - //~^ ERROR temporary value dropped while borrowed - blah = Box::new(ss) as Box; - } -} diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr deleted file mode 100644 index 81e858fa0..000000000 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0716]: temporary value dropped while borrowed - --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:12:27 - | -LL | let ss: &isize = &id(1); - | ^^^^^ creates a temporary value which is freed while still in use -... -LL | } - | - temporary value is freed at the end of this statement -LL | } - | - borrow might be used here, when `blah` is dropped and runs the destructor for type `Box` - | - = note: consider using a `let` binding to create a longer lived value - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.rs b/src/test/ui/span/regions-close-over-type-parameter-2.rs deleted file mode 100644 index aca3972cb..000000000 --- a/src/test/ui/span/regions-close-over-type-parameter-2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Test for what happens when a type parameter `A` is closed over into -// an object. This should yield errors unless `A` (and the object) -// both have suitable bounds. - -trait Foo { fn get(&self); } - -impl Foo for A { - fn get(&self) { - } -} - -fn repeater3<'a,A:'a>(v: A) -> Box { - Box::new(v) as Box -} - -fn main() { - - // Error results because the type of is inferred to be - // ~Repeat<&'blk isize> where blk is the lifetime of the block below. - - let _ = { - let tmp0 = 3; - let tmp1 = &tmp0; - repeater3(tmp1) - }; - //~^^^ ERROR `tmp0` does not live long enough -} diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.stderr b/src/test/ui/span/regions-close-over-type-parameter-2.stderr deleted file mode 100644 index 2e584d9a8..000000000 --- a/src/test/ui/span/regions-close-over-type-parameter-2.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0597]: `tmp0` does not live long enough - --> $DIR/regions-close-over-type-parameter-2.rs:23:20 - | -LL | let tmp1 = &tmp0; - | ^^^^^ borrowed value does not live long enough -LL | repeater3(tmp1) - | --------------- borrow later captured here by trait object -LL | }; - | - `tmp0` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/regions-escape-loop-via-variable.rs b/src/test/ui/span/regions-escape-loop-via-variable.rs deleted file mode 100644 index ad468896b..000000000 --- a/src/test/ui/span/regions-escape-loop-via-variable.rs +++ /dev/null @@ -1,14 +0,0 @@ -fn main() { - let x = 3; - - // Here, the variable `p` gets inferred to a type with a lifetime - // of the loop body. The regionck then determines that this type - // is invalid. - let mut p = &x; - - loop { - let x = 1 + *p; - p = &x; - } - //~^^ ERROR `x` does not live long enough -} diff --git a/src/test/ui/span/regions-escape-loop-via-variable.stderr b/src/test/ui/span/regions-escape-loop-via-variable.stderr deleted file mode 100644 index 42df66852..000000000 --- a/src/test/ui/span/regions-escape-loop-via-variable.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/regions-escape-loop-via-variable.rs:11:13 - | -LL | let x = 1 + *p; - | -- borrow later used here -LL | p = &x; - | ^^ borrowed value does not live long enough -LL | } - | - `x` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/regions-escape-loop-via-vec.rs b/src/test/ui/span/regions-escape-loop-via-vec.rs deleted file mode 100644 index 1fceb0969..000000000 --- a/src/test/ui/span/regions-escape-loop-via-vec.rs +++ /dev/null @@ -1,13 +0,0 @@ -// The type of `y` ends up getting inferred to the type of the block. -fn broken() { - let mut x = 3; - let mut _y = vec![&mut x]; - while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed - let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed - _y.push(&mut z); - //~^ ERROR `z` does not live long enough - x += 1; //~ ERROR cannot use `x` because it was mutably borrowed - } -} - -fn main() { } diff --git a/src/test/ui/span/regions-escape-loop-via-vec.stderr b/src/test/ui/span/regions-escape-loop-via-vec.stderr deleted file mode 100644 index 2b6493077..000000000 --- a/src/test/ui/span/regions-escape-loop-via-vec.stderr +++ /dev/null @@ -1,50 +0,0 @@ -error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:5:11 - | -LL | let mut _y = vec![&mut x]; - | ------ borrow of `x` occurs here -LL | while x < 10 { - | ^ use of borrowed `x` -LL | let mut z = x; -LL | _y.push(&mut z); - | --------------- borrow later used here - -error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:6:21 - | -LL | let mut _y = vec![&mut x]; - | ------ borrow of `x` occurs here -LL | while x < 10 { -LL | let mut z = x; - | ^ use of borrowed `x` -LL | _y.push(&mut z); - | --------------- borrow later used here - -error[E0597]: `z` does not live long enough - --> $DIR/regions-escape-loop-via-vec.rs:7:17 - | -LL | _y.push(&mut z); - | --------^^^^^^- - | | | - | | borrowed value does not live long enough - | borrow later used here -... -LL | } - | - `z` dropped here while still borrowed - -error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:9:9 - | -LL | let mut _y = vec![&mut x]; - | ------ borrow of `x` occurs here -... -LL | _y.push(&mut z); - | --------------- borrow later used here -LL | -LL | x += 1; - | ^^^^^^ use of borrowed `x` - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0503, E0597. -For more information about an error, try `rustc --explain E0503`. diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs b/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs deleted file mode 100644 index 3b20285b1..000000000 --- a/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs +++ /dev/null @@ -1,22 +0,0 @@ -fn borrow(x: &T) -> &T {x} - -fn foo(mut cond: C, mut make_box: M) where - C: FnMut() -> bool, - M: FnMut() -> Box, -{ - let mut y: &isize; - loop { - let x = make_box(); - - // Here we complain because the resulting region - // of this borrow is the fn body as a whole. - y = borrow(&*x); - //~^ ERROR `*x` does not live long enough - - assert_eq!(*x, *y); - if cond() { break; } - } - assert!(*y != 0); -} - -fn main() {} diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr b/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr deleted file mode 100644 index fd67c65c4..000000000 --- a/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0597]: `*x` does not live long enough - --> $DIR/regions-infer-borrow-scope-within-loop.rs:13:20 - | -LL | y = borrow(&*x); - | ^^^ borrowed value does not live long enough -... -LL | } - | - `*x` dropped here while still borrowed -LL | assert!(*y != 0); - | -- borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.rs b/src/test/ui/span/send-is-not-static-ensures-scoping.rs deleted file mode 100644 index 2aecc2a7e..000000000 --- a/src/test/ui/span/send-is-not-static-ensures-scoping.rs +++ /dev/null @@ -1,26 +0,0 @@ -struct Guard<'a> { - f: Box, -} - -fn scoped<'a, F: Fn() + Send + 'a>(f: F) -> Guard<'a> { - Guard { f: Box::new(f) } -} - -impl<'a> Guard<'a> { - fn join(self) {} -} - -fn main() { - let bad = { - let x = 1; - let y = &x; - //~^ ERROR `x` does not live long enough - - scoped(|| { - let _z = y; - //~^ ERROR `y` does not live long enough - }) - }; - - bad.join(); -} diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.stderr b/src/test/ui/span/send-is-not-static-ensures-scoping.stderr deleted file mode 100644 index 65d10c130..000000000 --- a/src/test/ui/span/send-is-not-static-ensures-scoping.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-ensures-scoping.rs:16:17 - | -LL | let bad = { - | --- borrow later stored here -LL | let x = 1; -LL | let y = &x; - | ^^ borrowed value does not live long enough -... -LL | }; - | - `x` dropped here while still borrowed - -error[E0597]: `y` does not live long enough - --> $DIR/send-is-not-static-ensures-scoping.rs:20:22 - | -LL | let bad = { - | --- borrow later stored here -... -LL | scoped(|| { - | -- value captured here -LL | let _z = y; - | ^ borrowed value does not live long enough -... -LL | }; - | - `y` dropped here while still borrowed - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.rs b/src/test/ui/span/send-is-not-static-std-sync-2.rs deleted file mode 100644 index 38746d4cb..000000000 --- a/src/test/ui/span/send-is-not-static-std-sync-2.rs +++ /dev/null @@ -1,39 +0,0 @@ -// basic tests to see that certain "obvious" errors are caught by -// these types no longer requiring `'static` (RFC 458) - -#![allow(dead_code)] - -use std::sync::{Mutex, RwLock, mpsc}; - -fn mutex() { - let lock = { - let x = 1; - Mutex::new(&x) - }; - //~^^ ERROR `x` does not live long enough - - let _dangling = *lock.lock().unwrap(); -} - -fn rwlock() { - let lock = { - let x = 1; - RwLock::new(&x) - }; - //~^^ ERROR `x` does not live long enough - let _dangling = *lock.read().unwrap(); -} - -fn channel() { - let (_tx, rx) = { - let x = 1; - let (tx, rx) = mpsc::channel(); - let _ = tx.send(&x); - (tx, rx) - }; - //~^^^ ERROR `x` does not live long enough - - let _dangling = rx.recv(); -} - -fn main() {} diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.stderr b/src/test/ui/span/send-is-not-static-std-sync-2.stderr deleted file mode 100644 index bcd07e116..000000000 --- a/src/test/ui/span/send-is-not-static-std-sync-2.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:11:20 - | -LL | let lock = { - | ---- borrow later stored here -LL | let x = 1; -LL | Mutex::new(&x) - | ^^ borrowed value does not live long enough -LL | }; - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:21:21 - | -LL | let lock = { - | ---- borrow later stored here -LL | let x = 1; -LL | RwLock::new(&x) - | ^^ borrowed value does not live long enough -LL | }; - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:31:25 - | -LL | let (_tx, rx) = { - | --- borrow later used here -... -LL | let _ = tx.send(&x); - | ^^ borrowed value does not live long enough -LL | (tx, rx) -LL | }; - | - `x` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/send-is-not-static-std-sync.rs b/src/test/ui/span/send-is-not-static-std-sync.rs deleted file mode 100644 index f8ab5243c..000000000 --- a/src/test/ui/span/send-is-not-static-std-sync.rs +++ /dev/null @@ -1,55 +0,0 @@ -// basic tests to see that certain "obvious" errors are caught by -// these types no longer requiring `'static` (RFC 458) - -#![allow(dead_code)] - -use std::sync::{Mutex, RwLock, mpsc}; - -fn mutex() { - let x = 1; - let y = Box::new(1); - let lock = Mutex::new(&x); - *lock.lock().unwrap() = &*y; - drop(y); //~ ERROR cannot move out - { - let z = 2; - *lock.lock().unwrap() = &z; - } - //~^^ ERROR `z` does not live long enough - lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use) -} - -fn rwlock() { - let x = 1; - let y = Box::new(1); - let lock = RwLock::new(&x); - *lock.write().unwrap() = &*y; - drop(y); //~ ERROR cannot move out - { - let z = 2; - *lock.write().unwrap() = &z; - } - //~^^ ERROR `z` does not live long enough - lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use) -} - -fn channel() { - let x = 1; - let y = Box::new(1); - let (tx, rx) = mpsc::channel(); - - tx.send(&x).unwrap(); - tx.send(&*y); - drop(y); //~ ERROR cannot move out - { - let z = 2; - tx.send(&z).unwrap(); - } - //~^^ ERROR `z` does not live long enough - // (channels lack #[may_dangle], thus their dtors are implicit uses of `z`) -} - -fn main() {} - -trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } -impl Fake for T { } diff --git a/src/test/ui/span/send-is-not-static-std-sync.stderr b/src/test/ui/span/send-is-not-static-std-sync.stderr deleted file mode 100644 index 5d493a3e4..000000000 --- a/src/test/ui/span/send-is-not-static-std-sync.stderr +++ /dev/null @@ -1,72 +0,0 @@ -error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:13:10 - | -LL | *lock.lock().unwrap() = &*y; - | --- borrow of `*y` occurs here -LL | drop(y); - | ^ move out of `y` occurs here -... -LL | *lock.lock().unwrap() = &z; - | ----------- borrow later used here - -error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:16:33 - | -LL | *lock.lock().unwrap() = &z; - | ^^ borrowed value does not live long enough -LL | } - | - `z` dropped here while still borrowed -LL | -LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use) - | -------------- borrow later used here - -error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:27:10 - | -LL | *lock.write().unwrap() = &*y; - | --- borrow of `*y` occurs here -LL | drop(y); - | ^ move out of `y` occurs here -... -LL | *lock.write().unwrap() = &z; - | ------------ borrow later used here - -error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:30:34 - | -LL | *lock.write().unwrap() = &z; - | ^^ borrowed value does not live long enough -LL | } - | - `z` dropped here while still borrowed -LL | -LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use) - | -------------- borrow later used here - -error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:43:10 - | -LL | tx.send(&*y); - | --- borrow of `*y` occurs here -LL | drop(y); - | ^ move out of `y` occurs here -... -LL | tx.send(&z).unwrap(); - | ----------- borrow later used here - -error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:46:17 - | -LL | tx.send(&z).unwrap(); - | ^^ borrowed value does not live long enough -LL | } - | - `z` dropped here while still borrowed -... -LL | } - | - borrow might be used here, when `tx` is dropped and runs the `Drop` code for type `Sender` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to 6 previous errors - -Some errors have detailed explanations: E0505, E0597. -For more information about an error, try `rustc --explain E0505`. diff --git a/src/test/ui/span/slice-borrow.rs b/src/test/ui/span/slice-borrow.rs deleted file mode 100644 index 38cd7acbd..000000000 --- a/src/test/ui/span/slice-borrow.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Test slicing expressions doesn't defeat the borrow checker. - -fn main() { - let y; - { - let x: &[isize] = &vec![1, 2, 3, 4, 5]; - //~^ ERROR temporary value dropped while borrowed - y = &x[1..]; - } - y.use_ref(); -} - -trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } -impl Fake for T { } diff --git a/src/test/ui/span/slice-borrow.stderr b/src/test/ui/span/slice-borrow.stderr deleted file mode 100644 index b70bf69d6..000000000 --- a/src/test/ui/span/slice-borrow.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0716]: temporary value dropped while borrowed - --> $DIR/slice-borrow.rs:6:28 - | -LL | let x: &[isize] = &vec![1, 2, 3, 4, 5]; - | ^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use -... -LL | } - | - temporary value is freed at the end of this statement -LL | y.use_ref(); - | ----------- borrow later used here - | - = note: consider using a `let` binding to create a longer lived value - = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/span/suggestion-non-ascii.rs b/src/test/ui/span/suggestion-non-ascii.rs deleted file mode 100644 index 914efd85a..000000000 --- a/src/test/ui/span/suggestion-non-ascii.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let tup = (1,); - println!("☃{}", tup[0]); //~ ERROR cannot index into a value of type -} diff --git a/src/test/ui/span/suggestion-non-ascii.stderr b/src/test/ui/span/suggestion-non-ascii.stderr deleted file mode 100644 index b14632d4e..000000000 --- a/src/test/ui/span/suggestion-non-ascii.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0608]: cannot index into a value of type `({integer},)` - --> $DIR/suggestion-non-ascii.rs:3:21 - | -LL | println!("☃{}", tup[0]); - | ^^^^^^ help: to access tuple elements, use: `tup.0` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0608`. diff --git a/src/test/ui/span/transitive-dep-span.rs b/src/test/ui/span/transitive-dep-span.rs deleted file mode 100644 index 2d46f74ad..000000000 --- a/src/test/ui/span/transitive-dep-span.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Tests that we properly serialize/deserialize spans from transitive dependencies -// (e.g. imported SourceFiles) -// -// The order of these next lines is important, since we need -// transitive_dep_two.rs to be able to reference transitive_dep_three.rs -// -// aux-build: transitive_dep_three.rs -// aux-build: transitive_dep_two.rs -// compile-flags: -Z macro-backtrace - -extern crate transitive_dep_two; - -transitive_dep_two::parse_error!(); //~ ERROR expected one of - -fn main() {} diff --git a/src/test/ui/span/transitive-dep-span.stderr b/src/test/ui/span/transitive-dep-span.stderr deleted file mode 100644 index 4dc3e5721..000000000 --- a/src/test/ui/span/transitive-dep-span.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: expected one of `!` or `::`, found `error` - --> $DIR/auxiliary/transitive_dep_three.rs:6:27 - | -LL | macro_rules! parse_error { - | ------------------------ in this expansion of `transitive_dep_two::parse_error!` -LL | () => { parse error } - | ^^^^^ expected one of `!` or `::` - | - ::: $DIR/transitive-dep-span.rs:13:1 - | -LL | transitive_dep_two::parse_error!(); - | ---------------------------------- - | | - | in this macro invocation - | in this macro invocation - -error: aborting due to previous error - diff --git a/src/test/ui/span/type-annotations-needed-expr.rs b/src/test/ui/span/type-annotations-needed-expr.rs deleted file mode 100644 index f64dab4d7..000000000 --- a/src/test/ui/span/type-annotations-needed-expr.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - let _ = (vec![1,2,3]).into_iter().sum() as f64; //~ ERROR E0282 -} diff --git a/src/test/ui/span/type-annotations-needed-expr.stderr b/src/test/ui/span/type-annotations-needed-expr.stderr deleted file mode 100644 index 9dff6c64d..000000000 --- a/src/test/ui/span/type-annotations-needed-expr.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/type-annotations-needed-expr.rs:2:39 - | -LL | let _ = (vec![1,2,3]).into_iter().sum() as f64; - | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` - | -help: consider specifying the generic argument - | -LL | let _ = (vec![1,2,3]).into_iter().sum::() as f64; - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/span/type-binding.rs b/src/test/ui/span/type-binding.rs deleted file mode 100644 index 32016e127..000000000 --- a/src/test/ui/span/type-binding.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Regression test for issue #28158 -// Test the type binding span doesn't include >> - -use std::ops::Deref; - -fn homura>(_: T) {} -//~^ ERROR not found - -fn main() {} diff --git a/src/test/ui/span/type-binding.stderr b/src/test/ui/span/type-binding.stderr deleted file mode 100644 index cb0aefe06..000000000 --- a/src/test/ui/span/type-binding.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0220]: associated type `Trget` not found for `Deref` - --> $DIR/type-binding.rs:6:20 - | -LL | fn homura>(_: T) {} - | ^^^^^ help: there is an associated type with a similar name: `Target` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0220`. diff --git a/src/test/ui/span/typo-suggestion.rs b/src/test/ui/span/typo-suggestion.rs deleted file mode 100644 index e9d7bc65e..000000000 --- a/src/test/ui/span/typo-suggestion.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - let foo = 1; - - // `foo` shouldn't be suggested, it is too dissimilar from `bar`. - println!("Hello {}", bar); //~ ERROR cannot find value - - // But this is close enough. - println!("Hello {}", fob); //~ ERROR cannot find value -} diff --git a/src/test/ui/span/typo-suggestion.stderr b/src/test/ui/span/typo-suggestion.stderr deleted file mode 100644 index 61d4e0611..000000000 --- a/src/test/ui/span/typo-suggestion.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0425]: cannot find value `bar` in this scope - --> $DIR/typo-suggestion.rs:5:26 - | -LL | println!("Hello {}", bar); - | ^^^ not found in this scope - -error[E0425]: cannot find value `fob` in this scope - --> $DIR/typo-suggestion.rs:8:26 - | -LL | println!("Hello {}", fob); - | ^^^ help: a local variable with a similar name exists: `foo` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/span/unused-warning-point-at-identifier.rs b/src/test/ui/span/unused-warning-point-at-identifier.rs deleted file mode 100644 index af4834503..000000000 --- a/src/test/ui/span/unused-warning-point-at-identifier.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass - -#![warn(unused)] - -enum Enum { //~ WARN enum `Enum` is never used - A, - B, - C, - D, -} - -struct Struct { //~ WARN struct `Struct` is never constructed - a: usize, - b: usize, - c: usize, - d: usize, -} - -fn func() -> usize { //~ WARN function `func` is never used - 3 -} - -fn -func_complete_span() //~ WARN function `func_complete_span` is never used --> usize -{ - 3 -} - -fn main() {} diff --git a/src/test/ui/span/unused-warning-point-at-identifier.stderr b/src/test/ui/span/unused-warning-point-at-identifier.stderr deleted file mode 100644 index c2cb56231..000000000 --- a/src/test/ui/span/unused-warning-point-at-identifier.stderr +++ /dev/null @@ -1,33 +0,0 @@ -warning: enum `Enum` is never used - --> $DIR/unused-warning-point-at-identifier.rs:5:6 - | -LL | enum Enum { - | ^^^^ - | -note: the lint level is defined here - --> $DIR/unused-warning-point-at-identifier.rs:3:9 - | -LL | #![warn(unused)] - | ^^^^^^ - = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` - -warning: struct `Struct` is never constructed - --> $DIR/unused-warning-point-at-identifier.rs:12:8 - | -LL | struct Struct { - | ^^^^^^ - -warning: function `func` is never used - --> $DIR/unused-warning-point-at-identifier.rs:19:4 - | -LL | fn func() -> usize { - | ^^^^ - -warning: function `func_complete_span` is never used - --> $DIR/unused-warning-point-at-identifier.rs:24:1 - | -LL | func_complete_span() - | ^^^^^^^^^^^^^^^^^^ - -warning: 4 warnings emitted - diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs b/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs deleted file mode 100644 index 9bfbfab06..000000000 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs +++ /dev/null @@ -1,125 +0,0 @@ -// Checking that `Vec` cannot hide lifetimes within `T` when `T` -// implements `Drop` and might access methods of values that have -// since been deallocated. -// -// In this case, the values in question hold (non-zero) unique-ids -// that zero themselves out when dropped, and are wrapped in another -// type with a destructor that asserts that the ids it references are -// indeed non-zero (i.e., effectively checking that the id's are not -// dropped while there are still any outstanding references). -// -// However, the values in question are also formed into a -// cyclic-structure, ensuring that there is no way for all of the -// conditions above to be satisfied, meaning that if the dropck is -// sound, it should reject this code. - - - -use std::cell::Cell; -use id::Id; - -mod s { - use std::sync::atomic::{AtomicUsize, Ordering}; - - static S_COUNT: AtomicUsize = AtomicUsize::new(0); - - /// generates globally unique count (global across the current - /// process, that is) - pub fn next_count() -> usize { - S_COUNT.fetch_add(1, Ordering::SeqCst) + 1 - } -} - -mod id { - use s; - - /// Id represents a globally unique identifier (global across the - /// current process, that is). When dropped, it automatically - /// clears its `count` field, but leaves `orig_count` untouched, - /// so that if there are subsequent (erroneous) invocations of its - /// method (which is unsound), we can observe it by seeing that - /// the `count` is 0 while the `orig_count` is non-zero. - #[derive(Debug)] - pub struct Id { - orig_count: usize, - count: usize, - } - - impl Id { - /// Creates an `Id` with a globally unique count. - pub fn new() -> Id { - let c = s::next_count(); - println!("building Id {}", c); - Id { orig_count: c, count: c } - } - /// returns the `count` of self; should be non-zero if - /// everything is working. - pub fn count(&self) -> usize { - println!("Id::count on {} returns {}", self.orig_count, self.count); - self.count - } - } - - impl Drop for Id { - fn drop(&mut self) { - println!("dropping Id {}", self.count); - self.count = 0; - } - } -} - -trait HasId { - fn count(&self) -> usize; -} - -#[derive(Debug)] -struct CheckId { - v: T -} - -#[allow(non_snake_case)] -fn CheckId(t: T) -> CheckId { CheckId{ v: t } } - -impl Drop for CheckId { - fn drop(&mut self) { - assert!(self.v.count() > 0); - } -} - -#[derive(Debug)] -struct C<'a> { - id: Id, - v: Vec>>>>, -} - -impl<'a> HasId for Cell>> { - fn count(&self) -> usize { - match self.get() { - None => 1, - Some(c) => c.id.count(), - } - } -} - -impl<'a> C<'a> { - fn new() -> C<'a> { - C { id: Id::new(), v: Vec::new() } - } -} - -fn f() { - let (mut c1, mut c2); - c1 = C::new(); - c2 = C::new(); - - c1.v.push(CheckId(Cell::new(None))); - c2.v.push(CheckId(Cell::new(None))); - c1.v[0].v.set(Some(&c2)); - //~^ ERROR `c2` does not live long enough - c2.v[0].v.set(Some(&c1)); - //~^ ERROR `c1` does not live long enough -} - -fn main() { - f(); -} diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr deleted file mode 100644 index f87c32d1a..000000000 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0597]: `c2` does not live long enough - --> $DIR/vec-must-not-hide-type-from-dropck.rs:117:24 - | -LL | c1.v[0].v.set(Some(&c2)); - | ^^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `c2` dropped here while still borrowed - | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `c1` does not live long enough - --> $DIR/vec-must-not-hide-type-from-dropck.rs:119:24 - | -LL | c2.v[0].v.set(Some(&c1)); - | ^^^ borrowed value does not live long enough -LL | -LL | } - | - - | | - | `c1` dropped here while still borrowed - | borrow might be used here, when `c1` is dropped and runs the destructor for type `C<'_>` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/vec_refs_data_with_early_death.rs b/src/test/ui/span/vec_refs_data_with_early_death.rs deleted file mode 100644 index c23c52115..000000000 --- a/src/test/ui/span/vec_refs_data_with_early_death.rs +++ /dev/null @@ -1,33 +0,0 @@ -// This test is a simple example of code that violates the dropck -// rules: it pushes `&x` and `&y` into a bag (with dtor), but the -// referenced data will be dropped before the bag is. - - - - - - - -fn main() { - let mut v = Bag::new(); - - let x: i8 = 3; - let y: i8 = 4; - - v.push(&x); - //~^ ERROR `x` does not live long enough - v.push(&y); - //~^ ERROR `y` does not live long enough - - assert_eq!(v.0, [&3, &4]); -} - -//`Vec` is #[may_dangle] w.r.t. `T`; putting a bag over its head -// forces borrowck to treat dropping the bag as a potential use. -struct Bag(Vec); -impl Drop for Bag { fn drop(&mut self) { } } - -impl Bag { - fn new() -> Self { Bag(Vec::new()) } - fn push(&mut self, t: T) { self.0.push(t); } -} diff --git a/src/test/ui/span/vec_refs_data_with_early_death.stderr b/src/test/ui/span/vec_refs_data_with_early_death.stderr deleted file mode 100644 index 684e78453..000000000 --- a/src/test/ui/span/vec_refs_data_with_early_death.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/vec_refs_data_with_early_death.rs:17:12 - | -LL | v.push(&x); - | ^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `x` dropped here while still borrowed - | borrow might be used here, when `v` is dropped and runs the `Drop` code for type `Bag` - | - = note: values in a scope are dropped in the opposite order they are defined - -error[E0597]: `y` does not live long enough - --> $DIR/vec_refs_data_with_early_death.rs:19:12 - | -LL | v.push(&y); - | ^^ borrowed value does not live long enough -... -LL | } - | - - | | - | `y` dropped here while still borrowed - | borrow might be used here, when `v` is dropped and runs the `Drop` code for type `Bag` - | - = note: values in a scope are dropped in the opposite order they are defined - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/span/visibility-ty-params.rs b/src/test/ui/span/visibility-ty-params.rs deleted file mode 100644 index d77febe0a..000000000 --- a/src/test/ui/span/visibility-ty-params.rs +++ /dev/null @@ -1,13 +0,0 @@ -macro_rules! m { - ($p: path) => (pub(in $p) struct Z;) -} - -struct S(T); -m!{ S } //~ ERROR unexpected generic arguments in path - //~| ERROR expected module, found struct `S` - -mod m { - m!{ m<> } //~ ERROR unexpected generic arguments in path -} - -fn main() {} diff --git a/src/test/ui/span/visibility-ty-params.stderr b/src/test/ui/span/visibility-ty-params.stderr deleted file mode 100644 index 067893fd2..000000000 --- a/src/test/ui/span/visibility-ty-params.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: unexpected generic arguments in path - --> $DIR/visibility-ty-params.rs:6:6 - | -LL | m!{ S } - | ^^^^ - -error[E0577]: expected module, found struct `S` - --> $DIR/visibility-ty-params.rs:6:5 - | -LL | m!{ S } - | ^^^^^ not a module - -error: unexpected generic arguments in path - --> $DIR/visibility-ty-params.rs:10:10 - | -LL | m!{ m<> } - | ^^ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0577`. diff --git a/src/test/ui/span/wf-method-late-bound-regions.rs b/src/test/ui/span/wf-method-late-bound-regions.rs deleted file mode 100644 index ca9f73d0a..000000000 --- a/src/test/ui/span/wf-method-late-bound-regions.rs +++ /dev/null @@ -1,24 +0,0 @@ -// A method's receiver must be well-formed, even if it has late-bound regions. -// Because of this, a method's substs being well-formed does not imply that -// the method's implied bounds are met. - -struct Foo<'b>(Option<&'b ()>); - -trait Bar<'b> { - fn xmute<'a>(&'a self, u: &'b u32) -> &'a u32; -} - -impl<'b> Bar<'b> for Foo<'b> { - fn xmute<'a>(&'a self, u: &'b u32) -> &'a u32 { u } -} - -fn main() { - let f = Foo(None); - let f2 = f; - let dangling = { - let pointer = Box::new(42); - f2.xmute(&pointer) - }; - //~^^ ERROR `pointer` does not live long enough - println!("{}", dangling); -} diff --git a/src/test/ui/span/wf-method-late-bound-regions.stderr b/src/test/ui/span/wf-method-late-bound-regions.stderr deleted file mode 100644 index 6b0b00820..000000000 --- a/src/test/ui/span/wf-method-late-bound-regions.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0597]: `pointer` does not live long enough - --> $DIR/wf-method-late-bound-regions.rs:20:18 - | -LL | let dangling = { - | -------- borrow later stored here -LL | let pointer = Box::new(42); -LL | f2.xmute(&pointer) - | ^^^^^^^^ borrowed value does not live long enough -LL | }; - | - `pointer` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. -- cgit v1.2.3